[Home]

Summary:ASTERISK-02001: AGI script does not see first digit from SIP cahnnel (using DTMF via SIP INFO)
Reporter:albor (albor)Labels:
Date Opened:2004-07-12 21:46:40Date Closed:2011-06-07 14:10:07
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Core/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:First scenario Send DTMF via SIP INFO. AGI script does not see first
digit dialed. (BUG)

Send DTMF:

Grandstream set
Send DTMF:    via SIP INFO

sip.conf
...
dtmfmode = info
...

extensions.conf
...
exten => 8300,1,agi,sip_test.agi
exten => 8300,2,hangup
...

After voice prompt dialed 1234 console displayed:


   -- Executing AGI("SIP/101-dbcd", "sip_test.agi") in new stack
   -- Launched AGI Script /sbin/agi-bin/sip_test.agi
 sip_test.agi: test start
   -- Playing 'vm-password' (language 'en')
 sip_test.agi: result 234
 sip_test.agi: dialed 234
 sip_test.agi: test stop
   -- AGI Script sip_test.agi completed, returning 0
   -- Executing Hangup("SIP/101-dbcd", "") in new stack

... end of display

/sbin/agi-bin/sip_test.agi

======================================
#!/usr/bin/perl
use strict;

$|=1;

use lib qw(..);
use lib qw(.);
use lib qw(/usr/local/lib/perl5/site_perl/5.8.0/);
sub test();

# Setup some variables
my %AGI; my $tests = 0; my $fail = 0; my $pass = 0;
my $cid = "UNKNOWN";

if ( 1 ){
 while(<STDIN>) {
   chomp;
   last unless length($_);
   if (/^agi_(\w+)\:\s+(.*)$/) {
     $AGI{$1} = $2;
     if($1 eq 'callerid'){
       $cid = $2;
       if ( $cid =~ /\<([0-9]+)/ ){
         $cid = $1;
 #        last;
       }
     };
   }
 }
}

print "VERBOSE \"test start\"\n";
my $result = <STDIN>;
&checkresult($result);

 print "GET DATA vm-password \"2000\" \n";
 my $result = <STDIN>;
 &checkresult($result);

 my $dialed = "";
 if ($result =~ /^200/) {
   $result =~ /result=(-?\d+)/;
   if (length($1)) {
     $dialed = $1;
   }
 }

print "VERBOSE \"result $dialed\"\n";
my $result = <STDIN>;
&checkresult($result);

print "VERBOSE \"dialed $dialed\"\n";
my $result = <STDIN>;
&checkresult($result);


print "VERBOSE \"test stop\"\n";
my $result = <STDIN>;
&checkresult($result);

sub checkresult {
 my ($res) = @_;
}

=============================
Note: sip debug showes

That all digits received by asterisk:
in the form:
============================================
   -- Playing 'vm-password' (language 'en')
sips*CLI>

Sip read:
INFO sip:8300@192.168.0.1 SIP/2.0
Via: SIP/2.0/UDP 192.168.0.199;branch=z9hG4bKa1d376f3924a9a40
From: "alboralboralboralboralboralboralboralbor"
<sip:105@192.168.0.1>;tag=1c47cb5aab0219d1
To: <sip:8300@192.168.0.1>
Contact: <sip:105@192.168.0.199>
Call-ID: dabbbb386f045f5c@192.168.0.199
CSeq: 55999 INFO
User-Agent: Grandstream BT100 1.0.4.55
Max-Forwards: 70
Allow: INVITE,ACK,CANCEL,BYE,NOTIFY,REFER,OPTIONS,INFO,SUBSCRIBE
Content-Type: application/dtmf-relay
Content-Length: 22

