Maybe:
if (loose_route()) {
route(DLGURI);
if (is_method("BYE")) {
setflag(FLT_ACC); # do accounting ...
setflag(FLT_ACCFAILED); # ... even if the
transaction fails
} else if ( is_method("ACK") ) {
# ACK is forwarded statelessly
route(NATMANAGE);
} else if ( is_method("NOTIFY") ) {
# Add Record-Route for in-dialog
NOTIFY as per RFC 6665.
record_route();
}
route(RELAY);
exit;
}
--- I'm SoCIaL, MayBe
Hi There....
Hope someone can point me in the right direction.
The config below allows the device to register and will send the 200 OK without issue
It also allows the SUBSCRIBES to get in and a 202 Accepted is returned properly.
It also allows the device to send OPTION keepalives and they get in/out OK
The issue I am having at the moment is the outbount NOTIFY ofr the SUBS and outbound OPTIONS for heartbeat.
Can someone please point me at what I need to change so the OUTBOUND messages get delivered.
The issue I see is NAT related as the devices are behind firewalls at location A.
The Kamailio system and the inner PBX are all on Public IP.
################
debug=3
memdbg=5
memlog=5
log_facility=LOG_LOCAL0
fork=yes
children=4
listen=udp:192.168.1.3:8081
port=8081
#!define FLAG_FROM_SWITCH 1
#!define FLAG_FROM_DEVICE 2
mpath="/usr/lib/x86_64-linux-gnu/kamailio/modules/"
loadmodule "tm.so"
loadmodule "sl.so"
loadmodule "pv.so"
loadmodule "rr.so"
loadmodule "textops.so"
loadmodule "textopsx.so"
loadmodule "usrloc.so"
loadmodule "xlog.so"
loadmodule "path.so"
loadmodule "nathelper.so"
loadmodule "siputils.so"
# ----- nathelper params -----
modparam("nathelper|registrar", "received_avp", "$avp(RECEIVED)")
####### Routing Logic ########
request_route {
route(CHECK_SOURCE_IP);
# CANCEL processing
if (is_method("CANCEL")) {
if (t_check_trans()) {
route(RELAY);
}
exit;
}
route(WITHINDLG);
t_check_trans();
if( is_method("OPTIONS") ) {
t_relay();
}
if( is_method("REGISTER|SUBSCRIBE") ) {
add_path();
}
if( is_method("INVITE|REFER") ) {
record_route();
}
if( isflagset(FLAG_FROM_SWITCH) ) {
t_on_reply("OUTBOUND_REPLY");
} else {
$du = "sip:192.168.3.3:5060";
}
route(RELAY);
}
# SIP dialogs
route[WITHINDLG] {
if (has_totag()) {
# sequential request withing a dialog should
# take the path determined by record-routing
if (loose_route()) {
route(RELAY);
} else {
if (is_method("NOTIFY")) {
route(RELAY);
}
if (is_method("SUBSCRIBE") && uri == myself) {
# in-dialog subscribe requests
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
#xlog("ACK without matching transaction ... ignore and discard");
exit;
}
}
sl_send_reply("404","Not here");
}
exit;
}
}
onreply_route[OUTBOUND_REPLY]
{
route(NAT_TEST_AND_CORRECT);
}
route[NAT_TEST_AND_CORRECT]
{
if (nat_uac_test("3")) {
if (is_method("REGISTER|SUBSCRIBE")) {
fix_nated_register();
} else {
fix_nated_contact();
}
force_rport();
}
if (has_body("application/sdp") && nat_uac_test("8")) {
fix_nated_sdp("10");
}
}
route[RELAY]
{
if (!t_relay()) {
sl_reply_error();
}
exit;
}
route[LOGIT] {
xlog("L_INFO", "LOGIT: $var(spot) - $rm");
if( $ft == $null )
xlog("L_INFO", "LOGIT: $var(spot) - From:$fU @ $fd - $fu");
else
xlog("L_INFO", "LOGIT: $var(spot) - From:$fU @ $fd - $fu:$ft");
if( $tt == $null )
xlog("L_INFO", "LOGIT: $var(spot) - To:$tU @ $td - $tu");
else
xlog("L_INFO", "LOGIT: $var(spot) - To:$tU @ $td - $tu:$tt");
xlog("L_INFO", "LOGIT: $var(spot) - REQ:$rm @ $ru");
xlog("L_INFO", "LOGIT: $var(spot) - ACT:$(rd{s.select,0,.})");
xlog("L_INFO", "LOGIT: $var(spot) - HST:$(rd{s.select,1,.})");
xlog("L_INFO", "LOGIT: $var(spot) - CNT:$ct");
xlog("L_INFO", "LOGIT: $var(spot) - UAC:$ua");
if( $du != $null )
xlog("L_INFO", "LOGIT: $var(spot) - DURI:$du");
}
route[CHECK_SOURCE_IP]
{
$var(spot) = 'CHECK_SOURCE_IP';
route(LOGIT);
switch($si) {
case "192.168.3.2":
setflag(FLAG_FROM_SWITCH);
return;
default:
setflag(FLAG_FROM_DEVICE);
return;
}
}
__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions
* sr-users@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the sender!
Edit mailing list options or unsubscribe:
* https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users