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.

exten=>.,1,Set(CALLERID(num)=${cid})
exten=>
.,n,Gosub(monitor,${EXTEN},1)
same => _X!,1,Answer()
same => n,WaitForSilence(1500,1)
same=> n,Playback(waitmusic)
same => n,WaitForSilence(1500,1)
same => n,AGI(cx_agi/dtmf.py,${CALLERID(number)},${EXTEN},${UNIQUEID})
same=> n,BackGround(waitmusic)
same => n,WaitForSilence(1500,1)
same=> n,BackGround(waitmusic)
same=>n,WaitExten(3)
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/agi.py”, 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/dtmf.py completed, returning 0
please help me about this problem,

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

same=>n,WaitExten(3)
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.