Signal=1
Duration=800
12 headers, 2 lines
Transmitting (no NAT):
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.0.199;branch=z9hG4bKa1d376f3924a9a40
From: "alboralboralboralboralboralboralboralbor"
<sip:105@192.168.0.1>;tag=1c47cb5aab0219d1
To: <sip:8300@192.168.0.1>;tag=as1bdfcdce
Call-ID: dabbbb386f045f5c@192.168.0.199
CSeq: 55999 INFO
User-Agent: Asterisk PBX
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER
Contact: <sip:8300@192.168.0.1>
Content-Length: 0
===============================================================


Second scenario Send DTMF in-audio. AGI script works fine. (:))

All the same except

Grandstream set
Send DTMF:    in-audio

sip.conf:
...
dtmfmode = inband
...

Comments:By: Brian West (bkw918) 2004-07-13 09:16:37

You do realize that sip-info doesn't guarantee digits arrive in the order you dialed(if they even arrive).  Attach a more detailed sip debug and the version of asterisk you're using.

By: albor (albor) 2004-07-13 17:03:39

I do not think the order is a problem. And you raise a valid question. I did not see INFO method failed when entering password for voice mail, but it may happen if packet droped, you correct that rtp may give you additional redundancy. On another  hand with RTP you use kbytes to send information of no more then several bytes.

Any way...

Asterisk build is CVS-HEAD-05/18/04-17:17:28
Thank you for help

full capture with sip debug followes:

Sip read:
INVITE sip:8300@192.168.0.1 SIP/2.0
Via: SIP/2.0/UDP 192.168.0.199;branch=z9hG4bK83cd11fdb552b247
From: "alboralboralboralboralboralboralboralbor" <sip:105@192.168.0.1>;tag=9a9999849bdad8ff
To: <sip:8300@192.168.0.1>
Contact: <sip:105@192.168.0.199>
Call-ID: 400de03cb0eba4be@192.168.0.199
CSeq: 13124 INVITE
User-Agent: Grandstream BT100 1.0.4.55
Max-Forwards: 70
Allow: INVITE,ACK,CANCEL,BYE,NOTIFY,REFER,OPTIONS,INFO,SUBSCRIBE
Content-Type: application/sdp
Content-Length: 271

v=0
o=105 8000 8000 IN IP4 192.168.0.199
s=SIP Call
c=IN IP4 192.168.0.199
t=0 0
m=audio 5004 RTP/AVP 0 8 4 18 2 15
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:4 G723/8000
a=rtpmap:18 G729/8000
a=rtpmap:2 G726-32/8000
a=rtpmap:15 G728/8000
a=ptime:20

12 headers, 13 lines
Using latest request as basis request
Sending to 192.168.0.199 : 5060 (NAT)
Found RTP audio format 0
Found RTP audio format 8
Found RTP audio format 4
Found RTP audio format 18
Found RTP audio format 2
Found RTP audio format 15
Peer RTP is at port 192.168.0.199:0
Found description format PCMU
Found description format PCMA
Found description format G723
Found description format G729
Found description format G726-32
Found description format G728
Capabilities: us - 0x8(ALAW), peer - audio=0x11d(G723|ULAW|ALAW|G726|G729A)/video=0x0(EMPTY), combined - 0x8(ALAW)
Non-codec capabilities: us - 0x1(G723), peer - 0x0(EMPTY), combined - 0x0(EMPTY)
Found user '105'
Looking for 8300 in internal_1
list_route: hop: <sip:105@192.168.0.199>
Transmitting (no NAT):
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 192.168.0.199;branch=z9hG4bK83cd11fdb552b247
From: "alboralboralboralboralboralboralboralbor" <sip:105@192.168.0.1>;tag=9a9999849bdad8ff
To: <sip:8300@192.168.0.1>;tag=as109f8cbc
Call-ID: 400de03cb0eba4be@192.168.0.199
CSeq: 13124 INVITE
User-Agent: Asterisk PBX
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER
Contact: <sip:8300@192.168.0.1>
Content-Length: 0


