[SR-Users] Translate calling/called party based on username to telephone number base id.

Helena Garcia-Nieto helena.gnieto at morodo.co.uk
Tue Apr 22 17:33:12 CEST 2014

Hi all.


I want to thank you all for the great info and help that you provide in this
mailing list. I am just starting to work with kamailio and still learning.


I would like some help to point me on the right direction on our new


We have a kamailio server acting basically as location server and call
proxy. We are connected to a PSTN gw to reach the outside world. It is
working fine but now the client requested some changes that may imply we
work with username base subscribers (user1. Characters based) at kamailio
side but we still need to convert these usernames to numbers when sending
the call to the PSTN gw. Username-number should be fix and can be stored in
a table on the db.


We would need to lookup userpart of all the header (from, to, contact.) and
substitute incoming username with the peer number for calls from the app to
pstn. And translate numbers to usernames on the calls from pstn to the apps.


I am reading uac module  and the sqlops module to search in the db before
the substitution but I am not sure if that is the best approach to the


Could anyone point me in the right direction or suggest a  better way to do
that? Have anyone already implemented this type of modifications? I am a bit
worried for the dialog consistency although I've read the uac module should
take care of it


Thanks in advanced



From: Helena Garcia-Nieto [mailto:helena.gnieto at morodo.co.uk] 
Sent: martes, 10 de diciembre de 2013 16:19
To: 'Kamailio (SER) - Users Mailing List'
Cc: helena.gnieto at morodo.co.uk
Subject: 500 I'm terribly sorry error





Thanks in advanced for the help. I am almost new with kamailio and still
struggling through silly problems so please forgive me if the solution is so


I have a network like


Xlitle -- Kamailio -- GW


The GW is more or less out of my reach for changing the behaivour.

As devices I have xlitle


Kamailio is on version 4.0.2


I've changed only few things from the default config file. Add mysql
support, auth, userlocdb, pstngw.


For this part, gw routing , I've defined gw ip and port inside the PSTN
definition like:

#!ifdef WITH_PSTN

# PSTN GW Routing


# - pstn.gw_ip: valid IP or hostname as string value, example:

# pstn.gw_ip = "" desc "My PSTN GW Address"


# - by default is empty to avoid misrouting

pstn.gw_ip = "" desc "PSTN GW Address"

pstn.gw_port = "" desc "PSTN GW Port"



iskratel.gw_ip = "10.XX.XX.XX"

iskratel.gw_port = "5060"




I route the calls with:



And defined a routing function

route[ISKRATEL] {

#!ifdef WITH_PSTN

        # check if ISKRATEL GW IP is defined

        if (strempty($sel(cfg_get.iskratel.gw_ip))) {

                xlog("SCRIPT: PSTN rotuing enabled but iskratel.gw_ip not





        # only local users allowed to call

        if(from_uri!=myself) {

                sl_send_reply("403", "Not Allowed");




        if (strempty($sel(cfg_get.iskratel.gw_port))) {

                $ru = "sip:" + $rU + "@" + $sel(cfg_get.iskratel.gw_ip);

       } else {

                $ru = "sip:" + $rU + "@" + $sel(cfg_get.iskratel.gw_ip) +

                                        + $sel(cfg_get.iskratel.gw_port);





        # Add profix to ISKRATEL: A99901

        subst_uri('/^sip:(.*)/sip:A99901\1/i'); # add A99901










I can see that the code goes all the way to the route(relay) but all I can
see is the 500 I'm terribly sorry, server error occurred (7/SL) and a second
response 500 I'm terribly sorry, server error occurred (7/TM)


I've tried defining the IP as the given pstn.gw_ip and route(pstn) without
changing anything on the  pst default routing but the response of the server
is the same.


I cannot see any special error on the logs.


I have the exact same config for this part, in another test server and the
calls go to the gw without reporting any error.


I'll appreciate any help from you! Thanks in advanced for your time



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

More information about the sr-users mailing list