Discussion:
[SR-Users] Msilo not delivering message (status 408)
Peter Villeneuve
2014-07-14 17:56:34 UTC
Permalink
Hi,

This is most likely a stupid mistake on my route config, but msilo
correctly stores messages for offline users, but when they come back
online, the message never arrives.

Looking through the debug logs indeed there is an error, with status 408,
which suggests kamaiio can't find a route to the user that just logged.
Before I spend hours looking through all the routing blocks, perhaps
someone more exprienced in kamailio can see the problem right away and
offer a solution?

Thanks


DEBUG: msilo [msilo.c:1148]: m_dump(): msg [1-12] for:
sip:1010-TNFzNwJ3FISaMJb+***@public.gmane.org
DEBUG: <core> [io_wait.h:617]: io_watch_del(): DBG: io_watch_del (0x8e3040,
9, -1, 0x10) fd_no=2 called
DEBUG: <core> [tcp_read.c:1437]: release_tcpconn(): releasing con
0x7f61ced1b1b0, state 1, fd=9, id=1
DEBUG: <core> [tcp_read.c:1438]: release_tcpconn(): extra_data
0x7f61ced1c4f8
DEBUG: <core> [tcp_main.c:3385]: handle_tcp_child(): handle_tcp_child:
reader response= 7f61ced1b1b0, 1 from 0
DEBUG: <core> [io_wait.h:390]: io_watch_add(): DBG: io_watch_add(0x89ec40,
26, 2, 0x7f61ced1b1b0), fd_no=21
DEBUG: <core> [tcp_main.c:3515]: handle_tcp_child(): handle_tcp_child:
CONN_RELEASE 0x7f61ced1b1b0 refcnt= 1
DEBUG: tm [t_reply.c:1304]: t_should_relay_response(): ->>>>>>>>> T_code=0,
new_code=408
DEBUG: tm [t_reply.c:2086]: local_reply(): DEBUG: local_reply: branch=0,
save=0, winner=0
DEBUG: tm [t_reply.c:2123]: local_reply(): DEBUG: local transaction
completed
DEBUG: tm [t_hooks.c:288]: run_trans_callbacks_internal(): DBG:
trans=0x7f61ced1d868, callback type 1024, id 0 entered
DEBUG: msilo [msilo.c:1317]: m_tm_callback(): *completed with status 408*
[mid: 140058058335472/13]
DEBUG: msilo [msilo.c:1325]: m_tm_callback(): message <13> was not sent
successfully
DEBUG: msilo [ms_msg_list.c:236]: msg_list_set_flag(): mid:13 fl:8
DEBUG: tm [t_reply.c:1304]: t_should_relay_response(): ->>>>>>>>> T_code=0,
new_code=408
DEBUG: tm [t_reply.c:2086]: local_reply(): DEBUG: local_reply: branch=0,
save=0, winner=0
DEBUG: tm [t_reply.c:2123]: local_reply(): DEBUG: local transaction
completed
DEBUG: tm [t_hooks.c:288]: run_trans_callbacks_internal(): DBG:
trans=0x7f61ced5f098, callback type 1024, id 0 entered
DEBUG: msilo [msilo.c:1317]: m_tm_callback(): completed with status 408
[mid: 140058058329184/12]
DEBUG: msilo [msilo.c:1325]: m_tm_callback(): message <12> was not sent
successfully
DEBUG: msilo [ms_msg_list.c:236]: msg_list_set_flag(): mid:12 fl:8
Daniel-Constantin Mierla
2014-07-16 07:58:04 UTC
Permalink
Hello,

can you watch the sip traffic on the network to see if the sip messages
is sent out? You can use ngrep, like:

ngrep -d any -qt -W byline "sip" port 5060

Cheers,
Daniel
Post by Peter Villeneuve
Hi,
This is most likely a stupid mistake on my route config, but msilo
correctly stores messages for offline users, but when they come back
online, the message never arrives.
Looking through the debug logs indeed there is an error, with status
408, which suggests kamaiio can't find a route to the user that just
logged. Before I spend hours looking through all the routing blocks,
perhaps someone more exprienced in kamailio can see the problem right
away and offer a solution?
Thanks
DEBUG: <core> [io_wait.h:617]: io_watch_del(): DBG: io_watch_del
(0x8e3040, 9, -1, 0x10) fd_no=2 called
DEBUG: <core> [tcp_read.c:1437]: release_tcpconn(): releasing con
0x7f61ced1b1b0, state 1, fd=9, id=1
DEBUG: <core> [tcp_read.c:1438]: release_tcpconn(): extra_data
0x7f61ced1c4f8
reader response= 7f61ced1b1b0, 1 from 0
io_watch_add(0x89ec40, 26, 2, 0x7f61ced1b1b0), fd_no=21
CONN_RELEASE 0x7f61ced1b1b0 refcnt= 1
DEBUG: tm [t_reply.c:1304]: t_should_relay_response(): ->>>>>>>>>
T_code=0, new_code=408
branch=0, save=0, winner=0
DEBUG: tm [t_reply.c:2123]: local_reply(): DEBUG: local transaction
completed
trans=0x7f61ced1d868, callback type 1024, id 0 entered
DEBUG: msilo [msilo.c:1317]: m_tm_callback(): *completed with status
408* [mid: 140058058335472/13]
DEBUG: msilo [msilo.c:1325]: m_tm_callback(): message <13> was not
sent successfully
DEBUG: msilo [ms_msg_list.c:236]: msg_list_set_flag(): mid:13 fl:8
DEBUG: tm [t_reply.c:1304]: t_should_relay_response(): ->>>>>>>>>
T_code=0, new_code=408
branch=0, save=0, winner=0
DEBUG: tm [t_reply.c:2123]: local_reply(): DEBUG: local transaction
completed
trans=0x7f61ced5f098, callback type 1024, id 0 entered
DEBUG: msilo [msilo.c:1317]: m_tm_callback(): completed with status
408 [mid: 140058058329184/12]
DEBUG: msilo [msilo.c:1325]: m_tm_callback(): message <12> was not
sent successfully
DEBUG: msilo [ms_msg_list.c:236]: msg_list_set_flag(): mid:12 fl:8
_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
--
Daniel-Constantin Mierla - http://www.asipto.com
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Peter Villeneuve
2014-07-16 15:38:46 UTC
Permalink
Thanks for your help Daniel.

OK I ngrepped port 5060 and indeed the message tries to get delivered.
However it never arrives at the client (1010 in this case).
I have added localhost listeners for UDP and TCP, even though all clients
register through TLS only (could this be the root of the problem?). I added
localhost listeners because I was getting the no socket found error message.

Listening on
udp: 127.0.0.1:5080
tcp: 127.0.0.1:5060
tls: 79.my.server.IP1:5061
Aliases:
tcp: localhost:5060
udp: localhost:5080
*: my.domain.com:*

U 2014/07/16 15:29:14.904285 127.0.0.1:5080 -> 79.my.server.IP1:5060
MESSAGE sip:1010-TNFzNwJ3FISaMJb+***@public.gmane.org SIP/2.0.
Via: SIP/2.0/UDP 127.0.0.1:5080
;branch=z9hG4bKcde3.542219f4000000000000000000000000.0.
To: <sip:1010-TNFzNwJ3FISaMJb+***@public.gmane.org>.
From: <sip:1000-TNFzNwJ3FISaMJb+***@public.gmane.org>;tag=def4124455da8a0b8e97eafabd028e26-2c30.
CSeq: 10 MESSAGE.
Call-ID: 16b126996f51d89c-12460-savSHZN5Fh+***@public.gmane.org
Max-Forwards: 70.
Content-Length: 58.
User-Agent: kamailio (4.1.4 (x86_64/linux)).
Date: Wed, 16 Jul 2014 15:22:31 GMT.
Content-Type: text/plain.
.
[Offline message - Wed Jul 16 15:22:31 2014] Test 1,2,3
Post by Daniel-Constantin Mierla
Hello,
can you watch the sip traffic on the network to see if the sip messages is
ngrep -d any -qt -W byline "sip" port 5060
Cheers,
Daniel
Hi,
This is most likely a stupid mistake on my route config, but msilo
correctly stores messages for offline users, but when they come back
online, the message never arrives.
Looking through the debug logs indeed there is an error, with status
408, which suggests kamaiio can't find a route to the user that just
logged. Before I spend hours looking through all the routing blocks,
perhaps someone more exprienced in kamailio can see the problem right away
and offer a solution?
Thanks
DEBUG: <core> [io_wait.h:617]: io_watch_del(): DBG: io_watch_del
(0x8e3040, 9, -1, 0x10) fd_no=2 called
DEBUG: <core> [tcp_read.c:1437]: release_tcpconn(): releasing con
0x7f61ced1b1b0, state 1, fd=9, id=1
DEBUG: <core> [tcp_read.c:1438]: release_tcpconn(): extra_data
0x7f61ced1c4f8
reader response= 7f61ced1b1b0, 1 from 0
DEBUG: <core> [io_wait.h:390]: io_watch_add(): DBG: io_watch_add(0x89ec40,
26, 2, 0x7f61ced1b1b0), fd_no=21
CONN_RELEASE 0x7f61ced1b1b0 refcnt= 1
DEBUG: tm [t_reply.c:1304]: t_should_relay_response(): ->>>>>>>>>
T_code=0, new_code=408
DEBUG: tm [t_reply.c:2086]: local_reply(): DEBUG: local_reply: branch=0,
save=0, winner=0
DEBUG: tm [t_reply.c:2123]: local_reply(): DEBUG: local transaction
completed
trans=0x7f61ced1d868, callback type 1024, id 0 entered
DEBUG: msilo [msilo.c:1317]: m_tm_callback(): *completed with status 408*
[mid: 140058058335472/13]
DEBUG: msilo [msilo.c:1325]: m_tm_callback(): message <13> was not sent
successfully
DEBUG: msilo [ms_msg_list.c:236]: msg_list_set_flag(): mid:13 fl:8
DEBUG: tm [t_reply.c:1304]: t_should_relay_response(): ->>>>>>>>>
T_code=0, new_code=408
DEBUG: tm [t_reply.c:2086]: local_reply(): DEBUG: local_reply: branch=0,
save=0, winner=0
DEBUG: tm [t_reply.c:2123]: local_reply(): DEBUG: local transaction
completed
trans=0x7f61ced5f098, callback type 1024, id 0 entered
DEBUG: msilo [msilo.c:1317]: m_tm_callback(): completed with status 408
[mid: 140058058329184/12]
DEBUG: msilo [msilo.c:1325]: m_tm_callback(): message <12> was not sent
successfully
DEBUG: msilo [ms_msg_list.c:236]: msg_list_set_flag(): mid:12 fl:8
_______________________________________________
--
Daniel-Constantin Mierla - http://www.asipto.comhttp://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
Peter Villeneuve
2014-07-16 15:44:05 UTC
Permalink
And here's the full routing block. I copied it from someone else on the
list that was troubleshooting msilo a while back.
Also, I can confirm the message never gets delivered because it remains in
msilo DB and kamailio logs shows it trying and trying.


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


# Main SIP request routing logic
# - processing of any incoming SIP request starts with this route
route {

# per request initial checks
route(REQINIT);

# NAT detection
route(NAT);

# handle requests within SIP dialogs
route(WITHINDLG);

### only initial requests (no To tag)

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

if (is_method("MESSAGE"))
{
log(1,"-------------------------------------------------------->WE
HAVE A NEW MESSAGE\n");
route(MSILO_MESSAGE);
}
t_check_trans();

# authentication
route(AUTH);

# 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
}

# dispatch requests to foreign domains
route(SIPOUT);

### requests for my local domains

# 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 to PSTN
route(PSTN);

# user location service
route(LOCATION);

route(RELAY);
}


route[RELAY] {
#!ifdef WITH_NAT
if (check_route_param("nat=yes")) {
setbflag(FLB_NATB);
}
if (isflagset(FLT_NATS) || isbflagset(FLB_NATB)) {
route(RTPPROXY);
}
#!endif


/* example how to enable some additional event routes */
if (is_method("INVITE")) {
#t_on_branch("BRANCH_ONE");
t_on_reply("REPLY_ONE");
t_on_failure("FAIL_ONE");
}

if (!t_relay()) {
sl_reply_error();
}
exit;
}

