Browse Source

only add k-cid header if it doesn't exist already

* initiators can provide k-cid
master
lazedo 6 years ago
parent
commit
8ed11dc5c7
1 changed files with 15 additions and 5 deletions
  1. +15
    -5
      kamailio/presence-fast-pickup.cfg

+ 15
- 5
kamailio/presence-fast-pickup.cfg View File

@ -60,7 +60,9 @@ route[PRESENCE_FAST_PICKUP_ATTEMPT]
route(PRESENCE_FAST_PICKUP_OPTION); route(PRESENCE_FAST_PICKUP_OPTION);
$du = $sht(fp=>$var(md5)); $du = $sht(fp=>$var(md5));
append_hf("Replaces: $var(replaced_call_id)$var(Pickup)\r\n"); append_hf("Replaces: $var(replaced_call_id)$var(Pickup)\r\n");
append_hf("k-cid: $var(replaced_call_id)\r\n");
if(!is_present_hf("k-cid")) {
append_hf("k-cid: $var(replaced_call_id)\r\n");
}
xlog("L_INFO", "$ci|log|fast|found shortcut for call-id $var(replaced_call_id) , redirecting ($(ru{uri.user})) to $du\n"); xlog("L_INFO", "$ci|log|fast|found shortcut for call-id $var(replaced_call_id) , redirecting ($(ru{uri.user})) to $du\n");
route(RELAY); route(RELAY);
exit(); exit();
@ -88,7 +90,9 @@ route[PRESENCE_FAST_PICKUP_ATTEMPT]
} }
remove_hf_re("^Replaces"); remove_hf_re("^Replaces");
append_hf("Replaces: $var(rep)\r\n"); append_hf("Replaces: $var(rep)\r\n");
append_hf("k-cid: $var(replaced_call_id)\r\n");
if(!is_present_hf("k-cid")) {
append_hf("k-cid: $var(replaced_call_id)\r\n");
}
xlog("L_INFO", "$ci|log|call-id $var(replaced_call_id) found, redirecting call ($(ru{uri.user})) to $du => $var(rep)\n"); xlog("L_INFO", "$ci|log|call-id $var(replaced_call_id) found, redirecting call ($(ru{uri.user})) to $du => $var(rep)\n");
route(RELAY); route(RELAY);
exit(); exit();
@ -109,7 +113,9 @@ route[PRESENCE_FAST_PICKUP_ATTEMPT]
$var(park) = $_s(*3$(ru{uri.user}{s.substr,2,0})@$(ru{uri.domain})); $var(park) = $_s(*3$(ru{uri.user}{s.substr,2,0})@$(ru{uri.domain}));
if($sht(park=>$var(park)) != $null) { if($sht(park=>$var(park)) != $null) {
$du = $sht(park=>$var(park)); $du = $sht(park=>$var(park));
append_hf("k-cid: $sht(park=>$var(park)::callid)\r\n");
if(!is_present_hf("k-cid")) {
append_hf("k-cid: $sht(park=>$var(park)::callid)\r\n");
}
xlog("L_INFO", "$ci|log|redirecting park request to $du , callid : $sht(park=>$var(park)::callid)\n"); xlog("L_INFO", "$ci|log|redirecting park request to $du , callid : $sht(park=>$var(park)::callid)\n");
route(RELAY); route(RELAY);
exit(); exit();
@ -119,7 +125,9 @@ route[PRESENCE_FAST_PICKUP_ATTEMPT]
if($sht(park=>$(ru{uri.user})@$(ru{uri.domain})) != $null) { if($sht(park=>$(ru{uri.user})@$(ru{uri.domain})) != $null) {
$du = $sht(park=>$(ru{uri.user})@$(ruri{uri.domain})); $du = $sht(park=>$(ru{uri.user})@$(ruri{uri.domain}));
append_hf("k-cid: $sht(park=>$(ru{uri.user})@$(ruri{uri.domain})::callid)\r\n");
if(!is_present_hf("k-cid")) {
append_hf("k-cid: $sht(park=>$(ru{uri.user})@$(ruri{uri.domain})::callid)\r\n");
}
xlog("L_INFO", "$ci|log|redirecting park request to $du, callid: $sht(park=>$(ru{uri.user})@$(ruri{uri.domain})::callid)\n"); xlog("L_INFO", "$ci|log|redirecting park request to $du, callid: $sht(park=>$(ru{uri.user})@$(ruri{uri.domain})::callid)\n");
route(RELAY); route(RELAY);
exit(); exit();
@ -138,7 +146,9 @@ route[PRESENCE_FAST_PICKUP_ATTEMPT]
$du = $(kzR{kz.json,Channels[0].switch_url}); $du = $(kzR{kz.json,Channels[0].switch_url});
if($du != $null) { if($du != $null) {
xlog("L_INFO", "$ci|log|redirecting park request to $du from realtime query reply\n"); xlog("L_INFO", "$ci|log|redirecting park request to $du from realtime query reply\n");
append_hf("k-cid: $(kzR{kz.json,Channels[0].call_id})\r\n");
if(!is_present_hf("k-cid")) {
append_hf("k-cid: $(kzR{kz.json,Channels[0].call_id})\r\n");
}
route(RELAY); route(RELAY);
exit(); exit();
} }


Loading…
Cancel
Save