Browse Source

Adding logic around functions that require REGISTRAT_ROLE, or NAT_TRAVERSAL_ROLE (#149)

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

+ 16
- 1
kamailio/default.cfg View File

@ -406,10 +406,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
@ -496,9 +499,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
@ -552,14 +557,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();
@ -585,6 +594,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")) {
@ -597,6 +607,7 @@ route[INTERNAL_TO_EXTERNAL_RELAY]
exit; exit;
} }
} }
#!endif
remove_hf_re("^X-.*"); remove_hf_re("^X-.*");
@ -636,8 +647,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");
@ -893,6 +906,7 @@ event_route[kazoo:consumer-event-connection-closed]
xlog("L_INFO","connection to $(kzE{kz.json,host}) closed\n"); xlog("L_INFO","connection to $(kzE{kz.json,host}) closed\n");
} }
#!ifdef REGISTRAR_ROLE
route[ADD_AUTHORIZATION_HEADERS] route[ADD_AUTHORIZATION_HEADERS]
{ {
if (!is_method("INVITE|MESSAGE|REFER")) { if (!is_method("INVITE|MESSAGE|REFER")) {
@ -929,6 +943,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