[SR-Users] Kamilio dispatcher not registering with asterisk

Mihai m at mokalife.ro
Mon Dec 7 16:05:45 CET 2020


Hi all,

i have a problem with kamailio 5.3.x and asterisk 13, i basically forward
everything, but i cant manage to make it register.

The register arrives on asterisk see the capture bellow:
Any help is much appreciated!
----------------
REGISTER sip:oro.sips.nl;transport=UDP SIP/2.0
Via: SIP/2.0/UDP
104.201.100.15;branch=z9hG4bK4d5e.997621d931a2ad9f6423e2ac7782a319.1
Via: SIP/2.0/UDP 34.12.55.102:34626
;received=34.12.55.102;branch=z9hG4bK-524287-1---0a0bffd64bbd9941;rport=34626
Max-Forwards: 69
Contact: <sip:test-user1 at 34.12.55.102:34626
;transport=UDP;rinstance=85c33e976be3dad1>
To: <sip:test-user1 at oro.sips.nl;transport=UDP>
From: <sip:test-user1 at oro.sips.nl;transport=UDP>;tag=6d8fd914
Call-ID: h6lkViFgxurpVRkw4Ly-GQ..
CSeq: 1 REGISTER
Expires: 60
Allow: INVITE, ACK, CANCEL, BYE, NOTIFY, REFER, MESSAGE, OPTIONS, INFO,
SUBSCRIBE
User-Agent: Z 5.4.9 rv2.10.11.7
Allow-Events: presence, kpml, talk
Content-Length: 0
Path: <sip:104.201.100.15;lr;received=sip:34.12.55.102:34626>

-------------------the config -------
# - flags
#   FLT_ - per transaction (message) flags
# FLB_ - per branch flags
#!define FLT_ACC 1
#!define FLT_ACCMISSED 2
#!define FLT_ACCFAILED 3

#!define FLT_FS 10

####### Global Parameters #########

debug=4
log_stderror=yes

memdbg=5
memlog=5

log_facility=LOG_LOCAL0

fork=yes
children=4

/* comment the next line to enable TCP */
disable_tcp=yes

/* uncomment the next line to disable the auto discovery of local aliases
   based on revers DNS on IPs (default on) */
auto_aliases=no

/* add local domain aliases */
# alias="mysipserver.com"

port=5060

/* uncomment and configure the following line if you want Kamailio to
   bind on a specific interface/port/proto (default bind on all available)
*/
# listen=udp:127.0.0.1:5060

sip_warning=no

####### Modules Section ########

# set module path
#mpath="/usr/local/lib/kamailio/modules/"

#loadmodule "db_mysql.so"
loadmodule "jsonrpcs.so"
loadmodule "kex.so"
loadmodule "corex.so"
loadmodule "tm.so"
loadmodule "tmx.so"
loadmodule "sl.so"
loadmodule "rr.so"
loadmodule "pv.so"
loadmodule "maxfwd.so"
loadmodule "textops.so"
loadmodule "siputils.so"
loadmodule "xlog.so"
loadmodule "sanity.so"
loadmodule "ctl.so"
loadmodule "acc.so"
loadmodule "dispatcher.so"
loadmodule "path.so"

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


# ----- jsonrpcs params -----
modparam("jsonrpcs", "pretty_format", 1)


# ----- rr params -----
# add value to ;lr param to cope with most of the UAs
modparam("rr", "enable_full_lr", 1)
# do not append from tag to the RR (no need for this script)
modparam("rr", "append_fromtag", 0)


# ----- acc params -----
modparam("acc", "log_flag", FLT_ACC)
modparam("acc", "failed_transaction_flag", FLT_ACCFAILED)
modparam("acc", "log_extra",
"src_user=$fU;src_domain=$fd;dst_ouser=$tU;dst_user=$rU;dst_domain=$rd;src_ip=$si")

# ----- tm params -----
modparam("tm", "fr_timer", 2000)
modparam("tm", "fr_inv_timer", 40000)

# ----- dispatcher params -----
#modparam("dispatcher", "db_url", DBURL)
#modparam("dispatcher", "table_name", "dispatcher")
modparam("dispatcher", "list_file", "/etc/kamailio/dispatcher.list")
modparam("dispatcher", "flags", 2)
modparam("dispatcher", "xavp_dst", "_dsdst_")
modparam("dispatcher", "xavp_ctx", "_dsctx_")
modparam("dispatcher", "ds_ping_from", "sip:proxy at mykamailio")
modparam("dispatcher", "ds_ping_interval", 30)
modparam("dispatcher", "ds_probing_threshold", 10)
modparam("dispatcher", "ds_inactive_threshold", 5)
modparam("dispatcher", "ds_ping_reply_codes",
"class=2;code=403;code=488;class=3")
modparam("dispatcher", "ds_probing_mode", 1)

