[OpenSIPS-Users] dbalias and location lookup branching

John Sliney John.Sliney at lcs.com
Tue Sep 26 18:28:34 UTC 2023


Hi,

I’m currently attempting to take an INVITE from an Asterisk server that is requesting an extension number, perform dbalias lookups to have extensions turned into sip users (x1000 -> test_hardphone) and then do location lookups on those sip users.  There can be multiple sip users for each extension and multiple locations for each sip user.

Using the code below partially works but when there are no location entries for the requested sip user, OpenSIPS returns a 500 and prints out “ERROR:  t_forward_nonack failed” how can I have OpenSIPS instead respond with a 404?

### CODE ###

modparam("alias_db",        "append_branches",          1)

route {
    if ( is_from_gw() ) {
        alias_db_lookup("dbaliases");
        t_on_branch("sip_user_branch");
    }
    route(relay);
    return(0);
}

branch_route[sip_user_branch] {
    route(lookup_sip_user);
}

route[lookup_sip_user] {
    if ( ! lookup("location")  ) {
        drop();
    }
}

route[relay] {
    if ( ! t_relay() ) {
        sl_reply_error();
        rtpproxy_unforce();
        return(0);
    }
}

### CODE ###

Any help would be appreciated, Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20230926/e636ef1d/attachment-0001.html>


More information about the Users mailing list