<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
<html><body>
<p>Dear All!</p>
<p>I need to replace Contact header receiving from UAC to new one.</p>
<p>I have strange problem with all Yealink phones.</p>
<p>When I use remove_hf/insert_hf in onreply route opensips didn't proper strip header.</p>
<p>My config:</p>
<pre>onreply_route[1]<br />{</pre>
<pre> if(is_present_hf("Contact"))<br /> {<br /> if(remove_hf("Contact"))<br /> {<br /> insert_hf("Contact: <sip:$tU@$si:$sp>\r\n", "From");<br /> }<br /> else<br /> {<br /> 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");<br /> }<br /> }</pre>
<pre>}</pre>
<pre> </pre>
<pre>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"</pre>
<pre> </pre>
<pre>SIP/2.0 200 OK<br />Via: SIP/2.0/TCP SIP-UPLINK-GW-IP:5092;received=SIP-UPLINK-GW-IP;branch=z9hG4bK-d8754z-cf461413f8f8b92e-1---d8754z-;rport=35007<br />Record-Route: <sip:username@OPENSIPS-WAN-IP;r2=on;lr;ftag=ff571748;nat=yes><br />Record-Route: <sip:username@OPENSIPS-LAN-IP;transport=tcp;r2=on;lr;ftag=ff571748;nat=yes><br />Contact: <sip:username@UAC-WAN-IP:1197><br />From: "1234567" <sip:1234567@OPENSIPS-LAN-IP:5092>;tag=ff571748<br />To: <sip:username@domain.com>;tag=193729847<br />Call-ID: NzkxZjNjNzUxNjVhMGZkMjZkZDY5M2RkNTk2NWE1ODU.<br />CSeq: 1 INVITE<br />sip:username@UAC-WAN-IP:1197Content-Type: application/sdp<br />Allow: INVITE, INFO, PRACK, ACK, BYE, CANCEL, OPTIONS, NOTIFY, REGISTER, SUBSCRIBE, REFER, PUBLISH, UPDATE, MESSAGE<br />User-Agent: Yealink SIP-T20P 9.60.14.8<br />Content-Length: 203<br /><br />v=0<br />o=- 20000 20000 IN IP4 UAC-LAN-IP<br />s=SDP data<br />c=IN IP4 192.168.30.4<br />t=0 0<br />m=audio 17264 RTP/AVP 8 96<br />a=rtpmap:8 PCMA/8000<br />a=fmtp:96 0-15<br />a=rtpmap:96 telephone-event/8000<br />a=sdpmangled:yes</pre>
<pre> </pre>
<pre>Trace without Contact manipulations:</pre>
<pre> </pre>
<pre>SIP/2.0 200 OK<br />Via: SIP/2.0/TCP SIP-UPLINK-GW-IP:5092;received=SIP-UPLINK-GW-IP;branch=z9hG4bK-d8754z-37e3024aff94374c-1---d8754z-;rport=35030<br />Record-Route: <sip:username@OPENSIPS-WAN-IP;r2=on;lr;ftag=71ab6c06;nat=yes><br />Record-Route: <sip:username@OPENSIPS-LAN-IP;transport=tcp;r2=on;lr;ftag=71ab6c06;nat=yes><br />From: "1234567" <sip:1234567@OPENSIPS-LAN-IP:5092>;tag=71ab6c06<br />To: <sip:username@domain.com>;tag=1956700973<br />Call-ID: NzliOWI0OTAzYjk0NmIwZDM4ZWFkZDI4Yjg5NWUxNjQ.<br />CSeq: 1 INVITE<br />Contact: <sip:username@UAC-WAN-IP:1197><br />Content-Type: application/sdp<br />Allow: INVITE, INFO, PRACK, ACK, BYE, CANCEL, OPTIONS, NOTIFY, REGISTER, SUBSCRIBE, REFER, PUBLISH, UPDATE, MESSAGE<br />User-Agent: Yealink SIP-T20P 9.60.14.8<br />Content-Length: 203<br /><br />v=0<br />o=- 20001 20001 IN IP4 UAC-LAN-IP<br />s=SDP data<br />c=IN IP4 192.168.30.4<br />t=0 0<br />m=audio 17188 RTP/AVP 8 96<br />a=rtpmap:8 PCMA/8000<br />a=fmtp:96 0-15<br />a=rtpmap:96 telephone-event/8000<br />a=sdpmangled:yes</pre>
<pre> </pre>
<pre>Please help.</pre>
<pre>Thanks in advance!</pre>
<div> </div>
</body></html>