SIP Header Manipulation - Audio issue with IP dial

Hi,

I am trying to dial a sip user via SIP URI (his IP:PORT Combination). i am using XYZ as target user which is registered.

Asterisk server is on live ip, while both calling and called users are behind router.

Asterisk server IP: 70.118.x.x

calling user IP: 224.69.x.x

called user IP: 117.58.x.x:5062

I dialed the registered user via it’s ip and port to which it was registered. like this,

Dial(SIP/XYZ@117.58.x.x:5062,30,rtT)

during conversation audio was one way (calling party can hear called party but called party can not hear caller).

i see INVITE sip:XYZ@117.58.x.x:5062 SIP/2.0 when dialing via IP:Port.

but normaly dialing Dial(SIP/XYZ) has INVITE sip:XYZ@192.168.0.10:5062 SIP/2.0

port forwarding and other rules are properly applied as normal dial has no audio problem. I also tried playing with canreinvite and directrtpsetup etc, but situation is same. it seems that with normal dial asterisk has some way of translating local address to router and audio is proper. while dialing by IP:Port asterisk is not able to send audio to the callee.

I have read rfc3261 and under stand INVITE and re-INVITE but my question is how can i modify INVITE request or send custome re-INVITE ?
what measures i can take to pin-point where the problem is and how to resolve it?

waiting for your kind response.

Nasir Javaid.

There is no direct control of Re-INVITEs; you would need to change the Asterisk source code.

Many settings, including Dial options, channel variables, the use of the AddHeader application and sip.conf settings affect the contents of a normal INVITE.

For your one way audio, across a NAT boundary, you should look at parameters containing “nat” (keyword or value), localanets, STUN settings and the external host name.

Thank you very much david,

