[asterisk-users] how asterisk knows which context forward the call to?

Joseph syscon780 at gmail.com
Wed Feb 17 20:59:10 CST 2010


Apology for not posting too much details.
I'm trying to figure it out how the ATA adapter knows which context (from sip.conf) send the call to?

I'm puzzled as I have never encounter this problem before.
I have for example two ATA adapters (Linksys and Audiocodes) both register with asterisk per-port and both have FXS/FXO interfaces.

In sip.conf
[pstn-4444]
...
context=incoming
...

[pstn-9998] 
...
context=fax-incoming
...

They both register with asterisk just fine. The cheaper one has only one FXO interface and send the call correctly to the interface it is registered to via 
sip.conf.
The higher end ATA Audiocodes has two FXO interfaces and forwards the calls only to ONE context regardless of which interface the all come IN.

I captured the traffic via "tcpdump" but I'm not sure how to recognized why and how to call is being forwarded incorrectly from Audiocodes gateway.

 From Audiocodes:

.......a..INVITE sip:4 at 10.10.0.2 SIP/2.0
Via: SIP/2.0/UDP 10.10.0.8;branch=z9hG4bKac445090997
Max-Forwards: 70
From: "KMIEC Z" <sip:7804715665 at 10.10.0.8>;tag=1c445087336
To: <sip:4 at 10.10.0.2>
Call-ID: 445086899172201014155 at 10.10.0.8
CSeq: 1 INVITE
Contact: <sip:pstn-4444 at 10.10.0.8:5060>
Supported: em,100rel,timer,replaces,path,early-session,resource-priority,sdp-anat
Allow: REGISTER,OPTIONS,INVITE,ACK,CANCEL,BYE,NOTIFY,PRACK,REFER,INFO,SUBSCRIBE,UPDATE
User-Agent: Audiocodes-Sip-Gateway-MP-114 FXS_FXO/v.5.60A.030.001
Content-Type: application/sdp
Content-Disposition: session
Content-Length: 249

v=0
o=AudiocodesGW 445081214 445081091 IN IP4 10.10.0.8
s=Phone-Call
c=IN IP4 10.10.0.8
t=0 0
m=audio 6020 RTP/AVP 0 8 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=ptime:20
a=sendrecv

14:02:34.305631 IP (tos 0x0, ttl 64, id 37384, offset 0, flags [none], proto UDP (17), length 426) 10.10.0.2.5060 > 10.10.0.8.5060: [udp sum ok] UDP, length 
398
E....... at ...

..

..........SIP/2.0 100 Trying
Via: SIP/2.0/UDP 10.10.0.8;branch=z9hG4bKac445090997;received=10.10.0.8
From: "KMIEC Z" <sip:7804715665 at 10.10.0.8>;tag=1c445087336
To: <sip:4 at 10.10.0.2>
Call-ID: 445086899172201014155 at 10.10.0.8
CSeq: 1 INVITE
User-Agent: Asterisk PBX
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY
Supported: replaces
Contact: <sip:4 at 10.10.0.2>
Content-Length: 0


14:02:34.305950 IP (tos 0x0, ttl 64, id 37385, offset 0, flags [none], proto UDP (17), length 804) 10.10.0.2.5060 > 10.10.0.8.5060: [udp sum ok] UDP, length 
776
E..$.	.. at ...

..

.........UINVITE sip:4 at 10.10.0.8:5060 SIP/2.0
Via: SIP/2.0/UDP 10.10.0.2:5060;branch=z9hG4bK50dcf744;rport
From: "KMIEC Z" <sip:7804715665 at 10.10.0.2>;tag=as6f0a71bb
To: <sip:4 at 10.10.0.8:5060>
Contact: <sip:7804715665 at 10.10.0.2>
Call-ID: 7e9a498f101e94e952bb286242c24bc1 at 10.10.0.2
CSeq: 102 INVITE
User-Agent: Asterisk PBX
Max-Forwards: 70
Date: Wed, 17 Feb 2010 21:02:34 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY
Supported: replaces
Content-Type: application/sdp
Content-Length: 258
...


 From Linksys:

