Browse Source

Adding logic around functions that require REGISTRAR_ROLE or NAT_TRAVERSAL_ROLE (#148)

4.1
derek2600hz 9 years ago
committed by bitbashing
parent
commit
2322761c0a
1 changed files with 16 additions and 1 deletions
  1. +16
    -1
      kamailio/default.cfg

+ 16
- 1
kamailio/default.cfg View File

@ -413,10 +413,13 @@ route[HANDLE_NOTIFY]
xlog("L_INFO", "$ci|log|Able to loose-route. Cool beans!\n"); xlog("L_INFO", "$ci|log|Able to loose-route. Cool beans!\n");
} }
#!ifdef REGISTRAR_ROLE
if (registered("location")) { if (registered("location")) {
lookup("location"); lookup("location");
xlog("L_INFO", "$ci|log|routing to $ruid\n"); xlog("L_INFO", "$ci|log|routing to $ruid\n");
} }
#!endif
route(INTERNAL_TO_EXTERNAL_RELAY); route(INTERNAL_TO_EXTERNAL_RELAY);
} else { } else {
#!ifdef TRAFFIC_FILTER_ROLE #!ifdef TRAFFIC_FILTER_ROLE
@ -503,9 +506,11 @@ route[HANDLE_IN_DIALOG_REQUESTS]
} }
#!endif #!endif
#!ifdef NAT_TRAVERSAL_ROLE
if(!isdsturiset()) { if(!isdsturiset()) {
handle_ruri_alias(); handle_ruri_alias();
} }
#!endif
xlog("L_INFO", "$ci|log|loose_route in-dialog message\n"); xlog("L_INFO", "$ci|log|loose_route in-dialog message\n");
# Called on in-dialog requests # Called on in-dialog requests
@ -559,14 +564,18 @@ route[PREPARE_INITIAL_REQUESTS]
} }
if (loose_route()) { if (loose_route()) {
#!ifdef REGISTRAR_ROLE
$xavp(regcfg=>match_received) = $su; $xavp(regcfg=>match_received) = $su;
if(registered("location", "$rz:$Au", 2) == 1) { if(registered("location", "$rz:$Au", 2) == 1) {
xlog("L_INFO", "$ci|log|allowing initial route-set for $Au\n"); xlog("L_INFO", "$ci|log|allowing initial route-set for $Au\n");
} else { } else {
#!endif
xlog("L_WARN", "$ci|end|dropping initial request with route-set\n"); xlog("L_WARN", "$ci|end|dropping initial request with route-set\n");
sl_send_reply("403", "No pre-loaded routes"); sl_send_reply("403", "No pre-loaded routes");
exit(); exit();
#!ifdef REGISTRAR_ROLE
} }
#!endif
} }
record_route(); record_route();
@ -592,6 +601,7 @@ route[INTERNAL_TO_EXTERNAL_RELAY]
} }
#!endif #!endif
#!ifdef REGISTRAR_ROLE
if ($hdr(X-KAZOO-AOR) != $null) { if ($hdr(X-KAZOO-AOR) != $null) {
xlog("L_INFO", "$ci|log|using AOR $hdr(X-KAZOO-AOR)\n"); xlog("L_INFO", "$ci|log|using AOR $hdr(X-KAZOO-AOR)\n");
if (reg_fetch_contacts("location", "$hdr(X-KAZOO-AOR)", "callee")) { if (reg_fetch_contacts("location", "$hdr(X-KAZOO-AOR)", "callee")) {
@ -604,6 +614,7 @@ route[INTERNAL_TO_EXTERNAL_RELAY]
exit; exit;
} }
} }
#!endif
remove_hf_re("^X-.*"); remove_hf_re("^X-.*");
@ -643,8 +654,10 @@ route[EXTERNAL_TO_INTERNAL_RELAY]
remove_hf_re("^X-.*"); remove_hf_re("^X-.*");
append_hf("X-AUTH-IP: $si\r\n"); append_hf("X-AUTH-IP: $si\r\n");
append_hf("X-AUTH-PORT: $sp\r\n"); append_hf("X-AUTH-PORT: $sp\r\n");
#!ifdef REGISTRAR_ROLE
route(ADD_AUTHORIZATION_HEADERS); route(ADD_AUTHORIZATION_HEADERS);
#!endif
t_on_reply("INTERNAL_REPLY"); t_on_reply("INTERNAL_REPLY");
t_on_failure("INTERNAL_FAULT"); t_on_failure("INTERNAL_FAULT");
@ -820,6 +833,7 @@ onsend_route {
xlog("L_INFO", "$ci|pass|$sndfrom(ip):$sndfrom(port) -> $sndto(ip):$sndto(port)\n"); xlog("L_INFO", "$ci|pass|$sndfrom(ip):$sndfrom(port) -> $sndto(ip):$sndto(port)\n");
} }
#!ifdef REGISTRAR_ROLE
route[ADD_AUTHORIZATION_HEADERS] route[ADD_AUTHORIZATION_HEADERS]
{ {
if (!is_method("INVITE|MESSAGE|REFER")) { if (!is_method("INVITE|MESSAGE|REFER")) {
@ -856,6 +870,7 @@ route[ADD_AUTHORIZATION_HEADERS]
append_hf("X-ecallmgr_Owner-ID: $(xavp(ulattrs=>custom_channel_vars){kz.json,Owner-ID})\r\n"); append_hf("X-ecallmgr_Owner-ID: $(xavp(ulattrs=>custom_channel_vars){kz.json,Owner-ID})\r\n");
} }
} }
#!endif
#!ifdef PRESENCE_NOTIFY_INIT #!ifdef PRESENCE_NOTIFY_INIT
event_route[tm:local-request] event_route[tm:local-request]


Loading…
Cancel
Save