Bug#473456: asterisk: chan_sip starts RTP stream before receiving ACK

Marcus Better marcus at better.se
Sun Mar 30 18:51:38 UTC 2008


Package: asterisk
Version: 1:1.4.18.1~dfsg-1
Severity: normal

chan_sip starts the RTP media stream without waiting for the required
ACK. This is incorrect and causes several problems. First, the client
is not necessarily listening at that point and may miss the first part
of the media. Second, at that point the session has not been set up
and can still be CANCELed, which is common when using proxies that do
parallel search.

As can be seen from the following log, the sequence is:

UAC                       Asterisk
10.1.2.3:5060             10.1.2.3:5061

       INVITE
--------------------------->

       100 Trying
<---------------------------

       OK
<---------------------------


       OK (retransmit)
<---------------------------

       RTP
<===========================>

       OK (retransmit)
<---------------------------


So Asterisk is sending media although it is still retransmitting the
OK response. (In this case the UAC actually sent an ACK that never
reached Asterisk due to misconfiguration, which explains why the UAC
sends audio.)


<--- SIP read from 10.1.2.3:5060 --->
INVITE sip:echo at 10.1.2.3:5061 SIP/2.0
Record-Route: <sip:10.1.2.3;ftag=7rHjXH36ctX2H;avp=3pMBDABuYXRlZF9jYWxsZXIBAAAA;lr>
Via: SIP/2.0/UDP 10.1.2.3;branch=z9hG4bK1013.139d198.0
Via: SIP/2.0/UDP 172.16.1.102:5060;rport=5060;appname=Proxy;branch=z9hG4bKd9960566507221e6f5914c94afcf3e02;handler=h1,SIP/2.0/UDP 10.1.2.3;branch=z9hG4bK1013.039d198.0,SIP/2.0/UDP 192.168.100.10:49156;rport=49156;branch=z9hG4bKp693yX6te322K;received=81.5.6.7
Max-Forwards: 14
From: <sip:user at example.org>;tag=7rHjXH36ctX2H
To: <sip:echo at example.org>
Call-ID: 29fa7d62-7910-122b-f182-00194f9ed371
CSeq: 97326985 INVITE
Contact: <sip:user at 172.16.1.102:5060>
User-Agent: Telepathy-SofiaSIP/0.5.3 sofia-sip/1.12.8
Allow: INVITE,ACK,BYE,CANCEL,OPTIONS,PRACK,MESSAGE,UPDATE
Supported: timer,100rel
Proxy-Authorization: Digest response="d7d356ca8f83eb79657e972aa74f51bb",cnonce="KgR7nnkQEiuC8QAZT57TcQ",username="user",realm="example.org",nonce="47efb2185b83b8627cdb871ab6a62e03fbeb326a",qop=auth,nc=00000001,uri="sip:echo at example.org",algorithm=MD5
Min-SE: 120
Content-Type: application/sdp
Content-Disposition: session
P-hint: To Lucy
Record-Route: <sip:172.16.1.102:5060;transport=udp;lr;appname=Proxy;handler=h1>
Content-Length: 329
P-hint: usrloc applied