modparam("path", "use_received", 1)

####### Routing Logic ########


# main request routing logic

request_route {

# per request initial checks
route(REQINIT);

        if(ds_is_from_list()) {
       setflag(FLT_FS);
        }

# CANCEL processing
if (is_method("CANCEL")) {
if (t_check_trans()) {
route(RELAY);
}
exit;
}

# handle retransmissions
if (!is_method("ACK")) {
if(t_precheck_trans()) {
t_check_trans();
exit;
}
t_check_trans();
}

# handle requests within SIP dialogs
route(WITHINDLG);

        if (isflagset(FLT_FS)) {
                route(FROM_FS);
                exit;
        }

### only initial requests (no To tag)

# record routing for dialog forming requests (in case they are routed)
# - remove preloaded route headers
remove_hf("Route");
if (is_method("INVITE|SUBSCRIBE")) {
record_route();
}

# account only INVITEs
if (is_method("INVITE")) {
setflag(FLT_ACC); # do accounting
}

# handle presence related requests
route(PRESENCE);

# handle registrations
route(REGISTRAR);

if ($rU==$null) {
# request with no Username in RURI
sl_send_reply("484","Address Incomplete");
exit;
}

# dispatch destinations
route(DISPATCH);
}

route[FROM_FS]
{
        record_route();
        route(RELAY);
        exit;
}

route[RELAY] {
if (!t_relay()) {
sl_reply_error();
}
exit;
}

# Per SIP request initial checks
route[REQINIT] {
if (!mf_process_maxfwd_header("10")) {
sl_send_reply("483","Too Many Hops");
exit;
}

if(!sanity_check("1511", "7")) {
xlog("Malformed SIP message from $si:$sp\n");
exit;
}
}

# Handle requests within SIP dialogs
route[WITHINDLG] {
if (has_totag()) {
# sequential request withing a dialog should
# take the path determined by record-routing
if (loose_route()) {
if (is_method("BYE")) {
setflag(FLT_ACC); # do accounting ...
setflag(FLT_ACCFAILED); # ... even if the transaction fails
}
route(RELAY);
} else {
if (is_method("SUBSCRIBE") && uri == myself) {
# in-dialog subscribe requests
route(PRESENCE);
exit;
}
if ( is_method("ACK") ) {
if ( t_check_trans() ) {
# non loose-route, but stateful ACK;
# must be ACK after a 487 or e.g. 404 from upstream server
t_relay();
exit;
} else {
# ACK without matching transaction ... ignore and discard.
exit;
}
}
sl_send_reply("404","Not here");
}
exit;
}
}

# Handle SIP registrations
route[REGISTRAR] {
if(!is_method("REGISTER"))
return;
add_path_received();
        route(DISPATCH);
}

# Presence server route
route[PRESENCE] {
if(!is_method("PUBLISH|SUBSCRIBE"))
return;

sl_send_reply("404", "Not here");
exit;
}

# Dispatch requests
route[DISPATCH] {
# round robin dispatching on gateways group '1'
switch ($fd){
case "oro.sips.nl":
send_reply(483, "Ok, Skipper!");
if (!ds_select_dst("1", "4")) {
log("ERROR: no active destinations found!\n");
send_reply(503, "Service Unavailable");
exit;
}
ds_select_dst("1", "4");
log("---- flag value is $dd -- branch $fd \n");
xdbg("--- SCRIPT: going to <$ru> via <$du> (attrs:
$xavp(_dsdst_=>attrs))\n");
break;
case "oro2.sips.nl":
send_reply(483, "Ok, Skipper!");
if (!ds_select_dst("2", "4")) {
log("ERROR: no active destinations found!\n");
send_reply(503, "Service Unavailable");
exit;
}
ds_select_dst("2", "4");
log("---- flag value is $dd -- branch $fd \n");
xdbg("--- SCRIPT: going to <$ru> via <$du> (attrs:
$xavp(_dsdst_=>attrs))\n");
break;
default:
   log("unknow destination?");
   send_reply(503, "No service defined");
   exit;
}

xdbg("--- SCRIPT: going to <$ru> via <$du> (attrs:
$xavp(_dsdst_=>attrs))\n");
t_on_failure("RTF_DISPATCH");
route(RELAY);
exit;
}

# Try next destionations in failure route
failure_route[RTF_DISPATCH] {
if (t_is_canceled()) {
exit;
}
# next DST - only for 500 or local timeout
if (t_check_status("500")
or (t_branch_timeout() and !t_branch_replied())) {
if(ds_next_dst()) {
xdbg("--- SCRIPT: retrying to <$ru> via <$du> (attrs:
$xavp(_dsdst_=>attrs))\n");
t_on_failure("RTF_DISPATCH");
route(RELAY);
exit;
}
}
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20201207/718224dd/attachment.htm>


More information about the sr-users mailing list