Hi

This is how I handle them on the registrar:


[...]
# Record original destination before performing call forwarding
$avp(pre_redir_destination) = $rU;
[...]

Somewhere in the config we start reacting to replies from the
customer like when busy...

        if (t_check_status("(486)|(600)")) {
                $avp(cf_reason) = "user-busy";
                route(CFB); # Check if Call Forward on Busy is active and if 
so, handle this
                route(CFVM); # Check if Call Forward to Voicemail is active and 
if so, handle this
                $avp(announcecode) = "BUSY"; # No Call Forward setting found to 
handle 'busy' so just send to media server and play BUSY tone.
                t_send_reply("$avp(rstatus)", "$avp(rtext)");
                exit;
        }

Or the one you are looking for, when customer replies with 301 or 302:

        if (t_check_status("(301)|(302)")) {
                $avp(destination) = $(T_rpl($ct){tobody.user});
                if ($avp(debug) > 0) {
                        xlog("L_INFO", "$cfg(route): Got REDIRECTION: 
$avp(rstatus) $avp(rtext) towards $T_rpl($ct) => $avp(destination) RU: $rU");
                }
                $avp(cf_reason) = "deflection";
                t_on_branch("BR_REDIR_TO_CORE");
                route(ROUTE_TO_CORE);
                exit;
        }

branch_route[BR_REDIR_TO_CORE]
{
        if ($avp(debug) > 0) {
                xlog("L_INFO", "$cfg(route): BR_idx: $T_branch_idx 
$avp(pre_redir_destination) NEW: $avp(destination) FROM: $avp(from_in) setting 
TO\n");
        }
        if (is_present_hf("X-OrigFrom")) { # Restore From we had before 
possible translation to customer
                $fU = $(hdr(X-OrigFrom));
        }
        remove_hf("Diversion");
        $avp(pai_in) = $avp(pre_redir_destination);
        $var(newdi) = "<sip:" + $avp(pre_redir_destination) + "@" + 
$(fu{uri.host}) + ">;reason=" + $avp(cf_reason);
        if ($avp(debug) > 0) {
                xlog("L_INFO", "$cfg(route): Adding HEADER: $var(newdi)\n");
        }
        append_hf("Diversion: $var(newdi)\r\n");
        $tU = $avp(destination);
        $rU = $avp(destination);
}


Mit freundlichen Grüssen

-Benoît Panizzon-
-- 
I m p r o W a r e   A G    -    Leiter Commerce Kunden
______________________________________________________

Zurlindenstrasse 29             Tel  +41 61 826 93 00
CH-4133 Pratteln                Fax  +41 61 826 93 01
Schweiz                         Web  http://www.imp.ch
______________________________________________________
__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions
To unsubscribe send an email to [email protected]
Important: keep the mailing list in the recipients, do not reply only to the 
sender!
Edit mailing list options or unsubscribe:

Reply via email to