Problem in WAIT FOR DIGIT

i am executing DeadAGI script in which i call WAIT FOR DIGIT with -1 option,
but the script does not wait and exits immidiately

can anybody tell me why it does not wait for digit input

this is my extensions.conf

exten => 999, 1 , Wait()
exten => 999, 2 , Answer()
exten => 999, 3 , Dial(SIP/105)
exten => h, 1 , DeadAGI(test)
exten => h, 2 , HangUp()

this is what i get at asterisk prompt

Originator*CLI> agi debug
AGI Debugging Enabled
– Executing Wait(“SIP/100-a28f”, “”) in new stack
– Executing Answer(“SIP/100-a28f”, “”) in new stack
– Executing Dial(“SIP/100-a28f”, “SIP/105”) in new stack
– Called 105
– SIP/105-e801 is ringing
– SIP/105-e801 answered SIP/100-a28f
– Attempting native bridge of SIP/100-a28f and SIP/105-e801
== Spawn extension (agents, 999, 3) exited non-zero on ‘SIP/100-a28f’
– Executing DeadAGI(“SIP/100-a28f”, “test”) in new stack
– Launched AGI Script /var/lib/asterisk/agi-bin/test
AGI Tx >> agi_request: test
AGI Tx >> agi_channel: SIP/100-a28f
AGI Tx >> agi_language: en
AGI Tx >> agi_type: SIP
AGI Tx >> agi_uniqueid: 1155063624.10
AGI Tx >> agi_callerid: 100
AGI Tx >> agi_calleridname: 100
AGI Tx >> agi_callingpres: 0
AGI Tx >> agi_callingani2: 0
AGI Tx >> agi_callington: 0
AGI Tx >> agi_callingtns: 0
AGI Tx >> agi_dnid: 999
AGI Tx >> agi_rdnis: unknown
AGI Tx >> agi_context: agents
AGI Tx >> agi_extension: h
AGI Tx >> agi_priority: 1
AGI Tx >> agi_enhanced: 0.0
AGI Tx >> agi_accountcode:
AGI Tx >>
AGI Rx << SAY NUMBER 225 “”
– Playing ‘digits/2’ (language ‘en’)
– Playing ‘digits/hundred’ (language ‘en’)
– Playing ‘digits/20’ (language ‘en’)
– Playing ‘digits/5’ (language ‘en’)
AGI Tx >> 200 result=0
AGI Rx << WAIT FOR DIGIT -1""
AGI Tx >> 200 result=1
– AGI Script test completed, returning 0
– Executing Hangup(“SIP/100-a28f”, “”) in new stack
== Spawn extension (agents, h, 2) exited non-zero on ‘SIP/100-a28f’

this is my agi script

[code] #include <stdio.h>
#include <string.h>

main() {

   char        line[80];

   /* use line buffering */

   setlinebuf(stdout);

   setlinebuf(stderr);

   /* read and ignore AGI environment */

   while (1) {

       fgets(line,80,stdin);

       if (strlen(line) <= 1) break;

   }

   /* Send asterisk a command */

printf("SAY NUMBER 225 \"\"\n");
printf("WAIT FOR DIGIT -1\"\"\n");

   /* Read response from Asterisk and show on console */

   fgets(line,80,stdin);

   fputs(line,stderr);

}
[/code]

any insight would be appreciated…

try to insert -1 value inside “” :

printf(“WAIT FOR DIGIT “-1”\n”);

anyway i have same problem with getdata and waitfordigit in perl agi script, with all 1.2 version of asterisk.

i used this: printf(“WAIT FOR DIGIT “-1” \n”);

but it still does not execute the command, and the script ends immediately.
this is what i get the asterisk prompt:

