[OpenSIPS-Users] dbalias and location lookup branching

M S medeanwz at gmail.com
Wed Sep 27 10:54:05 UTC 2023


Maybe a send_reply(404) after if(!lookup(location)), instead of drop?

On Tue, Sep 26, 2023 at 8:30 PM John Sliney <John.Sliney at lcs.com> wrote:

> 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
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20230927/d88bc0b4/attachment.html>


More information about the Users mailing list