Discussion:
[SR-Users] To Rewrite SDP when request goes from kamailio to outside network
Anurag Mishra
2014-07-14 11:27:13 UTC
Permalink
Hi All,

I have been struggling with this issue for a long and could not find a way
to solve it. I have setup FreeSWITCH and Kamailio on the single server but
on a private server with a private IP and fronted by firewall. Firewall has
all the ports opened.

FreeSWITCH is running with nonat. Kamailio has public IP advertised on port
5060 and private IP on 5070 for phones on LAN. Problem is with outbound
calls there is no audio and reason I can see is contact field in SDP has
the private IP of the server instead of the public IP.

Internal device to device calls is working fine. I have tried to rewrite
the SDP and have written below code, but got no success:

request_route
{
xlog("L_DBG", "Request Route Enter");
if (is_method("INVITE"))
{
xlog("L_DBG", "Request Route Enter in Invite");
if (has_body("application/sdp"))
{
xlog("L_DBG", "Request Route Enter in SDP of
Invite");
if (search("IN IP4 PRIVATE_IP"))
{
xlog("L_DBG", "Request Route Search IN IP4
PRIVATE_IP");
fix_nated_sdp("8", "PUBLIC_IP");
fix_nated_sdp("2", "PUBLIC_IP");
}
}
}
}
Can anyone help me to get rid of this.

Thanks,
Anurag Mishra
Daniel-Constantin Mierla
2014-07-14 12:37:01 UTC
Permalink
Hello,

you should use search_body(...) from textops module for searching the
private IP in the body.

Cheers,
Daniel
Post by Anurag Mishra
Hi All,
I have been struggling with this issue for a long and could not find a
way to solve it. I have setup FreeSWITCH and Kamailio on the single
server but on a private server with a private IP and fronted by
firewall. Firewall has all the ports opened.
FreeSWITCH is running with nonat. Kamailio has public IP advertised on
port 5060 and private IP on 5070 for phones on LAN. Problem is with
outbound calls there is no audio and reason I can see is contact field
in SDP has the private IP of the server instead of the public IP.
Internal device to device calls is working fine. I have tried to
request_route
{
xlog("L_DBG", "Request Route Enter");
if (is_method("INVITE"))
{
xlog("L_DBG", "Request Route Enter in Invite");
if (has_body("application/sdp"))
{
xlog("L_DBG", "Request Route Enter in SDP
of Invite");
if (search("IN IP4 PRIVATE_IP"))
{
xlog("L_DBG", "Request Route
Search IN IP4 PRIVATE_IP");
fix_nated_sdp("8", "PUBLIC_IP");
fix_nated_sdp("2", "PUBLIC_IP");
}
}
}
}
Can anyone help me to get rid of this.
Thanks,
Anurag Mishra
_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
--
Daniel-Constantin Mierla - http://www.asipto.com
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Loading...