v=0
o=- 3677906115887924909 1100100664627011715 IN IP4 192.168.100.10
s=-
t=0 0
m=audio 35498 RTP/AVP 96 18 8 0 13 97
c=IN IP4 10.1.2.3
a=rtpmap:96 iLBC/8000
a=fmtp:96 mode=30
a=rtpmap:18 G729/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:13 CN/8000
a=rtpmap:97 telephone-event/8000
a=nortpproxy:yes
<------------->
--- (21 headers 14 lines) ---
Sending to 10.1.2.3 : 5060 (no NAT)
Using INVITE request as basis request - 29fa7d62-7910-122b-f182-00194f9ed371
Found no matching peer or user for '10.1.2.3:5060'
Found RTP audio format 96
Found RTP audio format 18
Found RTP audio format 8
Found RTP audio format 0
Found RTP audio format 13
Found RTP audio format 97
Peer audio RTP is at port 10.1.2.3:35498
Found audio description format iLBC for ID 96
Found audio description format G729 for ID 18
Found audio description format PCMA for ID 8
Found audio description format PCMU for ID 0
Found audio description format CN for ID 13
Found audio description format telephone-event for ID 97
Capabilities: us - 0x8000e (gsm|ulaw|alaw|h263), peer - audio=0x50c (ulaw|alaw|g729|ilbc)/video=0x0 (nothing), combined - 0xc (ulaw|alaw)
Non-codec capabilities (dtmf): us - 0x1 (telephone-event), peer - 0x3 (telephone-event|CN), combined - 0x1 (telephone-event)
Peer audio RTP is at port 10.1.2.3:35498
Looking for echo in default (domain 10.1.2.3)
list_route: hop: <sip:10.1.2.3;ftag=7rHjXH36ctX2H;avp=3pMBDABuYXRlZF9jYWxsZXIBAAAA;lr>
list_route: hop: <sip:172.16.1.102:5060;transport=udp;lr;appname=Proxy;handler=h1>

<--- Transmitting (no NAT) to 10.1.2.3:5060 --->
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 10.1.2.3;branch=z9hG4bK1013.139d198.0;received=10.1.2.3
Via: SIP/2.0/UDP 172.16.1.102:5060;rport=5060;appname=Proxy;branch=z9hG4bKd9960566507221e6f5914c94afcf3e02;handler=h1,SIP/2.0/UDP 10.1.2.3;branch=z9hG4bK1013.039d198.0,SIP/2.0/UDP 192.168.100.10:49156;rport=49156;branch=z9hG4bKp693yX6te322K;received=81.5.6.7
Record-Route: <sip:10.1.2.3;ftag=7rHjXH36ctX2H;avp=3pMBDABuYXRlZF9jYWxsZXIBAAAA;lr>
Record-Route: <sip:172.16.1.102:5060;transport=udp;lr;appname=Proxy;handler=h1>
From: <sip:user at example.org>;tag=7rHjXH36ctX2H
To: <sip:echo at example.org>
Call-ID: 29fa7d62-7910-122b-f182-00194f9ed371
CSeq: 97326985 INVITE
User-Agent: Asterisk PBX
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY
Supported: replaces
Contact: <sip:echo at 10.1.2.3:5061>
Content-Length: 0


<------------>
Audio is at 10.1.2.3 port 10638
Adding codec 0x4 (ulaw) to SDP
Adding codec 0x8 (alaw) to SDP
Adding non-codec 0x1 (telephone-event) to SDP

<--- Reliably Transmitting (no NAT) to 10.1.2.3:5060 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 10.1.2.3;branch=z9hG4bK1013.139d198.0;received=10.1.2.3
Via: SIP/2.0/UDP 172.16.1.102:5060;rport=5060;appname=Proxy;branch=z9hG4bKd9960566507221e6f5914c94afcf3e02;handler=h1,SIP/2.0/UDP 10.1.2.3;branch=z9hG4bK1013.039d198.0,SIP/2.0/UDP 192.168.100.10:49156;rport=49156;branch=z9hG4bKp693yX6te322K;received=81.5.6.7
Record-Route: <sip:10.1.2.3;ftag=7rHjXH36ctX2H;avp=3pMBDABuYXRlZF9jYWxsZXIBAAAA;lr>
Record-Route: <sip:172.16.1.102:5060;transport=udp;lr;appname=Proxy;handler=h1>
From: <sip:user at example.org>;tag=7rHjXH36ctX2H
To: <sip:echo at example.org>;tag=as7260f365
Call-ID: 29fa7d62-7910-122b-f182-00194f9ed371
CSeq: 97326985 INVITE
User-Agent: Asterisk PBX
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY
Supported: replaces
Contact: <sip:echo at 10.1.2.3:5061>
Content-Type: application/sdp
Content-Length: 263

v=0
o=root 27731 27731 IN IP4 10.1.2.3
s=session
c=IN IP4 10.1.2.3
t=0 0
m=audio 10638 RTP/AVP 0 8 97
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:97 telephone-event/8000
a=fmtp:97 0-16
a=silenceSupp:off - - - -
a=ptime:20
a=sendrecv

<------------>
Retransmitting #1 (no NAT) to 10.1.2.3:5060:
SIP/2.0 200 OK
Via: SIP/2.0/UDP 10.1.2.3;branch=z9hG4bK1013.139d198.0;received=10.1.2.3
Via: SIP/2.0/UDP 172.16.1.102:5060;rport=5060;appname=Proxy;branch=z9hG4bKd9960566507221e6f5914c94afcf3e02;handler=h1,SIP/2.0/UDP 10.1.2.3;branch=z9hG4bK1013.039d198.0,SIP/2.0/UDP 192.168.100.10:49156;rport=49156;branch=z9hG4bKp693yX6te322K;received=81.5.6.7
Record-Route: <sip:10.1.2.3;ftag=7rHjXH36ctX2H;avp=3pMBDABuYXRlZF9jYWxsZXIBAAAA;lr>
Record-Route: <sip:172.16.1.102:5060;transport=udp;lr;appname=Proxy;handler=h1>
From: <sip:user at example.org>;tag=7rHjXH36ctX2H
To: <sip:echo at example.org>;tag=as7260f365
Call-ID: 29fa7d62-7910-122b-f182-00194f9ed371
CSeq: 97326985 INVITE
User-Agent: Asterisk PBX
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY
Supported: replaces
Contact: <sip:echo at 10.1.2.3:5061>
Content-Type: application/sdp
ontent-Length: 263

v=0
o=root 27731 27731 IN IP4 10.1.2.3
s=session
c=IN IP4 10.1.2.3
t=0 0
m=audio 10638 RTP/AVP 0 8 97
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:97 telephone-event/8000
a=fmtp:97 0-16
a=silenceSupp:off - - - -
a=ptime:20
a=sendrecv

---
Sent RTP packet to      10.1.2.3:35498 (type 00, seq 023664, ts 000160, len 000160)
Sent RTP packet to      10.1.2.3:35498 (type 00, seq 023665, ts 000320, len 000160)
Sent RTP packet to      10.1.2.3:35498 (type 00, seq 023666, ts 000480, len 000160)
Sent RTP packet to      10.1.2.3:35498 (type 00, seq 023667, ts 000640, len 000160)
Sent RTP packet to      10.1.2.3:35498 (type 00, seq 023668, ts 000800, len 000160)
Sent RTP packet to      10.1.2.3:35498 (type 00, seq 023669, ts 000960, len 000160)
Sent RTP packet to      10.1.2.3:35498 (type 00, seq 023670, ts 001120, len 000160)
Sent RTP packet to      10.1.2.3:35498 (type 00, seq 023671, ts 001280, len 000160)
Sent RTP packet to      10.1.2.3:35498 (type 00, seq 023672, ts 001440, len 000160)
Sent RTP packet to      10.1.2.3:35498 (type 00, seq 023673, ts 001600, len 000160)
Sent RTP packet to      10.1.2.3:35498 (type 00, seq 023674, ts 001760, len 000160)
Sent RTP packet to      10.1.2.3:35498 (type 00, seq 023675, ts 001920, len 000160)
Sent RTP packet to      10.1.2.3:35498 (type 00, seq 023676, ts 002080, len 000160)
Sent RTP packet to      10.1.2.3:35498 (type 00, seq 023677, ts 002240, len 000160)
Sent RTP packet to      10.1.2.3:35498 (type 00, seq 023678, ts 002400, len 000160)
Sent RTP packet to      10.1.2.3:35498 (type 00, seq 023679, ts 002560, len 000160)
Sent RTP packet to      10.1.2.3:35498 (type 00, seq 023680, ts 002720, len 000160)
Sent RTP packet to      10.1.2.3:35498 (type 00, seq 023681, ts 002880, len 000160)
Sent RTP packet to      10.1.2.3:35498 (type 00, seq 023682, ts 003040, len 000160)
Got  RTP packet from    10.1.2.3:35498 (type 00, seq 017265, ts 121877997, len 000160)
Sent RTP packet to      10.1.2.3:35498 (type 00, seq 023683, ts 003200, len 000160)
Got  RTP packet from    10.1.2.3:35498 (type 00, seq 017266, ts 121878157, len 000160)
Got  RTP packet from    10.1.2.3:35498 (type 00, seq 017267, ts 121878317, len 000160)
Sent RTP packet to      10.1.2.3:35498 (type 00, seq 023684, ts 003360, len 000160)
Got  RTP packet from    10.1.2.3:35498 (type 00, seq 017268, ts 121878477, len 000160)
Sent RTP packet to      10.1.2.3:35498 (type 00, seq 023685, ts 003520, len 000160)
Got  RTP packet from    10.1.2.3:35498 (type 00, seq 017269, ts 121878637, len 000160)
Sent RTP packet to      10.1.2.3:35498 (type 00, seq 023686, ts 003680, len 000160)
Got  RTP packet from    10.1.2.3:35498 (type 00, seq 017270, ts 121878797, len 000160)
Sent RTP packet to      10.1.2.3:35498 (type 00, seq 023687, ts 003840, len 000160)
Got  RTP packet from    10.1.2.3:35498 (type 00, seq 017271, ts 121878957, len 000160)
Sent RTP packet to      10.1.2.3:35498 (type 00, seq 023688, ts 004000, len 000160)

