<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><meta http-equiv="Content-Type" content="text/html; charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><meta http-equiv="Content-Type" content="text/html; charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div dir="auto" style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><meta http-equiv="Content-Type" content="text/html; charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><meta http-equiv="Content-Type" content="text/html; charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><meta http-equiv="Content-Type" content="text/html; charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><meta http-equiv="Content-Type" content="text/html; charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hi Nick,<div class=""><br class=""></div><div class="">Yes, this is a very good use-case for Kamailio and hits squarely in the centre of its most canonical functionality.</div><div class=""><br class=""></div><div class="">You can easily rewrite the Request URI of an incoming INVITE by writing directly to the $rd “pseudovariable”. $rd represents the domain portion of the Request URI, and it is writable, unlike most variables which point to various parts of the SIP message buffer.</div><div class=""><br class=""></div><div class="">In effect, you would do:</div><div class=""><br class=""></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><font face="Andale Mono" class="">route {</font></blockquote><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><font face="Andale Mono" class="">   …</font></blockquote><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><font face="Andale Mono" class=""><br class=""></font></blockquote><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><font face="Andale Mono" class="">   # Some boilerplate stuff.</font></blockquote><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><font face="Andale Mono" class=""><br class=""></font></blockquote><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><font face="Andale Mono" class="">   …</font></blockquote><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><font face="Andale Mono" class=""><br class=""></font></blockquote><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><font face="Andale Mono" class="">   # Some access control stuff to see if INVITE</font></blockquote><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><font face="Andale Mono" class="">   # is coming from a trusted place.</font></blockquote><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><font face="Andale Mono" class=""><br class=""></font></blockquote><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><font face="Andale Mono" class="">   if(!invite_is_allowed_so_to_speak()) {</font></blockquote><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><font face="Andale Mono" class="">      sl_send_reply(“403”, “Forbidden”);</font></blockquote><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><font face="Andale Mono" class="">      exit;</font></blockquote><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><font face="Andale Mono" class="">   }</font></blockquote><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><font face="Andale Mono" class=""><br class=""></font></blockquote><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><font face="Andale Mono" class="">   if(is_method(“INVITE”)) {</font></blockquote><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><font face="Andale Mono" class="">      # Somehow determine what FQDN to use for</font></blockquote><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><font face="Andale Mono" class="">      # the RURI domain, based on a database </font></blockquote><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><font face="Andale Mono" class="">      # lookup, hard-coded, whatever.</font></blockquote><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><font face="Andale Mono" class=""><br class=""></font></blockquote><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><font face="Andale Mono" class="">      $rd = ‘<a href="http://example-setup.sip.twilio.com/" class="">example-setup.sip.twilio.com</a>’;</font></blockquote><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><font face="Andale Mono" class=""><br class=""></font></blockquote><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><font face="Andale Mono" class="">      if(!t_relay()) </font></blockquote><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><font face="Andale Mono" class="">         sl_reply_error();</font></blockquote><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><font face="Andale Mono" class="">      </font></blockquote><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><font face="Andale Mono" class="">      Exit;</font></blockquote><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><font face="Andale Mono" class="">    }</font></blockquote><div class=""><br class=""></div><div class="">You should be able to modify the stock Kamailio config included with the package to do this fairly easily, and I’m sure folks on the mailing list will be supportive of further questions. :-)</div><div class=""><br class=""></div><div class="">Good luck!</div><div class=""><br class=""></div><div class="">— Alex</div><div class=""><br class=""><div class="">-- <br class="">Alex Balashov | Principal | Evariste Systems LLC<br class=""><br class="">Tel: +1-706-510-6800 / +1-800-250-5920 (toll-free)<br class="">Web: <a href="http://www.evaristesys.com/" class="">http://www.evaristesys.com/</a>, <a href="http://www.csrpswitch.com/" class="">http://www.csrpswitch.com/</a><br class=""></div><br class=""><blockquote type="cite" class="">On Jul 21, 2021, at 9:20 PM, Nick Hurlburt <<a href="mailto:nick@techmatters.org" class="">nick@techmatters.org</a>> wrote:<br class=""><br class="">Hello all,<br class=""> <br class="">My name is Nick Hurlburt, and work with a nonprofit tech organization that provides a software platform for child helplines around the world.  I am a new user to Kamailio, and I'm interested in figuring out if my use case is appropriate, getting some tips on how to go about it, and possibly enlisting some expert help.<br class=""> <br class="">Our service is built on top of Twilio, but we are working in some countries where Twilio doesn't have phone numbers.  So in those areas, we are working with local telecoms on ways to integrate using a SIP connection.  In one particular example, the telecom company can send SIP INVITEs but can only address them to a static IP.  However, Twilio needs to receive the invite addressed to a fully-qualified domain name (eg, <a href="http://example-setup.sip.twilio.com/" class="">example-setup.sip.twilio.com</a>).  The idea arose to use Kamailio as a proxy to accept the static IP-addressed request and then rewrite the request to pass it along to a domain name.  Then once the connection is established between the two endpoints, the media can flow directly between them.<br class=""> <br class="">I have a software engineering background but still coming up to speed when it comes to VoIP technology.  I'd be interested in:<br class="">- does this sound like a good use case for Kamailio?<br class="">- is there any specific documentation you could point me to for this use case?  (I have been looking at the Kamailio documentation, but a quick pointer could save a lot of time in digging through it)<br class="">- if anyone from the community would be open to helping us develop a prototype/proof-of-concept instance of this, especially if you're open to contributing to a nonprofit on a volunteer or discounted rate, I'd love to talk more<br class=""> <br class="">Thank you,<br class="">Nick<br class=""> <br class="">__________________________________________________________<br class="">Kamailio - Users Mailing List - Non Commercial Discussions<br class=""> * <a href="mailto:sr-users@lists.kamailio.org" class="">sr-users@lists.kamailio.org</a><br class="">Important: keep the mailing list in the recipients, do not reply only to the sender!<br class="">Edit mailing list options or unsubscribe:<br class=""> * <a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" class="">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a><br class=""></blockquote><br class=""></div></div></div></div></div></div></div></div></div></body></html>