##storing offline messages
route[MSILO_MESSAGE]{
if (lookup("location")){
t_on_failure("FAIL_MESSAGE");
t_relay();
xlog("L_NOTICE","---------------------------------MI: ($mi), MB: ($mb)\n");
}else{
xlog("L_NOTICE","------------------MESSAGE PROCESSING: location not found,
storing offline message ID: ($ru)\n");
m_store("$ru");
sl_send_reply("202", "ACCEPTED");
xlog("L_NOTICE","------------------MESSAGE PROCESSING: location not found,
stored offline message ID: ($ru)\n");
};
exit;
};

failure_route[FAIL_MESSAGE]{

xlog("L_NOTICE","------------------MESSAGE PROCESSING: user cannot be
reached, storing offline message ID: ($ou)\n");
m_store("$ou");
t_reply("202", "ACCEPTED");
xlog("L_NOTICE","------------------MESSAGE PROCESSING: user cannot be
reached, stored offline message ID: ($ou)\n");
exit;
}




# Per SIP request initial checks
route[REQINIT] {
#!ifdef WITH_ANTIFLOOD
# flood dection from same IP and traffic ban for a while
# be sure you exclude checking trusted peers, such as pstn gateways
# - local host excluded (e.g., loop to self)
if(src_ip!=myself)
{
if($sht(ipban=>$si)!=$null)
{
# ip is already blocked
xdbg("request from blocked IP - $rm from $fu (IP:$si:$sp)\n");
exit;
}
if (!pike_check_req())
{
xlog("L_ALERT","ALERT: pike blocking $rm from $fu (IP:$si:$sp)\n");
$sht(ipban=>$si) = 1;
exit;
}
}
#!endif

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() ) {
# no loose-route, but stateful ACK;
# must be an 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"))
{
if(isflagset(FLT_NATS))
{
setbflag(FLB_NATB);
# uncomment next line to do SIP NAT pinging
setbflag(FLB_NATSIPPING);
}
if (!save("location"))
sl_reply_error();
# MSILO - dumping user's offline messages
m_dump();
log(1,"-------------------------MESSAGE PROCESSING:
dumping offline messages\n");

exit;
}
}

# USER location service
route[LOCATION] {

#!ifdef WITH_ALIASDB
# search in DB-based aliases
alias_db_lookup("dbaliases");
#!endif

if (!lookup("location")) {
switch ($rc) {
case -1:
case -3:
t_newtran();
t_reply("404", "Not Found");
exit;
case -2:
sl_send_reply("405", "Method Not Allowed");
exit;
}
}

# when routing via usrloc, log the missed calls also
if (is_method("INVITE"))
{
setflag(FLT_ACCMISSED);
}
}

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

#!ifdef WITH_PRESENCE
if (!t_newtran())
{
sl_reply_error();
exit;
};

if(is_method("PUBLISH"))
{
handle_publish();
t_release();
}
else
if( is_method("SUBSCRIBE"))
{
handle_subscribe();
t_release();
}
exit;
#!endif
# if presence enabled, this part will not be executed
if (is_method("PUBLISH") || $rU==$null)
{
sl_send_reply("404", "Not here");
exit;
}
return;
}

# Authentication route
route[AUTH] {
#!ifdef WITH_AUTH
if (is_method("REGISTER"))
{
# authenticate the REGISTER requests (uncomment to enable auth)
if (!www_authorize("$td", "subscriber"))
{
www_challenge("$td", "0");
exit;
}

if ($au!=$tU)
{
sl_send_reply("403","Forbidden auth ID");
exit;
}
} else {

#!ifdef WITH_IPAUTH
if(allow_source_address())
{
# source IP allowed
return;
}
#!endif

# authenticate if from local subscriber
if (from_uri==myself)
{
if (!proxy_authorize("$fd", "subscriber")) {
proxy_challenge("$fd", "0");
exit;
}
if (is_method("PUBLISH"))
{
if ($au!=$tU) {
sl_send_reply("403","Forbidden auth ID");
exit;
}
} else {
if ($au!=$fU) {
sl_send_reply("403","Forbidden auth ID");
exit;
}
}

consume_credentials();
# caller authenticated
} else {
# caller is not local subscriber, then check if it calls
# a local destination, otherwise deny, not an open relay here
if (!uri==myself)
{
sl_send_reply("403","Not relaying");
exit;
}
}
}
#!endif
return;
}

# Caller NAT detection route
route[NAT] {
#!ifdef WITH_NAT
force_rport();
if (nat_uac_test("19")) {
if (method=="REGISTER") {
fix_nated_register();
} else {
fix_nated_contact();
}
setflag(FLT_NATS);
}
#!endif
return;
}

# RTPProxy control
route[RTPPROXY] {
#!ifdef WITH_NAT
if (is_method("BYE")) {
unforce_rtp_proxy();
} else if (is_method("INVITE")){
rtpproxy_offer();
}
if (!has_totag()) add_rr_param(";nat=yes");
#!endif
return;
}

# Routing to foreign domains
route[SIPOUT] {
if (!uri==myself)
{
append_hf("P-hint: outbound\r\n");
route(RELAY);
}
}

# PSTN GW routing
route[PSTN] {
#!ifdef WITH_PSTN
# check if PSTN GW IP is defined
if (strempty($sel(cfg_get.pstn.gw_ip))) {
xlog("SCRIPT: PSTN rotuing enabled but pstn.gw_ip not defined\n");
return;
}

# route to PSTN dialed numbers starting with '+' or '00'
# (international format)
# - update the condition to match your dialing rules for PSTN routing
if(!($rU=~"^(\+|00)[1-9][0-9]{3,20}$"))
return;

# only local users allowed to call
if(from_uri!=myself) {
sl_send_reply("403", "Not Allowed");
exit;
}

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

route(RELAY);
exit;
#!endif

return;
}

# XMLRPC routing
#!ifdef WITH_XMLRPC
route[XMLRPC]
{
# allow XMLRPC from localhost
if ((method=="POST" || method=="GET")
&& (src_ip==127.0.0.1)) {
# close connection only for xmlrpclib user agents (there is a bug in
# xmlrpclib: it waits for EOF before interpreting the response).
if ($hdr(User-Agent) =~ "xmlrpclib")
set_reply_close();
set_reply_no_connect();
dispatch_rpc();
exit;
}
send_reply("403", "Forbidden");
exit;
}
#!endif

# Sample branch router
branch_route[BRANCH_ONE] {
xdbg("new branch at $ru\n");
}

# Sample onreply route
onreply_route[REPLY_ONE] {
xdbg("incoming reply\n");
#!ifdef WITH_NAT
if ((isflagset(FLT_NATS) || isbflagset(FLB_NATB))
&& status=~"(183)|(2[0-9][0-9])") {

rtpproxy_answer();
}
if (isbflagset("6")) {
fix_nated_contact();
}
#!endif
}

# Sample failure route
failure_route[FAIL_ONE] {
#!ifdef WITH_NAT
if (is_method("INVITE")
&& (isbflagset(FLB_NATB) || isflagset(FLT_NATS))) {
unforce_rtp_proxy();
}
#!endif

if (t_is_canceled()) {
exit;
}

# uncomment the following lines if you want to block client
# redirect based on 3xx replies.
##if (t_check_status("3[0-9][0-9]")) {
##t_reply("404","Not found");
## exit;
##}

# uncomment the following lines if you want to redirect the failed
# calls to a different new destination
##if (t_check_status("486|408")) {
## sethostport("192.168.2.100:5060");
## append_branch();
## # do not set the missed call flag again
## t_relay();
##}
}
Post by Peter Villeneuve
Thanks for your help Daniel.
OK I ngrepped port 5060 and indeed the message tries to get delivered.
However it never arrives at the client (1010 in this case).
I have added localhost listeners for UDP and TCP, even though all clients
register through TLS only (could this be the root of the problem?). I added
localhost listeners because I was getting the no socket found error message.
Listening on
udp: 127.0.0.1:5080
tcp: 127.0.0.1:5060
tls: 79.my.server.IP1:5061
tcp: localhost:5060
udp: localhost:5080
*: my.domain.com:*
U 2014/07/16 15:29:14.904285 127.0.0.1:5080 -> 79.my.server.IP1:5060
Via: SIP/2.0/UDP 127.0.0.1:5080
;branch=z9hG4bKcde3.542219f4000000000000000000000000.0.
CSeq: 10 MESSAGE.
Max-Forwards: 70.
Content-Length: 58.
User-Agent: kamailio (4.1.4 (x86_64/linux)).
Date: Wed, 16 Jul 2014 15:22:31 GMT.
Content-Type: text/plain.
.
[Offline message - Wed Jul 16 15:22:31 2014] Test 1,2,3
On Wed, Jul 16, 2014 at 8:58 AM, Daniel-Constantin Mierla <
Post by Daniel-Constantin Mierla
Hello,
can you watch the sip traffic on the network to see if the sip messages
ngrep -d any -qt -W byline "sip" port 5060
Cheers,
Daniel
Hi,
This is most likely a stupid mistake on my route config, but msilo
correctly stores messages for offline users, but when they come back
online, the message never arrives.
Looking through the debug logs indeed there is an error, with status
408, which suggests kamaiio can't find a route to the user that just
logged. Before I spend hours looking through all the routing blocks,
perhaps someone more exprienced in kamailio can see the problem right away
and offer a solution?
Thanks
DEBUG: <core> [io_wait.h:617]: io_watch_del(): DBG: io_watch_del
(0x8e3040, 9, -1, 0x10) fd_no=2 called
DEBUG: <core> [tcp_read.c:1437]: release_tcpconn(): releasing con
0x7f61ced1b1b0, state 1, fd=9, id=1
DEBUG: <core> [tcp_read.c:1438]: release_tcpconn(): extra_data
0x7f61ced1c4f8
reader response= 7f61ced1b1b0, 1 from 0
io_watch_add(0x89ec40, 26, 2, 0x7f61ced1b1b0), fd_no=21
CONN_RELEASE 0x7f61ced1b1b0 refcnt= 1
DEBUG: tm [t_reply.c:1304]: t_should_relay_response(): ->>>>>>>>>
T_code=0, new_code=408
DEBUG: tm [t_reply.c:2086]: local_reply(): DEBUG: local_reply: branch=0,
save=0, winner=0
DEBUG: tm [t_reply.c:2123]: local_reply(): DEBUG: local transaction
completed
trans=0x7f61ced1d868, callback type 1024, id 0 entered
DEBUG: msilo [msilo.c:1317]: m_tm_callback(): *completed with status
408* [mid: 140058058335472/13]
DEBUG: msilo [msilo.c:1325]: m_tm_callback(): message <13> was not sent
successfully
DEBUG: msilo [ms_msg_list.c:236]: msg_list_set_flag(): mid:13 fl:8
DEBUG: tm [t_reply.c:1304]: t_should_relay_response(): ->>>>>>>>>
T_code=0, new_code=408
DEBUG: tm [t_reply.c:2086]: local_reply(): DEBUG: local_reply: branch=0,
save=0, winner=0
DEBUG: tm [t_reply.c:2123]: local_reply(): DEBUG: local transaction
completed
trans=0x7f61ced5f098, callback type 1024, id 0 entered
DEBUG: msilo [msilo.c:1317]: m_tm_callback(): completed with status 408
[mid: 140058058329184/12]
DEBUG: msilo [msilo.c:1325]: m_tm_callback(): message <12> was not sent
successfully
DEBUG: msilo [ms_msg_list.c:236]: msg_list_set_flag(): mid:12 fl:8
_______________________________________________
--
Daniel-Constantin Mierla - http://www.asipto.comhttp://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
Peter Villeneuve
2014-07-16 18:01:52 UTC
Permalink
I removed the localhost listeners on TCP and UDP, and, as I suspected,
Kamailio doesn't seem to like that.
Why isn't kamailio sending the message back through the TLS socket?


NOTICE: <script>: -------------------------MESSAGE PROCESSING: dumping
offline messages
ERROR: tm [ut.h:343]: uri2dst2(): no corresponding socket for af 2
ERROR: tm [uac.c:266]: t_uac_prepare(): t_uac: no socket found
Post by Peter Villeneuve
And here's the full routing block. I copied it from someone else on the
list that was troubleshooting msilo a while back.
Also, I can confirm the message never gets delivered because it remains in
msilo DB and kamailio logs shows it trying and trying.
####### Routing Logic ########
# Main SIP request routing logic
# - processing of any incoming SIP request starts with this route
route {
# per request initial checks
route(REQINIT);
# NAT detection
route(NAT);
# handle requests within SIP dialogs
route(WITHINDLG);
### only initial requests (no To tag)
# CANCEL processing
if (is_method("CANCEL"))
{
if (t_check_trans())
t_relay();
exit;
}
if (is_method("MESSAGE"))
{
log(1,"-------------------------------------------------------->WE HAVE A
NEW MESSAGE\n");
route(MSILO_MESSAGE);
}
t_check_trans();
# authentication
route(AUTH);
# 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
}
# dispatch requests to foreign domains
route(SIPOUT);
### requests for my local domains
# 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 to PSTN
route(PSTN);
# user location service
route(LOCATION);
route(RELAY);
}
route[RELAY] {
#!ifdef WITH_NAT
if (check_route_param("nat=yes")) {
setbflag(FLB_NATB);
}
if (isflagset(FLT_NATS) || isbflagset(FLB_NATB)) {
route(RTPPROXY);
}
#!endif
/* example how to enable some additional event routes */
if (is_method("INVITE")) {
#t_on_branch("BRANCH_ONE");
t_on_reply("REPLY_ONE");
t_on_failure("FAIL_ONE");
}
if (!t_relay()) {
sl_reply_error();
}
exit;
}
##storing offline messages
route[MSILO_MESSAGE]{
if (lookup("location")){
t_on_failure("FAIL_MESSAGE");
t_relay();
xlog("L_NOTICE","---------------------------------MI: ($mi), MB: ($mb)\n");
}else{
xlog("L_NOTICE","------------------MESSAGE PROCESSING: location not
found, storing offline message ID: ($ru)\n");
m_store("$ru");
sl_send_reply("202", "ACCEPTED");
xlog("L_NOTICE","------------------MESSAGE PROCESSING: location not
found, stored offline message ID: ($ru)\n");
};
exit;
};
failure_route[FAIL_MESSAGE]{
xlog("L_NOTICE","------------------MESSAGE PROCESSING: user cannot be
reached, storing offline message ID: ($ou)\n");
m_store("$ou");
t_reply("202", "ACCEPTED");
xlog("L_NOTICE","------------------MESSAGE PROCESSING: user cannot be
reached, stored offline message ID: ($ou)\n");
exit;
}
# Per SIP request initial checks
route[REQINIT] {
#!ifdef WITH_ANTIFLOOD
# flood dection from same IP and traffic ban for a while
# be sure you exclude checking trusted peers, such as pstn gateways
# - local host excluded (e.g., loop to self)
if(src_ip!=myself)
{
if($sht(ipban=>$si)!=$null)
{
# ip is already blocked
xdbg("request from blocked IP - $rm from $fu (IP:$si:$sp)\n");
exit;
}
if (!pike_check_req())
{
xlog("L_ALERT","ALERT: pike blocking $rm from $fu (IP:$si:$sp)\n");
$sht(ipban=>$si) = 1;
exit;
}
}
#!endif
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() ) {
# no loose-route, but stateful ACK;
# must be an 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"))
{
if(isflagset(FLT_NATS))
{
setbflag(FLB_NATB);
# uncomment next line to do SIP NAT pinging
setbflag(FLB_NATSIPPING);
}
if (!save("location"))
sl_reply_error();
# MSILO - dumping user's offline messages
m_dump();
log(1,"-------------------------MESSAGE
PROCESSING: dumping offline messages\n");
exit;
}
}
# USER location service
route[LOCATION] {
#!ifdef WITH_ALIASDB
# search in DB-based aliases
alias_db_lookup("dbaliases");
#!endif
if (!lookup("location")) {
switch ($rc) {
t_newtran();
t_reply("404", "Not Found");
exit;
sl_send_reply("405", "Method Not Allowed");
exit;
}
}
# when routing via usrloc, log the missed calls also
if (is_method("INVITE"))
{
setflag(FLT_ACCMISSED);
}
}
# Presence server route
route[PRESENCE] {
if(!is_method("PUBLISH|SUBSCRIBE"))
return;
#!ifdef WITH_PRESENCE
if (!t_newtran())
{
sl_reply_error();
exit;
};
if(is_method("PUBLISH"))
{
handle_publish();
t_release();
}
else
if( is_method("SUBSCRIBE"))
{
handle_subscribe();
t_release();
}
exit;
#!endif
# if presence enabled, this part will not be executed
if (is_method("PUBLISH") || $rU==$null)
{
sl_send_reply("404", "Not here");
exit;
}
return;
}
# Authentication route
route[AUTH] {
#!ifdef WITH_AUTH
if (is_method("REGISTER"))
{
# authenticate the REGISTER requests (uncomment to enable auth)
if (!www_authorize("$td", "subscriber"))
{
www_challenge("$td", "0");
exit;
}
if ($au!=$tU)
{
sl_send_reply("403","Forbidden auth ID");
exit;
}
} else {
#!ifdef WITH_IPAUTH
if(allow_source_address())
{
# source IP allowed
return;
}
#!endif
# authenticate if from local subscriber
if (from_uri==myself)
{
if (!proxy_authorize("$fd", "subscriber")) {
proxy_challenge("$fd", "0");
exit;
}
if (is_method("PUBLISH"))
{
if ($au!=$tU) {
sl_send_reply("403","Forbidden auth ID");
exit;
}
} else {
if ($au!=$fU) {
sl_send_reply("403","Forbidden auth ID");
exit;
}
}
consume_credentials();
# caller authenticated
} else {
# caller is not local subscriber, then check if it calls
# a local destination, otherwise deny, not an open relay here
if (!uri==myself)
{
sl_send_reply("403","Not relaying");
exit;
}
}
}
#!endif
return;
}
# Caller NAT detection route
route[NAT] {
#!ifdef WITH_NAT
force_rport();
if (nat_uac_test("19")) {
if (method=="REGISTER") {
fix_nated_register();
} else {
fix_nated_contact();
}
setflag(FLT_NATS);
}
#!endif
return;
}
# RTPProxy control
route[RTPPROXY] {
#!ifdef WITH_NAT
if (is_method("BYE")) {
unforce_rtp_proxy();
} else if (is_method("INVITE")){
rtpproxy_offer();
}
if (!has_totag()) add_rr_param(";nat=yes");
#!endif
return;
}
# Routing to foreign domains
route[SIPOUT] {
if (!uri==myself)
{
append_hf("P-hint: outbound\r\n");
route(RELAY);
}
}
# PSTN GW routing
route[PSTN] {
#!ifdef WITH_PSTN
# check if PSTN GW IP is defined
if (strempty($sel(cfg_get.pstn.gw_ip))) {
xlog("SCRIPT: PSTN rotuing enabled but pstn.gw_ip not defined\n");
return;
}
# route to PSTN dialed numbers starting with '+' or '00'
# (international format)
# - update the condition to match your dialing rules for PSTN routing
if(!($rU=~"^(\+|00)[1-9][0-9]{3,20}$"))
return;
# only local users allowed to call
if(from_uri!=myself) {
sl_send_reply("403", "Not Allowed");
exit;
}
route(RELAY);
exit;
#!endif
return;
}
# XMLRPC routing
#!ifdef WITH_XMLRPC
route[XMLRPC]
{
# allow XMLRPC from localhost
if ((method=="POST" || method=="GET")
&& (src_ip==127.0.0.1)) {
# close connection only for xmlrpclib user agents (there is a bug in
# xmlrpclib: it waits for EOF before interpreting the response).
if ($hdr(User-Agent) =~ "xmlrpclib")
set_reply_close();
set_reply_no_connect();
dispatch_rpc();
exit;
}
send_reply("403", "Forbidden");
exit;
}
#!endif
# Sample branch router
branch_route[BRANCH_ONE] {
xdbg("new branch at $ru\n");
}
# Sample onreply route
onreply_route[REPLY_ONE] {
xdbg("incoming reply\n");
#!ifdef WITH_NAT
if ((isflagset(FLT_NATS) || isbflagset(FLB_NATB))
&& status=~"(183)|(2[0-9][0-9])") {
rtpproxy_answer();
}
if (isbflagset("6")) {
fix_nated_contact();
}
#!endif
}
# Sample failure route
failure_route[FAIL_ONE] {
#!ifdef WITH_NAT
if (is_method("INVITE")
&& (isbflagset(FLB_NATB) || isflagset(FLT_NATS))) {
unforce_rtp_proxy();
}
#!endif
if (t_is_canceled()) {
exit;
}
# uncomment the following lines if you want to block client
# redirect based on 3xx replies.
##if (t_check_status("3[0-9][0-9]")) {
##t_reply("404","Not found");
## exit;
##}
# uncomment the following lines if you want to redirect the failed
# calls to a different new destination
##if (t_check_status("486|408")) {
## sethostport("192.168.2.100:5060");
## append_branch();
## # do not set the missed call flag again
## t_relay();
##}
}
Post by Peter Villeneuve
Thanks for your help Daniel.
OK I ngrepped port 5060 and indeed the message tries to get delivered.
However it never arrives at the client (1010 in this case).
I have added localhost listeners for UDP and TCP, even though all clients
register through TLS only (could this be the root of the problem?). I added
localhost listeners because I was getting the no socket found error message.
Listening on
udp: 127.0.0.1:5080
tcp: 127.0.0.1:5060
tls: 79.my.server.IP1:5061
tcp: localhost:5060
udp: localhost:5080
*: my.domain.com:*
U 2014/07/16 15:29:14.904285 127.0.0.1:5080 -> 79.my.server.IP1:5060
Via: SIP/2.0/UDP 127.0.0.1:5080
;branch=z9hG4bKcde3.542219f4000000000000000000000000.0.
CSeq: 10 MESSAGE.
Max-Forwards: 70.
Content-Length: 58.
User-Agent: kamailio (4.1.4 (x86_64/linux)).
Date: Wed, 16 Jul 2014 15:22:31 GMT.
Content-Type: text/plain.
.
[Offline message - Wed Jul 16 15:22:31 2014] Test 1,2,3
On Wed, Jul 16, 2014 at 8:58 AM, Daniel-Constantin Mierla <
Post by Daniel-Constantin Mierla
Hello,
can you watch the sip traffic on the network to see if the sip messages
ngrep -d any -qt -W byline "sip" port 5060
Cheers,
Daniel
Hi,
This is most likely a stupid mistake on my route config, but msilo
correctly stores messages for offline users, but when they come back
online, the message never arrives.
Looking through the debug logs indeed there is an error, with status
408, which suggests kamaiio can't find a route to the user that just
logged. Before I spend hours looking through all the routing blocks,
perhaps someone more exprienced in kamailio can see the problem right away
and offer a solution?
Thanks
DEBUG: <core> [io_wait.h:617]: io_watch_del(): DBG: io_watch_del
(0x8e3040, 9, -1, 0x10) fd_no=2 called
DEBUG: <core> [tcp_read.c:1437]: release_tcpconn(): releasing con
0x7f61ced1b1b0, state 1, fd=9, id=1
DEBUG: <core> [tcp_read.c:1438]: release_tcpconn(): extra_data
0x7f61ced1c4f8
reader response= 7f61ced1b1b0, 1 from 0
io_watch_add(0x89ec40, 26, 2, 0x7f61ced1b1b0), fd_no=21
CONN_RELEASE 0x7f61ced1b1b0 refcnt= 1
DEBUG: tm [t_reply.c:1304]: t_should_relay_response(): ->>>>>>>>>
T_code=0, new_code=408
DEBUG: tm [t_reply.c:2086]: local_reply(): DEBUG: local_reply: branch=0,
save=0, winner=0
DEBUG: tm [t_reply.c:2123]: local_reply(): DEBUG: local transaction
completed
trans=0x7f61ced1d868, callback type 1024, id 0 entered
DEBUG: msilo [msilo.c:1317]: m_tm_callback(): *completed with status
408* [mid: 140058058335472/13]
DEBUG: msilo [msilo.c:1325]: m_tm_callback(): message <13> was not sent
successfully
DEBUG: msilo [ms_msg_list.c:236]: msg_list_set_flag(): mid:13 fl:8
DEBUG: tm [t_reply.c:1304]: t_should_relay_response(): ->>>>>>>>>
T_code=0, new_code=408
DEBUG: tm [t_reply.c:2086]: local_reply(): DEBUG: local_reply: branch=0,
save=0, winner=0
DEBUG: tm [t_reply.c:2123]: local_reply(): DEBUG: local transaction
completed
trans=0x7f61ced5f098, callback type 1024, id 0 entered
DEBUG: msilo [msilo.c:1317]: m_tm_callback(): completed with status 408
[mid: 140058058329184/12]
DEBUG: msilo [msilo.c:1325]: m_tm_callback(): message <12> was not sent
successfully
DEBUG: msilo [ms_msg_list.c:236]: msg_list_set_flag(): mid:12 fl:8
_______________________________________________
--
Daniel-Constantin Mierla - http://www.asipto.comhttp://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
Peter Villeneuve
2014-07-16 20:37:04 UTC
Permalink
Can anyone help please? I was supposed to have this server up and running
hours ago and I can't think of anything to do next to help debug this.

Thanks
Post by Peter Villeneuve
I removed the localhost listeners on TCP and UDP, and, as I suspected,
Kamailio doesn't seem to like that.
Why isn't kamailio sending the message back through the TLS socket?
NOTICE: <script>: -------------------------MESSAGE PROCESSING: dumping offline messages
ERROR: tm [ut.h:343]: uri2dst2(): no corresponding socket for af 2
ERROR: tm [uac.c:266]: t_uac_prepare(): t_uac: no socket found
Post by Peter Villeneuve
And here's the full routing block. I copied it from someone else on the
list that was troubleshooting msilo a while back.
Also, I can confirm the message never gets delivered because it remains
in msilo DB and kamailio logs shows it trying and trying.
####### Routing Logic ########
# Main SIP request routing logic
# - processing of any incoming SIP request starts with this route
route {
# per request initial checks
route(REQINIT);
# NAT detection
route(NAT);
# handle requests within SIP dialogs
route(WITHINDLG);
### only initial requests (no To tag)
# CANCEL processing
if (is_method("CANCEL"))
{
if (t_check_trans())
t_relay();
exit;
}
if (is_method("MESSAGE"))
{
log(1,"-------------------------------------------------------->WE HAVE A
NEW MESSAGE\n");
route(MSILO_MESSAGE);
}
t_check_trans();
# authentication
route(AUTH);
# 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
}
# dispatch requests to foreign domains
route(SIPOUT);
### requests for my local domains
# 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 to PSTN
route(PSTN);
# user location service
route(LOCATION);
route(RELAY);
}
route[RELAY] {
#!ifdef WITH_NAT
if (check_route_param("nat=yes")) {
setbflag(FLB_NATB);
}
if (isflagset(FLT_NATS) || isbflagset(FLB_NATB)) {
route(RTPPROXY);
}
#!endif
/* example how to enable some additional event routes */
if (is_method("INVITE")) {
#t_on_branch("BRANCH_ONE");
t_on_reply("REPLY_ONE");
t_on_failure("FAIL_ONE");
}
if (!t_relay()) {
sl_reply_error();
}
exit;
}
##storing offline messages
route[MSILO_MESSAGE]{
if (lookup("location")){
t_on_failure("FAIL_MESSAGE");
t_relay();
xlog("L_NOTICE","---------------------------------MI: ($mi), MB: ($mb)\n");
}else{
xlog("L_NOTICE","------------------MESSAGE PROCESSING: location not
found, storing offline message ID: ($ru)\n");
m_store("$ru");
sl_send_reply("202", "ACCEPTED");
xlog("L_NOTICE","------------------MESSAGE PROCESSING: location not
found, stored offline message ID: ($ru)\n");
};
exit;
};
failure_route[FAIL_MESSAGE]{
xlog("L_NOTICE","------------------MESSAGE PROCESSING: user cannot be
reached, storing offline message ID: ($ou)\n");
m_store("$ou");
t_reply("202", "ACCEPTED");
xlog("L_NOTICE","------------------MESSAGE PROCESSING: user cannot be
reached, stored offline message ID: ($ou)\n");
exit;
}
# Per SIP request initial checks
route[REQINIT] {
#!ifdef WITH_ANTIFLOOD
# flood dection from same IP and traffic ban for a while
# be sure you exclude checking trusted peers, such as pstn gateways
# - local host excluded (e.g., loop to self)
if(src_ip!=myself)
{
if($sht(ipban=>$si)!=$null)
{
# ip is already blocked
xdbg("request from blocked IP - $rm from $fu (IP:$si:$sp)\n");
exit;
}
if (!pike_check_req())
{
xlog("L_ALERT","ALERT: pike blocking $rm from $fu (IP:$si:$sp)\n");
$sht(ipban=>$si) = 1;
exit;
}
}
#!endif
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() ) {
# no loose-route, but stateful ACK;
# must be an 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"))
{
if(isflagset(FLT_NATS))
{
setbflag(FLB_NATB);
# uncomment next line to do SIP NAT pinging
setbflag(FLB_NATSIPPING);
}
if (!save("location"))
sl_reply_error();
# MSILO - dumping user's offline messages
m_dump();
log(1,"-------------------------MESSAGE
PROCESSING: dumping offline messages\n");
exit;
}
}
# USER location service
route[LOCATION] {
#!ifdef WITH_ALIASDB
# search in DB-based aliases
alias_db_lookup("dbaliases");
#!endif
if (!lookup("location")) {
switch ($rc) {
t_newtran();
t_reply("404", "Not Found");
exit;
sl_send_reply("405", "Method Not Allowed");
exit;
}
}
# when routing via usrloc, log the missed calls also
if (is_method("INVITE"))
{
setflag(FLT_ACCMISSED);
}
}
# Presence server route
route[PRESENCE] {
if(!is_method("PUBLISH|SUBSCRIBE"))
return;
#!ifdef WITH_PRESENCE
if (!t_newtran())
{
sl_reply_error();
exit;
};
if(is_method("PUBLISH"))
{
handle_publish();
t_release();
}
else
if( is_method("SUBSCRIBE"))
{
handle_subscribe();
t_release();
}
exit;
#!endif
# if presence enabled, this part will not be executed
if (is_method("PUBLISH") || $rU==$null)
{
sl_send_reply("404", "Not here");
exit;
}
return;
}
# Authentication route
route[AUTH] {
#!ifdef WITH_AUTH
if (is_method("REGISTER"))
{
# authenticate the REGISTER requests (uncomment to enable auth)
if (!www_authorize("$td", "subscriber"))
{
www_challenge("$td", "0");
exit;
}
if ($au!=$tU)
{
sl_send_reply("403","Forbidden auth ID");
exit;
}
} else {
#!ifdef WITH_IPAUTH
if(allow_source_address())
{
# source IP allowed
return;
}
#!endif
# authenticate if from local subscriber
if (from_uri==myself)
{
if (!proxy_authorize("$fd", "subscriber")) {
proxy_challenge("$fd", "0");
exit;
}
if (is_method("PUBLISH"))
{
if ($au!=$tU) {
sl_send_reply("403","Forbidden auth ID");
exit;
}
} else {
if ($au!=$fU) {
sl_send_reply("403","Forbidden auth ID");
exit;
}
}
consume_credentials();
# caller authenticated
} else {
# caller is not local subscriber, then check if it calls
# a local destination, otherwise deny, not an open relay here
if (!uri==myself)
{
sl_send_reply("403","Not relaying");
exit;
}
}
}
#!endif
return;
}
# Caller NAT detection route
route[NAT] {
#!ifdef WITH_NAT
force_rport();
if (nat_uac_test("19")) {
if (method=="REGISTER") {
fix_nated_register();
} else {
fix_nated_contact();
}
setflag(FLT_NATS);
}
#!endif
return;
}
# RTPProxy control
route[RTPPROXY] {
#!ifdef WITH_NAT
if (is_method("BYE")) {
unforce_rtp_proxy();
} else if (is_method("INVITE")){
rtpproxy_offer();
}
if (!has_totag()) add_rr_param(";nat=yes");
#!endif
return;
}
# Routing to foreign domains
route[SIPOUT] {
if (!uri==myself)
{
append_hf("P-hint: outbound\r\n");
route(RELAY);
}
}
# PSTN GW routing
route[PSTN] {
#!ifdef WITH_PSTN
# check if PSTN GW IP is defined
if (strempty($sel(cfg_get.pstn.gw_ip))) {
xlog("SCRIPT: PSTN rotuing enabled but pstn.gw_ip not defined\n");
return;
}
# route to PSTN dialed numbers starting with '+' or '00'
# (international format)
# - update the condition to match your dialing rules for PSTN routing
if(!($rU=~"^(\+|00)[1-9][0-9]{3,20}$"))
return;
# only local users allowed to call
if(from_uri!=myself) {
sl_send_reply("403", "Not Allowed");
exit;
}
route(RELAY);
exit;
#!endif
return;
}
# XMLRPC routing
#!ifdef WITH_XMLRPC
route[XMLRPC]
{
# allow XMLRPC from localhost
if ((method=="POST" || method=="GET")
&& (src_ip==127.0.0.1)) {
# close connection only for xmlrpclib user agents (there is a bug in
# xmlrpclib: it waits for EOF before interpreting the response).
if ($hdr(User-Agent) =~ "xmlrpclib")
set_reply_close();
set_reply_no_connect();
dispatch_rpc();
exit;
}
send_reply("403", "Forbidden");
exit;
}
#!endif
# Sample branch router
branch_route[BRANCH_ONE] {
xdbg("new branch at $ru\n");
}
# Sample onreply route
onreply_route[REPLY_ONE] {
xdbg("incoming reply\n");
#!ifdef WITH_NAT
if ((isflagset(FLT_NATS) || isbflagset(FLB_NATB))
&& status=~"(183)|(2[0-9][0-9])") {
rtpproxy_answer();
}
if (isbflagset("6")) {
fix_nated_contact();
}
#!endif
}
# Sample failure route
failure_route[FAIL_ONE] {
#!ifdef WITH_NAT
if (is_method("INVITE")
&& (isbflagset(FLB_NATB) || isflagset(FLT_NATS))) {
unforce_rtp_proxy();
}
#!endif
if (t_is_canceled()) {
exit;
}
# uncomment the following lines if you want to block client
# redirect based on 3xx replies.
##if (t_check_status("3[0-9][0-9]")) {
##t_reply("404","Not found");
## exit;
##}
# uncomment the following lines if you want to redirect the failed
# calls to a different new destination
##if (t_check_status("486|408")) {
## sethostport("192.168.2.100:5060");
## append_branch();
## # do not set the missed call flag again
## t_relay();
##}
}
Post by Peter Villeneuve
Thanks for your help Daniel.
OK I ngrepped port 5060 and indeed the message tries to get delivered.
However it never arrives at the client (1010 in this case).
I have added localhost listeners for UDP and TCP, even though all
clients register through TLS only (could this be the root of the problem?).
I added localhost listeners because I was getting the no socket found error
message.
Listening on
udp: 127.0.0.1:5080
tcp: 127.0.0.1:5060
tls: 79.my.server.IP1:5061
tcp: localhost:5060
udp: localhost:5080
*: my.domain.com:*
U 2014/07/16 15:29:14.904285 127.0.0.1:5080 -> 79.my.server.IP1:5060
Via: SIP/2.0/UDP 127.0.0.1:5080
;branch=z9hG4bKcde3.542219f4000000000000000000000000.0.
Post by Peter Villeneuve
;tag=def4124455da8a0b8e97eafabd028e26-2c30.
CSeq: 10 MESSAGE.
Max-Forwards: 70.
Content-Length: 58.
User-Agent: kamailio (4.1.4 (x86_64/linux)).
Date: Wed, 16 Jul 2014 15:22:31 GMT.
Content-Type: text/plain.
.
[Offline message - Wed Jul 16 15:22:31 2014] Test 1,2,3
On Wed, Jul 16, 2014 at 8:58 AM, Daniel-Constantin Mierla <
Post by Peter Villeneuve
Hello,
can you watch the sip traffic on the network to see if the sip messages
ngrep -d any -qt -W byline "sip" port 5060
Cheers,
Daniel
Hi,
This is most likely a stupid mistake on my route config, but msilo
correctly stores messages for offline users, but when they come back
online, the message never arrives.
Looking through the debug logs indeed there is an error, with status
408, which suggests kamaiio can't find a route to the user that just
logged. Before I spend hours looking through all the routing blocks,
perhaps someone more exprienced in kamailio can see the problem right away
and offer a solution?
Thanks
DEBUG: <core> [io_wait.h:617]: io_watch_del(): DBG: io_watch_del
(0x8e3040, 9, -1, 0x10) fd_no=2 called
DEBUG: <core> [tcp_read.c:1437]: release_tcpconn(): releasing con
0x7f61ced1b1b0, state 1, fd=9, id=1
DEBUG: <core> [tcp_read.c:1438]: release_tcpconn(): extra_data
0x7f61ced1c4f8
reader response= 7f61ced1b1b0, 1 from 0
io_watch_add(0x89ec40, 26, 2, 0x7f61ced1b1b0), fd_no=21
CONN_RELEASE 0x7f61ced1b1b0 refcnt= 1
DEBUG: tm [t_reply.c:1304]: t_should_relay_response(): ->>>>>>>>>
T_code=0, new_code=408
branch=0, save=0, winner=0
DEBUG: tm [t_reply.c:2123]: local_reply(): DEBUG: local transaction
completed
trans=0x7f61ced1d868, callback type 1024, id 0 entered
DEBUG: msilo [msilo.c:1317]: m_tm_callback(): *completed with status
408* [mid: 140058058335472/13]
DEBUG: msilo [msilo.c:1325]: m_tm_callback(): message <13> was not sent
successfully
DEBUG: msilo [ms_msg_list.c:236]: msg_list_set_flag(): mid:13 fl:8
DEBUG: tm [t_reply.c:1304]: t_should_relay_response(): ->>>>>>>>>
T_code=0, new_code=408
branch=0, save=0, winner=0
DEBUG: tm [t_reply.c:2123]: local_reply(): DEBUG: local transaction
completed
trans=0x7f61ced5f098, callback type 1024, id 0 entered
DEBUG: msilo [msilo.c:1317]: m_tm_callback(): completed with status
408 [mid: 140058058329184/12]
DEBUG: msilo [msilo.c:1325]: m_tm_callback(): message <12> was not sent
successfully
DEBUG: msilo [ms_msg_list.c:236]: msg_list_set_flag(): mid:12 fl:8
_______________________________________________
--
Daniel-Constantin Mierla - http://www.asipto.comhttp://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
Peter Villeneuve
2014-07-17 12:10:24 UTC
Permalink
I guess no one really knows why it isn't working either.
The only option I have left seems to be to try and update to the 4.2
nightly and hope that whatever's wrong is a bug with 4.1.4 and not a simple
mistake in my routing syntax or logic.

Daniel, is 4.2 nightly debian package stable enough for a production
system? Would you recommend I upgrade?

Thanks
Post by Peter Villeneuve
Can anyone help please? I was supposed to have this server up and running
hours ago and I can't think of anything to do next to help debug this.
Thanks
Post by Peter Villeneuve
I removed the localhost listeners on TCP and UDP, and, as I suspected,
Kamailio doesn't seem to like that.
Why isn't kamailio sending the message back through the TLS socket?
NOTICE: <script>: -------------------------MESSAGE PROCESSING: dumping offline messages
ERROR: tm [ut.h:343]: uri2dst2(): no corresponding socket for af 2
ERROR: tm [uac.c:266]: t_uac_prepare(): t_uac: no socket found
Post by Peter Villeneuve
And here's the full routing block. I copied it from someone else on the
list that was troubleshooting msilo a while back.
Also, I can confirm the message never gets delivered because it remains
in msilo DB and kamailio logs shows it trying and trying.
####### Routing Logic ########
# Main SIP request routing logic
# - processing of any incoming SIP request starts with this route
route {
# per request initial checks
route(REQINIT);
# NAT detection
route(NAT);
# handle requests within SIP dialogs
route(WITHINDLG);
### only initial requests (no To tag)
# CANCEL processing
if (is_method("CANCEL"))
{
if (t_check_trans())
t_relay();
exit;
}
if (is_method("MESSAGE"))
{
log(1,"-------------------------------------------------------->WE HAVE A
NEW MESSAGE\n");
route(MSILO_MESSAGE);
}
t_check_trans();
# authentication
route(AUTH);
# 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
}
# dispatch requests to foreign domains
route(SIPOUT);
### requests for my local domains
# 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 to PSTN
route(PSTN);
# user location service
route(LOCATION);
route(RELAY);
}
route[RELAY] {
#!ifdef WITH_NAT
if (check_route_param("nat=yes")) {
setbflag(FLB_NATB);
}
if (isflagset(FLT_NATS) || isbflagset(FLB_NATB)) {
route(RTPPROXY);
}
#!endif
/* example how to enable some additional event routes */
if (is_method("INVITE")) {
#t_on_branch("BRANCH_ONE");
t_on_reply("REPLY_ONE");
t_on_failure("FAIL_ONE");
}
if (!t_relay()) {
sl_reply_error();
}
exit;
}
##storing offline messages
route[MSILO_MESSAGE]{
if (lookup("location")){
t_on_failure("FAIL_MESSAGE");
t_relay();
xlog("L_NOTICE","---------------------------------MI: ($mi), MB: ($mb)\n");
}else{
xlog("L_NOTICE","------------------MESSAGE PROCESSING: location not
found, storing offline message ID: ($ru)\n");
m_store("$ru");
sl_send_reply("202", "ACCEPTED");
xlog("L_NOTICE","------------------MESSAGE PROCESSING: location not
found, stored offline message ID: ($ru)\n");
};
exit;
};
failure_route[FAIL_MESSAGE]{
xlog("L_NOTICE","------------------MESSAGE PROCESSING: user cannot
be reached, storing offline message ID: ($ou)\n");
m_store("$ou");
t_reply("202", "ACCEPTED");
xlog("L_NOTICE","------------------MESSAGE PROCESSING: user cannot
be reached, stored offline message ID: ($ou)\n");
exit;
}
# Per SIP request initial checks
route[REQINIT] {
#!ifdef WITH_ANTIFLOOD
# flood dection from same IP and traffic ban for a while
# be sure you exclude checking trusted peers, such as pstn gateways
# - local host excluded (e.g., loop to self)
if(src_ip!=myself)
{
if($sht(ipban=>$si)!=$null)
{
# ip is already blocked
xdbg("request from blocked IP - $rm from $fu (IP:$si:$sp)\n");
exit;
}
if (!pike_check_req())
{
xlog("L_ALERT","ALERT: pike blocking $rm from $fu (IP:$si:$sp)\n");
$sht(ipban=>$si) = 1;
exit;
}
}
#!endif
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() ) {
# no loose-route, but stateful ACK;
# must be an 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"))
{
if(isflagset(FLT_NATS))
{
setbflag(FLB_NATB);
# uncomment next line to do SIP NAT pinging
setbflag(FLB_NATSIPPING);
}
if (!save("location"))
sl_reply_error();
# MSILO - dumping user's offline messages
m_dump();
log(1,"-------------------------MESSAGE
PROCESSING: dumping offline messages\n");
exit;
}
}
# USER location service
route[LOCATION] {
#!ifdef WITH_ALIASDB
# search in DB-based aliases
alias_db_lookup("dbaliases");
#!endif
if (!lookup("location")) {
switch ($rc) {
t_newtran();
t_reply("404", "Not Found");
exit;
sl_send_reply("405", "Method Not Allowed");
exit;
}
}
# when routing via usrloc, log the missed calls also
if (is_method("INVITE"))
{
setflag(FLT_ACCMISSED);
}
}
# Presence server route
route[PRESENCE] {
if(!is_method("PUBLISH|SUBSCRIBE"))
return;
#!ifdef WITH_PRESENCE
if (!t_newtran())
{
sl_reply_error();
exit;
};
if(is_method("PUBLISH"))
{
handle_publish();
t_release();
}
else
if( is_method("SUBSCRIBE"))
{
handle_subscribe();
t_release();
}
exit;
#!endif
# if presence enabled, this part will not be executed
if (is_method("PUBLISH") || $rU==$null)
{
sl_send_reply("404", "Not here");
exit;
}
return;
}
# Authentication route
route[AUTH] {
#!ifdef WITH_AUTH
if (is_method("REGISTER"))
{
# authenticate the REGISTER requests (uncomment to enable auth)
if (!www_authorize("$td", "subscriber"))
{
www_challenge("$td", "0");
exit;
}
if ($au!=$tU)
{
sl_send_reply("403","Forbidden auth ID");
exit;
}
} else {
#!ifdef WITH_IPAUTH
if(allow_source_address())
{
# source IP allowed
return;
}
#!endif
# authenticate if from local subscriber
if (from_uri==myself)
{
if (!proxy_authorize("$fd", "subscriber")) {
proxy_challenge("$fd", "0");
exit;
}
if (is_method("PUBLISH"))
{
if ($au!=$tU) {
sl_send_reply("403","Forbidden auth ID");
exit;
}
} else {
if ($au!=$fU) {
sl_send_reply("403","Forbidden auth ID");
exit;
}
}
consume_credentials();
# caller authenticated
} else {
# caller is not local subscriber, then check if it calls
# a local destination, otherwise deny, not an open relay here
if (!uri==myself)
{
sl_send_reply("403","Not relaying");
exit;
}
}
}
#!endif
return;
}
# Caller NAT detection route
route[NAT] {
#!ifdef WITH_NAT
force_rport();
if (nat_uac_test("19")) {
if (method=="REGISTER") {
fix_nated_register();
} else {
fix_nated_contact();
}
setflag(FLT_NATS);
}
#!endif
return;
}
# RTPProxy control
route[RTPPROXY] {
#!ifdef WITH_NAT
if (is_method("BYE")) {
unforce_rtp_proxy();
} else if (is_method("INVITE")){
rtpproxy_offer();
}
if (!has_totag()) add_rr_param(";nat=yes");
#!endif
return;
}
# Routing to foreign domains
route[SIPOUT] {
if (!uri==myself)
{
append_hf("P-hint: outbound\r\n");
route(RELAY);
}
}
# PSTN GW routing
route[PSTN] {
#!ifdef WITH_PSTN
# check if PSTN GW IP is defined
if (strempty($sel(cfg_get.pstn.gw_ip))) {
xlog("SCRIPT: PSTN rotuing enabled but pstn.gw_ip not defined\n");
return;
}
# route to PSTN dialed numbers starting with '+' or '00'
# (international format)
# - update the condition to match your dialing rules for PSTN routing
if(!($rU=~"^(\+|00)[1-9][0-9]{3,20}$"))
return;
# only local users allowed to call
if(from_uri!=myself) {
sl_send_reply("403", "Not Allowed");
exit;
}
route(RELAY);
exit;
#!endif
return;
}
# XMLRPC routing
#!ifdef WITH_XMLRPC
route[XMLRPC]
{
# allow XMLRPC from localhost
if ((method=="POST" || method=="GET")
&& (src_ip==127.0.0.1)) {
# close connection only for xmlrpclib user agents (there is a bug in
# xmlrpclib: it waits for EOF before interpreting the response).
if ($hdr(User-Agent) =~ "xmlrpclib")
set_reply_close();
set_reply_no_connect();
dispatch_rpc();
exit;
}
send_reply("403", "Forbidden");
exit;
}
#!endif
# Sample branch router
branch_route[BRANCH_ONE] {
xdbg("new branch at $ru\n");
}
# Sample onreply route
onreply_route[REPLY_ONE] {
xdbg("incoming reply\n");
#!ifdef WITH_NAT
if ((isflagset(FLT_NATS) || isbflagset(FLB_NATB))
&& status=~"(183)|(2[0-9][0-9])") {
rtpproxy_answer();
}
if (isbflagset("6")) {
fix_nated_contact();
}
#!endif
}
# Sample failure route
failure_route[FAIL_ONE] {
#!ifdef WITH_NAT
if (is_method("INVITE")
&& (isbflagset(FLB_NATB) || isflagset(FLT_NATS))) {
unforce_rtp_proxy();
}
#!endif
if (t_is_canceled()) {
exit;
}
# uncomment the following lines if you want to block client
# redirect based on 3xx replies.
##if (t_check_status("3[0-9][0-9]")) {
##t_reply("404","Not found");
## exit;
##}
# uncomment the following lines if you want to redirect the failed
# calls to a different new destination
##if (t_check_status("486|408")) {
## sethostport("192.168.2.100:5060");
## append_branch();
## # do not set the missed call flag again
## t_relay();
##}
}
Post by Peter Villeneuve
Thanks for your help Daniel.
OK I ngrepped port 5060 and indeed the message tries to get delivered.
However it never arrives at the client (1010 in this case).
I have added localhost listeners for UDP and TCP, even though all
clients register through TLS only (could this be the root of the problem?).
I added localhost listeners because I was getting the no socket found error
message.
Listening on
udp: 127.0.0.1:5080
tcp: 127.0.0.1:5060
tls: 79.my.server.IP1:5061
tcp: localhost:5060
udp: localhost:5080
*: my.domain.com:*
U 2014/07/16 15:29:14.904285 127.0.0.1:5080 -> 79.my.server.IP1:5060
Via: SIP/2.0/UDP 127.0.0.1:5080
;branch=z9hG4bKcde3.542219f4000000000000000000000000.0.
Post by Peter Villeneuve
;tag=def4124455da8a0b8e97eafabd028e26-2c30.
CSeq: 10 MESSAGE.
Max-Forwards: 70.
Content-Length: 58.
User-Agent: kamailio (4.1.4 (x86_64/linux)).
Date: Wed, 16 Jul 2014 15:22:31 GMT.
Content-Type: text/plain.
.
[Offline message - Wed Jul 16 15:22:31 2014] Test 1,2,3
On Wed, Jul 16, 2014 at 8:58 AM, Daniel-Constantin Mierla <
Post by Peter Villeneuve
Hello,
can you watch the sip traffic on the network to see if the sip
ngrep -d any -qt -W byline "sip" port 5060
Cheers,
Daniel
Hi,
This is most likely a stupid mistake on my route config, but msilo
correctly stores messages for offline users, but when they come back
online, the message never arrives.
Looking through the debug logs indeed there is an error, with status
408, which suggests kamaiio can't find a route to the user that just
logged. Before I spend hours looking through all the routing blocks,
perhaps someone more exprienced in kamailio can see the problem right away
and offer a solution?
Thanks
DEBUG: <core> [io_wait.h:617]: io_watch_del(): DBG: io_watch_del
(0x8e3040, 9, -1, 0x10) fd_no=2 called
DEBUG: <core> [tcp_read.c:1437]: release_tcpconn(): releasing con
0x7f61ced1b1b0, state 1, fd=9, id=1
DEBUG: <core> [tcp_read.c:1438]: release_tcpconn(): extra_data
0x7f61ced1c4f8
reader response= 7f61ced1b1b0, 1 from 0
io_watch_add(0x89ec40, 26, 2, 0x7f61ced1b1b0), fd_no=21
CONN_RELEASE 0x7f61ced1b1b0 refcnt= 1
DEBUG: tm [t_reply.c:1304]: t_should_relay_response(): ->>>>>>>>>
T_code=0, new_code=408
branch=0, save=0, winner=0
DEBUG: tm [t_reply.c:2123]: local_reply(): DEBUG: local transaction
completed
trans=0x7f61ced1d868, callback type 1024, id 0 entered
DEBUG: msilo [msilo.c:1317]: m_tm_callback(): *completed with status
408* [mid: 140058058335472/13]
DEBUG: msilo [msilo.c:1325]: m_tm_callback(): message <13> was not
sent successfully
DEBUG: msilo [ms_msg_list.c:236]: msg_list_set_flag(): mid:13 fl:8
DEBUG: tm [t_reply.c:1304]: t_should_relay_response(): ->>>>>>>>>
T_code=0, new_code=408
branch=0, save=0, winner=0
DEBUG: tm [t_reply.c:2123]: local_reply(): DEBUG: local transaction
completed
trans=0x7f61ced5f098, callback type 1024, id 0 entered
DEBUG: msilo [msilo.c:1317]: m_tm_callback(): completed with status
408 [mid: 140058058329184/12]
DEBUG: msilo [msilo.c:1325]: m_tm_callback(): message <12> was not
sent successfully
DEBUG: msilo [ms_msg_list.c:236]: msg_list_set_flag(): mid:12 fl:8
_______________________________________________
--
Daniel-Constantin Mierla - http://www.asipto.comhttp://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
Daniel-Constantin Mierla
2014-07-17 12:22:06 UTC
Permalink
I don't remember any relevant updates to msilo lately. So it should be
the same.

Unfortunately the heavy traveling I had lately added a lot of load for
the moment to properly investigate you case. But msilo is running fine
on many installations here, so I expect to be some problem with the config.

I haven't seen any sip trace taken on the server, which I asked, iirc.
Did you monitored the loopback interface?

You can try to set the outbound proxy address to the kamailio's ip and port:

http://kamailio.org/docs/modules/stable/modules/msilo.html#idp121032

Then see what happens on the network interface.

Cheers,
Daniel
Post by Peter Villeneuve
I guess no one really knows why it isn't working either.
The only option I have left seems to be to try and update to the 4.2
nightly and hope that whatever's wrong is a bug with 4.1.4 and not a
simple mistake in my routing syntax or logic.
Daniel, is 4.2 nightly debian package stable enough for a production
system? Would you recommend I upgrade?
Thanks
Can anyone help please? I was supposed to have this server up and
running hours ago and I can't think of anything to do next to help
debug this.
Thanks
On Wed, Jul 16, 2014 at 7:01 PM, Peter Villeneuve
I removed the localhost listeners on TCP and UDP, and, as I
suspected, Kamailio doesn't seem to like that.
Why isn't kamailio sending the message back through the TLS socket?
NOTICE: <script>: -------------------------MESSAGE PROCESSING: dumping offline messages
ERROR: tm [ut.h:343]: uri2dst2(): no corresponding socket for af 2
ERROR: tm [uac.c:266]: t_uac_prepare(): t_uac: no socket found
On Wed, Jul 16, 2014 at 4:44 PM, Peter Villeneuve
And here's the full routing block. I copied it from
someone else on the list that was troubleshooting msilo a
while back.
Also, I can confirm the message never gets delivered
because it remains in msilo DB and kamailio logs shows it
trying and trying.
####### Routing Logic ########
# Main SIP request routing logic
# - processing of any incoming SIP request starts with this route
route {
# per request initial checks
route(REQINIT);
# NAT detection
route(NAT);
# handle requests within SIP dialogs
route(WITHINDLG);
### only initial requests (no To tag)
# CANCEL processing
if (is_method("CANCEL"))
{
if (t_check_trans())
t_relay();
exit;
}
if (is_method("MESSAGE"))
{
log(1,"-------------------------------------------------------->WE
HAVE A NEW MESSAGE\n");
route(MSILO_MESSAGE);
}
t_check_trans();
# authentication
route(AUTH);
# 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
}
# dispatch requests to foreign domains
route(SIPOUT);
### requests for my local domains
# 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 to PSTN
route(PSTN);
# user location service
route(LOCATION);
route(RELAY);
}
route[RELAY] {
#!ifdef WITH_NAT
if (check_route_param("nat=yes")) {
setbflag(FLB_NATB);
}
if (isflagset(FLT_NATS) || isbflagset(FLB_NATB)) {
route(RTPPROXY);
}
#!endif
/* example how to enable some additional event routes */
if (is_method("INVITE")) {
#t_on_branch("BRANCH_ONE");
t_on_reply("REPLY_ONE");
t_on_failure("FAIL_ONE");
}
if (!t_relay()) {
sl_reply_error();
}
exit;
}
##storing offline messages
route[MSILO_MESSAGE]{
if (lookup("location")){
t_on_failure("FAIL_MESSAGE");
t_relay();
($mi), MB: ($mb)\n");
}else{
location not found, storing offline message ID: ($ru)\n");
m_store("$ru");
sl_send_reply("202", "ACCEPTED");
location not found, stored offline message ID: ($ru)\n");
};
exit;
};
failure_route[FAIL_MESSAGE]{
user cannot be reached, storing offline message ID: ($ou)\n");
m_store("$ou");
t_reply("202", "ACCEPTED");
user cannot be reached, stored offline message ID: ($ou)\n");
exit;
}
# Per SIP request initial checks
route[REQINIT] {
#!ifdef WITH_ANTIFLOOD
# flood dection from same IP and traffic ban for a while
# be sure you exclude checking trusted peers, such as pstn gateways
# - local host excluded (e.g., loop to self)
if(src_ip!=myself)
{
if($sht(ipban=>$si)!=$null)
{
# ip is already blocked
xdbg("request from blocked IP - $rm from $fu (IP:$si:$sp)\n");
exit;
}
if (!pike_check_req())
{
xlog("L_ALERT","ALERT: pike blocking $rm from $fu
(IP:$si:$sp)\n");
$sht(ipban=>$si) = 1;
exit;
}
}
#!endif
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() ) {
# no loose-route, but stateful ACK;
# must be an 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"))
{
if(isflagset(FLT_NATS))
{
setbflag(FLB_NATB);
# uncomment next line to do SIP NAT pinging
setbflag(FLB_NATSIPPING);
}
if (!save("location"))
sl_reply_error();
# MSILO - dumping user's offline messages
m_dump();
dumping offline messages\n");
exit;
}
}
# USER location service
route[LOCATION] {
#!ifdef WITH_ALIASDB
# search in DB-based aliases
alias_db_lookup("dbaliases");
#!endif
if (!lookup("location")) {
switch ($rc) {
t_newtran();
t_reply("404", "Not Found");
exit;
sl_send_reply("405", "Method Not Allowed");
exit;
}
}
# when routing via usrloc, log the missed calls also
if (is_method("INVITE"))
{
setflag(FLT_ACCMISSED);
}
}
# Presence server route
route[PRESENCE] {
if(!is_method("PUBLISH|SUBSCRIBE"))
return;
#!ifdef WITH_PRESENCE
if (!t_newtran())
{
sl_reply_error();
exit;
};
if(is_method("PUBLISH"))
{
handle_publish();
t_release();
}
else
if( is_method("SUBSCRIBE"))
{
handle_subscribe();
t_release();
}
exit;
#!endif
# if presence enabled, this part will not be executed
if (is_method("PUBLISH") || $rU==$null)
{
sl_send_reply("404", "Not here");
exit;
}
return;
}
# Authentication route
route[AUTH] {
#!ifdef WITH_AUTH
if (is_method("REGISTER"))
{
# authenticate the REGISTER requests (uncomment to enable auth)
if (!www_authorize("$td", "subscriber"))
{
www_challenge("$td", "0");
exit;
}
if ($au!=$tU)
{
sl_send_reply("403","Forbidden auth ID");
exit;
}
} else {
#!ifdef WITH_IPAUTH
if(allow_source_address())
{
# source IP allowed
return;
}
#!endif
# authenticate if from local subscriber
if (from_uri==myself)
{
if (!proxy_authorize("$fd", "subscriber")) {
proxy_challenge("$fd", "0");
exit;
}
if (is_method("PUBLISH"))
{
if ($au!=$tU) {
sl_send_reply("403","Forbidden auth ID");
exit;
}
} else {
if ($au!=$fU) {
sl_send_reply("403","Forbidden auth ID");
exit;
}
}
consume_credentials();
# caller authenticated
} else {
# caller is not local subscriber, then check if it calls
# a local destination, otherwise deny, not an open relay here
if (!uri==myself)
{
sl_send_reply("403","Not relaying");
exit;
}
}
}
#!endif
return;
}
# Caller NAT detection route
route[NAT] {
#!ifdef WITH_NAT
force_rport();
if (nat_uac_test("19")) {
if (method=="REGISTER") {
fix_nated_register();
} else {
fix_nated_contact();
}
setflag(FLT_NATS);
}
#!endif
return;
}
# RTPProxy control
route[RTPPROXY] {
#!ifdef WITH_NAT
if (is_method("BYE")) {
unforce_rtp_proxy();
} else if (is_method("INVITE")){
rtpproxy_offer();
}
if (!has_totag()) add_rr_param(";nat=yes");
#!endif
return;
}
# Routing to foreign domains
route[SIPOUT] {
if (!uri==myself)
{
append_hf("P-hint: outbound\r\n");
route(RELAY);
}
}
# PSTN GW routing
route[PSTN] {
#!ifdef WITH_PSTN
# check if PSTN GW IP is defined
if (strempty($sel(cfg_get.pstn.gw_ip))) {
xlog("SCRIPT: PSTN rotuing enabled but pstn.gw_ip not defined\n");
return;
}
# route to PSTN dialed numbers starting with '+' or '00'
# (international format)
# - update the condition to match your dialing rules for
PSTN routing
if(!($rU=~"^(\+|00)[1-9][0-9]{3,20}$"))
return;
# only local users allowed to call
if(from_uri!=myself) {
sl_send_reply("403", "Not Allowed");
exit;
}
route(RELAY);
exit;
#!endif
return;
}
# XMLRPC routing
#!ifdef WITH_XMLRPC
route[XMLRPC]
{
# allow XMLRPC from localhost
if ((method=="POST" || method=="GET")
&& (src_ip==127.0.0.1)) {
# close connection only for xmlrpclib user agents (there
is a bug in
# xmlrpclib: it waits for EOF before interpreting the response).
if ($hdr(User-Agent) =~ "xmlrpclib")
set_reply_close();
set_reply_no_connect();
dispatch_rpc();
exit;
}
send_reply("403", "Forbidden");
exit;
}
#!endif
# Sample branch router
branch_route[BRANCH_ONE] {
xdbg("new branch at $ru\n");
}
# Sample onreply route
onreply_route[REPLY_ONE] {
xdbg("incoming reply\n");
#!ifdef WITH_NAT
if ((isflagset(FLT_NATS) || isbflagset(FLB_NATB))
&& status=~"(183)|(2[0-9][0-9])") {
rtpproxy_answer();
}
if (isbflagset("6")) {
fix_nated_contact();
}
#!endif
}
# Sample failure route
failure_route[FAIL_ONE] {
#!ifdef WITH_NAT
if (is_method("INVITE")
&& (isbflagset(FLB_NATB) || isflagset(FLT_NATS))) {
unforce_rtp_proxy();
}
#!endif
if (t_is_canceled()) {
exit;
}
# uncomment the following lines if you want to block client
# redirect based on 3xx replies.
##if (t_check_status("3[0-9][0-9]")) {
##t_reply("404","Not found");
##exit;
##}
# uncomment the following lines if you want to redirect the failed
# calls to a different new destination
##if (t_check_status("486|408")) {
##sethostport("192.168.2.100:5060
<http://192.168.2.100:5060>");
##append_branch();
### do not set the missed call flag again
##t_relay();
##}
}
On Wed, Jul 16, 2014 at 4:38 PM, Peter Villeneuve
Thanks for your help Daniel.
OK I ngrepped port 5060 and indeed the message tries
to get delivered. However it never arrives at the
client (1010 in this case).
I have added localhost listeners for UDP and TCP, even
though all clients register through TLS only (could
this be the root of the problem?). I added localhost
listeners because I was getting the no socket found
error message.
Listening on
udp: 127.0.0.1:5080 <http://127.0.0.1:5080>
tcp: 127.0.0.1:5060 <http://127.0.0.1:5060>
tls: 79.my.server.IP1:5061
tcp: localhost:5060
udp: localhost:5080
*: my.domain.com:*
U 2014/07/16 15:29:14.904285 127.0.0.1:5080
<http://127.0.0.1:5080> -> 79.my.server.IP1:5060
Via: SIP/2.0/UDP
127.0.0.1:5080;branch=z9hG4bKcde3.542219f4000000000000000000000000.0.
CSeq: 10 MESSAGE.
Max-Forwards: 70.
Content-Length: 58.
User-Agent: kamailio (4.1.4 (x86_64/linux)).
Date: Wed, 16 Jul 2014 15:22:31 GMT.
Content-Type: text/plain.
.
[Offline message - Wed Jul 16 15:22:31 2014] Test 1,2,3
On Wed, Jul 16, 2014 at 8:58 AM, Daniel-Constantin
Hello,
can you watch the sip traffic on the network to
see if the sip messages is sent out? You can use
ngrep -d any -qt -W byline "sip" port 5060
Cheers,
Daniel
Post by Peter Villeneuve
Hi,
This is most likely a stupid mistake on my route
config, but msilo correctly stores messages for
offline users, but when they come back online,
the message never arrives.
Looking through the debug logs indeed there is an
error, with status 408, which suggests kamaiio
can't find a route to the user that just logged.
Before I spend hours looking through all the
routing blocks, perhaps someone more exprienced
in kamailio can see the problem right away and
offer a solution?
Thanks
DEBUG: msilo [msilo.c:1148]: m_dump(): msg [1-12]
DBG: io_watch_del (0x8e3040, 9, -1, 0x10) fd_no=2
called
release_tcpconn(): releasing con 0x7f61ced1b1b0,
state 1, fd=9, id=1
release_tcpconn(): extra_data 0x7f61ced1c4f8
handle_tcp_child(): handle_tcp_child: reader
response= 7f61ced1b1b0, 1 from 0
DBG: io_watch_add(0x89ec40, 26, 2,
0x7f61ced1b1b0), fd_no=21
CONN_RELEASE 0x7f61ced1b1b0 refcnt= 1
t_should_relay_response(): ->>>>>>>>> T_code=0,
new_code=408
local_reply: branch=0, save=0, winner=0
local transaction completed
trans=0x7f61ced1d868, callback type 1024, id 0
entered
*completed with status 408* [mid: 140058058335472/13]
message <13> was not sent successfully
msg_list_set_flag(): mid:13 fl:8
t_should_relay_response(): ->>>>>>>>> T_code=0,
new_code=408
local_reply: branch=0, save=0, winner=0
local transaction completed
trans=0x7f61ced5f098, callback type 1024, id 0
entered
completed with status 408 [mid: 140058058329184/12]
message <12> was not sent successfully
msg_list_set_flag(): mid:12 fl:8
_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
--
Daniel-Constantin Mierla -http://www.asipto.com
http://twitter.com/#!/miconda <http://twitter.com/#%21/miconda> -http://www.linkedin.com/in/miconda
_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) -
sr-users mailing list
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
--
Daniel-Constantin Mierla - http://www.asipto.com
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Waite, Hugh
2014-07-17 14:11:08 UTC
Permalink
Hi,
We did have a working msilo implementation a while back, but we don’t use it any more, so I can only look back at the config files (which are a lot more complicated than yours).

We added the a modparam modparam("msilo", "outbound_proxy", "sip:MY_REAL_IP:MY_SIP_PORT;transport=tcp")
which will make it arrive on the local machine on the given socket (instead of localhost) to be processed, but that probably isn’t your problem.

Is it possible that Kamailio is trying to establish a new connection, instead of reusing the existing connection to the client? That would be visible as TCP SYNs in a trace and would cause a 408 after the timeout. We are using a separate outbound enabled edge proxy so this isn’t a problem for us.

Regards,
Hugh


From: sr-users-***@lists.sip-router.org [mailto:sr-users-***@lists.sip-router.org] On Behalf Of Peter Villeneuve
Sent: 17 July 2014 13:10
To: Daniel-Constantin Mierla; Kamailio (SER) - Users Mailing List
Subject: Re: [SR-Users] Msilo not delivering message (status 408)

I guess no one really knows why it isn't working either.
The only option I have left seems to be to try and update to the 4.2 nightly and hope that whatever's wrong is a bug with 4.1.4 and not a simple mistake in my routing syntax or logic.

Daniel, is 4.2 nightly debian package stable enough for a production system? Would you recommend I upgrade?

Thanks

On Wed, Jul 16, 2014 at 9:37 PM, Peter Villeneuve <***@gmail.com<mailto:***@gmail.com>> wrote:
Can anyone help please? I was supposed to have this server up and running hours ago and I can't think of anything to do next to help debug this.

Thanks

On Wed, Jul 16, 2014 at 7:01 PM, Peter Villeneuve <***@gmail.com<mailto:***@gmail.com>> wrote:
I removed the localhost listeners on TCP and UDP, and, as I suspected, Kamailio doesn't seem to like that.
Why isn't kamailio sending the message back through the TLS socket?



NOTICE: <script>: -------------------------MESSAGE PROCESSING: dumping offline messages

ERROR: tm [ut.h:343]: uri2dst2(): no corresponding socket for af 2

ERROR: tm [uac.c:266]: t_uac_prepare(): t_uac: no socket found

On Wed, Jul 16, 2014 at 4:44 PM, Peter Villeneuve <***@gmail.com<mailto:***@gmail.com>> wrote:
And here's the full routing block. I copied it from someone else on the list that was troubleshooting msilo a while back.
Also, I can confirm the message never gets delivered because it remains in msilo DB and kamailio logs shows it trying and trying.


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



On Wed, Jul 16, 2014 at 4:38 PM, Peter Villeneuve <***@gmail.com<mailto:***@gmail.com>> wrote:
Thanks for your help Daniel.

OK I ngrepped port 5060 and indeed the message tries to get delivered. However it never arrives at the client (1010 in this case).
I have added localhost listeners for UDP and TCP, even though all clients register through TLS only (could this be the root of the problem?). I added localhost listeners because I was getting the no socket found error message.

Listening on
udp: 127.0.0.1:5080<http://127.0.0.1:5080>
tcp: 127.0.0.1:5060<http://127.0.0.1:5060>
tls: 79.my.server.IP1:5061
Aliases:
tcp: localhost:5060
udp: localhost:5080
*: my.domain.com:*

U 2014/07/16 15:29:14.904285 127.0.0.1:5080<http://127.0.0.1:5080> -> 79.my.server.IP1:5060
MESSAGE sip:***@my.domain.com<mailto:sip%***@my.domain.com> SIP/2.0.
Via: SIP/2.0/UDP 127.0.0.1:5080;branch=z9hG4bKcde3.542219f4000000000000000000000000.0.
To: <sip:***@my.domain.com<mailto:sip%***@my.domain.com>>.
From: <sip:***@my.domain.com<mailto:sip%***@my.domain.com>>;tag=def4124455da8a0b8e97eafabd028e26-2c30.
CSeq: 10 MESSAGE.
Call-ID: 16b126996f51d89c-***@127.0.0.1<mailto:16b126996f51d89c-***@127.0.0.1>.
Max-Forwards: 70.
Content-Length: 58.
User-Agent: kamailio (4.1.4 (x86_64/linux)).
Date: Wed, 16 Jul 2014 15:22:31 GMT.
Content-Type: text/plain.
.
[Offline message - Wed Jul 16 15:22:31 2014] Test 1,2,3

On Wed, Jul 16, 2014 at 8:58 AM, Daniel-Constantin Mierla <***@gmail.com<mailto:***@gmail.com>> wrote:
Hello,

can you watch the sip traffic on the network to see if the sip messages is sent out? You can use ngrep, like:

ngrep -d any -qt -W byline "sip" port 5060

Cheers,
Daniel

On 14/07/14 19:56, Peter Villeneuve wrote:
Hi,

This is most likely a stupid mistake on my route config, but msilo correctly stores messages for offline users, but when they come back online, the message never arrives.

Looking through the debug logs indeed there is an error, with status 408, which suggests kamaiio can't find a route to the user that just logged. Before I spend hours looking through all the routing blocks, perhaps someone more exprienced in kamailio can see the problem right away and offer a solution?

Thanks


DEBUG: msilo [msilo.c:1148]: m_dump(): msg [1-12] for: sip:***@my.domain.com<mailto:sip%***@my.domain.com>
DEBUG: <core> [io_wait.h:617]: io_watch_del(): DBG: io_watch_del (0x8e3040, 9, -1, 0x10) fd_no=2 called
DEBUG: <core> [tcp_read.c:1437]: release_tcpconn(): releasing con 0x7f61ced1b1b0, state 1, fd=9, id=1
DEBUG: <core> [tcp_read.c:1438]: release_tcpconn(): extra_data 0x7f61ced1c4f8
DEBUG: <core> [tcp_main.c:3385]: handle_tcp_child(): handle_tcp_child: reader response= 7f61ced1b1b0, 1 from 0
DEBUG: <core> [io_wait.h:390]: io_watch_add(): DBG: io_watch_add(0x89ec40, 26, 2, 0x7f61ced1b1b0), fd_no=21
DEBUG: <core> [tcp_main.c:3515]: handle_tcp_child(): handle_tcp_child: CONN_RELEASE 0x7f61ced1b1b0 refcnt= 1
DEBUG: tm [t_reply.c:1304]: t_should_relay_response(): ->>>>>>>>> T_code=0, new_code=408
DEBUG: tm [t_reply.c:2086]: local_reply(): DEBUG: local_reply: branch=0, save=0, winner=0
DEBUG: tm [t_reply.c:2123]: local_reply(): DEBUG: local transaction completed
DEBUG: tm [t_hooks.c:288]: run_trans_callbacks_internal(): DBG: trans=0x7f61ced1d868, callback type 1024, id 0 entered
DEBUG: msilo [msilo.c:1317]: m_tm_callback(): completed with status 408 [mid: 140058058335472/13]
DEBUG: msilo [msilo.c:1325]: m_tm_callback(): message <13> was not sent successfully
DEBUG: msilo [ms_msg_list.c:236]: msg_list_set_flag(): mid:13 fl:8
DEBUG: tm [t_reply.c:1304]: t_should_relay_response(): ->>>>>>>>> T_code=0, new_code=408
DEBUG: tm [t_reply.c:2086]: local_reply(): DEBUG: local_reply: branch=0, save=0, winner=0
DEBUG: tm [t_reply.c:2123]: local_reply(): DEBUG: local transaction completed
DEBUG: tm [t_hooks.c:288]: run_trans_callbacks_internal(): DBG: trans=0x7f61ced5f098, callback type 1024, id 0 entered
DEBUG: msilo [msilo.c:1317]: m_tm_callback(): completed with status 408 [mid: 140058058329184/12]
DEBUG: msilo [msilo.c:1325]: m_tm_callback(): message <12> was not sent successfully
DEBUG: msilo [ms_msg_list.c:236]: msg_list_set_flag(): mid:12 fl:8




_______________________________________________

SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list

sr-***@lists.sip-router.org<mailto:sr-***@lists.sip-router.org>

http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
--
Daniel-Constantin Mierla - http://www.asipto.com

http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda

_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-***@lists.sip-router.org<mailto:sr-***@lists.sip-router.org>
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users





________________________________
This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you for understanding.
Peter Villeneuve
2014-07-17 14:35:08 UTC
Permalink
Thanks for helping out Hugh (and obviously Daniel)

I have made some progress by adding the modparam ("msilo",
"outbound_proxy", "sip:my.domain.com:5061;transport=tls").
Now indeed the stored message gets delivered when a UAC registers.

But I just noticed that it was also filling up msilo db with "user xxx is
offline!" messages, instead of sending that msg to the initial UAC sending
the msg.
This likely means I'm doing something wrong with the routing, as it feels
like it's in an endless loop. I think Daniel earlier suggested adding if(src_ip
!= myself) t_on_failure("FAIL_MESSAGE") to another poster that was having
trouble with the exact same routing config, but I'm not sure exactly where
to insert it.

Can someone experienced with the routing syntax point out my - likely
obvious - mistake?

Cheers,
Peter
Post by Waite, Hugh
Hi,
We did have a working msilo implementation a while back, but we don’t use
it any more, so I can only look back at the config files (which are a lot
more complicated than yours).
We added the a modparam *modparam("msilo", "outbound_proxy",
"sip:MY_REAL_IP:MY_SIP_PORT;transport=tcp")*
which will make it arrive on the local machine on the given socket
(instead of localhost) to be processed, but that probably isn’t your
problem.
Is it possible that Kamailio is trying to establish a new connection,
instead of reusing the existing connection to the client? That would be
visible as TCP SYNs in a trace and would cause a 408 after the timeout. We
are using a separate outbound enabled edge proxy so this isn’t a problem
for us.
Regards,
Hugh
*Sent:* 17 July 2014 13:10
*To:* Daniel-Constantin Mierla; Kamailio (SER) - Users Mailing List
*Subject:* Re: [SR-Users] Msilo not delivering message (status 408)
I guess no one really knows why it isn't working either.
The only option I have left seems to be to try and update to the 4.2
nightly and hope that whatever's wrong is a bug with 4.1.4 and not a simple
mistake in my routing syntax or logic.
Daniel, is 4.2 nightly debian package stable enough for a production
system? Would you recommend I upgrade?
Thanks
Can anyone help please? I was supposed to have this server up and running
hours ago and I can't think of anything to do next to help debug this.
Thanks
I removed the localhost listeners on TCP and UDP, and, as I suspected,
Kamailio doesn't seem to like that.
Why isn't kamailio sending the message back through the TLS socket?
NOTICE: <script>: -------------------------MESSAGE PROCESSING: dumping offline messages
ERROR: tm [ut.h:343]: uri2dst2(): no corresponding socket for af 2
ERROR: tm [uac.c:266]: t_uac_prepare(): t_uac: no socket found
And here's the full routing block. I copied it from someone else on the
list that was troubleshooting msilo a while back.
Also, I can confirm the message never gets delivered because it remains in
msilo DB and kamailio logs shows it trying and trying.
####### Routing Logic ########


Thanks for your help Daniel.
OK I ngrepped port 5060 and indeed the message tries to get delivered.
However it never arrives at the client (1010 in this case).
I have added localhost listeners for UDP and TCP, even though all clients
register through TLS only (could this be the root of the problem?). I added
localhost listeners because I was getting the no socket found error message.
Listening on
udp: 127.0.0.1:5080
tcp: 127.0.0.1:5060
tls: 79.my.server.IP1:5061
tcp: localhost:5060
udp: localhost:5080
*: my.domain.com:*
U 2014/07/16 15:29:14.904285 127.0.0.1:5080 -> 79.my.server.IP1:5060
Via: SIP/2.0/UDP 127.0.0.1:5080
;branch=z9hG4bKcde3.542219f4000000000000000000000000.0.
CSeq: 10 MESSAGE.
Max-Forwards: 70.
Content-Length: 58.
User-Agent: kamailio (4.1.4 (x86_64/linux)).
Date: Wed, 16 Jul 2014 15:22:31 GMT.
Content-Type: text/plain.
.
[Offline message - Wed Jul 16 15:22:31 2014] Test 1,2,3
On Wed, Jul 16, 2014 at 8:58 AM, Daniel-Constantin Mierla <
Hello,
can you watch the sip traffic on the network to see if the sip messages is
ngrep -d any -qt -W byline "sip" port 5060
Cheers,
Daniel
Hi,
This is most likely a stupid mistake on my route config, but msilo
correctly stores messages for offline users, but when they come back
online, the message never arrives.
Looking through the debug logs indeed there is an error, with status 408,
which suggests kamaiio can't find a route to the user that just logged.
Before I spend hours looking through all the routing blocks, perhaps
someone more exprienced in kamailio can see the problem right away and
offer a solution?
Thanks
DEBUG: <core> [io_wait.h:617]: io_watch_del(): DBG: io_watch_del
(0x8e3040, 9, -1, 0x10) fd_no=2 called
DEBUG: <core> [tcp_read.c:1437]: release_tcpconn(): releasing con
0x7f61ced1b1b0, state 1, fd=9, id=1
DEBUG: <core> [tcp_read.c:1438]: release_tcpconn(): extra_data 0x7f61ced1c4f8
reader response= 7f61ced1b1b0, 1 from 0
DEBUG: <core> [io_wait.h:390]: io_watch_add(): DBG: io_watch_add(0x89ec40,
26, 2, 0x7f61ced1b1b0), fd_no=21
CONN_RELEASE 0x7f61ced1b1b0 refcnt= 1
DEBUG: tm [t_reply.c:1304]: t_should_relay_response(): ->>>>>>>>> T_code=0, new_code=408
DEBUG: tm [t_reply.c:2086]: local_reply(): DEBUG: local_reply: branch=0, save=0, winner=0
DEBUG: tm [t_reply.c:2123]: local_reply(): DEBUG: local transaction completed
trans=0x7f61ced1d868, callback type 1024, id 0 entered
DEBUG: msilo [msilo.c:1317]: m_tm_callback(): *completed with status 408*
[mid: 140058058335472/13]
DEBUG: msilo [msilo.c:1325]: m_tm_callback(): message <13> was not sent successfully
DEBUG: msilo [ms_msg_list.c:236]: msg_list_set_flag(): mid:13 fl:8
DEBUG: tm [t_reply.c:1304]: t_should_relay_response(): ->>>>>>>>> T_code=0, new_code=408
DEBUG: tm [t_reply.c:2086]: local_reply(): DEBUG: local_reply: branch=0, save=0, winner=0
DEBUG: tm [t_reply.c:2123]: local_reply(): DEBUG: local transaction completed
trans=0x7f61ced5f098, callback type 1024, id 0 entered
DEBUG: msilo [msilo.c:1317]: m_tm_callback(): completed with status 408
[mid: 140058058329184/12]
DEBUG: msilo [msilo.c:1325]: m_tm_callback(): message <12> was not sent successfully
DEBUG: msilo [ms_msg_list.c:236]: msg_list_set_flag(): mid:12 fl:8
_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
--
Daniel-Constantin Mierla - http://www.asipto.com
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
------------------------------
This e-mail and any attachment is for authorised use by the intended
recipient(s) only. It may contain proprietary material, confidential
information and/or be subject to legal privilege. It should not be copied,
disclosed to, retained or used by, any other party. If you are not an
intended recipient then please promptly delete this e-mail and any
attachment and all copies and inform the sender. Thank you for
understanding.
_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
Peter Villeneuve
2014-07-17 21:46:58 UTC
Permalink
Well I've been experimenting with this for hours and still no joy
:( Hair pulling continues

Here's what I did to help debug. I updated to 4.2 and I started using the
default TCP listener on 5060 and have turned off the TLS listener to make
debugging easier.
I have also tried using the routing config from here
<http://telephonynetworks.blogspot.pt/2012/08/configuracion-de-kamailio-33-con-nat.html>
but
I get the exact same results as with the routing posted above, which tends
to rule out any config issues (I think).

Here's what I found so far.

If I don't set the msilo outbound proxy like Daniel suggested, I get the
dreaded "no socket found" error I mentioned earlier.

If I do set the proxy, the offline message does get delivered as expected.
The problem is that once I send a new message to an offline user, the
caller doesn't receive the "user whatever is offline" message, but simply a
202.
Then I look in msilo DB and suddenly I have 7k messages and growing and
have to shut down kamailio and clean the db.

Example to make understanding this weird behavior easier. Msilo outbound
proxy set:

1010 sends msg "testing 123" to 1000 (offline). Msilo stores the msg
correctly, although 1010 never does receive the "***User 1000 is offline!"
message, only a 202 I see in ngrep.
I then look in the msilo db and confirm the "testing 123" msg is there. But
right after there is another message stored in msilo, which is what should
have been sent to 1000 instead of being stored in the silo.

sip:registrar-TNFzNwJ3FISawkFULUB+***@public.gmane.org:1010-TNFzNwJ3FISFnCxG7onLTRm3Bx9F/***@public.gmane.org7
14:11:00*** User 1000 is offline!
And then registrar storing a message for registrar saying 1010 is offline
(which is obviously wrong since 1010 just sent the msg)

sip:registrar-TNFzNwJ3FISawkFULUB+***@public.gmane.org:registrar-TNFzNwJ3FIRBOTUWyH3yiN7TtmEFrOiQd9VljMOyqDKIwRZHo2/***@public.gmane.orgm
2014-07-17 14:11:00*** User 1010 is offline!

And then it gets simply crazy with over 7K repeating messages in the silo
saying the user registrar is offline.

sip:registrar-TNFzNwJ3FISawkFULUB+***@public.gmane.org:registrar-TNFzNwJ3FIRBOTUWyH3yiN7TtmEFrOiQd9VljMOyqDKIwRZHo2/***@public.gmane.orgm
2014-07-17 14:11:00*** User registrar is offline!


To top it all off I see this in the sip trace

What's puzzling me is this: 79.my.server.IP1:58487 -> 79.my.server.IP1:5060

Why does kamailio send to itself from port 58487 to 5060 and not from 5060
to the UAC's public IP?


Sorry to dump so much info here but I'm hoping to resolve this before I go
nuts.

Daniel, when you have the time can you take a look please?

Thanks,
Peter

T 2014/07/17 21:10:30.383043 85.xx.xx.xx:50235 -> 79.my.server.IP1:5060 [AP]
MESSAGE sip:1000-TNFzNwJ3FISaMJb+***@public.gmane.org SIP/2.0.
v: SIP/2.0/TCP 192.168.1.4:50235
;rport;branch=z9hG4bKPjCYikazjsY44q1jqMtDzapRCfqofgZ.3O;alias.
Max-Forwards: 70.
f: <sip:1010-TNFzNwJ3FISaMJb+***@public.gmane.org>;tag=s.HDD1ArN1dDgnwxgeWWK7meY98dkvrS.
t: <sip:1000-TNFzNwJ3FISaMJb+***@public.gmane.org>.
i: p8PAwoJ6ZLCy7ClSqe8sXD8FWMTU3LQ9.
CSeq: 64674 MESSAGE.
Accept: text/plain, application/im-iscomposing+xml.
User-Agent: PJSIP_m3-19/r2423.
Route: <sip:my.domain.com;transport=tcp;lr>.
c: text/plain.
l: 25.
.
msg from 1010 to 1000

T 2014/07/17 21:10:30.390095 *79.my.server.IP1:58487 ->
79.my.server.IP1:5060* [AP]
MESSAGE sip:1010-TNFzNwJ3FISaMJb+***@public.gmane.org SIP/2.0.
Via: SIP/2.0/TCP
79.my.server.IP1;branch=z9hG4bK17.50c7d2e1000000000000000000000000.0.
;tag=416b6f80e891b334140ffeafcc1fa032-ecd9.
CSeq: 10 MESSAGE.
Call-ID: 6807412f0f15f619-29814-HbsIVW1VZsQWsOQgtsjBHeG/***@public.gmane.org
Max-Forwards: 70.
Content-Length: 25.
User-Agent: kamailio (4.2.0-dev7 (x86_64/linux)).
Contact: registrar-TNFzNwJ3FISaMJb+***@public.gmane.org;msilo=yes.
Content-Type: text/plain.
.
*** User 1000 is offline!

T 2014/07/17 21:10:30.390156 79.my.server.IP1:5060 -> 85.xx.xx.xx:50235 [AP]
SIP/2.0 202 ACCEPTED.
v: SIP/2.0/TCP 192.168.1.4:50235
;rport=50235;branch=z9hG4bKPjCYikazjsY44q1jqMtDzapRCfqofgZ.3O;alias;received=85.xx.xx.xx.
f: <sip:1010-TNFzNwJ3FISaMJb+***@public.gmane.org>;tag=s.HDD1ArN1dDgnwxgeWWK7meY98dkvrS.
t: <sip:1000-TNFzNwJ3FISaMJb+***@public.gmane.org>;tag=83a51ef5beb3f269619e74eb008b8b4e.7652.
i: p8PAwoJ6ZLCy7ClSqe8sXD8FWMTU3LQ9.
CSeq: 64674 MESSAGE.
Server: kamailio (4.2.0-dev7 (x86_64/linux)).
Content-Length: 0.
.


T 2014/07/17 21:10:30.390441 79.my.server.IP1:5060 -> 85.xx.xx.xx:50235 [AP]
MESSAGE sip:1010-***@public.gmane.org:50235;transport=TCP SIP/2.0.
Via: SIP/2.0/TCP
79.my.server.IP1;branch=z9hG4bK17.f09631e651d35b19e10d44b11fe53d81.0;i=3.
Via: SIP/2.0/TCP
79.my.server.IP1;rport=58487;branch=z9hG4bK17.50c7d2e1000000000000000000000000.0.
;tag=416b6f80e891b334140ffeafcc1fa032-ecd9.
CSeq: 10 MESSAGE.
Call-ID: 6807412f0f15f619-29814-HbsIVW1VZsQWsOQgtsjBHeG/***@public.gmane.org
Max-Forwards: 69.
Content-Length: 25.
User-Agent: kamailio (4.2.0-dev7 (x86_64/linux)).
Contact: registrar-TNFzNwJ3FISaMJb+***@public.gmane.org;msilo=yes.
Content-Type: text/plain.
.
*** User 1000 is offline!

T 2014/07/17 21:11:00.357394 79.my.server.IP1:58487 ->
79.my.server.IP1:5060 [AP]
MESSAGE sip:registrar-TNFzNwJ3FISaMJb+***@public.gmane.org SIP/2.0.
Via: SIP/2.0/TCP
79.my.server.IP1;branch=z9hG4bK24f7.237c32d3000000000000000000000000.0.
;tag=416b6f80e891b334140ffeafcc1fa032-a22d.
CSeq: 10 MESSAGE.
Call-ID: 6807412f0f15f618-29809-HbsIVW1VZsQWsOQgtsjBHeG/***@public.gmane.org
Max-Forwards: 70.
Content-Length: 25.
User-Agent: kamailio (4.2.0-dev7 (x86_64/linux)).
Contact: registrar-TNFzNwJ3FISaMJb+***@public.gmane.org;msilo=yes.
Content-Type: text/plain.
.
*** User 1010 is offline!

T 2014/07/17 21:11:00.358375 79.my.server.IP1:5060 ->
79.my.server.IP1:58487 [AP]
SIP/2.0 202 ACCEPTED.
Via: SIP/2.0/TCP
79.my.server.IP1;branch=z9hG4bK17.50c7d2e1000000000000000000000000.0;rport=58487.
;tag=416b6f80e891b334140ffeafcc1fa032-ecd9.
CSeq: 10 MESSAGE.
Call-ID: 6807412f0f15f619-29814-HbsIVW1VZsQWsOQgtsjBHeG/***@public.gmane.org
Server: kamailio (4.2.0-dev7 (x86_64/linux)).
Content-Length: 0.
.


T 2014/07/17 21:11:00.359438 79.my.server.IP1:58487 ->
79.my.server.IP1:5060 [AP]
MESSAGE sip:registrar-TNFzNwJ3FISaMJb+***@public.gmane.org SIP/2.0.
Via: SIP/2.0/TCP
79.my.server.IP1;branch=z9hG4bK810c.0eb84110000000000000000000000000.0.
;tag=416b6f80e891b334140ffeafcc1fa032-2a02.
CSeq: 10 MESSAGE.
Call-ID: 6807412f0f15f618-29816-HbsIVW1VZsQWsOQgtsjBHeG/***@public.gmane.org
Max-Forwards: 70.
Content-Length: 30.
User-Agent: kamailio (4.2.0-dev7 (x86_64/linux)).
Contact: registrar-TNFzNwJ3FISaMJb+***@public.gmane.org;msilo=yes.
Content-Type: text/plain.
.
*** User registrar is offline!

T 2014/07/17 21:11:00.359495 79.my.server.IP1:5060 ->
79.my.server.IP1:58487 [AP]
SIP/2.0 202 ACCEPTED.
Via: SIP/2.0/TCP
79.my.server.IP1;branch=z9hG4bK24f7.237c32d3000000000000000000000000.0;rport=58487.
;tag=416b6f80e891b334140ffeafcc1fa032-a22d.
CSeq: 10 MESSAGE.
Call-ID: 6807412f0f15f618-29809-HbsIVW1VZsQWsOQgtsjBHeG/***@public.gmane.org
Server: kamailio (4.2.0-dev7 (x86_64/linux)).
Content-Length: 0.
.
Thanks for helping out Hugh (and obviously Daniel)
I have made some progress by adding the modparam ("msilo",
"outbound_proxy", "sip:my.domain.com:5061;transport=tls").
Now indeed the stored message gets delivered when a UAC registers.
But I just noticed that it was also filling up msilo db with "user xxx is
offline!" messages, instead of sending that msg to the initial UAC sending
the msg.
This likely means I'm doing something wrong with the routing, as it feels
like it's in an endless loop. I think Daniel earlier suggested adding if(src_ip
!= myself) t_on_failure("FAIL_MESSAGE") to another poster that was having
trouble with the exact same routing config, but I'm not sure exactly where
to insert it.
Can someone experienced with the routing syntax point out my - likely
obvious - mistake?
Cheers,
Peter
Post by Waite, Hugh
Hi,
We did have a working msilo implementation a while back, but we don’t use
it any more, so I can only look back at the config files (which are a lot
more complicated than yours).
We added the a modparam *modparam("msilo", "outbound_proxy",
"sip:MY_REAL_IP:MY_SIP_PORT;transport=tcp")*
which will make it arrive on the local machine on the given socket
(instead of localhost) to be processed, but that probably isn’t your
problem.
Is it possible that Kamailio is trying to establish a new connection,
instead of reusing the existing connection to the client? That would be
visible as TCP SYNs in a trace and would cause a 408 after the timeout. We
are using a separate outbound enabled edge proxy so this isn’t a problem
for us.
Regards,
Hugh
*Sent:* 17 July 2014 13:10
*To:* Daniel-Constantin Mierla; Kamailio (SER) - Users Mailing List
*Subject:* Re: [SR-Users] Msilo not delivering message (status 408)
I guess no one really knows why it isn't working either.
The only option I have left seems to be to try and update to the 4.2
nightly and hope that whatever's wrong is a bug with 4.1.4 and not a simple
mistake in my routing syntax or logic.
Daniel, is 4.2 nightly debian package stable enough for a production
system? Would you recommend I upgrade?
Thanks
Can anyone help please? I was supposed to have this server up and running
hours ago and I can't think of anything to do next to help debug this.
Thanks
I removed the localhost listeners on TCP and UDP, and, as I suspected,
Kamailio doesn't seem to like that.
Why isn't kamailio sending the message back through the TLS socket?
NOTICE: <script>: -------------------------MESSAGE PROCESSING: dumping offline messages
ERROR: tm [ut.h:343]: uri2dst2(): no corresponding socket for af 2
ERROR: tm [uac.c:266]: t_uac_prepare(): t_uac: no socket found
And here's the full routing block. I copied it from someone else on the
list that was troubleshooting msilo a while back.
Also, I can confirm the message never gets delivered because it remains
in msilo DB and kamailio logs shows it trying and trying.
####### Routing Logic ########


Thanks for your help Daniel.
OK I ngrepped port 5060 and indeed the message tries to get delivered.
However it never arrives at the client (1010 in this case).
I have added localhost listeners for UDP and TCP, even though all clients
register through TLS only (could this be the root of the problem?). I added
localhost listeners because I was getting the no socket found error message.
Listening on
udp: 127.0.0.1:5080
tcp: 127.0.0.1:5060
tls: 79.my.server.IP1:5061
tcp: localhost:5060
udp: localhost:5080
*: my.domain.com:*
U 2014/07/16 15:29:14.904285 127.0.0.1:5080 -> 79.my.server.IP1:5060
Via: SIP/2.0/UDP 127.0.0.1:5080
;branch=z9hG4bKcde3.542219f4000000000000000000000000.0.
CSeq: 10 MESSAGE.
Max-Forwards: 70.
Content-Length: 58.
User-Agent: kamailio (4.1.4 (x86_64/linux)).
Date: Wed, 16 Jul 2014 15:22:31 GMT.
Content-Type: text/plain.
.
[Offline message - Wed Jul 16 15:22:31 2014] Test 1,2,3
On Wed, Jul 16, 2014 at 8:58 AM, Daniel-Constantin Mierla <
Hello,
can you watch the sip traffic on the network to see if the sip messages
ngrep -d any -qt -W byline "sip" port 5060
Cheers,
Daniel
Hi,
This is most likely a stupid mistake on my route config, but msilo
correctly stores messages for offline users, but when they come back
online, the message never arrives.
Looking through the debug logs indeed there is an error, with status 408,
which suggests kamaiio can't find a route to the user that just logged.
Before I spend hours looking through all the routing blocks, perhaps
someone more exprienced in kamailio can see the problem right away and
offer a solution?
Thanks
DEBUG: <core> [io_wait.h:617]: io_watch_del(): DBG: io_watch_del
(0x8e3040, 9, -1, 0x10) fd_no=2 called
DEBUG: <core> [tcp_read.c:1437]: release_tcpconn(): releasing con
0x7f61ced1b1b0, state 1, fd=9, id=1
DEBUG: <core> [tcp_read.c:1438]: release_tcpconn(): extra_data 0x7f61ced1c4f8
reader response= 7f61ced1b1b0, 1 from 0
io_watch_add(0x89ec40, 26, 2, 0x7f61ced1b1b0), fd_no=21
CONN_RELEASE 0x7f61ced1b1b0 refcnt= 1
DEBUG: tm [t_reply.c:1304]: t_should_relay_response(): ->>>>>>>>> T_code=0, new_code=408
DEBUG: tm [t_reply.c:2086]: local_reply(): DEBUG: local_reply: branch=0, save=0, winner=0
DEBUG: tm [t_reply.c:2123]: local_reply(): DEBUG: local transaction completed
trans=0x7f61ced1d868, callback type 1024, id 0 entered
DEBUG: msilo [msilo.c:1317]: m_tm_callback(): *completed with status 408*
[mid: 140058058335472/13]
DEBUG: msilo [msilo.c:1325]: m_tm_callback(): message <13> was not sent successfully
DEBUG: msilo [ms_msg_list.c:236]: msg_list_set_flag(): mid:13 fl:8
DEBUG: tm [t_reply.c:1304]: t_should_relay_response(): ->>>>>>>>> T_code=0, new_code=408
DEBUG: tm [t_reply.c:2086]: local_reply(): DEBUG: local_reply: branch=0, save=0, winner=0
DEBUG: tm [t_reply.c:2123]: local_reply(): DEBUG: local transaction completed
trans=0x7f61ced5f098, callback type 1024, id 0 entered
DEBUG: msilo [msilo.c:1317]: m_tm_callback(): completed with status 408
[mid: 140058058329184/12]
DEBUG: msilo [msilo.c:1325]: m_tm_callback(): message <12> was not sent successfully
DEBUG: msilo [ms_msg_list.c:236]: msg_list_set_flag(): mid:12 fl:8
_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
--
Daniel-Constantin Mierla - http://www.asipto.com
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
------------------------------
This e-mail and any attachment is for authorised use by the intended
recipient(s) only. It may contain proprietary material, confidential
information and/or be subject to legal privilege. It should not be copied,
disclosed to, retained or used by, any other party. If you are not an
intended recipient then please promptly delete this e-mail and any
attachment and all copies and inform the sender. Thank you for
understanding.
_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
Daniel-Constantin Mierla
2014-07-17 22:01:41 UTC
Permalink
You should not call m_store() if src_ip==myself -- in this way you avoid
to store notification messages that cannot be delivered.

Why notifications are not delivered has to be troubleshooted there. Have
you tried also with UDP?

Cheers,
Daniel
Post by Peter Villeneuve
Well I've been experimenting with this for hours and still no joy
:( Hair pulling continues
Here's what I did to help debug. I updated to 4.2 and I started using
the default TCP listener on 5060 and have turned off the TLS listener
to make debugging easier.
I have also tried using the routing config from here
<http://telephonynetworks.blogspot.pt/2012/08/configuracion-de-kamailio-33-con-nat.html> but
I get the exact same results as with the routing posted above, which
tends to rule out any config issues (I think).
Here's what I found so far.
If I don't set the msilo outbound proxy like Daniel suggested, I get
the dreaded "no socket found" error I mentioned earlier.
If I do set the proxy, the offline message does get delivered as
expected. The problem is that once I send a new message to an offline
user, the caller doesn't receive the "user whatever is offline"
message, but simply a 202.
Then I look in msilo DB and suddenly I have 7k messages and growing
and have to shut down kamailio and clean the db.
Example to make understanding this weird behavior easier. Msilo
1010 sends msg "testing 123" to 1000 (offline). Msilo stores the msg
correctly, although 1010 never does receive the "***User 1000 is
offline!" message, only a 202 I see in ngrep.
I then look in the msilo db and confirm the "testing 123" msg is
there. But right after there is another message stored in msilo, which
is what should have been sent to 1000 instead of being stored in the silo.
<http://my.domain.com> 2014-07-17 14:11:00 *** User 1000 is offline!
And then registrar storing a message for registrar saying 1010 is
offline (which is obviously wrong since 1010 just sent the msg)
my.domain.com
2014-07-17 14:11:00 *** User 1010 is offline!
And then it gets simply crazy with over 7K repeating messages in the
silo saying the user registrar is offline.
my.domain.com
2014-07-17 14:11:00 *** User registrar is offline!
To top it all off I see this in the sip trace
What's puzzling me is this: 79.my.server.IP1:58487 ->
79.my.server.IP1:5060
Why does kamailio send to itself from port 58487 to 5060 and not from
5060 to the UAC's public IP?
Sorry to dump so much info here but I'm hoping to resolve this before
I go nuts.
Daniel, when you have the time can you take a look please?
Thanks,
Peter
T 2014/07/17 21:10:30.383043 85.xx.xx.xx:50235 ->
79.my.server.IP1:5060 [AP]
v: SIP/2.0/TCP
192.168.1.4:50235;rport;branch=z9hG4bKPjCYikazjsY44q1jqMtDzapRCfqofgZ.3O;alias.
Max-Forwards: 70.
i: p8PAwoJ6ZLCy7ClSqe8sXD8FWMTU3LQ9.
CSeq: 64674 MESSAGE.
Accept: text/plain, application/im-iscomposing+xml.
User-Agent: PJSIP_m3-19/r2423.
Route: <sip:my.domain.com <http://my.domain.com>;transport=tcp;lr>.
c: text/plain.
l: 25.
.
msg from 1010 to 1000
T 2014/07/17 21:10:30.390095 *79.my.server.IP1:58487 ->
79.my.server.IP1:5060* [AP]
Via: SIP/2.0/TCP
79.my.server.IP1;branch=z9hG4bK17.50c7d2e1000000000000000000000000.0.
CSeq: 10 MESSAGE.
Max-Forwards: 70.
Content-Length: 25.
User-Agent: kamailio (4.2.0-dev7 (x86_64/linux)).
Content-Type: text/plain.
.
*** User 1000 is offline!
T 2014/07/17 21:10:30.390156 79.my.server.IP1:5060 ->
85.xx.xx.xx:50235 [AP]
SIP/2.0 202 ACCEPTED.
v: SIP/2.0/TCP
192.168.1.4:50235;rport=50235;branch=z9hG4bKPjCYikazjsY44q1jqMtDzapRCfqofgZ.3O;alias;received=85.xx.xx.xx.
i: p8PAwoJ6ZLCy7ClSqe8sXD8FWMTU3LQ9.
CSeq: 64674 MESSAGE.
Server: kamailio (4.2.0-dev7 (x86_64/linux)).
Content-Length: 0.
.
T 2014/07/17 21:10:30.390441 79.my.server.IP1:5060 ->
85.xx.xx.xx:50235 [AP]
Via: SIP/2.0/TCP
79.my.server.IP1;branch=z9hG4bK17.f09631e651d35b19e10d44b11fe53d81.0;i=3.
Via: SIP/2.0/TCP
79.my.server.IP1;rport=58487;branch=z9hG4bK17.50c7d2e1000000000000000000000000.0.
CSeq: 10 MESSAGE.
Max-Forwards: 69.
Content-Length: 25.
User-Agent: kamailio (4.2.0-dev7 (x86_64/linux)).
Content-Type: text/plain.
.
*** User 1000 is offline!
T 2014/07/17 21:11:00.357394 79.my.server.IP1:58487 ->
79.my.server.IP1:5060 [AP]
Via: SIP/2.0/TCP
79.my.server.IP1;branch=z9hG4bK24f7.237c32d3000000000000000000000000.0.
CSeq: 10 MESSAGE.
Max-Forwards: 70.
Content-Length: 25.
User-Agent: kamailio (4.2.0-dev7 (x86_64/linux)).
Content-Type: text/plain.
.
*** User 1010 is offline!
T 2014/07/17 21:11:00.358375 79.my.server.IP1:5060 ->
79.my.server.IP1:58487 [AP]
SIP/2.0 202 ACCEPTED.
Via: SIP/2.0/TCP
79.my.server.IP1;branch=z9hG4bK17.50c7d2e1000000000000000000000000.0;rport=58487.
CSeq: 10 MESSAGE.
Server: kamailio (4.2.0-dev7 (x86_64/linux)).
Content-Length: 0.
.
T 2014/07/17 21:11:00.359438 79.my.server.IP1:58487 ->
79.my.server.IP1:5060 [AP]
Via: SIP/2.0/TCP
79.my.server.IP1;branch=z9hG4bK810c.0eb84110000000000000000000000000.0.
CSeq: 10 MESSAGE.
Max-Forwards: 70.
Content-Length: 30.
User-Agent: kamailio (4.2.0-dev7 (x86_64/linux)).
Content-Type: text/plain.
.
*** User registrar is offline!
T 2014/07/17 21:11:00.359495 79.my.server.IP1:5060 ->
79.my.server.IP1:58487 [AP]
SIP/2.0 202 ACCEPTED.
Via: SIP/2.0/TCP
79.my.server.IP1;branch=z9hG4bK24f7.237c32d3000000000000000000000000.0;rport=58487.
CSeq: 10 MESSAGE.
Server: kamailio (4.2.0-dev7 (x86_64/linux)).
Content-Length: 0.
.
Thanks for helping out Hugh (and obviously Daniel)
I have made some progress by adding the modparam ("msilo",
"outbound_proxy", "sip:my.domain.com:5061;transport=tls").
Now indeed the stored message gets delivered when a UAC registers.
But I just noticed that it was also filling up msilo db with "user
xxx is offline!" messages, instead of sending that msg to the
initial UAC sending the msg.
This likely means I'm doing something wrong with the routing, as
it feels like it's in an endless loop. I think Daniel earlier
suggested adding if(src_ip != myself) t_on_failure("FAIL_MESSAGE")
to another poster that was having trouble with the exact same
routing config, but I'm not sure exactly where to insert it.
Can someone experienced with the routing syntax point out my -
likely obvious - mistake?
Cheers,
Peter
On Thu, Jul 17, 2014 at 3:11 PM, Waite, Hugh
Hi,
We did have a working msilo implementation a while back, but
we donÂ’t use it any more, so I can only look back at the
config files (which are a lot more complicated than yours).
We added the a modparam *modparam("msilo", "outbound_proxy",
"sip:MY_REAL_IP:MY_SIP_PORT;transport=tcp")*
which will make it arrive on the local machine on the given
socket (instead of localhost) to be processed, but that
probably isnÂ’t your problem.
Is it possible that Kamailio is trying to establish a new
connection, instead of reusing the existing connection to the
client? That would be visible as TCP SYNs in a trace and would
cause a 408 after the timeout. We are using a separate
outbound enabled edge proxy so this isnÂ’t a problem for us.
Regards,
Hugh
*Peter Villeneuve
*Sent:* 17 July 2014 13:10
*To:* Daniel-Constantin Mierla; Kamailio (SER) - Users Mailing
List
*Subject:* Re: [SR-Users] Msilo not delivering message (status
408)
I guess no one really knows why it isn't working either.
The only option I have left seems to be to try and update to
the 4.2 nightly and hope that whatever's wrong is a bug with
4.1.4 and not a simple mistake in my routing syntax or logic.
Daniel, is 4.2 nightly debian package stable enough for a
production system? Would you recommend I upgrade?
Thanks
On Wed, Jul 16, 2014 at 9:37 PM, Peter Villeneuve
Can anyone help please? I was supposed to have this server up
and running hours ago and I can't think of anything to do next
to help debug this.
Thanks
On Wed, Jul 16, 2014 at 7:01 PM, Peter Villeneuve
I removed the localhost listeners on TCP and UDP, and, as I
suspected, Kamailio doesn't seem to like that.
Why isn't kamailio sending the message back through the TLS socket?
NOTICE: <script>: -------------------------MESSAGE PROCESSING: dumping offline messages
ERROR: tm [ut.h:343]: uri2dst2(): no corresponding socket for af 2
ERROR: tm [uac.c:266]: t_uac_prepare(): t_uac: no socket found
On Wed, Jul 16, 2014 at 4:44 PM, Peter Villeneuve
And here's the full routing block. I copied it from someone
else on the list that was troubleshooting msilo a while back.
Also, I can confirm the message never gets delivered because
it remains in msilo DB and kamailio logs shows it trying and
trying.
####### Routing Logic ########
Â…
On Wed, Jul 16, 2014 at 4:38 PM, Peter Villeneuve
Thanks for your help Daniel.
OK I ngrepped port 5060 and indeed the message tries to get
delivered. However it never arrives at the client (1010 in
this case).
I have added localhost listeners for UDP and TCP, even though
all clients register through TLS only (could this be the root
of the problem?). I added localhost listeners because I was
getting the no socket found error message.
Listening on
udp: 127.0.0.1:5080 <http://127.0.0.1:5080>
tcp: 127.0.0.1:5060 <http://127.0.0.1:5060>
tls: 79.my.server.IP1:5061
tcp: localhost:5060
udp: localhost:5080
*: my.domain.com:*
U 2014/07/16 15:29:14.904285 127.0.0.1:5080
<http://127.0.0.1:5080> -> 79.my.server.IP1:5060
Via: SIP/2.0/UDP
127.0.0.1:5080;branch=z9hG4bKcde3.542219f4000000000000000000000000.0.
CSeq: 10 MESSAGE.
Max-Forwards: 70.
Content-Length: 58.
User-Agent: kamailio (4.1.4 (x86_64/linux)).
Date: Wed, 16 Jul 2014 15:22:31 GMT.
Content-Type: text/plain.
.
[Offline message - Wed Jul 16 15:22:31 2014] Test 1,2,3
On Wed, Jul 16, 2014 at 8:58 AM, Daniel-Constantin Mierla
Hello,
can you watch the sip traffic on the network to see if the sip
ngrep -d any -qt -W byline "sip" port 5060
Cheers,
Daniel
Hi,
This is most likely a stupid mistake on my route config,
but msilo correctly stores messages for offline users, but
when they come back online, the message never arrives.
Looking through the debug logs indeed there is an error,
with status 408, which suggests kamaiio can't find a route
to the user that just logged. Before I spend hours looking
through all the routing blocks, perhaps someone more
exprienced in kamailio can see the problem right away and
offer a solution?
Thanks
io_watch_del (0x8e3040, 9, -1, 0x10) fd_no=2 called
releasing con 0x7f61ced1b1b0, state 1, fd=9, id=1
extra_data 0x7f61ced1c4f8
handle_tcp_child: reader response= 7f61ced1b1b0, 1 from 0
io_watch_add(0x89ec40, 26, 2, 0x7f61ced1b1b0), fd_no=21
handle_tcp_child: CONN_RELEASE 0x7f61ced1b1b0 refcnt= 1
->>>>>>>>> T_code=0, new_code=408
local_reply: branch=0, save=0, winner=0
DEBUG: tm [t_reply.c:2123]: local_reply(): DEBUG: local
transaction completed
DBG: trans=0x7f61ced1d868, callback type 1024, id 0 entered
DEBUG: msilo [msilo.c:1317]: m_tm_callback(): *completed
with status 408* [mid: 140058058335472/13]
DEBUG: msilo [msilo.c:1325]: m_tm_callback(): message <13>
was not sent successfully
DEBUG: msilo [ms_msg_list.c:236]: msg_list_set_flag(): mid:13 fl:8
->>>>>>>>> T_code=0, new_code=408
local_reply: branch=0, save=0, winner=0
DEBUG: tm [t_reply.c:2123]: local_reply(): DEBUG: local
transaction completed
DBG: trans=0x7f61ced5f098, callback type 1024, id 0 entered
DEBUG: msilo [msilo.c:1317]: m_tm_callback(): completed
with status 408 [mid: 140058058329184/12]
DEBUG: msilo [msilo.c:1325]: m_tm_callback(): message <12>
was not sent successfully
DEBUG: msilo [ms_msg_list.c:236]: msg_list_set_flag(): mid:12 fl:8
_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
--
Daniel-Constantin Mierla -http://www.asipto.com
http://twitter.com/#!/miconda <http://twitter.com/#%21/miconda> -http://www.linkedin.com/in/miconda
_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
------------------------------------------------------------------------
This e-mail and any attachment is for authorised use by the
intended recipient(s) only. It may contain proprietary
material, confidential information and/or be subject to legal
privilege. It should not be copied, disclosed to, retained or
used by, any other party. If you are not an intended recipient
then please promptly delete this e-mail and any attachment and
all copies and inform the sender. Thank you for understanding.
_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
--
Daniel-Constantin Mierla - http://www.asipto.com
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Peter Villeneuve
2014-07-18 16:40:23 UTC
Permalink
Thanks Daniel.
UDP is the same story as TCP and TLS, unfortunately.

Looking through the logs, I see strange errors in parsing the contact
header when msilo prepares to send the notification back to 1000.
This is for the notification message that should have been sent back to
1000 after he sent a message to 1010 (offline).
I also see that kamailio reports that 1000's location was not found, even
though he's obviously registered.

The more I play around with this, the more confused I become.

Do you think this contact parsing error could be the root of the problems?

Cheers,
Peter


Jul 18 15:50:32 pbx /usr/sbin/kamailio[12600]: DEBUG: <core>
[parser/msg_parser.c:623]: parse_msg(): SIP Request:
Jul 18 15:50:32 pbx /usr/sbin/kamailio[12600]: DEBUG: <core>
[parser/msg_parser.c:625]: parse_msg(): method: <MESSAGE>
Jul 18 15:50:32 pbx /usr/sbin/kamailio[12600]: DEBUG: <core>
[parser/msg_parser.c:627]: parse_msg(): uri: <sip:1000-TNFzNwJ3FISaMJb+***@public.gmane.org>
Jul 18 15:50:32 pbx /usr/sbin/kamailio[12600]: DEBUG: <core>
[parser/msg_parser.c:629]: parse_msg(): version: <SIP/2.0>
Jul 18 15:50:32 pbx /usr/sbin/kamailio[12600]: DEBUG: <core>
[parser/parse_via.c:1284]: parse_via_param(): Found param type 232,
<branch> = <z9hG4bK90dc.68116a97000000000000000000000000.0>; state=16
Jul 18 15:50:32 pbx /usr/sbin/kamailio[12600]: DEBUG: <core>
[parser/parse_via.c:2672]: parse_via(): end of header reached, state=5
Jul 18 15:50:32 pbx /usr/sbin/kamailio[12600]: DEBUG: <core>
[parser/msg_parser.c:513]: parse_headers(): parse_headers: Via found,
flags=2
Jul 18 15:50:32 pbx /usr/sbin/kamailio[12600]: DEBUG: <core>
[parser/msg_parser.c:515]: parse_headers(): parse_headers: this is the
first via
Jul 18 15:50:32 pbx /usr/sbin/kamailio[12600]: DEBUG: <core>
[receive.c:152]: receive_msg(): After parse_msg...
Jul 18 15:50:32 pbx /usr/sbin/kamailio[12600]: DEBUG: <core>
[receive.c:193]: receive_msg(): preparing to run routing scripts...
Jul 18 15:50:32 pbx /usr/sbin/kamailio[12600]: DEBUG: <core>
[parser/parse_addr_spec.c:893]: parse_addr_spec(): end of header reached,
state=10
Jul 18 15:50:32 pbx /usr/sbin/kamailio[12600]: DEBUG: <core>
[parser/msg_parser.c:190]: get_hdr_field(): DEBUG: get_hdr_field: <To>
[28]; uri=[sip:1000-TNFzNwJ3FISaMJb+***@public.gmane.org]
Jul 18 15:50:32 pbx /usr/sbin/kamailio[12600]: DEBUG: <core>
[parser/msg_parser.c:192]: get_hdr_field(): DEBUG: to body [<
sip:1000-TNFzNwJ3FISaMJb+***@public.gmane.org>#015#012]
Jul 18 15:50:32 pbx /usr/sbin/kamailio[12600]: DEBUG: <core>
[parser/msg_parser.c:170]: get_hdr_field(): get_hdr_field: cseq <CSeq>:
<10> <MESSAGE>
Jul 18 15:50:32 pbx /usr/sbin/kamailio[12600]: DEBUG: maxfwd
[mf_funcs.c:85]: is_maxfwd_present(): value = 70
Jul 18 15:50:32 pbx /usr/sbin/kamailio[12600]: DEBUG: <core>
[parser/msg_parser.c:204]: get_hdr_field(): DEBUG: get_hdr_body :
content_length=25
Jul 18 15:50:32 pbx /usr/sbin/kamailio[12600]: DEBUG: <core>
[parser/msg_parser.c:106]: get_hdr_field(): found end of header
Jul 18 15:50:32 pbx /usr/sbin/kamailio[12600]: DEBUG: <core>
[parser/parse_addr_spec.c:176]: parse_to_param(): DEBUG: add_param:
tag=533cb9e91f4b999cf76861cbb9ed54ed-bb2e
Jul 18 15:50:32 pbx /usr/sbin/kamailio[12600]: DEBUG: <core>
[parser/parse_addr_spec.c:893]: parse_addr_spec(): end of header reached,
state=29
Jul 18 15:50:32 pbx /usr/sbin/kamailio[12600]: DEBUG: sanity
[mod_sanity.c:255]: w_sanity_check(): sanity checks result: 1
Jul 18 15:50:32 pbx /usr/sbin/kamailio[12600]: DEBUG: siputils
[sipops.c:161]: w_is_first_hop(): no 2nd via found - first hop
Jul 18 15:50:32 pbx /usr/sbin/kamailio[12600]: *ERROR: <core>
[parser/contact/contact.c:175]: skip_name(): skip_name(): Error in contact,
scheme separator not found*
Jul 18 15:50:32 pbx /usr/sbin/kamailio[12600]: ERROR: <core>
[parser/contact/contact.c:202]: parse_contacts(): parse_contacts(): Error
while skipping name part
Jul 18 15:50:32 pbx /usr/sbin/kamailio[12600]: ERROR: <core>
[parser/contact/parse_contact.c:59]: contact_parser(): contact_parser():
Error while parsing contacts
Jul 18 15:50:32 pbx /usr/sbin/kamailio[12600]: ERROR: <core>
[parser/contact/parse_contact.c:88]: parse_contact(): parse_contact():
Error while parsing
Jul 18 15:50:32 pbx /usr/sbin/kamailio[12600]: ERROR: nathelper
[nhelpr_funcs.c:300]: get_contact_uri(): failed to parse Contact body
Jul 18 15:50:32 pbx /usr/sbin/kamailio[12600]: DEBUG: siputils
[checks.c:103]: has_totag(): no totag
Jul 18 15:50:32 pbx /usr/sbin/kamailio[12600]: NOTICE: <script>:
!------------------------------------>WE HAVE A NEW MESSAGE
Jul 18 15:50:32 pbx /usr/sbin/kamailio[12600]: DEBUG: registrar
[lookup.c:181]: *lookup(): contact for [1000] found by address*
Jul 18 15:50:32 pbx /usr/sbin/kamailio[12600]: DEBUG: <core>
[socket_info.c:583]: grep_sock_info(): grep_sock_info - checking if
host==us: 14==9 && [79.my.server.IP1] == [127.0.0.1]
Jul 18 15:50:32 pbx /usr/sbin/kamailio[12600]: DEBUG: <core>
[socket_info.c:583]: grep_sock_info(): grep_sock_info - checking if
host==us: 14==14 && [79.my.server.IP1] == [79.my.server.IP1]
Jul 18 15:50:32 pbx /usr/sbin/kamailio[12600]: NOTICE: <script>:
------------------MESSAGE PROCESSING: *location not found*, storing offline
message ID: (sip:1000-***@public.gmane.org:59287;transport=TLS)
Jul 18 15:50:32 pbx /usr/sbin/kamailio[12600]: DEBUG: msilo [msilo.c:605]:
m_store(): ------------ start ------------
Jul 18 15:50:32 pbx /usr/sbin/kamailio[12600]: DEBUG: msilo [msilo.c:648]:
m_store(): using user id [sip:1000-***@public.gmane.org:59287;transport=TLS]
Jul 18 15:50:32 pbx /usr/sbin/kamailio[12600]: DEBUG: msilo [msilo.c:732]:
m_store(): 'From' header: <sip:registrar-TNFzNwJ3FISaMJb+***@public.gmane.org>
Jul 18 15:50:32 pbx /usr/sbin/kamailio[12600]: DEBUG: msilo [msilo.c:849]:
m_store(): message stored. T:<sip:1000-TNFzNwJ3FISaMJb+***@public.gmane.org> F:<
sip:registrar-TNFzNwJ3FISaMJb+***@public.gmane.org>
Jul 18 15:50:32 pbx /usr/sbin/kamailio[12600]: DEBUG: msilo [msilo.c:858]:
m_store(): sending info message.
Jul 18 15:50:32 pbx /usr/sbin/kamailio[12600]: DEBUG: msilo [msilo.c:899]:
m_store(): contact header found


On Thu, Jul 17, 2014 at 11:01 PM, Daniel-Constantin Mierla <
Post by Daniel-Constantin Mierla
You should not call m_store() if src_ip==myself -- in this way you avoid
to store notification messages that cannot be delivered.
Why notifications are not delivered has to be troubleshooted there. Have
you tried also with UDP?
Cheers,
Daniel
Anthony Messina
2014-07-18 17:39:25 UTC
Permalink
You should not call m_store() if src_ip==myself -- in this way you avoid to
store notification messages that cannot be delivered.
Why notifications are not delivered has to be troubleshooted there. Have you
tried also with UDP?
Cheers,
Daniel
Well I've been experimenting with this for hours and still no joy
:( Hair pulling continues
Peter, I'm trying to accomplish something similar, also as a new user to
Kamailio and initially starting from the guide at
http://kb.asipto.com/asterisk:realtime:kamailio-4.0.x-asterisk-11.3.0-astdb
though I am using Asterisk 12 and Kamailio devel (built for Fedora here
https://messinet.com/rpms/browser/kamailio)

My goal is that Kamailio does MESSAGE processing with MSILO storage *only* for
users who actually exist -- not just any username in my domain, but a user who
is in the subscribers table -- there is no sense storing a message for a
username who will never register to receive it.

Here are the relevant blocks in my kamailio.cfg -- I've included full routing
blocks so you can see how the route is laid out. I admit that I am equally
not sure that this is the right way or the most efficient way to do it, but it
does work with UDP, TCP, and TLS including notifications.

Now that I have it "working," and understand more about routing in Kamailio,
I'm likely going to consolidate duplication. For instance, since I don't want
to store messages for invalid or non-existent accounts, I will probably do the
if(is_subscriber("$ou", "ps_auths", "1")) and add
t_on_failure("MANAGE_FAILURE"); in the request_route, etc.

Perhaps 1) this will help you, and 2) others may be able to give advice on my
configuration.



#!define WITH_AUTH
#!define WITH_MSILO


#!ifdef WITH_AUTH
loadmodule "auth.so"
loadmodule "auth_db.so"
#!ifdef WITH_IPAUTH
loadmodule "permissions.so"
#!endif
#!endif


#!ifdef WITH_MSILO
loadmodule "msilo.so"
#!endif


#!ifdef WITH_AUTH
# ----- auth_db params -----
modparam("auth_db", "calculate_ha1", yes)
modparam("auth_db", "load_credentials", "")

#!ifdef WITH_ASTERISK
modparam("auth_db", "user_column", "username")
modparam("auth_db", "domain_column", "realm")
modparam("auth_db", "password_column", "password")
# Workaround http://lists.sip-router.org/pipermail/sr-users/2013-August/079267.html
modparam("auth_db", "load_credentials", "username")
# End workaround
modparam("auth_db", "db_url", DBASTURL)
modparam("auth_db", "version_table", 0)
#!else
modparam("auth_db", "db_url", DBURL)
modparam("auth_db", "password_column", "password")
modparam("auth_db", "use_domain", MULTIDOMAIN)
#!endif

#!ifdef WITH_IPAUTH
# ----- permissions params -----
modparam("permissions", "db_url", DBURL)
modparam("permissions", "db_mode", 1)
#!endif
#!endif


#!ifdef WITH_MSILO
# ----- msilo params -----
modparam("msilo", "db_url", DBURL)
modparam("msilo", "from_address", "sip:$rU-gnoiKKNqQiqaMJb+***@public.gmane.org")
modparam("msilo", "offline_message", "I'll get my messages when I'm back
online.")
modparam("msilo", "content_type_hdr", "Content-Type: text/plain\r\n")
modparam("msilo", "expire_time", 604800)
#!endif


#######################
route[RELAY] {

# enable additional event routes for forwarded requests
# - serial forking, RTP relaying handling, a.s.o.
if (is_method("INVITE|BYE|SUBSCRIBE|UPDATE")) {
if(!t_is_set("branch_route")) t_on_branch("MANAGE_BRANCH");
}
if (is_method("INVITE|SUBSCRIBE|UPDATE")) {
if(!t_is_set("onreply_route")) t_on_reply("MANAGE_REPLY");
}
if (is_method("INVITE")) {
if(!t_is_set("failure_route")) t_on_failure("MANAGE_FAILURE");
}

#!ifdef WITH_MSILO
if (is_method("MESSAGE")) {
if(!t_is_set("failure_route")) t_on_failure("MANAGE_FAILURE");
}
#!endif

if (!t_relay()) {
sl_reply_error();
}
exit;
}


#######################
route[REGISTRAR] {
if (is_method("REGISTER"))
{
if(isflagset(FLT_NATS))
{
setbflag(FLB_NATB);
# uncomment next line to do SIP NAT pinging
## setbflag(FLB_NATSIPPING);
}
if (!save("location"))
sl_reply_error();

#!ifdef WITH_MSILO
# Ensure we aren't unregistering
# Right now, CSipSimple doesn't send an Allow header with an
un-REGISTER,
# so Kamailio skips to checking the Contact header for
expires, and appears
# to ignore the fact that an Expires: 0 header is present.
if($hdr(Expires) != 0)
m_dump();
#!endif

#!ifdef WITH_ASTERISK
route(REGFWD);
#!endif

exit;
}
}


#######################
route[LOCATION] {

#!ifdef WITH_SPEEDDIAL
# search for short dialing - 2-digit extension
if($rU=~"^[0-9][0-9]$")
if(sd_lookup("speed_dial"))
route(SIPOUT);
#!endif

#!ifdef WITH_ALIASDB
# search in DB-based aliases
if(alias_db_lookup("dbaliases"))
route(SIPOUT);
#!endif

#!ifdef WITH_ASTERISK
if(is_method("INVITE") && (!route(FROMASTERISK))) {
# if new call from out there - send to Asterisk
# - non-INVITE request are routed directly by Kamailio
# - traffic from Asterisk is routed also directy by Kamailio
route(TOASTERISK);
exit;
}
#!endif

$avp(oexten) = $rU;
if (!lookup("location")) {

#!ifdef WITH_MSILO
if(is_method("MESSAGE") && src_ip!=myself) {
# Ensure we have a valid account for which to store
MESSAGEs

#!ifdef WITH_ASTERISK
if(is_subscriber("$ru", "ps_auths", "1")) {
#!else
if(is_subscriber("$ru", "subscriber", "1")) {
#!endif

if(m_store("$ru")) {
xlog("L_INFO", "MSILO: MESSAGE from
$fu stored for offline user $ru\n");
send_reply("202", "Accepted");
} else {
xlog("L_ERR", "MSILO: unable to store
MESSAGE from $fu for offline user $ru\n");
send_reply("503", "Service
Unavailable");
}
} else {
xlog("L_ERR", "MSILO: MESSAGE from $fu not
stored for non-existent user $ru\n");
send_reply("404", "Not Found");
}
exit;
}
#!endif

$var(rc) = $rc;
route(TOVOICEMAIL);
t_newtran();
switch ($var(rc)) {
case -1:
case -3:
send_reply("404", "Not Found");
exit;
case -2:
send_reply("405", "Method Not Allowed");
exit;
}
}

# when routing via usrloc, log the missed calls also
if (is_method("INVITE"))
{
setflag(FLT_ACCMISSED);
}
}


#######################
route[AUTH] {
#!ifdef WITH_MSILO
# do not authenticate ourselves when dumping messages
if(is_method("MESSAGE") && src_ip==myself)
{
return;
}
#!endif

# if caller is not local subscriber, then check if it calls
# a local destination, otherwise deny, not an open relay here
if (from_uri!=myself && uri!=myself)
{
sl_send_reply("403","Not relaying");
exit;
}

#!ifdef WITH_AUTH

#!ifdef WITH_ASTERISK
# do not auth traffic from Asterisk - trusted!
if(route(FROMASTERISK))
return;
#!endif

#!ifdef WITH_IPAUTH
if((!is_method("REGISTER")) && allow_source_address())
{
# source IP allowed
return;
}
#!endif

if (is_method("REGISTER") || from_uri==myself)
{
# authenticate requests
#!ifdef WITH_ASTERISK
if (!auth_check("$fd", "ps_auths", "1")) {
#!else
if (!auth_check("$fd", "subscriber", "1")) {
#!endif
auth_challenge("$fd", "0");
exit;
}
# user authenticated - remove auth header
if(!is_method("REGISTER|PUBLISH"))
consume_credentials();
}
#!endif
return;
}


#######################
failure_route[MANAGE_FAILURE] {
route(NATMANAGE);

if (t_is_canceled()) {
exit;
}

#!ifdef WITH_BLOCK3XX
# block call redirect based on 3xx replies.
if (t_check_status("3[0-9][0-9]")) {
t_reply("404","Not found");
exit;
}
#!endif

#!ifdef WITH_MSILO
# Manage MSILO transmission failures
if(is_method("MESSAGE") && src_ip!=myself) {

# Ensure we have a valid account for which to store MESSAGEs
#!ifdef WITH_ASTERISK
if(is_subscriber("$ou", "ps_auths", "1")) {
#!else
if(is_subscriber("$ou", "subscriber", "1")) {
#!endif

if (m_store("$ou")) {
xlog("L_INFO", "MSILO: MESSAGE from $fu stored
for unreachable user $ou\n");
send_reply("202", "Accepted");
} else {
xlog("L_ERR", "MSILO: unable to store MESSAGE
from $fu for unreachable user $ou\n");
send_reply("503", "Service Unavailable");
}
}
exit;
}
#!endif

#!ifdef WITH_VOICEMAIL
# serial forking
# - route to voicemail on busy or no answer (timeout)
if (t_check_status("486|408")) {
$du = $null;
route(TOVOICEMAIL);
exit;
}
#!endif
}
--
Anthony - http://messinet.com - http://messinet.com/~amessina/gallery
8F89 5E72 8DF0 BCF0 10BE 9967 92DC 35DC B001 4A4E
Peter Villeneuve
2014-07-18 18:32:21 UTC
Permalink
You are a star Anthony!
Thanks a lot for sharing your config. It is much appreciated.
I'm going to study your config in detail and see if I can get it to work on
my install.

Cheers,
Peter
Post by Anthony Messina
Post by Daniel-Constantin Mierla
You should not call m_store() if src_ip==myself -- in this way you avoid
to
Post by Daniel-Constantin Mierla
store notification messages that cannot be delivered.
Why notifications are not delivered has to be troubleshooted there. Have
you
Post by Daniel-Constantin Mierla
tried also with UDP?
Cheers,
Daniel
Well I've been experimenting with this for hours and still no joy
:( Hair pulling continues
Peter, I'm trying to accomplish something similar, also as a new user to
Kamailio and initially starting from the guide at
http://kb.asipto.com/asterisk:realtime:kamailio-4.0.x-asterisk-11.3.0-astdb
though I am using Asterisk 12 and Kamailio devel (built for Fedora here
https://messinet.com/rpms/browser/kamailio)
My goal is that Kamailio does MESSAGE processing with MSILO storage *only*
for
users who actually exist -- not just any username in my domain, but a user
who
is in the subscribers table -- there is no sense storing a message for a
username who will never register to receive it.
Here are the relevant blocks in my kamailio.cfg -- I've included full
routing
blocks so you can see how the route is laid out. I admit that I am equally
not sure that this is the right way or the most efficient way to do it,
but it
does work with UDP, TCP, and TLS including notifications.
Now that I have it "working," and understand more about routing in
Kamailio,
I'm likely going to consolidate duplication. For instance, since I don't
want
to store messages for invalid or non-existent accounts, I will probably do
the
if(is_subscriber("$ou", "ps_auths", "1")) and add
t_on_failure("MANAGE_FAILURE"); in the request_route, etc.
Perhaps 1) this will help you, and 2) others may be able to give advice on
my
configuration.
#!define WITH_AUTH
#!define WITH_MSILO
#!ifdef WITH_AUTH
loadmodule "auth.so"
loadmodule "auth_db.so"
#!ifdef WITH_IPAUTH
loadmodule "permissions.so"
#!endif
#!endif
#!ifdef WITH_MSILO
loadmodule "msilo.so"
#!endif
#!ifdef WITH_AUTH
# ----- auth_db params -----
modparam("auth_db", "calculate_ha1", yes)
modparam("auth_db", "load_credentials", "")
#!ifdef WITH_ASTERISK
modparam("auth_db", "user_column", "username")
modparam("auth_db", "domain_column", "realm")
modparam("auth_db", "password_column", "password")
# Workaround
http://lists.sip-router.org/pipermail/sr-users/2013-August/079267.html
modparam("auth_db", "load_credentials", "username")
# End workaround
modparam("auth_db", "db_url", DBASTURL)
modparam("auth_db", "version_table", 0)
#!else
modparam("auth_db", "db_url", DBURL)
modparam("auth_db", "password_column", "password")
modparam("auth_db", "use_domain", MULTIDOMAIN)
#!endif
#!ifdef WITH_IPAUTH
# ----- permissions params -----
modparam("permissions", "db_url", DBURL)
modparam("permissions", "db_mode", 1)
#!endif
#!endif
#!ifdef WITH_MSILO
# ----- msilo params -----
modparam("msilo", "db_url", DBURL)
modparam("msilo", "offline_message", "I'll get my messages when I'm back
online.")
modparam("msilo", "content_type_hdr", "Content-Type: text/plain\r\n")
modparam("msilo", "expire_time", 604800)
#!endif
#######################
route[RELAY] {
# enable additional event routes for forwarded requests
# - serial forking, RTP relaying handling, a.s.o.
if (is_method("INVITE|BYE|SUBSCRIBE|UPDATE")) {
if(!t_is_set("branch_route")) t_on_branch("MANAGE_BRANCH");
}
if (is_method("INVITE|SUBSCRIBE|UPDATE")) {
if(!t_is_set("onreply_route")) t_on_reply("MANAGE_REPLY");
}
if (is_method("INVITE")) {
if(!t_is_set("failure_route"))
t_on_failure("MANAGE_FAILURE");
}
#!ifdef WITH_MSILO
if (is_method("MESSAGE")) {
if(!t_is_set("failure_route"))
t_on_failure("MANAGE_FAILURE");
}
#!endif
if (!t_relay()) {
sl_reply_error();
}
exit;
}
#######################
route[REGISTRAR] {
if (is_method("REGISTER"))
{
if(isflagset(FLT_NATS))
{
setbflag(FLB_NATB);
# uncomment next line to do SIP NAT pinging
## setbflag(FLB_NATSIPPING);
}
if (!save("location"))
sl_reply_error();
#!ifdef WITH_MSILO
# Ensure we aren't unregistering
# Right now, CSipSimple doesn't send an Allow header with
an
un-REGISTER,
# so Kamailio skips to checking the Contact header for
expires, and appears
# to ignore the fact that an Expires: 0 header is present.
if($hdr(Expires) != 0)
m_dump();
#!endif
#!ifdef WITH_ASTERISK
route(REGFWD);
#!endif
exit;
}
}
#######################
route[LOCATION] {
#!ifdef WITH_SPEEDDIAL
# search for short dialing - 2-digit extension
if($rU=~"^[0-9][0-9]$")
if(sd_lookup("speed_dial"))
route(SIPOUT);
#!endif
#!ifdef WITH_ALIASDB
# search in DB-based aliases
if(alias_db_lookup("dbaliases"))
route(SIPOUT);
#!endif
#!ifdef WITH_ASTERISK
if(is_method("INVITE") && (!route(FROMASTERISK))) {
# if new call from out there - send to Asterisk
# - non-INVITE request are routed directly by Kamailio
# - traffic from Asterisk is routed also directy by
Kamailio
route(TOASTERISK);
exit;
}
#!endif
$avp(oexten) = $rU;
if (!lookup("location")) {
#!ifdef WITH_MSILO
if(is_method("MESSAGE") && src_ip!=myself) {
# Ensure we have a valid account for which to store
MESSAGEs
#!ifdef WITH_ASTERISK
if(is_subscriber("$ru", "ps_auths", "1")) {
#!else
if(is_subscriber("$ru", "subscriber", "1")) {
#!endif
if(m_store("$ru")) {
xlog("L_INFO", "MSILO: MESSAGE from
$fu stored for offline user $ru\n");
send_reply("202", "Accepted");
} else {
xlog("L_ERR", "MSILO: unable to
store
MESSAGE from $fu for offline user $ru\n");
send_reply("503", "Service
Unavailable");
}
} else {
xlog("L_ERR", "MSILO: MESSAGE from $fu not
stored for non-existent user $ru\n");
send_reply("404", "Not Found");
}
exit;
}
#!endif
$var(rc) = $rc;
route(TOVOICEMAIL);
t_newtran();
switch ($var(rc)) {
send_reply("404", "Not Found");
exit;
send_reply("405", "Method Not Allowed");
exit;
}
}
# when routing via usrloc, log the missed calls also
if (is_method("INVITE"))
{
setflag(FLT_ACCMISSED);
}
}
#######################
route[AUTH] {
#!ifdef WITH_MSILO
# do not authenticate ourselves when dumping messages
if(is_method("MESSAGE") && src_ip==myself)
{
return;
}
#!endif
# if caller is not local subscriber, then check if it calls
# a local destination, otherwise deny, not an open relay here
if (from_uri!=myself && uri!=myself)
{
sl_send_reply("403","Not relaying");
exit;
}
#!ifdef WITH_AUTH
#!ifdef WITH_ASTERISK
# do not auth traffic from Asterisk - trusted!
if(route(FROMASTERISK))
return;
#!endif
#!ifdef WITH_IPAUTH
if((!is_method("REGISTER")) && allow_source_address())
{
# source IP allowed
return;
}
#!endif
if (is_method("REGISTER") || from_uri==myself)
{
# authenticate requests
#!ifdef WITH_ASTERISK
if (!auth_check("$fd", "ps_auths", "1")) {
#!else
if (!auth_check("$fd", "subscriber", "1")) {
#!endif
auth_challenge("$fd", "0");
exit;
}
# user authenticated - remove auth header
if(!is_method("REGISTER|PUBLISH"))
consume_credentials();
}
#!endif
return;
}
#######################
failure_route[MANAGE_FAILURE] {
route(NATMANAGE);
if (t_is_canceled()) {
exit;
}
#!ifdef WITH_BLOCK3XX
# block call redirect based on 3xx replies.
if (t_check_status("3[0-9][0-9]")) {
t_reply("404","Not found");
exit;
}
#!endif
#!ifdef WITH_MSILO
# Manage MSILO transmission failures
if(is_method("MESSAGE") && src_ip!=myself) {
# Ensure we have a valid account for which to store
MESSAGEs
#!ifdef WITH_ASTERISK
if(is_subscriber("$ou", "ps_auths", "1")) {
#!else
if(is_subscriber("$ou", "subscriber", "1")) {
#!endif
if (m_store("$ou")) {
xlog("L_INFO", "MSILO: MESSAGE from $fu
stored
for unreachable user $ou\n");
send_reply("202", "Accepted");
} else {
xlog("L_ERR", "MSILO: unable to store
MESSAGE
from $fu for unreachable user $ou\n");
send_reply("503", "Service Unavailable");
}
}
exit;
}
#!endif
#!ifdef WITH_VOICEMAIL
# serial forking
# - route to voicemail on busy or no answer (timeout)
if (t_check_status("486|408")) {
$du = $null;
route(TOVOICEMAIL);
exit;
}
#!endif
}
--
Anthony - http://messinet.com - http://messinet.com/~amessina/gallery
8F89 5E72 8DF0 BCF0 10BE 9967 92DC 35DC B001 4A4E
_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
Anthony Messina
2014-07-18 18:48:05 UTC
Permalink
Post by Peter Villeneuve
You are a star Anthony!
Thanks a lot for sharing your config. It is much appreciated.
I'm going to study your config in detail and see if I can get it to work on
my install.
Cheers,
Peter
Sure, Peter. One thing I noticed during testing (and after restarting
Kamailio between changes), I needed to un-REGISTER and re-REGISTER the
CSipSimple client that was going to send the MESSAGE to the offline user. If
I didn't do that, it would never receive the "User offline" reply message and
Kamailio would continually try to resend it.

-A
--
Anthony - http://messinet.com - http://messinet.com/~amessina/gallery
8F89 5E72 8DF0 BCF0 10BE 9967 92DC 35DC B001 4A4E
Peter Villeneuve
2014-07-18 22:34:27 UTC
Permalink
Hi again,

I've been playing around with Anthony's config posted above, and I believe
I'm almost there getting msilo to work properly, although it seems that
kamailio doesn't correctly recognize the callee is a local subscriber so it
rejects the message instead of storing it.
Shouldn't the is_subscriber function return true since user 1010 is in fact
a subscriber? I don't understand why it throws the invalid parameter error,
but it's late and I'm tired of staring at the config file for endless hours.
Am I forgetting something basic? The user (1000 in my example) registers
fine, so obviously kamailio can properly poll the DB.

Any clues?

Cheers

Jul 18 21:30:50 pbx /usr/sbin/kamailio[16778]: DEBUG: registrar
[lookup.c:158]: lookup(): '1010' Not found in usrloc
Jul 18 21:30:50 pbx /usr/sbin/kamailio[16778]: DEBUG: <core>
[socket_info.c:583]: grep_sock_info(): grep_sock_info - checking if
host==us: 14==14 && [85.xx.xx.xx] == [79.my.server.IP1]
Jul 18 21:30:50 pbx /usr/sbin/kamailio[16778]: DEBUG: <core>
[forward.c:454]: check_self(): check_self: host != me
Jul 18 21:30:50 pbx /usr/sbin/kamailio[16778]: DEBUG: auth_db
[authdb_mod.c:291]:* w_is_subscriber(): uri [sip:1010-TNFzNwJ3FISaMJb+***@public.gmane.org
<sip%3A1010-TNFzNwJ3FISaMJb+***@public.gmane.org>]* table [subscriber] flags [1]
Jul 18 21:30:50 pbx /usr/sbin/kamailio[16778]: ERROR: *<core>
[db_ut.c:280]: db_print_columns(): Invalid parameter value*
Jul 18 21:30:50 pbx /usr/sbin/kamailio[16778]: ERROR: auth_db
[authorize.c:97]: fetch_credentials(): failed to query database
Jul 18 21:30:50 pbx /usr/sbin/kamailio[16778]: ERROR: <script>: MSILO:
MESSAGE from sip:1000-TNFzNwJ3FISaMJb+***@public.gmane.org not stored for non-existent user
sip:1010-TNFzNwJ3FISaMJb+***@public.gmane.org
Jul 18 21:30:50 pbx /usr/sbin/kamailio[16778]: DEBUG: sl [sl.c:288]:
send_reply(): reply in stateless mode (sl)
Post by Anthony Messina
Post by Peter Villeneuve
You are a star Anthony!
Thanks a lot for sharing your config. It is much appreciated.
I'm going to study your config in detail and see if I can get it to work
on
Post by Peter Villeneuve
my install.
Cheers,
Peter
Sure, Peter. One thing I noticed during testing (and after restarting
Kamailio between changes), I needed to un-REGISTER and re-REGISTER the
CSipSimple client that was going to send the MESSAGE to the offline user.
If
I didn't do that, it would never receive the "User offline" reply message
and
Kamailio would continually try to resend it.
-A
--
Anthony - http://messinet.com - http://messinet.com/~amessina/gallery
8F89 5E72 8DF0 BCF0 10BE 9967 92DC 35DC B001 4A4E
_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
Anthony Messina
2014-07-18 22:57:09 UTC
Permalink
Post by Peter Villeneuve
Hi again,
I've been playing around with Anthony's config posted above, and I believe
I'm almost there getting msilo to work properly, although it seems that
kamailio doesn't correctly recognize the callee is a local subscriber so it
rejects the message instead of storing it. Shouldn't the is_subscriber
function return true since user 1010 is in fact a subscriber? I don't
understand why it throws the invalid parameter error, but it's late and I'm
tired of staring at the config file for endless hours. Am I forgetting
something basic? The user (1000 in my example) registers fine, so obviously
kamailio can properly poll the DB.
Any clues?
Cheers
Jul 18 21:30:50 pbx /usr/sbin/kamailio[16778]: DEBUG: registrar
[lookup.c:158]: lookup(): '1010' Not found in usrloc Jul 18 21:30:50 pbx
grep_sock_info(): grep_sock_info - checking if host==us: 14==14 &&
[85.xx.xx.xx] == [79.my.server.IP1] Jul 18 21:30:50 pbx
DEBUG: auth_db [authdb_mod.c:291]: w_is_subscriber(): uri
ERROR: auth_db [authorize.c:97]: fetch_credentials(): failed to query
DEBUG: sl [sl.c:288]: send_reply(): reply in stateless mode (sl)
You have to set auth_db's "load_credentials" variable to something--I chose
username since that was present in my db:

# Workaround http://lists.sip-router.org/pipermail/sr-users/2013-August/079267.html
modparam("auth_db", "load_credentials", "username")
--
Anthony - http://messinet.com - http://messinet.com/~amessina/gallery
8F89 5E72 8DF0 BCF0 10BE 9967 92DC 35DC B001 4A4E
Peter Villeneuve
2014-07-18 23:40:12 UTC
Permalink
Yup, that was it thanks.

Now I'm back to my original problem. I just have 1 tls listener on 5061.
I'm going to try and enable other transports and set the outbound proxy and
see if that fixes it.

Cheers

ERROR: tm [ut.h:343]: uri2dst2(): no corresponding socket for af 2
Post by Peter Villeneuve
Post by Peter Villeneuve
Hi again,
I've been playing around with Anthony's config posted above, and I
believe
Post by Peter Villeneuve
I'm almost there getting msilo to work properly, although it seems that
kamailio doesn't correctly recognize the callee is a local subscriber so
it
Post by Peter Villeneuve
rejects the message instead of storing it. Shouldn't the is_subscriber
function return true since user 1010 is in fact a subscriber? I don't
understand why it throws the invalid parameter error, but it's late and
I'm
Post by Peter Villeneuve
tired of staring at the config file for endless hours. Am I forgetting
something basic? The user (1000 in my example) registers fine, so
obviously
Post by Peter Villeneuve
kamailio can properly poll the DB.
Any clues?
Cheers
Jul 18 21:30:50 pbx /usr/sbin/kamailio[16778]: DEBUG: registrar
[lookup.c:158]: lookup(): '1010' Not found in usrloc Jul 18 21:30:50 pbx
grep_sock_info(): grep_sock_info - checking if host==us: 14==14 &&
[85.xx.xx.xx] == [79.my.server.IP1] Jul 18 21:30:50 pbx
DEBUG: auth_db [authdb_mod.c:291]: w_is_subscriber(): uri
pbx
Post by Peter Villeneuve
ERROR: auth_db [authorize.c:97]: fetch_credentials(): failed to query
user
Post by Peter Villeneuve
DEBUG: sl [sl.c:288]: send_reply(): reply in stateless mode (sl)
You have to set auth_db's "load_credentials" variable to something--I chose
# Workaround
http://lists.sip-router.org/pipermail/sr-users/2013-August/079267.html
modparam("auth_db", "load_credentials", "username")
--
Anthony - http://messinet.com - http://messinet.com/~amessina/gallery
8F89 5E72 8DF0 BCF0 10BE 9967 92DC 35DC B001 4A4E
_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
Peter Villeneuve
2014-07-20 18:42:11 UTC
Permalink
Just to update the list in case anyone cares.
Indeed I have finally managed to get msilo working properly by setting the
outbound proxy for msilo. And it works fine with just the TLS transport.

I really appreciate your help Anthony. Your config file was invaluable to
me.

Cheers,
Peter
Post by Peter Villeneuve
Yup, that was it thanks.
Now I'm back to my original problem. I just have 1 tls listener on 5061.
I'm going to try and enable other transports and set the outbound proxy
and see if that fixes it.
Cheers
ERROR: tm [ut.h:343]: uri2dst2(): no corresponding socket for af 2
Post by Peter Villeneuve
Post by Peter Villeneuve
Hi again,
I've been playing around with Anthony's config posted above, and I
believe
Post by Peter Villeneuve
I'm almost there getting msilo to work properly, although it seems that
kamailio doesn't correctly recognize the callee is a local subscriber
so it
Post by Peter Villeneuve
rejects the message instead of storing it. Shouldn't the is_subscriber
function return true since user 1010 is in fact a subscriber? I don't
understand why it throws the invalid parameter error, but it's late and
I'm
Post by Peter Villeneuve
tired of staring at the config file for endless hours. Am I forgetting
something basic? The user (1000 in my example) registers fine, so
obviously
Post by Peter Villeneuve
kamailio can properly poll the DB.
Any clues?
Cheers
Jul 18 21:30:50 pbx /usr/sbin/kamailio[16778]: DEBUG: registrar
[lookup.c:158]: lookup(): '1010' Not found in usrloc Jul 18 21:30:50 pbx
grep_sock_info(): grep_sock_info - checking if host==us: 14==14 &&
[85.xx.xx.xx] == [79.my.server.IP1] Jul 18 21:30:50 pbx
DEBUG: auth_db [authdb_mod.c:291]: w_is_subscriber(): uri
pbx
Post by Peter Villeneuve
ERROR: auth_db [authorize.c:97]: fetch_credentials(): failed to query
user
Post by Peter Villeneuve
DEBUG: sl [sl.c:288]: send_reply(): reply in stateless mode (sl)
You have to set auth_db's "load_credentials" variable to something--I chose
# Workaround
http://lists.sip-router.org/pipermail/sr-users/2013-August/079267.html
modparam("auth_db", "load_credentials", "username")
--
Anthony - http://messinet.com - http://messinet.com/~amessina/gallery
8F89 <http://messinet.com/~amessina/gallery8F89> 5E72 8DF0 BCF0 10BE
9967 92DC 35DC B001 4A4E
_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
Daniel-Constantin Mierla
2014-07-21 07:58:10 UTC
Permalink
Maybe someone can make a blog post somewhere or an article on the wiki
(http://www.kamailio.org/wiki/) with this topic, putting there the
config, so it will help others in the future.

Cheers,
Daniel
Post by Peter Villeneuve
Just to update the list in case anyone cares.
Indeed I have finally managed to get msilo working properly by setting
the outbound proxy for msilo. And it works fine with just the TLS
transport.
I really appreciate your help Anthony. Your config file was invaluable
to me.
Cheers,
Peter
On Sat, Jul 19, 2014 at 12:40 AM, Peter Villeneuve
Yup, that was it thanks.
Now I'm back to my original problem. I just have 1 tls listener on 5061.
I'm going to try and enable other transports and set the outbound
proxy and see if that fixes it.
Cheers
ERROR: tm [ut.h:343]: uri2dst2(): no corresponding socket for af 2
On Fri, Jul 18, 2014 at 11:57 PM, Anthony Messina
Post by Peter Villeneuve
Hi again,
I've been playing around with Anthony's config posted above,
and I believe
Post by Peter Villeneuve
I'm almost there getting msilo to work properly, although it
seems that
Post by Peter Villeneuve
kamailio doesn't correctly recognize the callee is a local
subscriber so it
Post by Peter Villeneuve
rejects the message instead of storing it. Shouldn't the
is_subscriber
Post by Peter Villeneuve
function return true since user 1010 is in fact a
subscriber? I don't
Post by Peter Villeneuve
understand why it throws the invalid parameter error, but
it's late and I'm
Post by Peter Villeneuve
tired of staring at the config file for endless hours. Am I
forgetting
Post by Peter Villeneuve
something basic? The user (1000 in my example) registers
fine, so obviously
Post by Peter Villeneuve
kamailio can properly poll the DB.
Any clues?
Cheers
Jul 18 21:30:50 pbx /usr/sbin/kamailio[16778]: DEBUG: registrar
[lookup.c:158]: lookup(): '1010' Not found in usrloc Jul 18
21:30:50 pbx
14==14 &&
Post by Peter Villeneuve
[85.xx.xx.xx] == [79.my.server.IP1] Jul 18 21:30:50 pbx
check_self: host != me Jul 18 21:30:50 pbx
DEBUG: auth_db [authdb_mod.c:291]: w_is_subscriber(): uri
table [subscriber] flags [1] Jul 18 21:30:50 pbx
Post by Peter Villeneuve
Invalid parameter value Jul 18 21:30:50 pbx
ERROR: auth_db [authorize.c:97]: fetch_credentials(): failed
to query
Post by Peter Villeneuve
DEBUG: sl [sl.c:288]: send_reply(): reply in stateless mode (sl)
You have to set auth_db's "load_credentials" variable to something--I chose
# Workaround
http://lists.sip-router.org/pipermail/sr-users/2013-August/079267.html
modparam("auth_db", "load_credentials", "username")
--
Anthony - http://messinet.com -
http://messinet.com/~amessina/gallery
8F89 <http://messinet.com/%7Eamessina/gallery8F89> 5E72 8DF0
BCF0 10BE 9967 92DC 35DC B001 4A4E
_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
--
Daniel-Constantin Mierla - http://www.asipto.com
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Loading...