[OpenSIPS-Users] Rewrite Username in URI when using userloc

Dave Singer dave.dorasinger at gmail.com
Fri May 20 06:24:44 CEST 2011


Spencer,
Looks like you just need to move $rU=$oU; into branch_route[2]
Note that in failure route it will be reset to what it was before
changes done in branch route so you may want to do it in main route
and in branch route.

Dave

On Thu, May 19, 2011 at 4:02 PM, Spencer Thomason
<spencer at 5ninesolutions.com> wrote:
> Hello all,
> I'm using Opensips in between several Freeswitch and Asterisk boxes (each with multiple DIDs) and my ITSP's proxies.  The local IP PBXs register to Opensips and inbound routing is done via the userloc module.  The problem I have is that I need to send in incoming INVITE to the original username, not the registered contact so the PBXs can perform the proper routing.  Currently I set $rU=$Ou in the request route which works perfectly if there is only one contact registered.  If there is more than one contact registered, the INVITE is sent to the registered contact and then the PBX doesn't know how to route the call since it hits a default contact.  Is there a better way to do this?  I'm fairly new to Opensips and would appreciate any help. :-)
>
> A snippet from my script:
> route {
>        ...
>        if (!lookup("location","m")) {
>                switch ($retcode) {
>                        case -1:
>                        case -3:
>                                t_newtran();
>                                t_reply("404", "Not Found");
>                                exit;
>                        case -2:
>                                sl_send_reply("405", "Method Not Allowed");
>                                exit;
>                }
>        }
>
>        $rU=$oU;
>        route(1);
> }
>
>
> route[1] {
>        if (is_method("INVITE")) {
>                t_on_branch("2");
>                t_on_reply("2");
>                t_on_failure("1");
>        }
>
>        if (!t_relay()) {
>                sl_reply_error();
>        };
>        exit;
> }
>
>
> branch_route[2] {
>        xlog("new branch at $ru\n");
> }
>
>
> onreply_route[2] {
>        xlog("incoming reply\n");
> }
>
>
> failure_route[1] {
>        if (t_was_cancelled()) {
>                exit;
>        }
>
>        if (t_check_status("3[0-9][0-9]")) {
>        t_reply("404","Not found");
>                exit;
>        }
> }
>
>
>
> Thanks,
> Spencer
>
>
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>



More information about the Users mailing list