Retransmitting #3 (no NAT) to 10.1.2.3:5060:
SIP/2.0 200 OK
Via: SIP/2.0/UDP 10.1.2.3;branch=z9hG4bK1013.139d198.0;received=10.1.2.3
Via: SIP/2.0/UDP 172.16.1.102:5060;rport=5060;appname=Proxy;branch=z9hG4bKd9960566507221e6f5914c94afcf3e02;handler=h1,SIP/2.0/UDP 10.1.2.3;branch=z9hG4bK1013.039d198.0,SIP/2.0/UDP 192.168.100.10:49156;rport=49156;branch=z9hG4bKp693yX6te322K;received=81.5.6.7
Record-Route: <sip:10.1.2.3;ftag=7rHjXH36ctX2H;avp=3pMBDABuYXRlZF9jYWxsZXIBAAAA;lr>
Record-Route: <sip:172.16.1.102:5060;transport=udp;lr;appname=Proxy;handler=h1>
From: <sip:user at example.org>;tag=7rHjXH36ctX2H
To: <sip:echo at example.org>;tag=as7260f365
Call-ID: 29fa7d62-7910-122b-f182-00194f9ed371
CSeq: 97326985 INVITE
User-Agent: Asterisk PBX
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY
Supported: replaces
Contact: <sip:echo at 10.1.2.3:5061>
Content-Type: application/sdp
ontent-Length: 263

v=0
o=root 27731 27731 IN IP4 10.1.2.3
s=session
c=IN IP4 10.1.2.3
t=0 0
m=audio 10638 RTP/AVP 0 8 97
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:97 telephone-event/8000
a=fmtp:97 0-16
a=silenceSupp:off - - - -
a=ptime:20
a=sendrecv

