How to detect dtmf code with AGI file?

current I am trying to get dtmf code when calling.
so to do this, I made python file and add the code to dialplan like this.

same => _X!,1,Answer()
same => n,WaitForSilence(1500,1)
same=> n,Playback(waitmusic)
same => n,WaitForSilence(1500,1)
same => n,AGI(cx_agi/,${CALLERID(number)},${EXTEN},${UNIQUEID})
same=> n,BackGround(waitmusic)
same => n,WaitForSilence(1500,1)
same=> n,BackGround(waitmusic)
same => n,Dial(SIP/${EXTEN})

but I can not get dtmf code yet.

while check agi debug, I can see this error too.
File “/usr/lib/python2.7/site-packages/asterisk/”, line 211, in get_result
raise AGIUnknownError(code, ‘Unhandled code or undefined response’)
asterisk.agi.AGIUnknownError: (511, ‘Unhandled code or undefined response’)
– <Local/99904443453888000@out1-00000000;2>AGI Script cx_agi/ completed, returning 0
please help me about this problem,

You haven’t provided the content of cx_agi/, or at least not in this topic.

same => n,Dial(SIP/${EXTEN})

The dial will never be reached. If WaitExten cannot find the entered extension or the t or e one, it will force the dialplan to terminate.

OP seems to be using the pyst2 class library.

AGIUnknownError is a catch all for unrecognized error numbers.

AGI error 511 is the result of trying to execute AGI on a channel that has already been hung up.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.