[Asterisk-Users] asterisk, SIP, Re-INVITEs and different contexts
irakli.natsvlishvili at thinkingvoice.com
irakli.natsvlishvili at thinkingvoice.com
Wed Sep 7 22:03:56 MST 2005
Hello Olle,
>It is easier to turn it around:
>Asterisk will issue a re-invite unless there is a reason
>to keep the audio going through Asterisk
>* NAT traversal issues
>* Canreinvite=no
>* Anything that needs asterisk to listen for DTMF in call
>* Codecs that needs to be transcoded
Ok, let's dig into this issue. Here is my test case.
Asterisk and two Cisco 7960 phones:
1. Extension 2780 with IP address 192.168.128.165 in context [internal]
2. Extension 1001 with IP address 192.168.128.172 in context [testing]
3. Asterisk is in the same subnet with IP 192.168.128.50
There is no NAT.
extensions.conf
[internal]
exten => 1001,1,Dial,local/1001 at testing
exten => 2780,1,NoOp()
exten => 2780,2,Dial,SIP/2780|15
[testing]
exten => 2780,1,Dial,local/2780 at internal
exten => 1001,1,NoOp()
exten => 1001,2,Dial,SIP/1001|15
sip.conf
[2780]
context=internal
type = friend
secret=2780
host = dynamic
dtmfmode=rfc2833
qualify=yes
disallow=all
allow=ulaw
allow=g729
canreinvite=yes
[1001]
context=testing
type = friend
secret = 1001
host = dynamic
dtmfmode=rfc2833
qualify=2000
canreinvite=yes
disallow=all
allow=ulaw
allow=g729
Is there any questions with extensions.conf or sip.conf?
Ok, let move forward. Please see my comments to the end of this message.
Call from 2780 to 1001, this is short Ethereal trace:
-----------------------------------------------------------
Source Destination Protocol Info
192.168.128.165 192.168.128.50 SIP/SDP Request: INVITE
sip:1001 at 192.168.128.50, with session description
192.168.128.50 192.168.128.165 SIP Status: 407 Proxy
Authentication Required
192.168.128.165 192.168.128.50 SIP Request: ACK
sip:1001 at 192.168.128.50
192.168.128.165 192.168.128.50 SIP/SDP Request: INVITE
sip:1001 at 192.168.128.50, with session description
192.168.128.50 192.168.128.165 SIP Status: 100 Trying
192.168.128.50 192.168.128.172 SIP/SDP Request: INVITE
sip:1001 at 192.168.128.172:5060, with session description
192.168.128.172 192.168.128.50 SIP Status: 100 Trying
192.168.128.172 192.168.128.50 SIP Status: 180 Ringing
192.168.128.50 192.168.128.165 SIP Status: 180 Ringing
192.168.128.172 192.168.128.50 SIP/SDP Status: 200 OK, with session
description
192.168.128.50 192.168.128.172 SIP Request: ACK
sip:1001 at 192.168.128.172:5060
192.168.128.50 192.168.128.165 SIP/SDP Status: 200 OK, with session
description
192.168.128.50 192.168.128.172 SIP/SDP Request: INVITE
sip:1001 at 192.168.128.172:5060, with session description
192.168.128.165 192.168.128.50 SIP Request: ACK
sip:1001 at 192.168.128.50:5060
192.168.128.50 192.168.128.165 SIP/SDP Request: INVITE
sip:2780 at 192.168.128.165:5060, with session description
192.168.128.172 192.168.128.50 SIP/SDP Status: 200 OK, with session
description
192.168.128.50 192.168.128.172 SIP Request: ACK
sip:1001 at 192.168.128.172:5060
192.168.128.165 192.168.128.50 SIP/SDP Status: 200 OK, with session
description
192.168.128.50 192.168.128.165 SIP Request: ACK
sip:2780 at 192.168.128.165:5060
192.168.128.172 192.168.128.50 SIP Request: BYE
sip:2780 at 192.168.128.50:5060
192.168.128.50 192.168.128.172 SIP Status: 200 OK
192.168.128.50 192.168.128.165 SIP/SDP Request: INVITE
sip:2780 at 192.168.128.165:5060, with session description
192.168.128.165 192.168.128.50 SIP/SDP Status: 200 OK, with session
description
192.168.128.50 192.168.128.165 SIP Request: ACK
sip:2780 at 192.168.128.165:5060
192.168.128.50 192.168.128.165 SIP Request: BYE
sip:2780 at 192.168.128.165:5060
192.168.128.165 192.168.128.50 SIP Status: 200 OK
On Asterisk console:
-- Executing Dial("SIP/2780-1555", "local/1001 at testing") in new stack
-- Called 1001 at testing
-- Executing NoOp("Local/1001 at testing-1dbc,2", "") in new stack
-- Executing Dial("Local/1001 at testing-1dbc,2", "SIP/1001|15") in new stack
-- Called 1001
-- SIP/1001-667b is ringing
-- Local/1001 at testing-1dbc,1 is ringing
-- SIP/1001-667b answered Local/1001 at testing-1dbc,2
-- Local/1001 at testing-1dbc,1 stopped sounds
-- Local/1001 at testing-1dbc,1 answered SIP/2780-1555
-- Attempting native bridge of SIP/2780-1555 and SIP/1001-667b
*CLI> sip show channels
Peer User/ANR Call ID Seq (Tx/Rx) Format Last Msg
192.168.128.172 1001 75e28b2556a 00103/00000 ulaw Tx: ACK
192.168.128.165 2780 003094c2-bf 00102/00102 ulaw Tx: ACK
*CLI> show channels verbose
Channel Context Extension Prio State Application Data
CallerID Duration Accountcode BridgedTo
SIP/1001-667b testing 1 Up Bridged Call SIP/2780-1555
1001 SIP/2780-1555
SIP/2780-1555 testing 1001 2 Up Dial SIP/1001|15
2780 00:00:17 SIP/1001-667b
-----------------------------------------------------------
Now, call from 1001 to 2780:
Source Destination Protocol Info
192.168.128.172 192.168.128.50 SIP/SDP Request: INVITE
sip:2780 at 192.168.128.50, with session description
192.168.128.50 192.168.128.172 SIP Status: 407 Proxy
Authentication Required
192.168.128.172 192.168.128.50 SIP Request: ACK
sip:2780 at 192.168.128.50
192.168.128.172 192.168.128.50 SIP/SDP Request: INVITE
sip:2780 at 192.168.128.50, with session description
192.168.128.50 192.168.128.172 SIP Status: 100 Trying
192.168.128.50 192.168.128.165 SIP/SDP Request: INVITE
sip:2780 at 192.168.128.165:5060, with session description
192.168.128.165 192.168.128.50 SIP Status: 100 Trying
192.168.128.165 192.168.128.50 SIP Status: 180 Ringing
192.168.128.50 192.168.128.172 SIP Status: 180 Ringing
192.168.128.165 192.168.128.50 SIP/SDP Status: 200 OK, with session
description
192.168.128.50 192.168.128.165 SIP Request: ACK
sip:2780 at 192.168.128.165:5060
192.168.128.50 192.168.128.172 SIP/SDP Status: 200 OK, with session
description
192.168.128.172 192.168.128.50 SIP Request: ACK
sip:2780 at 192.168.128.50:5060
192.168.128.172 192.168.128.50 SIP Request: BYE
sip:2780 at 192.168.128.50:5060
192.168.128.50 192.168.128.172 SIP Status: 200 OK
192.168.128.50 192.168.128.165 SIP Request: BYE
sip:2780 at 192.168.128.165:5060
192.168.128.165 192.168.128.50 SIP Status: 200 OK
On Asterisk console:
-- Executing Dial("SIP/1001-62d4", "local/2780 at internal") in new stack
-- Called 2780 at internal
-- Executing NoOp("Local/2780 at internal-969f,2", "") in new stack
-- Executing Dial("Local/2780 at internal-969f,2", "SIP/2780|15") in new stack
-- Called 2780
-- SIP/2780-d7e4 is ringing
-- Local/2780 at internal-969f,1 is ringing
-- SIP/2780-d7e4 answered Local/2780 at internal-969f,2
-- Local/2780 at internal-969f,1 stopped sounds
-- Local/2780 at internal-969f,1 answered SIP/1001-62d4
*CLI> sip show channels
Peer User/ANR Call ID Seq (Tx/Rx) Format Last Msg
192.168.128.165 2780 56952b0a2f0 00102/00000 ulaw Tx: ACK
192.168.128.172 1001 001201ad-72 00101/00102 ulaw Rx: ACK
*CLI> show channels verbose
Channel Context Extension Prio State Application Data
CallerID Duration Accountcode BridgedTo
SIP/2780-d7e4 internal 1 Up Bridged Call SIP/1001-62d4
2780 SIP/1001-62d4
SIP/1001-62d4 internal 2780 2 Up Dial SIP/2780|15
1001 00:00:14 SIP/2780-d7e4
---------------------------------------------------------------
So, when 2780 calls 1001, RTP stream flow directly between phones.
When 1001 calls 2780, RTP stream goes via Asterisk because it does not
issue Re-INVITEs.
I've tested it with six different UAs. I always get the same result.
Any comments? Could anybody re-test it?
I.N.
P.S. *CLI> show version
Asterisk CVS-NHEAD-08/14/05-04:38:46
More information about the asterisk-users
mailing list