Hi there,

I have done a few iterations of the above before, I assume you are just doing a simple B2BUA-like transaction here?

The main things to do that worked for me were:

Double RR params (with private first then public second - but I set these in my kemi python file after enabling double rr in the cfg) and a force send socket of your private address for signalling - https://www.kamailio.org/docs/modules/devel/modules/rr.html#rr.p.enable_double_rr/ https://www.kamailio.org/wiki/cookbooks/5.0.x/core#force_send_socket

The above makes sure the sending socket is the private and the signalling gets back to the box.

RTPengine manage flags for SDP - (direction=private direction=public) these needs to be in your RTPengine config as well the rtpengine_manage() block in your config - check the flags in rtpengine_offer() - https://www.kamailio.org/docs/modules/stable/modules/rtpengine.html#rtpengine.f.rtpengine_offer

I use the above when using textops to see if it has a: "has_body_type(application/sdp)" criteria, then check the source address to see if it is a private IP and if not it goes pub->pri - then an else statement to go pri->pub

That should get you there hopefully.

I will try dig out some code if you get stuck though it might take a while as it was ages ago.

Cheers,

John.

On Thu, 18 Jan 2024 at 22:58, Jere Cassidy via sr-users <sr-users@lists.kamailio.org> wrote:

Hello! 

Thanks in advance for any help you can provide.

I have a simple setup here and am struggling a bit with getting a final working solution.


This is just a single direction flow from a SIP provider inbound to servers running HMPelements with CTI integration (sip endpoint).  Essentially a different DN / dial number would go to a different backend server.  There is no registration involved.

The kamailio server therefore needs to sit between the SIP provider and the backend servers, it will be a NAT situation where private RFC1918 addresses will be used on the backend after the server receives it with public IP information.

So that's it.    What is the simplest way to accomplish this?


If it would help - here's what ive done so far:

For the Kamailio server, I have an AWS EC2 instance with a public IP bound/assigned to the main private IP.  During troubleshooting, I've added another private IP to the NIC so that I could throw up another listener.   I was thinking I'd need to accept the SIP on the first listener with the "advertise" directive.  The second listener would not have an advertise directive so perhaps could be used to talk to the backends. 

I defined the WITH NAT and rtp proxy settings (pointing to the first listener below).  The RTP Proxy daemon also knows about the y.y.y.y public address below.

In the kamailio.cfg, I have a listener setup :

listen=udp:172.24.40.28:5060 advertise y.y.y.y:5060
listen=udp:172.24.40.26:5060

then threw in a route(CMS)  in the request route and created the following route block:

route[CMS] {
        #check URI matches phone xxxxxxxxxx
        if (uri=~"^sip:\+1xxxxxxxxxx@") {
                rewritehostport("10.12.18.193:5060");
                forward(uri:host, uri:port);
                exit;
        };

}

I get the SIP delivered to the backend host!  but the INVITE headers are stil pointing to public IPs and the SDP info is not adjusted to be a private IP as well - as follows:
z.z.z.z = sip provider ,  y.y.y.y = public ip (aws ec2 ip). xxxxxxxxx = calling phone, ######## = called phone (matches routeCMS above)


INVITE sip:+1##########@10.12.18.193:5060 SIP/2.0
Record-Route: <sip:y.y.y.y;lr>
Via: SIP/2.0/UDP y.y.y.y:5060;branch=z9hG4bK28b7.56b42fdeec9f10cd13030b3711b16f4d.0
Via: SIP/2.0/UDP z.z.z.z:11000;received=z.z.z.z;rport=11000;branch=z9hG4bKQ2yQKgv7NtKQF
Max-Forwards: 48
From: "" <sip:+1xxxxxxxxxx@z.z.z.z;isup-oli=0>;tag=tUF15gaNg6N6j
To: <sip:+1##########@y.y.y.y>
Call-ID: 9ee7e073-c7fc-46ac-a839-f3c77eaed903
CSeq: 78244364 INVITE
Contact: <sip:mod_sofia@z.z.z.z:11000>
User-Agent: 2600Hz
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REFER, NOTIFY
Supported: path, replaces
Allow-Events: talk, hold, conference, refer
Privacy: none
Content-Type: application/sdp
Content-Disposition: session
Content-Length: 278
X-FS-Core-UUID: 4e0b2928-d913-42c4-9809-f77a36d281be
X-FS-Support: update_display,send_info
P-Asserted-Identity: "" <sip:+1xxxxxxxxx@z.z.z.z>

v=0
o=FreeSWITCH 1705572686 1705572687 IN IP4 z.z.z.z


Thanks much!





__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions
To unsubscribe send an email to sr-users-leave@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the sender!
Edit mailing list options or unsubscribe: