Hi,

I am trying to route some SIP calls to my gateway but I get the following error:

 

0(17329) lookup(): '0033146' Not found in usrloc

 

Bellow is my config, any thoughts?

 

Thanks,

Hamid

 

 

 

 

# ----------- global configuration parameters ------------------------

 

debug=8            # debug level (cmd line: -dddddddddd)

fork=no

log_stderror=yes    # (cmd line: -E)

 

#/*

fork=no

log_stderror=yes

#*/

check_via=no    # (cmd. line: -v)

dns=no          # (cmd. line: -r)

rev_dns=no      # (cmd. line: -R)

port=5060

children=4

fifo="/tmp/openser_fifo"

listen = udp:10.20.20.18:5060

alias="mytestdomain.com"

 

#

# uncomment the following lines for TLS support

#disable_tls = 0

#listen = tls:your_IP:5061

#tls_verify = 1

#tls_require_certificate = 0

#tls_method = TLSv1

#tls_certificate = "/home/darilion/software/openser-1.0.1-cvs/sip-server/debian/openser/etc/openser/tls/user/user-cert.pem"

#tls_private_key = "/home/darilion/software/openser-1.0.1-cvs/sip-server/debian/openser/etc/openser/tls/user/user-privkey.pem"

#tls_ca_list = "/home/darilion/software/openser-1.0.1-cvs/sip-server/debian/openser/etc/openser/tls/user/user-calist.pem"

 

# ------------------ module loading ----------------------------------

 

# Uncomment this if you want to use SQL database

#loadmodule "/usr/lib/openser/modules/mysql.so"

 

#loadmodule "/usr/lib/openser/modules/sl.so"

#loadmodule "/usr/lib/openser/modules/tm.so"

#loadmodule "/usr/lib/openser/modules/rr.so"

#loadmodule "/usr/lib/openser/modules/maxfwd.so"

#loadmodule "/usr/lib/openser/modules/usrloc.so"

#loadmodule "/usr/lib/openser/modules/registrar.so"

#loadmodule "/usr/lib/openser/modules/textops.so"

#loadmodule "/usr/lib/openser/modules/uri.so"

 

#loadmodule "/usr/lib/openser/modules/auth.so"

#loadmodule "/usr/lib/openser/modules/auth_radius.so"

#loadmodule "/usr/lib/openser/modules/group_radius.so"

#loadmodule "/usr/lib/openser/modules/avp_radius.so"

#loadmodule "/usr/lib/openser/modules/acc.so"

#loadmodule "/usr/lib/openser/modules/avpops.so"

 

mpath="/usr/local/lib/openser/modules/"

 

loadmodule "mysql.so"

loadmodule "sl.so"

loadmodule "tm.so"

loadmodule "rr.so"

loadmodule "maxfwd.so"

loadmodule "avpops.so"

loadmodule "usrloc.so"

loadmodule "registrar.so"

loadmodule "textops.so"

#loadmodule "xlog.so"

loadmodule "uri.so"

loadmodule "acc.so"

loadmodule "auth.so"

loadmodule "auth_radius.so"

loadmodule "group_radius.so"

loadmodule "avp_radius.so"

# ----------------- setting module-specific parameters ---------------

 

# -- usrloc params --

 

modparam("usrloc", "db_mode",   2)

modparam("usrloc", "db_url", "mysql://root:hashtaloo.@localhost/openser")

modparam("rr", "enable_full_lr", 1)

modparam("auth_radius", "radius_config", "/etc/radiusclient-ng/radiusclient.conf")

modparam("acc", "radius_flag", 1)

modparam("acc", "radius_missed_flag", 2)

modparam("acc", "log_flag", 1)

modparam("acc", "log_missed_flag", 1)

modparam("acc", "service_type", 15)

modparam("acc", "radius_extra", "Sip-Src-IP=$si;Sip-Src-Port=$sp")

modparam("acc|auth_radius|group_radius|avp_radius", "radius_config", "/usr/local/etc/radiusclient-ng/radiusclient.conf")

modparam("group_radius", "use_domain", 1)

modparam("avpops", "avp_aliases", "day=i:101;time=i:102")

 

# -------------------------  request routing logic -------------------

 

# main routing logic

 

route{

 

        # initial sanity checks -- messages with

        # max_forwards==0, or excessively long requests

        if (!mf_process_maxfwd_header("10")) {

                sl_send_reply("483","Too Many Hops");

                exit;

        };

 

        if (msg:len >=  2048 ) {

                sl_send_reply("513", "Message too big");

                exit;

        };

 

        # we record-route all messages -- to make sure that

        # subsequent messages will go through our proxy; that's

        # particularly good if upstream and downstream entities

        # use different transport protocol

        if (!method=="REGISTER")

                record_route();

 

        # subsequent messages withing a dialog should take the

        # path determined by record-routing

        if (loose_route()) {

                # mark routing logic in request

                append_hf("P-hint: rr-enforced\r\n");

                if(is_method("BYE"))

                { # log it all the time

                        acc_rad_request("200 ok");

                        acc_log_request("200 ok");

                }

                route(1);

        };

 

        if(is_method("INVITE") && !has_totag())

        {   # set the acc flags

                setflag(1);

                setflag(2);

        };

 

        if (!uri==myself) {

                # mark routing logic in request

                append_hf("P-hint: outbound\r\n");

                # if you have some interdomain connections via TLS

                #if(uri=~"@tls_domain1.net") {

                #       t_relay_to_tls("IP_domain1","port_domain1");

                #       exit;

                #} else if(uri=~"@tls_domain2.net") {

                #       t_relay_to_tls("IP_domain2","port_domain2");

                #       exit;

                #}

                route(1);

        };

 

        # if the request is for other domain use UsrLoc

        # (in case, it does not work, use the following command

        # with proper names and addresses in it)

        if (uri==myself) {

 

                if (method=="REGISTER") {

 

                        # Uncomment this if you want to use digest authentication

                        #if (!www_authorize("openser.org", "subscriber")) {

                        #       www_challenge("openser.org", "0");

                        #       exit;

                        #};

                        if (!radius_www_authorize("mytestdomain.com")) {

                                www_challenge("mytestdomain.com", "0");

                                exit;

                        };

 

                        save("location");

                        exit;

                };

 

                lookup("aliases");

                if (!uri==myself) {

                        append_hf("P-hint: outbound alias\r\n");

                        route(1);

                };

 

                # native SIP destinations are handled using our USRLOC DB

                if (!lookup("location")) {

                        acc_rad_request("404 Not Found");

                        acc_log_request("404 Not Found");

                        sl_send_reply("404", "Not Found");

                        exit;

                };

 

                # calls to pstn

                if(uri=~"sip:00[1-9][0-9]+@") {

                        if(is_method("INVITE") && !has_totag()) {

                               if (!radius_is_user_in("From", "voip")) {

                                        sl_send_reply("403", "Forbidden PSTN");

                                        exit;

                                };

                                              };

                        # Setting the gateway address

                        rewritehostport("10.20.20.19:5060");

                        route(1);

                };

       

                # load callee's avps

                if(avp_load_radius("callee"))

                {

                        # check if user has time filter enabled

                        if(avp_check("i:3", "eq/i:1"))

                        {

                                # print time in an avp

                                avp_printf("i:100", "$Tf");

                                # extract day

                                avp_subst("i:100/i:101", "/(.{3}) .+/*\1*/");

                                if(!avp_check("i:6", "fm/$day")) {

                                        sl_send_reply("403", "Forbidden - day");

                                        exit;

                                };

                                # extract 'hours:minutes'

                                avp_subst("i:100/i:102", "/(.{10}) (.{5}):.+/\2/");

                                if((is_avp_set("i:4") && avp_check("i:4", "gt/$time"))

                                        || (is_avp_set("i:5") && avp_check("i:5", "lt/$time"))) {

                                        sl_send_reply("403", "Forbidden - time");

                                        exit;

                                };

                        };

                };

 

                append_hf("P-hint: usrloc applied\r\n");

        };

 

        route(1);

}

 

 

route[1] {

        # send it out now; use stateful forwarding as it works reliably

        # even for UDP2TCP

        if (!t_relay()) {

                sl_reply_error();

        };

        exit;

}