I am trying to proxy a request from server A to server C with me being server B. i send the invite from A to B, then i need to send to server R which returns back to me a 300 redirect, which i then need to take the answer from the Contsct and then proxy the
original invite from A to C. server A can not handle 3xx responses and must be proxied. I havent been able to find any examples where the 300 is intercepted and a new invite to the target is sent. i have the following code but it results in no new INVITE
and the original session is hung until it is canceled. Any idea what i may be doing wrong? In the example below i am just hardcoding the uri for the new invite instead of getting from the Contact as a debug exercise. I am using Kamailio 5.7.3
route[HANDLEREDIRECT] {
xlog("L_INFO", "DBG: HANDLEREDIRECT");
msg_apply_changes();
$var(test) = $hdr(Contact);
xlog("L_INFO","DBG: redirect headers [$var(test)]: from=[$fu] from_user=[$fU], to=[$tu] to_user=[$tU]");
# send to gateway
$var(new_uri) = "sip:" + $tU + "@" + "gateway";
if ($var(new_uri) != "") {
xlog("DBG: Redirecting to: $var(new_uri)\n");
$ru = $var(new_uri);
$tu = $ru;
record_route();
route(RELAY);
exit;
# i have also tried using
#t_newtran();
# and
#t_relay();
} else {
xlog("DBG: No contact header found in 300 response\n");
}
}
# Manage outgoing branches
branch_route[MANAGE_BRANCH] {
xdbg("DBG: new branch [$T_branch_idx] to $ru\n");
xlog("L_INFO", "DBG: manage branch");
route(NATMANAGE);
return;
}
onreply_route[MANAGE_REPLY] {
xdbg("DBG: incoming reply\n");
xlog("L_INFO", "DBG: manage reply");
if (t_check_status("3[0-9][0-9]")) {
xlog("L_INFO", "DBG: got 3xx redirect");
route(HANDLEREDIRECT);
drop;
}
return;
}
I also tried using uac_redirect module, but it stalls the incoming invite also, and i cant figure out how to modify the uri from the contact before sending (to add params)
# Manage failure routing cases
failure_route[MANAGE_FAILURE] {
route(NATMANAGE);
if (t_is_canceled()) exit;
if (t_check_status("3[0-9][0-9]")) {
xlog("L_INFO", "DBG: following 3xx redirect");
get_redirects("3:1");
t_relay();
exit;
}
}
Rob Green | Chief Information Officer (CIO) | |
|
|
|
|
|
This communication is the Property of NUWAVE Communications and may contain confidential or privileged information. Unauthorized use of this communication is strictly prohibited and may be unlawful. If you have received this communication in Error, Please immediately notify the sender by reply e-mail and destroy all copies of the communication and any attachments. |
|
|