[Asterisk-Dev] WAIT FOR DIGIT, returns 200 result=0 always

Andy Harris andy at thirtover.com
Tue Jan 18 02:56:42 MST 2005


Dear List

I've been having a rather good time with the AGI gateway stuff, except I
can't get the 'WAIT FOR DIGIT' call to work.

Here's my code fragment:
==========================================================================
if __name__ == '__main__':

    A = agi.AGI()
    logenv(A.env)
    if (A.env['agi_callerid'] != 'andy') :
        Result = A.Cmd('SAY NUMBER 123 "*#"')
    else:
        Result = A.Cmd('STREAM FILE jedi-extension-trick "" ')
        Result = A.Cmd('WAIT FOR DIGIT 5000')
        logresp(str(Result))
        if (Result[0] == '200 result=0'):
            Result = A.Cmd('STREAM FILE auth-incorrect "" ')
        else:
            Result = A.Cmd('STREAM FILE auth-thankyou "" ')

    time.sleep(2)
    Result = A.Cmd('HANGUP \n')
==========================================================================
My logresp function records the string that comes back from Asterisk and
gives:

     ('200 result=0\n', 0)

Here's a trace from the Asterisk console:
AGI Debugging Enabled
AGI Tx >> agi_request: guff2.py
AGI Tx >> agi_channel: SIP/10.0.0.12-083b2658
AGI Tx >> agi_language: en
AGI Tx >> agi_type: SIP
AGI Tx >> agi_uniqueid: 1106041575.4
AGI Tx >> agi_callerid: andy
AGI Tx >> agi_calleridname: Andy Harris
AGI Tx >> agi_dnid: 4001
AGI Tx >> agi_rdnis: unknown
AGI Tx >> agi_context: default
AGI Tx >> agi_extension: 4001
AGI Tx >> agi_priority: 1
AGI Tx >> agi_enhanced: 0.0
AGI Tx >> agi_accountcode:
AGI Tx >>
AGI Rx << STREAM FILE jedi-extension-trick ""
AGI Tx >> 200 result=0 endpos=30400
AGI Rx << WAIT FOR DIGIT 5000
AGI Tx >> 200 result=0
AGI Rx << STREAM FILE auth-thankyou ""
AGI Tx >> 200 result=0 endpos=9440
AGI Rx << HANGUP
AGI Tx >> 200 result=1

By watching the console I can see that the full 5 seconds elapse whilst
I'm entering DTMF keys.

I'm on fedora core 3, with the following version of Asterisk:

pbx*CLI> show version
Asterisk CVS-HEAD-01/12/05-17:50:41 built by root at pbx on a i686 running Linux

Could some one point me in the right direction please?


Regards



Andy








More information about the asterisk-dev mailing list