Using remove_hf/insert_hf leads to garbage in SIP message

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Using remove_hf/insert_hf leads to garbage in SIP message

nick

Dear All!

I need to replace Contact header receiving from UAC to new one.

I have strange problem with all Yealink phones.

When I use remove_hf/insert_hf in onreply route opensips didn't proper strip header.

My config:

onreply_route[1]
{
                if(is_present_hf("Contact"))
{
if(remove_hf("Contact"))
{
insert_hf("Contact: <sip:$tU@$si:$sp>\r\n", "From");
}
else
{
xlog("L_ERR", "Error removing Contact header: M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci UA=$ua CT=$ct TO=$tU\n");
}
}
}
 
As you can see from trace below opensips proper remove Contact header, but leave "sip:username@UAC-WAN-IP:1197" before "Content-Type: application/sdp"
 
SIP/2.0 200 OK
Via: SIP/2.0/TCP SIP-UPLINK-GW-IP:5092;received=SIP-UPLINK-GW-IP;branch=z9hG4bK-d8754z-cf461413f8f8b92e-1---d8754z-;rport=35007
Record-Route: <sip:username@OPENSIPS-WAN-IP;r2=on;lr;ftag=ff571748;nat=yes>
Record-Route: <sip:username@OPENSIPS-LAN-IP;transport=tcp;r2=on;lr;ftag=ff571748;nat=yes>
Contact: <sip:username@UAC-WAN-IP:1197>
From: "1234567" <sip:1234567@OPENSIPS-LAN-IP:5092>;tag=ff571748
To: <sip:[hidden email]>;tag=193729847
Call-ID: NzkxZjNjNzUxNjVhMGZkMjZkZDY5M2RkNTk2NWE1ODU.
CSeq: 1 INVITE
sip:username@UAC-WAN-IP:1197Content-Type: application/sdp
Allow: INVITE, INFO, PRACK, ACK, BYE, CANCEL, OPTIONS, NOTIFY, REGISTER, SUBSCRIBE, REFER, PUBLISH, UPDATE, MESSAGE
User-Agent: Yealink SIP-T20P 9.60.14.8
Content-Length: 203

v=0
o=- 20000 20000 IN IP4 UAC-LAN-IP
s=SDP data
c=IN IP4 192.168.30.4
t=0 0
m=audio 17264 RTP/AVP 8 96
a=rtpmap:8 PCMA/8000
a=fmtp:96 0-15
a=rtpmap:96 telephone-event/8000
a=sdpmangled:yes
 
Trace without Contact manipulations:
 
SIP/2.0 200 OK
Via: SIP/2.0/TCP SIP-UPLINK-GW-IP:5092;received=SIP-UPLINK-GW-IP;branch=z9hG4bK-d8754z-37e3024aff94374c-1---d8754z-;rport=35030
Record-Route: <sip:username@OPENSIPS-WAN-IP;r2=on;lr;ftag=71ab6c06;nat=yes>
Record-Route: <sip:username@OPENSIPS-LAN-IP;transport=tcp;r2=on;lr;ftag=71ab6c06;nat=yes>
From: "1234567" <sip:1234567@OPENSIPS-LAN-IP:5092>;tag=71ab6c06
To: <sip:[hidden email]>;tag=1956700973
Call-ID: NzliOWI0OTAzYjk0NmIwZDM4ZWFkZDI4Yjg5NWUxNjQ.
CSeq: 1 INVITE
Contact: <sip:username@UAC-WAN-IP:1197>
Content-Type: application/sdp
Allow: INVITE, INFO, PRACK, ACK, BYE, CANCEL, OPTIONS, NOTIFY, REGISTER, SUBSCRIBE, REFER, PUBLISH, UPDATE, MESSAGE
User-Agent: Yealink SIP-T20P 9.60.14.8
Content-Length: 203

v=0
o=- 20001 20001 IN IP4 UAC-LAN-IP
s=SDP data
c=IN IP4 192.168.30.4
t=0 0
m=audio 17188 RTP/AVP 8 96
a=rtpmap:8 PCMA/8000
a=fmtp:96 0-15
a=rtpmap:96 telephone-event/8000
a=sdpmangled:yes
 
Please help.
Thanks in advance!
 

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Using remove_hf/insert_hf leads to garbage in SIP message