---
Sent RTP packet to      10.1.2.3:35498 (type 00, seq 023815, ts 024320, len 000160)
Sent RTP packet to      10.1.2.3:35498 (type 00, seq 023816, ts 024480, len 000160)
Sent RTP packet to      10.1.2.3:35498 (type 00, seq 023817, ts 024640, len 000160)
Sent RTP packet to      10.1.2.3:35498 (type 00, seq 023818, ts 024800, len 000160)
Sent RTP packet to      10.1.2.3:35498 (type 00, seq 023819, ts 024960, len 000160)
Sent RTP packet to      10.1.2.3:35498 (type 00, seq 023820, ts 025120, len 000160)
Sent RTP packet to      10.1.2.3:35498 (type 00, seq 023821, ts 025280, len 000160)
Sent RTP packet to      10.1.2.3:35498 (type 00, seq 023822, ts 025440, len 000160)
Sent RTP packet to      10.1.2.3:35498 (type 00, seq 023823, ts 025600, len 000160)
Sent RTP packet to      10.1.2.3:35498 (type 00, seq 023824, ts 025760, len 000160)
Sent RTP packet to      10.1.2.3:35498 (type 00, seq 023825, ts 025920, len 000160)
Sent RTP packet to      10.1.2.3:35498 (type 00, seq 023826, ts 026080, len 000160)
Sent RTP packet to      10.1.2.3:35498 (type 00, seq 023827, ts 026240, len 000160)
Sent RTP packet to      10.1.2.3:35498 (type 00, seq 023828, ts 026400, len 000160)
Sent RTP packet to      10.1.2.3:35498 (type 00, seq 023829, ts 026560, len 000160)
Sent RTP packet to      10.1.2.3:35498 (type 00, seq 023830, ts 026720, len 000160)
Sent RTP packet to      10.1.2.3:35498 (type 00, seq 023831, ts 026880, len 000160)


-- System Information:
Debian Release: 4.0
  APT prefers stable
  APT policy: (900, 'stable'), (400, 'testing'), (300, 'unstable')
Architecture: amd64 (x86_64)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.24-quartic
Locale: LANG=sv_SE.UTF-8, LC_CTYPE=sv_SE.UTF-8 (charmap=UTF-8)

Versions of packages asterisk depends on:
ii  adduser               3.102              Add and remove users and groups
ii  asterisk-config       1:1.4.18.1~dfsg-1  Configuration files for Asterisk
ii  asterisk-sounds-main  1:1.4.18.1~dfsg-1  Core Sound files for Asterisk (Eng
ii  libasound2            1.0.16-2           ALSA library
ii  libc-client2007       7:2007~dfsg-1      UW c-client library for mail proto
ii  libc6                 2.7-9              GNU C Library: Shared libraries
ii  libcap1               1:1.10-14          support for getting/setting POSIX.
ii  libct3                0.63-3.2           libraries for connecting to MS SQL
ii  libcurl3              7.18.0-1           Multi-protocol file transfer libra
ii  libgcc1               1:4.3.0-2          GCC support library
ii  libgsm1               1.0.12-1           Shared libraries for GSM speech co
ii  libiksemel3           1.2-3              C library for the Jabber IM platfo
ii  libkrb53              1.6.dfsg.3~beta1-4 MIT Kerberos runtime libraries
ii  libncurses5           5.6+20080203-1     Shared libraries for terminal hand
ii  libnewt0.52           0.52.2-10          Not Erik's Windowing Toolkit - tex
ii  libogg0               1.1.3-3            Ogg Bitstream Library
ii  libpopt0              1.10-3             lib for parsing cmdline parameters
ii  libpq5                8.3.0-1            PostgreSQL C client library
ii  libpri1.0             1.4.2-1            Primary Rate ISDN specification li
ii  libradiusclient-ng2   0.5.3-2            Enhanced RADIUS client library
ii  libsnmp15             5.4.1~dfsg-6       SNMP (Simple Network Management Pr
ii  libspeex1             1.1.12-3           The Speex Speech Codec
ii  libsqlite0            2.8.17-4           SQLite shared library
ii  libssl0.9.8           0.9.8g-7           SSL shared libraries
ii  libstdc++6            4.3.0-2            The GNU Standard C++ Library v3
ii  libtonezone1          1:1.4.8~dfsg-1     tonezone library (runtime)
ii  libvorbis0a           1.2.0.dfsg-3       The Vorbis General Audio Compressi
ii  libvorbisenc2         1.2.0.dfsg-3       The Vorbis General Audio Compressi
ii  libvpb0               4.2.26-1           Voicetronix telephony hardware use
ii  unixodbc              2.2.11-16          ODBC tools libraries
ii  zlib1g                1:1.2.3.3.dfsg-11  compression library - runtime

asterisk recommends no packages.

-- no debconf information





More information about the Pkg-voip-maintainers mailing list