..........INVITE sip:4 at 10.10.0.2 SIP/2.0
Via: SIP/2.0/UDP 10.10.0.6:5060;branch=z9hG4bK-a6fea026
From: KMIEC Z <sip:7804715665 at 10.10.0.2>;tag=3da21e945d4dbff6o1
To: <sip:4 at 10.10.0.2>
Remote-Party-ID: KMIEC Z <sip:7804715665 at 10.10.0.2>;screen=yes;party=calling
Call-ID: 83da216c-7c6ddafe at 10.10.0.6
CSeq: 101 INVITE
Max-Forwards: 70
Contact: <sip:7804715665 at 10.10.0.6:5060>
Expires: 240
User-Agent: Linksys/SPA3102-5.1.7(GW)
Content-Length: 434
Allow: ACK, BYE, CANCEL, INFO, INVITE, NOTIFY, OPTIONS, REFER
Supported: x-sipura, replaces
Content-Type: application/sdp

v=0
o=- 15099 15099 IN IP4 10.10.0.6
s=-
c=IN IP4 10.10.0.6
t=0 0
m=audio 16410 RTP/AVP 0 2 4 8 18 96 97 98 100 101
a=rtpmap:0 PCMU/8000
a=rtpmap:2 G726-32/8000
a=rtpmap:4 G723/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:18 G729a/8000
a=rtpmap:96 G726-40/8000
a=rtpmap:97 G726-24/8000
a=rtpmap:98 G726-16/8000
a=rtpmap:100 NSE/8000
a=fmtp:100 192-193
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=ptime:30
a=sendrecv

16:00:12.666784 IP (tos 0x0, ttl 64, id 31864, offset 0, flags [none], proto UDP (17), length 432) 10.10.0.2.5060 > 10.10.0.6.5060: [udp sum ok] UDP, length 
404
E...|x.. at ...

..

..........SIP/2.0 100 Trying
Via: SIP/2.0/UDP 10.10.0.6:5060;branch=z9hG4bK-a6fea026;received=10.10.0.6
From: KMIEC Z <sip:7804715665 at 10.10.0.2>;tag=3da21e945d4dbff6o1
To: <sip:4 at 10.10.0.2>
Call-ID: 83da216c-7c6ddafe at 10.10.0.6
CSeq: 101 INVITE
User-Agent: Asterisk PBX
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY
Supported: replaces
Contact: <sip:4 at 10.10.0.2>
Content-Length: 0


16:00:12.667389 IP (tos 0x0, ttl 64, id 31865, offset 0, flags [none], proto UDP (17), length 732) 10.10.0.2.5060 > 10.10.0.6.5060: [udp sum ok] UDP, length 
704
E...|y.. at ..|

..

..........SIP/2.0 200 OK
Via: SIP/2.0/UDP 10.10.0.6:5060;branch=z9hG4bK-a6fea026;received=10.10.0.6
From: KMIEC Z <sip:7804715665 at 10.10.0.2>;tag=3da21e945d4dbff6o1
To: <sip:4 at 10.10.0.2>;tag=as2fdf6ea0
Call-ID: 83da216c-7c6ddafe at 10.10.0.6
CSeq: 101 INVITE
User-Agent: Asterisk PBX
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY
Supported: replaces
Contact: <sip:4 at 10.10.0.2>
Content-Type: application/sdp
Content-Length: 256


Any ideas, how asterisk sip.conf knows how to interpret this incoming data? Which context to select?

--
Joseph



On 02/17/10 21:18, John Timms wrote:
>Your question is a little vague. I assume that you would be looking for the
>"GoTo" application. The syntax is explained here:
>http://www.voip-info.org/wiki/view/Asterisk+cmd+goto
>
><http://www.voip-info.org/wiki/view/Asterisk+cmd+goto>Also, you can look on
>page 426 of the Asterisk book, which is really helpful if you're new to
>Asterisk. Download it for free from the publisher here:
>http://downloads.oreilly.com/books/9780596510480.pdf
>
><http://downloads.oreilly.com/books/9780596510480.pdf>John Timms
>
>--
>John Timms
>(864) 416-1809
>johngtimms (at) gmail (dot) com
>--
>IT Department - Gnoso Inc.
>john (at) gnoso (dot) com
>--
>Grapedial- Affordable group phone messaging
>www.grapedial.com
>john (at) grapedial (dot) com



More information about the asterisk-users mailing list