Browse Source

nat traversal role for presence (#140)

* add nat_traversal to presence

* adjust dev time timer

* add KAZOO_DATA_DIR

* remove PRESENCE_NAT role
4.0 4.0.7
lazedo 9 years ago
committed by bitbashing
parent
commit
1323817655
2 changed files with 47 additions and 4 deletions
  1. +5
    -1
      kamailio/defs.cfg
  2. +42
    -3
      kamailio/presence-role.cfg

+ 5
- 1
kamailio/defs.cfg View File

@ -3,8 +3,12 @@
####### defs ########
#!ifndef KAZOO_DATA_DIR
#!substdef "!KAZOO_DATA_DIR!/etc/kazoo/kamailio/dbtext!g"
#!endif
#!ifndef KAZOO_DB_URL
#!substdef "!KAZOO_DB_URL!text:///etc/kazoo/kamailio/dbtext!g"
#!substdef "!KAZOO_DB_URL!text://KAZOO_DATA_DIR!g"
#!endif
#!ifndef MAX_WHILE_LOOPS


+ 42
- 3
kamailio/presence-role.cfg View File

@ -33,13 +33,52 @@ modparam("presence", "xavp_cfg", "pres")
modparam("kazoo", "db_url", "KAZOO_DB_URL")
modparam("kazoo", "pua_mode", 1)
#!ifdef NAT_TRAVERSAL_ROLE
#!ifndef NAT_TRAVERSAL_LOADED
#!trydef NAT_TRAVERSAL_LOADED
loadmodule "nat_traversal.so"
#!endif
modparam("nat_traversal", "keepalive_method", "OPTIONS")
modparam("nat_traversal", "keepalive_from", "sip:sipcheck@MY_HOSTNAME")
modparam("nat_traversal", "keepalive_state_file", "KAZOO_DATA_DIR/keep_alive_state")
modparam("nat_traversal", "keepalive_interval", 60)
#!endif
route[PRESENCE_NAT]
{
if (client_nat_test("3")) {
fix_contact();
nat_keepalive();
force_rport();
}
}
route[PRESENCE_CHECK_NAT]
{
#!ifdef REGISTRAR_ROLE
$xavp(regcfg=>match_received) = $su;
xlog("L_INFO", "$ci|check|checking if $fU is registered\n");
if(registered("location", "$rz:$fU", 2, 1)) {
## is registered, keep alive handled in registrar
route(NAT_TEST_AND_CORRECT);
return;
} else {
route(PRESENCE_NAT);
}
#!else
route(PRESENCE_NAT);
#!endif
}
####### Presence Logic ########
route[HANDLE_SUBSCRIBE]
{
if (is_method("SUBSCRIBE")) {
#!ifdef NAT_TRAVERSAL_ROLE
route(NAT_TEST_AND_CORRECT);
#!endif
#!ifdef NAT_TRAVERSAL_ROLE
route(PRESENCE_CHECK_NAT);
#!endif
if ($tU == $null) {
xlog("L_INFO", "$ci|stop|ignoring subscribe with empty TO username from a $ua\n");


Loading…
Cancel
Save