[SR-Users] Kamailio/How to send all requests ?

Phil Lavin phil.lavin at synety.com
Mon Feb 1 14:40:42 CET 2016

If indeed you mean ALL traffic, including traffic that Kamailio itself can route internally:

Add something to the LOCATION route to only allow usrloc based routing from the media server. In my case, I have added this at the top:

# Only do this for things authorized by IP
# UAs need to go via billing platform
if (!allow_source_address()) {

Create a new route that is called at the end of your main route with something like the following:

# Routing to Billing
route[BILLING] {
        # only local users allowed to call
        if (from_uri!=myself) {
                sl_send_reply("403", "Not Allowed");

        $ru = "sip:" + $rU + "@");


In essence, block all but allowed IPs (your media gateway IPs should be allowed) from routing via usrloc and change the request URI to route all traffic via the media gateway IP (

From: sr-users [mailto:sr-users-bounces at lists.sip-router.org] On Behalf Of alexandre.anconetti at orange.com
Sent: 01 February 2016 13:24
To: sr-users at lists.sip-router.org
Subject: [SR-Users] Kamailio/How to send all requests ?

Hello !
I'm using Kamailio for 2 months, and I have a problem with the routing logic.
My aim is to use 2 Kamailio servers (in a cluster, so I have a primary and a backup server with a Virtual IP that can switch between the 2 servers) working with 2 medias servers (same as above, a primary and a backup). The Kamailio servers are here to handle failover, so all the requests go through them, and then are sent to the active media server.
My question is : Which module(s) should I load to transmit all the requests (including registers) to my media server, through the Kamailio server ? Any particular parameters ? Then, what will be in the "request_route" ?
I'm using Kamailio 4.3.4.
Best regards,


Ce message et ses pieces jointes peuvent contenir des informations confidentielles ou privilegiees et ne doivent donc

pas etre diffuses, exploites ou copies sans autorisation. Si vous avez recu ce message par erreur, veuillez le signaler

a l'expediteur et le detruire ainsi que les pieces jointes. Les messages electroniques etant susceptibles d'alteration,

Orange decline toute responsabilite si ce message a ete altere, deforme ou falsifie. Merci.

This message and its attachments may contain confidential or privileged information that may be protected by law;

they should not be distributed, used or copied without authorisation.

If you have received this email in error, please notify the sender and delete this message and its attachments.

As emails may be altered, Orange is not liable for messages that have been modified, changed or falsified.

Thank you.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20160201/cab7cad1/attachment.html>

More information about the sr-users mailing list