[OpenSIPS-Users] Midregistrar handle failed registrations

Ben Newlin Ben.Newlin at genesys.com
Wed Sep 16 13:57:45 EST 2020


John,

The status of the response is exposed in several places, depending on your configuration. It can be accessed vis $rs [1], but since failure_route is processing the request you will need to specify the reply context [2], so $(<reply>rs). But if you are using the TM module then you can just use $T_reply_code [3].

The initial challenge for auth (401/407) will trigger the failure route, so every request will end up in failure route at least once if they are all challenged. But if authentication is successful and 2xx is returned it will not trigger the failure route a second time. The only place to see the 2xx status code is in a reply route.

[1] https://www.opensips.org/Documentation/Script-CoreVar-3-1#toc77
[2] https://www.opensips.org/Documentation/Script-CoreVar-3-1
[3] https://opensips.org/docs/modules/3.1.x/tm.html#pv_T_reply_code



Ben Newlin

From: Users <users-bounces at lists.opensips.org>
Date: Wednesday, September 16, 2020 at 9:30 AM
To: OpenSIPS users mailling list <users at lists.opensips.org>
Subject: Re: [OpenSIPS-Users] Midregistrar handle failed registrations
I have tried using t_on_failure + failure_route but every registration
ends up in the failure_route branch regardless of whether the
authentication was successful or not.

Does anyone know how I can capture the response returned from the main
registrar please to know in script whether the register was
authenticated or not?

On Wed, 2020-09-16 at 17:15 +1000, John Matich - Siptalk wrote:
> How do I capture the response of a failed registration that has been
> passed through to the main registrar and failed to authenticate?
>
> My code is:
>
> if (is_method("REGISTER")) {
>        mid_registrar_save("location");
>        switch ($retcode) {
>        case 1:
>                xlog("L_INFO", "forwarding REGISTER to main
> registrar...\n");
>                $ru = "sip:10.0.0.3:5070";
>                if (!t_relay()) {
>                        send_reply("500", "Server Internal Error 1");
>                }
>
>                break;
>        case 2:
>                xlog("L_INFO", "REGISTER has been absorbed!\n");
>                break;
>        default:
>                xlog("L_ERR", "mid-registrar error!\n");
>                send_reply("500", "Server Internal Error 2");
>        }
>
>        exit;
> }
>
> But there isn't anywhere that I can find to read a failed
> authentication.
>
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users


_______________________________________________
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/20200916/d95ddea8/attachment.html>


More information about the Users mailing list