to 192.168.0.199:5060
   -- Executing AGI("SIP/105-e9e4", "sip_test.agi") in new stack
   -- Launched AGI Script /sbin/agi-bin/sip_test.agi
 sip_test.agi: test start
We're at 192.168.0.1 port 12022
Answering with preferred capability 0x8(ALAW)
Transmitting (no NAT):
SIP/2.0 183 Session Progress
Via: SIP/2.0/UDP 192.168.0.199;branch=z9hG4bK83cd11fdb552b247
From: "alboralboralboralboralboralboralboralbor" <sip:105@192.168.0.1>;tag=9a9999849bdad8ff
To: <sip:8300@192.168.0.1>;tag=as109f8cbc
Call-ID: 400de03cb0eba4be@192.168.0.199
CSeq: 13124 INVITE
User-Agent: Asterisk PBX
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER
Contact: <sip:8300@192.168.0.1>
Content-Type: application/sdp
Content-Length: 158

v=0
o=root 19594 19594 IN IP4 192.168.0.1
s=session
c=IN IP4 192.168.0.1
t=0 0
m=audio 12022 RTP/AVP 8
a=rtpmap:8 PCMA/8000
a=silenceSupp:off - - - -

to 192.168.0.199:5060
   -- Playing 'vm-password' (language 'en')
sips*CLI>

Sip read:
INFO sip:8300@192.168.0.1 SIP/2.0
Via: SIP/2.0/UDP 192.168.0.199;branch=z9hG4bK83cd11fdb552b247
From: "alboralboralboralboralboralboralboralbor" <sip:105@192.168.0.1>;tag=9a9999849bdad8ff
To: <sip:8300@192.168.0.1>
Contact: <sip:105@192.168.0.199>
Call-ID: 400de03cb0eba4be@192.168.0.199
CSeq: 13124 INFO
User-Agent: Grandstream BT100 1.0.4.55
Max-Forwards: 70
Allow: INVITE,ACK,CANCEL,BYE,NOTIFY,REFER,OPTIONS,INFO,SUBSCRIBE
Content-Type: application/dtmf-relay
Content-Length: 23

Signal=1
Duration=1120
12 headers, 2 lines
Transmitting (no NAT):
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.0.199;branch=z9hG4bK83cd11fdb552b247
From: "alboralboralboralboralboralboralboralbor" <sip:105@192.168.0.1>;tag=9a9999849bdad8ff
To: <sip:8300@192.168.0.1>;tag=as109f8cbc
Call-ID: 400de03cb0eba4be@192.168.0.199
CSeq: 13124 INFO
User-Agent: Asterisk PBX
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER
Contact: <sip:8300@192.168.0.1>
Content-Length: 0


to 192.168.0.199:5060
sips*CLI>

Sip read:
INFO sip:8300@192.168.0.1 SIP/2.0
Via: SIP/2.0/UDP 192.168.0.199;branch=z9hG4bKcaa1791aa864dd2a
From: "alboralboralboralboralboralboralboralbor" <sip:105@192.168.0.1>;tag=9a9999849bdad8ff
To: <sip:8300@192.168.0.1>;tag=as109f8cbc
Contact: <sip:105@192.168.0.199>
Call-ID: 400de03cb0eba4be@192.168.0.199
CSeq: 13125 INFO
User-Agent: Grandstream BT100 1.0.4.55
Max-Forwards: 70
Allow: INVITE,ACK,CANCEL,BYE,NOTIFY,REFER,OPTIONS,INFO,SUBSCRIBE
Content-Type: application/dtmf-relay
Content-Length: 23

Signal=2
Duration=1120
12 headers, 2 lines
Receiving DTMF!
* DTMF received: '2'
Transmitting (no NAT):
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.0.199;branch=z9hG4bKcaa1791aa864dd2a
From: "alboralboralboralboralboralboralboralbor" <sip:105@192.168.0.1>;tag=9a9999849bdad8ff
To: <sip:8300@192.168.0.1>;tag=as109f8cbc
Call-ID: 400de03cb0eba4be@192.168.0.199
CSeq: 13125 INFO
User-Agent: Asterisk PBX
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER
Contact: <sip:8300@192.168.0.1>
Content-Length: 0


