[Serusers] Internal numbers prefix

Pavel Siderov - Hostmates pi at hostmates.com
Mon Jan 31 11:10:03 CET 2005


Hi there,
I'm trying to forward some destinations, but there are accounts/users starting the same way connected to the server. 
Example
account: 123456
When ser see that it forwards the call to other ser located at 12.34.56.79. I want my users to use prefix for local calls. 
Example:
calling 699123456 goes to local server user 123456 not to 12.34.56.79. Please check my code and tell me what's 
wrong:
...
if (uri=~"^sip:1234") {
        log(0, "\n\n************  Office 1  ***********\n");
        strip(0);
        rewritehostport("12.34.56.79:5060");
        append_branch("12.34.56.79");
        t_relay_to_udp("12.34.56.79", "5060");
        append_hf("P-hint: VoipSwitch GATEWAY\r\n");
        log(0, "********************************************\n\n\n");
        break;
  };

 if (uri=~"^sip:051") {
        log(0, "\n\n************  Office 2  ***********\n");
        strip(0);
        rewritehostport("12.34.56.78:5060");
        append_branch("12.34.56.78");
        t_relay_to_udp("12.34.56.78", "5060");
        append_hf("P-hint: VoipSwitch GATEWAY\r\n");
        log(0, "********************************************\n\n\n");
        break;
  };

 if (uri=~"^sip:699") {
        strip(3);
        route(1);
        break;
  };
}
                else {
                        sl_send_reply("399", "Your account balance is low!");
                };

                if (!lookup("location")) {
                        sl_send_reply("404", "Not Found");
                        break;
                };

        append_hf("P-hint: usrloc applied\r\n");
        route(1);


}

route[1] {

        if (isflagset(6)) {
            force_rtp_proxy();
        };

        t_on_reply("1");

        if (!t_relay()) {
                sl_reply_error();
        };
}

onreply_route[1] {
    if (isflagset(6) && status =~ "(183)|2[0-9][0-9]") {
        fix_nated_contact();
        force_rtp_proxy();
    } else if (nat_uac_test("1")) {
        fix_nated_contact();
    };
}


Thanks in advance :)!

Pavel Siderov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20050131/a6e350f2/attachment.htm>


More information about the sr-users mailing list