you have cleared my confusion of direct INVITE and Headers manipulation. I have noticed that during normal dial (Dial(SIP/XYZ) when connection is established between both ends, there is a SUBSCRIBE request generated and then comes NOTIFY. these requests are not generated when i dial via IP:Port. do you think this could be the problem. and any direct reference to how can i solve this problem. it’s almos 2 weeks and i am stuck in it.

i will appreciate if you could help.
below is debug trace after remote end picks up .

-- Call on SIP/XYZ-00794e30 left from hold
-- SIP/XYZ-00794e30 answered SIP/caller-9fd06cc0

hammer*CLI>
<— SIP read from 117.58.x.x:28614 —>

<------------->
— (0 headers 1 lines) —
hammer*CLI>
<— SIP read from 117.58.x.x:28614 —>
SUBSCRIBE sip:XYZ@asterisk.server.com:5678 SIP/2.0
Via: SIP/2.0/UDP 192.168.0.12:28614;branch=z9hG4bK-d8754z-7039d4338568107f-1—d8754z-;rport
Max-Forwards: 70
Contact: sip:XYZ@117.58.x.x:28614
To: "XYZ"sip:XYZ@asterisk.server.com:5678
From: "XYZ"sip:XYZ@asterisk.server.com:5678;tag=5d297f22
Call-ID: MTE5N2M4ZDY1OWRjOGQwMjgyOWEzZjkzYjA3Y2RkYWY.
CSeq: 1 SUBSCRIBE
Expires: 300
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO
User-Agent: X-Lite release 1104o stamp 56125
Event: message-summary
Content-Length: 0

<------------->
— (13 headers 0 lines) —
Creating new subscription
Sending to 117.58.x.x : 28614 (NAT)
Found peer 'XYZ’
Looking for XYZ in outbound_dial (domain asterisk.server.com)
hammer*CLI>
<— Transmitting (NAT) to 117.58.x.x:28614 —>
SIP/2.0 404 Not Found
Via: SIP/2.0/UDP 192.168.0.12:28614;branch=z9hG4bK-d8754z-7039d4338568107f-1—d8754z-;received=117.58.x.x;rport=28614
From: "XYZ"sip:XYZ@asterisk.server.com:5678;tag=5d297f22
To: "XYZ"sip:XYZ@asterisk.server.com:5678;tag=as724c598c
Call-ID: MTE5N2M4ZDY1OWRjOGQwMjgyOWEzZjkzYjA3Y2RkYWY.
CSeq: 1 SUBSCRIBE
User-Agent: Asterisk PBX
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY
Supported: replaces
Content-Length: 0

<------------>
Really destroying SIP dialog ‘MTE5N2M4ZDY1OWRjOGQwMjgyOWEzZjkzYjA3Y2RkYWY.’ Method: SUBSCRIBE
Reliably Transmitting (NAT) to 117.58.x.x:28614:
OPTIONS sip:XYZ@117.58.x.x:28614;rinstance=0266b8b94f488588 SIP/2.0
Via: SIP/2.0/UDP 70.118.x.x:5678;branch=z9hG4bK42fde971;rport
From: “asterisk” sip:asterisk@70.118.x.x:5678;tag=as223ef4a7
To: sip:XYZ@117.58.x.x:28614;rinstance=0266b8b94f488588
Contact: sip:asterisk@70.118.x.x:5678
Call-ID: 5c66fbdf4234deca50d5c44a18641582@70.118.x.x
CSeq: 102 OPTIONS
User-Agent: Asterisk PBX
Max-Forwards: 70
Date: Wed, 21 Jul 2010 15:07:07 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY
Supported: replaces
Content-Length: 0


hammer*CLI>
<— SIP read from 117.58.x.x:28614 —>
SIP/2.0 200 OK
Via: SIP/2.0/UDP 70.118.x.x:5678;branch=z9hG4bK42fde971;rport=5678
Contact: sip:192.168.0.12:28614
To: sip:XYZ@117.58.x.x:28614;rinstance=0266b8b94f488588;tag=15133f38
From: "asterisk"sip:asterisk@70.118.x.x:5678;tag=as223ef4a7
Call-ID: 5c66fbdf4234deca50d5c44a18641582@70.118.x.x
CSeq: 102 OPTIONS
Accept: application/sdp
Accept-Language: en
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO
User-Agent: X-Lite release 1104o stamp 56125
Content-Length: 0

<------------->
— (12 headers 0 lines) —
Really destroying SIP dialog '5c66fbdf4234deca50d5c44a18641582@70.118.x.x’ Method: OPTIONS
hammer*CLI>
<------------>
Scheduling destruction of SIP dialog '6514fece69f1718e5cefe72632909c0e@70.118.x.x’ in 23936 ms (Method: NOTIFY)
Reliably Transmitting (NAT) to 117.58.x.x:28614:
NOTIFY sip:XYZ@117.58.x.x:28614;rinstance=0266b8b94f488588 SIP/2.0
Via: SIP/2.0/UDP 70.118.x.x:5678;branch=z9hG4bK218cf73a;rport
From: “asterisk” sip:asterisk@70.118.x.x:5678;tag=as756cae64
To: sip:XYZ@117.58.x.x:28614;rinstance=0266b8b94f488588
Contact: sip:asterisk@70.118.x.x:5678
Call-ID: 6514fece69f1718e5cefe72632909c0e@70.118.x.x
CSeq: 102 NOTIFY
User-Agent: Asterisk PBX
Max-Forwards: 70
Event: message-summary
Content-Type: application/simple-message-summary
Content-Length: 92

Messages-Waiting: no
Message-Account: sip:asterisk@70.118.x.x
Voice-Message: 0/0 (0/0)


hammer*CLI>
<— SIP read from 117.58.x.x:28614 —>
SIP/2.0 200 OK
Via: SIP/2.0/UDP 70.118.x.x:5678;branch=z9hG4bK218cf73a;rport=5678
Contact: sip:192.168.0.12:28614
To: sip:XYZ@117.58.x.x:28614;rinstance=0266b8b94f488588;tag=b9541904
From: "asterisk"sip:asterisk@70.118.x.x:5678;tag=as756cae64
Call-ID: 6514fece69f1718e5cefe72632909c0e@70.118.x.x
CSeq: 102 NOTIFY
User-Agent: X-Lite release 1104o stamp 56125
Content-Length: 0

<------------->
— (9 headers 0 lines) —
Really destroying SIP dialog '6514fece69f1718e5cefe72632909c0e@70.118.x.x’ Method: NOTIFY
[Jul 21 11:07:15] DEBUG[23749]: chan_sip.c:3074 update_call_counter: Call to peer ‘XYZ’ removed from call limit 2
Scheduling destruction of SIP dialog '25a6e3604896da0e5482a7565560ce3b@70.118.x.x’ in 18624 ms (Method: INVITE)
[Jul 21 11:07:15] DEBUG[23749]: chan_sip.c:5695 reqprep: Strict routing enforced for session 25a6e3604896da0e5482a7565560ce3b@70.118.x.x
set_destination: Parsing sip:XYZ@117.58.x.x:28614;rinstance=0266b8b94f488588 for address/port to send to
set_destination: set destination to 117.58.x.x, port 28614
Reliably Transmitting (NAT) to 117.58.x.x:28614:
BYE sip:XYZ@117.58.x.x:28614;rinstance=0266b8b94f488588 SIP/2.0
Via: SIP/2.0/UDP 70.118.x.x:5678;branch=z9hG4bK05cc42e6;rport
From: “caller coke” sip:17142545542@70.118.x.x:5678;tag=as12245807
To: sip:XYZ@117.58.x.x:28614;rinstance=0266b8b94f488588;tag=bd6f2350
Call-ID: 25a6e3604896da0e5482a7565560ce3b@70.118.x.x
CSeq: 103 BYE
User-Agent: Asterisk PBX
Max-Forwards: 70
Content-Length: 0

I assume that you have port forwarded the RTP ports specified in rtp.conf ??

I also assume you have set up the following in your sip.conf trunk registration:
nat=yes
qualify=yes
localnet=l.a.n.0/netmask
externip=1.2.3.4

Some routers can be a real “challenge” too. have you had a look if there are any SIP ALGs running ??

Does this help ??
Cheers
Chris

yes i have port forwarded enabled as it is properly working with normal dial (SIP/XYZ), but dialing (SIP/XYZ@IP:Port) causes one way audio. this is strange as what could go wrong when dialing with IP:Port?
also i have nat=yes and qualify=yes in sip.conf.
my asterisk server is on live ip. do i still need to use extern ip / localnet settings? I think these settings are used only if asterisk server is behind NAT? ( Although I tried with entern ip settings but still no good. )

caller’s voice reaches asterisk server but is not being transported from asterisk server to callee …

I will check SIP ALG asap.

regards,

Nasir Javaid

[quote=“nasirjavaid”]yes i have port forwarded enabled as it is properly working with normal dial (SIP/XYZ), but dialing (SIP/XYZ@IP:Port) causes one way audio. this is strange as what could go wrong when dialing with IP:Port?
also i have nat=yes and qualify=yes in sip.conf.
my asterisk server is on live ip. do i still need to use extern ip / localnet settings? I think these settings are used only if asterisk server is behind NAT? ( Although I tried with entern ip settings but still no good. )

caller’s voice reaches asterisk server but is not being transported from asterisk server to callee …

I will check SIP ALG asap.

regards,

Nasir Javaid[/quote]

the thing i found frustrating is that when dialing by Dial(SIP/XZY) asterisk somehow manages to get local ip address of the user from his public(router) ip and writes the INVITE as follows,

INVITE sip:XYZ@192.168.0.10:5678 SIP/2.0
Via: SIP/2.0/UDP 73.80.x.x:5678;branch=z9hG4bK2ad06410;rport
From: “Axvoice Inc.” sip:XYZ@my.ast-server.com;tag=as5b95280b
To: sip:XYZ@192.168.0.10:5678
Contact: sip:XYZ@73.80.x.x:5678
Call-ID: 527c646a234633ae5399e4ec21213917@my.ast-server.com
CSeq: 102 INVITE
User-Agent: Asterisk PBX
Max-Forwards: 70
Date: Thu, 29 Jul 2010 14:02:40 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY
Supported: replaces
Content-Type: application/sdp
Content-Length: 332

v=0
o=root 9602 9602 IN IP4 73.80.x.x
s=session
c=IN IP4 73.80.x.x
t=0 0
m=audio 11936 RTP/AVP 0 8 18 3 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=rtpmap:3 GSM/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=silenceSupp:off - - - -
a=ptime:20
a=sendrecv

while dialing by Dial(SIP/XYZ@116.17.x.x:5678) has following INVITE

INVITE sip:XYZ@116.17.x.x:5678 SIP/2.0
Via: SIP/2.0/UDP 73.80.x.x:5678;branch=z9hG4bK46b80856;rport
From: “Caller” sip:1234567890@73.80.x.x:5678;tag=as04d85047
To: sip:adf@116.17.x.x:5678
Contact: sip:1234567890@73.80.x.x:5678
Call-ID: 1f8ccd4b4d7df7ef3f24bdb16a6c7b8c@73.80.x.x
CSeq: 102 INVITE
User-Agent: Asterisk PBX
Max-Forwards: 70
Date: Thu, 29 Jul 2010 13:59:51 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY
Supported: replaces
Content-Type: application/sdp
Content-Length: 332

v=0
o=root 9602 9602 IN IP4 73.80.x.x
s=session
c=IN IP4 73.80.x.x
t=0 0
m=audio 12594 RTP/AVP 0 8 18 3 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=rtpmap:3 GSM/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=silenceSupp:off - - - -
a=ptime:20
a=sendrecv

how to change TO, CONTACT header values? which parameters affect these values?