Originator*CLI>
– Registered SIP ‘100’ at 172.16.1.207 port 25714 expires 3600
– Executing Wait(“SIP/100-ee29”, “”) in new stack
– Executing Answer(“SIP/100-ee29”, “”) in new stack
– Executing Dial(“SIP/100-ee29”, “SIP/105”) in new stack
– Called 105
– SIP/105-4b84 is ringing
– SIP/105-4b84 answered SIP/100-ee29
– Attempting native bridge of SIP/100-ee29 and SIP/105-4b84
== Spawn extension (agents, 999, 3) exited non-zero on ‘SIP/100-ee29’
– Executing DeadAGI(“SIP/100-ee29”, “test”) in new stack
– Launched AGI Script /var/lib/asterisk/agi-bin/test
AGI Tx >> agi_request: test
AGI Tx >> agi_channel: SIP/100-ee29
AGI Tx >> agi_language: en
AGI Tx >> agi_type: SIP
AGI Tx >> agi_uniqueid: 1155752927.3
AGI Tx >> agi_callerid: 100
AGI Tx >> agi_calleridname: 100
AGI Tx >> agi_callingpres: 0
AGI Tx >> agi_callingani2: 0
AGI Tx >> agi_callington: 0
AGI Tx >> agi_callingtns: 0
AGI Tx >> agi_dnid: 999
AGI Tx >> agi_rdnis: unknown
AGI Tx >> agi_context: agents
AGI Tx >> agi_extension: h
AGI Tx >> agi_priority: 1
AGI Tx >> agi_enhanced: 0.0
AGI Tx >> agi_accountcode:
AGI Tx >>
AGI Rx << SAY NUMBER 123 “”
– Playing ‘digits/1’ (language ‘en’)
– Playing ‘digits/hundred’ (language ‘en’)
– Playing ‘digits/20’ (language ‘en’)
– Playing ‘digits/3’ (language ‘en’)
AGI Tx >> 200 result=0
– AGI Script test completed, returning 0
– Executing Hangup(“SIP/100-ee29”, “”) in new stack
== Spawn extension (agents, h, 2) exited non-zero on ‘SIP/100-ee29’
– Unregistered SIP ‘100’
– Unregistered SIP ‘105’

if i use this: printf(“WAIT FOR DIGIT “-1” “”\n”);

it gives the following error at the asterisk prompt:

AGI Rx << WAIT FOR DIGIT “-1” ""
AGI Tx >> 520-Invalid command syntax. Proper usage follows:
AGI Tx >> Usage: WAIT FOR DIGIT
Waits up to ‘timeout’ milliseconds for channel to receive a DTMF digit.
Returns -1 on channel failure, 0 if no digit is received in the timeout, or
the numerical value of the ascii of the digit if one is received. Use -1
for the timeout value if you desire the call to block indefinitely.
AGI Tx >> 520 End of proper usage.

i am using asterisk version 1.2.8

Has anybody figured this out yet? I am having the same problem w/ 1.2.12.

Thanks!

Hello,

This issue seems to be a little old… but I have exacly the same problem with versions 1.4.22 and 1.6.0.3-rc1.

The following debug output is from 1.6:

<SIP/5001-09644098>AGI Rx << WAIT FOR DIGIT 5000
[Dec 30 17:23:43] WARNING[20995]: channel.c:2250 ast_waitfordigit_full: The FD we were waiting for has something waiting. Waitfordigit returning numeric 1
<SIP/5001-09644098>AGI Tx >> 200 result=1

In general in my case WAIT FOR DIGIT is immediately returning 1.

Any advice on that greatly appreciated.

Regards,

I have the same problem. Running on Debian, using AGI via PHP, no zaptel hardware, all SIP-based. Using ztdummy, which I am aware is to resolve timing problems. (lists.alioth.debian.org/pipermai … 05804.html)

Furthermore, I’ve had some problems with audio commands not playing any audio. It is my suspicion that the AGI pipe gets messed up sometimes; it doesn’t seem very robust.

This thread is stale, and I’d really like to see someone from the community step up and investigate this. It’s a pretty big issue for me, because I must run my code in a busy loop checking for digits, because I have my code behave as if result=1 is the same as a timeout, but really asterisk actually returns immediately. It’s quite a busy loop!

Code snippet:

Error snippet:

My specifications:
running Debian linux 2.6.18-6-686 on Dell 1600SC
Asterisk 1.6.0.1
PHP 5.2.0-8+etch15 (cli) … not that it should matter

Module Size Used by
ztdummy 3624 0
zaptel 183364 1 ztdummy[/code]