Hi Nick,
Yes, this is a very good use-case for Kamailio and hits squarely in the centre of its most
canonical functionality.
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.
In effect, you would do:
route {
…
# Some boilerplate stuff.
…
# Some access control stuff to see if INVITE
# is coming from a trusted place.
if(!invite_is_allowed_so_to_speak()) {
sl_send_reply(“403”, “Forbidden”);
exit;
}
if(is_method(“INVITE”)) {
# Somehow determine what FQDN to use for
# the RURI domain, based on a database
# lookup, hard-coded, whatever.
$rd = ‘example-setup.sip.twilio.com <http://example-setup.sip.twilio.com/>’;
if(!t_relay())
sl_reply_error();
Exit;
}
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. :-)
Good luck!
— Alex
--
Alex Balashov | Principal | Evariste Systems LLC
Tel: +1-706-510-6800 / +1-800-250-5920 (toll-free)
Web:
http://www.evaristesys.com/ <http://www.evaristesys.com/>,
http://www.csrpswitch.com/ <http://www.csrpswitch.com/>
On Jul 21, 2021, at 9:20 PM, Nick Hurlburt
<nick(a)techmatters.org <mailto:nick@techmatters.org>> wrote:
Hello all,
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.
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,
example-setup.sip.twilio.com <http://example-setup.sip.twilio.com/>). 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.
I have a software engineering background but still coming up to speed when it comes to
VoIP technology. I'd be interested in:
- does this sound like a good use case for Kamailio?
- 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)
- 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
Thank you,
Nick
__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions
* sr-users(a)lists.kamailio.org <mailto:sr-users@lists.kamailio.org>
Important: keep the mailing list in the recipients, do not reply only to the sender!
Edit mailing list options or unsubscribe:
*
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
<https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users>