if (is_method("CANCEL")) {
xlog("L_INFO", "Received CANCEL request for $ci - Method: $rm - R-URI:
$ru\n");
if (!t_check_trans()) {
xlog("L_INFO", "No transaction found with t_check_trans(), trying
t_lookup_cancel()\n");
# Try to find the transaction using branch and Call-ID
$var(branch) = $(hdr(Via){param.value,branch});
if (!t_lookup_cancel()) {
xlog("L_WARN", "No transaction found for CANCEL - $ci with
branch $var(branch)\n");
sl_reply("481", "Call Leg/Transaction Does Not Exist");
exit;
}
xlog("L_INFO", "Found transaction using
t_lookup_cancel()\n");
}
# Extract destination from original request
if ($ru != "") {
$du = $ru;
xlog("L_INFO", "Setting destination from R-URI: $du\n");
} else {
xlog("L_WARN", "No R-URI found for CANCEL\n");
}
# Add debugging
xlog("L_INFO", "Forwarding CANCEL to $du for call $ci\n");
if (ds_is_from_list()) {
ds_load_unset();
xlog("L_INFO", "Unset dispatcher load for destination\n");
}
# Handle the client ID and call counting
if (is_present_hf("X-VICIdial-Client-Id")) {
$var(client_id) = $(hdr(X-VICIdial-Client-Id));
if ($var(client_id) =~ "^(CID_[0-9]+)-[a-z]$") {
$var(parent_id) = $(var(client_id){re.subst,/^(CID_[0-9]+)-[a-z]$/\1/});
} else {
$var(parent_id) = $var(client_id);
}
if($var(parent_id) != $null) {
lock("calls_$var(parent_id)");
if($sht(clientCalls=>$var(parent_id)) > 0) {
$sht(clientCalls=>$var(parent_id)) =
$sht(clientCalls=>$var(parent_id)) - 1;
xlog("L_INFO", "CANCEL: Decremented call count for
$var(parent_id) to $sht(clientCalls=>$var(parent_id))\n");
}
unlock("calls_$var(parent_id)");
}
}
# Send 200 OK response for the CANCEL
t_reply("200", "OK");
# Force the relay of CANCEL to the destination
t_relay();
exit;
} "This is my cancel route. It either forwards or relays the cancel message to the
destination and also provides an error."
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/4060
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/issues/4060(a)github.com>