nick
Forgot to add, that problem exists on opensips rev 7915 and latest
opensips rev 8151 from trunk.
OS: CentOS 5.6 x86_64
Hope that's help.

On Mon, 11 Jul 2011 17:41:02 +0400, [hidden email] wrote:

> Dear All!
>
> I need to replace Contact header receiving from UAC to new one.
>
> I have strange problem with all Yealink phones.
>
> When I use remove_hf/insert_hf in onreply route opensips didn't
> proper
> strip header.
>
> My config:
>
> onreply_route[1]
> {
>
> if(is_present_hf("Contact"))
> {
> if(remove_hf("Contact"))
> {
> insert_hf("Contact: rn", "From");
> }
> else
> {
> xlog("L_ERR", "Error removing Contact header: M=$rm RURI=$ru F=$fu
> T=$tu
> IP=$si ID=$ci UA=$ua CT=$ct TO=$tUn");
> }
> }
>
> }
>
> As you can see from trace below opensips proper remove Contact
> header,
> but leave "sip:username@UAC-WAN-IP:1197" before "Content-Type:
> application/sdp"
>
> SIP/2.0 200 OK
> Via: SIP/2.0/TCP
>
SIP-UPLINK-GW-IP:5092;received=SIP-UPLINK-GW-IP;branch=z9hG4bK-d8754z-cf461413f8f8b92e-1---d8754z-;rport=35007

> Record-Route:
> Record-Route:
> Contact:
> From: "1234567" ;tag=ff571748
> To: ;tag=193729847
> Call-ID: NzkxZjNjNzUxNjVhMGZkMjZkZDY5M2RkNTk2NWE1ODU.
> CSeq: 1 INVITE
> sip:username@UAC-WAN-IP:1197Content-Type: application/sdp
> Allow: INVITE, INFO, PRACK, ACK, BYE, CANCEL, OPTIONS, NOTIFY,
> REGISTER,
> SUBSCRIBE, REFER, PUBLISH, UPDATE, MESSAGE
> User-Agent: Yealink SIP-T20P 9.60.14.8
> Content-Length: 203
>
> v=0
> o=- 20000 20000 IN IP4 UAC-LAN-IP
> s=SDP data
> c=IN IP4 192.168.30.4
> t=0 0
> m=audio 17264 RTP/AVP 8 96
> a=rtpmap:8 PCMA/8000
> a=fmtp:96 0-15
> a=rtpmap:96 telephone-event/8000
> a=sdpmangled:yes
>
> Trace without Contact manipulations:
>
> SIP/2.0 200 OK
> Via: SIP/2.0/TCP
>
SIP-UPLINK-GW-IP:5092;received=SIP-UPLINK-GW-IP;branch=z9hG4bK-d8754z-37e3024aff94374c-1---d8754z-;rport=35030

> Record-Route:
> Record-Route:
> From: "1234567" ;tag=71ab6c06
> To: ;tag=1956700973
> Call-ID: NzliOWI0OTAzYjk0NmIwZDM4ZWFkZDI4Yjg5NWUxNjQ.
> CSeq: 1 INVITE
> Contact:
> Content-Type: application/sdp
> Allow: INVITE, INFO, PRACK, ACK, BYE, CANCEL, OPTIONS, NOTIFY,
> REGISTER,
> SUBSCRIBE, REFER, PUBLISH, UPDATE, MESSAGE
> User-Agent: Yealink SIP-T20P 9.60.14.8
> Content-Length: 203
>
> v=0
> o=- 20001 20001 IN IP4 UAC-LAN-IP
> s=SDP data
> c=IN IP4 192.168.30.4
> t=0 0
> m=audio 17188 RTP/AVP 8 96
> a=rtpmap:8 PCMA/8000
> a=fmtp:96 0-15
> a=rtpmap:96 telephone-event/8000
> a=sdpmangled:yes
>
> Please help.
>
> Thanks in advance!

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Using remove_hf/insert_hf leads to garbage in SIP message

Max Mühlbronner
Hi,


quick guess, dont know why, but could it be related to "insert_hf"?
I always used "append_hf" which adds the header after the last header
field. I never tried insert_hf, append_hf worked fine for me.


BR


Max M.


Am 11.07.2011 15:47, schrieb [hidden email]:

> Forgot to add, that problem exists on opensips rev 7915 and latest
> opensips rev 8151 from trunk.
> OS: CentOS 5.6 x86_64
> Hope that's help.
>
> On Mon, 11 Jul 2011 17:41:02 +0400, [hidden email] wrote:
>
>> Dear All!
>>
>> I need to replace Contact header receiving from UAC to new one.
>>
>> I have strange problem with all Yealink phones.
>>
>> When I use remove_hf/insert_hf in onreply route opensips didn't proper
>> strip header.
>>
>> My config:
>>
>> onreply_route[1]
>> {
>>
>> if(is_present_hf("Contact"))
>> {
>> if(remove_hf("Contact"))
>> {
>> insert_hf("Contact: rn", "From");
>> }
>> else
>> {
>> xlog("L_ERR", "Error removing Contact header: M=$rm RURI=$ru F=$fu T=$tu
>> IP=$si ID=$ci UA=$ua CT=$ct TO=$tUn");
>> }
>> }
>>
>> }
>>
>> As you can see from trace below opensips proper remove Contact header,
>> but leave "sip:username@UAC-WAN-IP:1197" before "Content-Type:
>> application/sdp"
>>
>> SIP/2.0 200 OK
>> Via: SIP/2.0/TCP
>>
> SIP-UPLINK-GW-IP:5092;received=SIP-UPLINK-GW-IP;branch=z9hG4bK-d8754z-cf461413f8f8b92e-1---d8754z-;rport=35007
>
>> Record-Route:
>> Record-Route:
>> Contact:
>> From: "1234567" ;tag=ff571748
>> To: ;tag=193729847
>> Call-ID: NzkxZjNjNzUxNjVhMGZkMjZkZDY5M2RkNTk2NWE1ODU.
>> CSeq: 1 INVITE
>> sip:username@UAC-WAN-IP:1197Content-Type: application/sdp
>> Allow: INVITE, INFO, PRACK, ACK, BYE, CANCEL, OPTIONS, NOTIFY, REGISTER,
>> SUBSCRIBE, REFER, PUBLISH, UPDATE, MESSAGE
>> User-Agent: Yealink SIP-T20P 9.60.14.8
>> Content-Length: 203
>>
>> v=0
>> o=- 20000 20000 IN IP4 UAC-LAN-IP
>> s=SDP data
>> c=IN IP4 192.168.30.4
>> t=0 0
>> m=audio 17264 RTP/AVP 8 96
>> a=rtpmap:8 PCMA/8000
>> a=fmtp:96 0-15
>> a=rtpmap:96 telephone-event/8000
>> a=sdpmangled:yes
>>
>> Trace without Contact manipulations:
>>
>> SIP/2.0 200 OK
>> Via: SIP/2.0/TCP
>>
> SIP-UPLINK-GW-IP:5092;received=SIP-UPLINK-GW-IP;branch=z9hG4bK-d8754z-37e3024aff94374c-1---d8754z-;rport=35030
>
>> Record-Route:
>> Record-Route:
>> From: "1234567" ;tag=71ab6c06
>> To: ;tag=1956700973
>> Call-ID: NzliOWI0OTAzYjk0NmIwZDM4ZWFkZDI4Yjg5NWUxNjQ.
>> CSeq: 1 INVITE
>> Contact:
>> Content-Type: application/sdp
>> Allow: INVITE, INFO, PRACK, ACK, BYE, CANCEL, OPTIONS, NOTIFY, REGISTER,
>> SUBSCRIBE, REFER, PUBLISH, UPDATE, MESSAGE
>> User-Agent: Yealink SIP-T20P 9.60.14.8
>> Content-Length: 203
>>
>> v=0
>> o=- 20001 20001 IN IP4 UAC-LAN-IP
>> s=SDP data
>> c=IN IP4 192.168.30.4
>> t=0 0
>> m=audio 17188 RTP/AVP 8 96
>> a=rtpmap:8 PCMA/8000
>> a=fmtp:96 0-15
>> a=rtpmap:96 telephone-event/8000
>> a=sdpmangled:yes
>>
>> Please help.
>>
>> Thanks in advance!
>
> _______________________________________________
> Users mailing list
> [hidden email]
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users