[Asterisk-Users] Problem while capturing DTMF digits in AGI
Madhawa Jayanath
asterisk-user at dualcall.com
Sun Jul 17 22:11:36 MST 2005
Hello,
You must answer the channel
use Asterisk::AGI;
$AGI = new Asterisk::AGI;
my %input = $AGI->ReadParse();
my $tests = 0;
my $pass = 0;
my $fail = 0;
#setup callback
$AGI->setcallback(\&mycallback);
print STDERR "AGI Environment Dump:\n";
foreach $i (sort keys %input) {
print STDERR " -- $i = $input{$i}\n";
}
$AGI->answer();#<---------------------------------------Answer the channel
Cheers,
Madhawa
somesh s wrote:
>Hi All,
>
>I have some problem while capturing DTMF digits in AGI
>script.
>
>My configuration for user is ..
>
>[9009]
>type=friend
>host=dynamic
>context=default
>dtmfmode=rfc2833
>dtmfrelax=no
>disallow=all
>allow=ulaw
>allow=h263
>canreinvite=yes
>
>
>
>
>[9010]
>type=friend
>host=dynamic
>context=default
>dtmfmode=rfc2833
>dtmfrelax=no
>disallow=all
>allow=ulaw
>allow=h263
>canreinvite=yes
>
>And the script read like ...
>use Asterisk::AGI;
>
>
>$AGI = new Asterisk::AGI;
>
>
>my %input = $AGI->ReadParse();
>my $tests = 0;
>my $pass = 0;
>my $fail = 0;
>
>
>#setup callback
>$AGI->setcallback(\&mycallback);
>
>
>
>
>print STDERR "AGI Environment Dump:\n";
>foreach $i (sort keys %input) {
> print STDERR " -- $i = $input{$i}\n";
>}
>my $timeout = 3000; # 3 second timeout
>my $wait = 1; # true
>my $outgoing_number;
>
>
>while($wait) {
> my $digit = $AGI->wait_for_digit($timeout);
> print STDERR "Digit ($digit)\n";
> if ($digit > 0) {
> $digit -= 48;
> $outgoing_number .= $digit;
> }
> else { #stop waiting for more digits
> $wait = 0;
> }
>}
>
>
>print STDERR "Outgoing number ($outgoing_number)\n";
>
>------>
>
>I will get the output as Outgoing number () and
>digits(0)
>
>Am I missing something here? Please do help me in this
>regard.
>
>Regards
>Somesh S Shanbhag
>
>
>
>__________________________________________________
>Do You Yahoo!?
>Tired of spam? Yahoo! Mail has the best spam protection around
>http://mail.yahoo.com
>_______________________________________________
>Asterisk-Users mailing list
>Asterisk-Users at lists.digium.com
>http://lists.digium.com/mailman/listinfo/asterisk-users
>To UNSUBSCRIBE or update options visit:
> http://lists.digium.com/mailman/listinfo/asterisk-users
>
>
>
>
More information about the asterisk-users
mailing list