[OpenSIPS-Users] Sip server dipping/advice
    M.Khaled W Chehab 
    kchehab at icucall.com
       
    Tue May 14 12:17:21 CEST 2013
    
    
  
Hi,
 
 
I am using opensips 1.8.x with do_routing module ,and trying to implement
the US  dipping service in my script
I am sending the call to the dipping sip server gateway and receive the 302
message containing  the LRN number  ,
As as result I can have the rn number but I am sending the invite  to the
dipping provider twice ,please can you advice how to setup it in the right
way  
if ($rU=~"^.") {
                route(7);
                route(1);
                exit;
 
route[1] {
        if (subst_uri('/(sip:.*);nat=yes/\1/')) {
                setbflag(6);
        }
 
        if (isflagset(5)) {
               search_append('Contact:.*sip:[^>[:cntrl:]]*', ';nat=yes');
        }
 
        # for INVITEs enable some additional helper routes
        if (is_method("INVITE")) {
 
 
                t_on_branch("2");
                t_on_reply("2");
                t_on_failure("1");
                avp_db_query("UPDATE `opensips`.`invites` set `trunkip`
='$rd' where  `CALLID` = '$ci' ");
 
        } else if (is_method("BYE")) {
                setflag(1); # do accounting ...
                setflag(3); #transaction falis
                setflag(4); #CDR Table
                xlog("----------------------------------------Route 1
Bye---------------");
                       
        } else if (is_method("ACK")) {
                # call answered an ACKed, start billing here
 
        } else if (is_method("CANCEL")) {
                # call cancelled by caller, do clean up here' ");
        }
 
        if (!t_relay()) {
                xlog("L_INFO", "--Debug Customer
ID:$avp(Cusid)/IP:$si------#11###Reply: $T_reply_code\n");
 
                send_reply("500","Internal Error");
        };
 
        exit;
}
 
route[7]{
if (!do_routing("$avp(Cusid)","FW")) {
drop();
                        exit;
                }
}
 
 
route[6] {
if ( use_next_gw() ) {
                                $var(prefix) =
$(avp(gw_attrs){csv.value,1});
                                $rU = $var(prefix) + $avp(dst);
                                xlog("L_INFO", "--Debug Customer
ID:$avp(Cusid)/IP:$si-----Calling number to Next Provier $rU\n");
                                setflag(26); #Missed calls
                                t_on_failure("1");
                                t_relay();
                                exit;
                        }
}
 
 
branch_route[2] {
        xlog("L_INFO", "--Debug Customer ID:$avp(Cusid)/IP:$si-----new
branch at $ru\n");
                route(7);
}
 
 
failure_route[1] {
 
 
         if (!t_check_status("302")) {
                if (!next_routing()){
                        xlog("L_INFO", "LRN - Unable to DIP");
                        t_reply("500","Unable to DIP");
                        exit;
                }
                xlog("L_INFO", "LRN - Unable to DIP - Trying Next");
                t_on_failure("1");
                t_relay();
                exit;  
        }
 
        if (!$(<reply>ct.fields(uri){param.value,rn})){
                                       xlog("L_INFO", "LRN - No redirect
information found");
                            route(1);
                                  }else if
($(<reply>ct.fields(uri){param.value,rn}) == $tU){
                  xlog("L_INFO", "LRN - Returned same number, no need to
redirect");
                                    route(1);
                                  }else{ 
                        xlog("LRN-----$rU-------Else lRN
$avp(lrnct)---------");
                        $rU=$avp(lrnct);           
                        xlog("LRN-----$rU-------Else lRN
$avp(lrnct)---------");
 
                 route(1);
                               
        }
                
                if (!t_check_status("487")) {
                        #$avp(failure_count) = $avp(failure_count) + 1;
480|486|603
                        route(6);
                }
        }
 
 
}
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20130514/3e698469/attachment.htm>
    
    
More information about the Users
mailing list