Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- route{
- setflag(LOG_FLAG);
- sip_trace();
- if (!mf_process_maxfwd_header("10")) {
- send_reply("483","Too Many Hops");
- exit;
- }
- # requests for my domain
- if (is_method("REGISTER")) {
- # authenticate the REGISTER requests
- if (!www_authorize("", "subscriber")) {
- www_challenge("", "0");
- exit;
- }
- if (!db_check_to()) {
- send_reply("403","Forbidden auth ID");
- exit;
- }
- if (!save("location"))
- sl_reply_error();
- exit;
- }
- if ($rU==NULL) {
- # request with no Username in RURI
- send_reply("484","Address Incomplete");
- exit;
- }
- if (lb_is_destination("$si","$sp") ) {
- # request from a LB destination
- # we should look to see where this call should be sent
- lookup("location");
- route(1);
- }
- if (is_method("INVITE")) {
- setflag(CDR_FLAG);
- }
- # detect resources and do balancing
- # PSTN call, but the GWs supports only G711
- # for calls without G711, transcoding will be used on the GW
- if ( !search_body("G711") ) {
- load_balance("1","transc;pstn");
- } else {
- load_balance("1","pstn");
- }
- # LB function returns negative if no suitable destination (for requested resources) is found,
- # or if all destinations are full
- if ($retcode<0) {
- sl_send_reply("500","Service full");
- exit;
- }
- # send it out
- if (!t_relay()) {
- sl_reply_error();
- }
- }
- route[1] {
- if (!t_relay()) {
- sl_reply_error();
- };
- exit;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement