@ -1,6 +1,5 @@
######## Generic Hash Table container in shared memory ########
######## Generic Hash Table container in shared memory ########
modparam("htable", "htable", "failover = >size=16;autoexpire=120")
modparam("htable", "htable", "failover = >size=16;autoexpire=120")
modparam("htable", "htable", "park = >size=4;autoexpire=600")
####### Dispatcher module ########
####### Dispatcher module ########
loadmodule "dispatcher.so"
loadmodule "dispatcher.so"
@ -69,61 +68,9 @@ route[DISPATCHER_FIND_ROUTES]
}
}
#!endif
#!endif
if (is_method("INVITE")) {
$var(replaced_call_id) = "none";
if( $(ou{uri.param,kazoo-id}{s.len}) > 0) {
if($hdr(Replaces) = = $null) {
$var(replaced_call_id) = $(ou{uri.param,kazoo-id}{s.unescape.param});
append_hf("Replaces: $var(replaced_call_id)\r\n");
}
}
if($hdr(Replaces)! = $null) {
$var(replaced_call_id) = $(hdr(Replaces){s.select,0,;});
}
if($var(replaced_call_id) ! = "none") {
xlog("L_INFO", "$ci|log|replaces call-id $var(replaced_call_id)");
$var(amqp_payload_request) = '{"Event-Category" : "call_event" , "Event-Name" : "channel_status_req", "Call-ID" : "' + $var(replaced_call_id) + '", "Active-Only" : true }';
$var(amqp_routing_key) = "call.status_req." + $(var(replaced_call_id){kz.encode});
if(kazoo_query("callevt", $var(amqp_routing_key), $var(amqp_payload_request))) {
$du = $(kzR{kz.json,Switch-URL});
if($du ! = $null) {
xlog("L_INFO", "$ci|log|call-id $var(replaced_call_id) found redirecting call to $du, courtesy of kazoo");
return;
}
}
}
##### CALL-PARK ####
if($(ru{uri.user}) = ~ "\*3" && $sht(park=>$(ru{uri.user})@$(ru{uri.domain})) != $null) {
$du = $sht(park=>$(ru{uri.user})@$(ruri{uri.domain}));
xlog("L_INFO", "$ci|log|redirecting park request to $du");
if ($hdr(Proxy-Authorization) ! = $null) {
xlog("L_INFO", "$ci|log|removed park redirect");
$sht(park = >$(ru{uri.user})@$(ruri{uri.domain})) = $null;
}
return;
}
##### CALL-PARK IN KAZOO ####
if($(ru{uri.user}) = ~ "\*3" && !($rd =~ "[0-9]{1,3}\.[0-9]{1,3}.[0-9]{1,3}\.[0-9]{1,3}") ) {
xlog("L_INFO", "$ci|log|checking park request to $(ru{uri.user})@$(ru{uri.domain})");
$var(amqp_payload_request) = '{"Event-Category" : "call_event" , "Event-Name" : "query_user_channels_req", "Username" : "$(ru{uri.user})", "Realm" : "$(ru{uri.domain})", "Active-Only" : true }';
$var(amqp_routing_key) = "call.status_req." + $(var(replaced_call_id){kz.encode});
if(kazoo_query("callevt", $var(amqp_routing_key), $var(amqp_payload_request))) {
$du = $(kzR{kz.json,Channels[0].switch_url});
if($du ! = $null) {
xlog("L_INFO", "$ci|log|redirecting park request to $du, courtesy of kazoo");
return;
}
}
}
}
#!ifdef FAST_PICKUP-ROLE
route(FAST_PICKUP_ATTEMPT);
#!endif
if (!ds_select_dst("$var(ds_group)", "0") || $(avp(ds_dst)[0]) = = $null) {
if (!ds_select_dst("$var(ds_group)", "0") || $(avp(ds_dst)[0]) = = $null) {
# if we selected from group 1, try again in group 2
# if we selected from group 1, try again in group 2