[SR-Users] remove_hf function in INVITE message

Daniel-Constantin Mierla miconda at gmail.com
Mon Aug 20 10:11:17 CEST 2018


The message is broken indeed, at the part:

Max-Forwards: 69
   
sip:7000 at 192.168.122.1:36853;transport=UDP;alias=192.168.122.1~36853~1To:
<sip:8000 at r-kh.com;transport=UDP>

Likely that is because you do couple of operations over the Contact
header, besides remove_hf()/append_hf(), you use also
set_contact_alias() or add_contact_alias(). You can do
msg_apply_changes() in between such operations to avoid breaking the sip
message.

Cheers,
Daniel


On 19.08.18 11:45, Mojtaba wrote:
> Today i encounter with strange issue in SIP signalling in Kamailio,
> In INVITE message, I just change Contact Header and relay message to
> destination, But the message is like this:
> 192.168.122.245.4080 > 192.168.122.174.5060: [bad udp cksum 0x7b5e ->
> 0x3a4d!] SIP, length: 1104
>     INVITE sip:8000 at r-kh.com;transport=UDP SIP/2.0
>     Record-Route: <sip:192.168.122.245:4080;lr;ftag=8e47e95e;nat=yes>
>     Via: SIP/2.0/UDP
> 192.168.122.245:4080;branch=z9hG4bK14d7.dc974309aba269b24213204d3ea085e2.0
>     Via: SIP/2.0/UDP
> 192.168.122.1:36853;rport=36853;branch=z9hG4bK-d8754z-423b431a3ebc8a22-1---d8754z-
>     Max-Forwards: 69
>     sip:7000 at 192.168.122.1:36853;transport=UDP;alias=192.168.122.1~36853~1To:
> <sip:8000 at r-kh.com;transport=UDP>
>     From: <sip:7000 at r-kh.com;transport=UDP>;tag=8e47e95e
>     Call-ID: YTZmYTJmYzg0ZDNiMjM2OGUxZGYwNzg4OWY1ZmIxYzc.
>     CSeq: 1 INVITE
>     Allow: INVITE, ACK, CANCEL, BYE, NOTIFY, REFER, MESSAGE, OPTIONS,
> INFO, SUBSCRIBE
>     Content-Type: application/sdp
>     Supported: replaces, norefersub, extended-refer, timer, X-cisco-serviceuri
>     User-Agent: Z 3.3.25608 r25552
>     Allow-Events: presence, kpml
>     Content-Length: 241
>      <SDP Body>
> The code in Kamailio is:
>
> #!ifdef WITH_SBC_NASIM
>         #if the Invite request is MO, forward it to Asterisk .
>         if (is_method("INVITE") && $si!="192.168.122.245") {
>                 xlog("L_INFO", "The Invite message from $si:$sp,
> Forwart to Asterisk.  <192.168.122.174:5060>.\n");
>                 remove_hf("Contact");
>                 append_hf("Contact:sip:$fU at sbc.r-kh.com\r\n");
>                 $du = "sip:192.168.122.174:5060";
>         }
> #!endif
>
> Be notice that, i have the same procedure in REGISTER message, But it
> is work correct,
>         if(is_method("REGISTER")) {
>                 xlog("L_INFO", "forward register to Asterisk\n");
>                 remove_hf("Contact");
>                 append_hf("Contact:sip:$fU at sbc.r-kh.com\r\n");
>                 rewriteuri("sip:r-kh.com");
>                 $du = "sip:192.168.122.174:5060";
>                 route(RELAY);
>         }
>
> Let me know what is the problem?
>

-- 
Daniel-Constantin Mierla -- www.asipto.com
www.twitter.com/miconda -- www.linkedin.com/in/miconda
Kamailio World Conference -- www.kamailioworld.com




More information about the sr-users mailing list