to 192.168.0.199:5060
sips*CLI>

Sip read:
INFO sip:8300@192.168.0.1 SIP/2.0
Via: SIP/2.0/UDP 192.168.0.199;branch=z9hG4bKe7e26a75339bf1c1
From: "alboralboralboralboralboralboralboralbor" <sip:105@192.168.0.1>;tag=9a9999849bdad8ff
To: <sip:8300@192.168.0.1>;tag=as109f8cbc
Contact: <sip:105@192.168.0.199>
Call-ID: 400de03cb0eba4be@192.168.0.199
CSeq: 13126 INFO
User-Agent: Grandstream BT100 1.0.4.55
Max-Forwards: 70
Allow: INVITE,ACK,CANCEL,BYE,NOTIFY,REFER,OPTIONS,INFO,SUBSCRIBE
Content-Type: application/dtmf-relay
Content-Length: 23

Signal=3
Duration=1280
12 headers, 2 lines
Receiving DTMF!
* DTMF received: '3'
Transmitting (no NAT):
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.0.199;branch=z9hG4bKe7e26a75339bf1c1
From: "alboralboralboralboralboralboralboralbor" <sip:105@192.168.0.1>;tag=9a9999849bdad8ff
To: <sip:8300@192.168.0.1>;tag=as109f8cbc
Call-ID: 400de03cb0eba4be@192.168.0.199
CSeq: 13126 INFO
User-Agent: Asterisk PBX
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER
Contact: <sip:8300@192.168.0.1>
Content-Length: 0


to 192.168.0.199:5060
sips*CLI>

Sip read:
INFO sip:8300@192.168.0.1 SIP/2.0
Via: SIP/2.0/UDP 192.168.0.199;branch=z9hG4bKfe5648cb2efd1007
From: "alboralboralboralboralboralboralboralbor" <sip:105@192.168.0.1>;tag=9a9999849bdad8ff
To: <sip:8300@192.168.0.1>;tag=as109f8cbc
Contact: <sip:105@192.168.0.199>
Call-ID: 400de03cb0eba4be@192.168.0.199
CSeq: 13127 INFO
User-Agent: Grandstream BT100 1.0.4.55
Max-Forwards: 70
Allow: INVITE,ACK,CANCEL,BYE,NOTIFY,REFER,OPTIONS,INFO,SUBSCRIBE
Content-Type: application/dtmf-relay
Content-Length: 23

Signal=4
Duration=1120
12 headers, 2 lines
Receiving DTMF!
* DTMF received: '4'
Transmitting (no NAT):
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.0.199;branch=z9hG4bKfe5648cb2efd1007
From: "alboralboralboralboralboralboralboralbor" <sip:105@192.168.0.1>;tag=9a9999849bdad8ff
To: <sip:8300@192.168.0.1>;tag=as109f8cbc
Call-ID: 400de03cb0eba4be@192.168.0.199
CSeq: 13127 INFO
User-Agent: Asterisk PBX
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER
Contact: <sip:8300@192.168.0.1>
Content-Length: 0


to 192.168.0.199:5060
 sip_test.agi: result 234
 sip_test.agi: dialed 234
 sip_test.agi: test stop
   -- AGI Script sip_test.agi completed, returning 0
   -- Executing Hangup("SIP/105-e9e4", "") in new stack

By: Mark Spencer (markster) 2004-07-14 04:06:36

This is a bug in the grandstream, specifically, it sends:

CSeq: 13124 INVITE

and then it sends:

CSeq: 13124 INFO

which as you can see uses the same sequence number, and thus Asterisk, correctly, does not send the digit.