Re: [SR-Users] remove_hf function in INVITE message

2018-08-20 Thread Daniel-Constantin Mierla
The message is broken indeed, at the part:

Max-Forwards: 69
   
sip:7000@192.168.122.1:36853;transport=UDP;alias=192.168.122.1~36853~1To:


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:8...@r-kh.com;transport=UDP SIP/2.0
> Record-Route: 
> 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@192.168.122.1:36853;transport=UDP;alias=192.168.122.1~36853~1To:
> 
> From: ;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
>  
> 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:$f...@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:$f...@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


___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] remove_hf function in INVITE message

2018-08-19 Thread Mojtaba
Hi again,
I used remove_hf_re and textop module ( subst('/re/repl/flags')) too,
like bellow:
   if(is_method("INVITE")){
   
subst('/^Cantact:(.*)$/Contact:sip:$f...@sbc.r-khorasan.tci.ir/ig');
   #or
   remove_hf("Contact");
   #or
   append_hf("Contact:sip:$f...@sbc.r-khorasan.tci.ir\r\n");
   }
But does not work, The "Bad Sip Request" is received.
On Sun, Aug 19, 2018 at 2:15 PM 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:8...@r-kh.com;transport=UDP SIP/2.0
> Record-Route: 
> 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@192.168.122.1:36853;transport=UDP;alias=192.168.122.1~36853~1To:
> 
> From: ;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
>  
> 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:$f...@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:$f...@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?
>
> --
> --Mojtaba Esfandiari.S



-- 
--Mojtaba Esfandiari.S

___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


[SR-Users] remove_hf function in INVITE message

2018-08-19 Thread Mojtaba
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:8...@r-kh.com;transport=UDP SIP/2.0
Record-Route: 
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@192.168.122.1:36853;transport=UDP;alias=192.168.122.1~36853~1To:

From: ;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
 
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:$f...@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:$f...@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?

-- 
--Mojtaba Esfandiari.S

___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users