[SR-Users] Pseudo-Variable {$au} is NULL

Daniel Meyer-Wendt dmeyer at ygomi.com
Wed Mar 20 15:32:53 CET 2019


Hi Daniel,

authentication is done in kamailio by querying the asterisk DB. Users appear in the location table, so I am assuming authentication is successful (or could I be wrong?), my modified AUTH code


route[AUTH] {
#!ifdef WITH_AUTH

#!ifdef WITH_ASTERISK
        # do not auth traffic from Asterisk - trusted!
        if(route(FROMASTERISK))
                return;
#!endif

#!ifdef WITH_IPAUTH
        if((!is_method("REGISTER")) && allow_source_address()) {
                # source IP allowed
                return;
        }
#!endif

        if (is_method("REGISTER") || from_uri==myself) {
                # authenticate requests
#!ifdef WITH_ASTERISK
                if (!auth_check("$fd", "sipusers", "1")) {
#!else
                if (!auth_check("$fd", "subscriber", "1")) {
#!endif
                        auth_challenge("$fd", "0");
                        exit;
                }


                # user authenticated - remove auth header
                if(!is_method("REGISTER|PUBLISH"))
                        consume_credentials();
        }
        # if caller is not local subscriber, then check if it calls
        # a local destination, otherwise deny, not an open relay here
        if (from_uri!=myself && uri!=myself) {
                sl_send_reply("403","Not relaying");
                exit;
        }


#!else

        # authentication not enabled - do not relay at all to foreign networks
        if(uri!=myself) {
                sl_send_reply("403","Not relaying");
                exit;
        }

#!endif
        return;
}

Thanks,
Daniel

From: Daniel-Constantin Mierla <miconda at gmail.com>
Sent: Mittwoch, 20. März 2019 14:51
To: Kamailio (SER) - Users Mailing List <sr-users at lists.kamailio.org>; Daniel Meyer-Wendt <dmeyer at ygomi.com>
Subject: Re: [SR-Users] Pseudo-Variable {$au} is NULL


Hello,

$au should be filled when the authentication is done. Are you doing it in kamailio, or the auth is done by asterisk?

Cheers,
Daniel
On 20.03.19 12:39, Daniel Meyer-Wendt wrote:
Hi All,

I am updating our Kamailio from 4.0.6 to the latest 5.2.2, we use kamailio as LB in front of two asterisk server.
My problem is that during registration forward to the asterisk servers {$au} is NULL

This is the code we have, which is the one you find in most documentations
$uac_req(furi)="sip:" + $au + "@" + $var(rip);


I logged some Pseudo-Variable to see their contents:

{$au}     NULL
{$aU}    NULL
{$Au}     username at domain.com<mailto:username at domain.com>
{$fU}     username
{$oU}    NULL
{$ru}      rU: {sip:domain.com;transport=UDP

and ended up doing this which works

$uac_req(furi)="sip:" + $fU + "@" + $var(rip);

Any idea what could be wrong?

Thanks,
Daniel



_______________________________________________

Kamailio (SER) - Users Mailing List

sr-users at lists.kamailio.org<mailto:sr-users at lists.kamailio.org>

https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users

--

Daniel-Constantin Mierla -- www.asipto.com<http://www.asipto.com>

www.twitter.com/miconda<http://www.twitter.com/miconda> -- www.linkedin.com/in/miconda<http://www.linkedin.com/in/miconda>

Kamailio World Conference - May 6-8, 2019 -- www.kamailioworld.com<http://www.kamailioworld.com>

Kamailio Advanced Training - Mar 25-27, 2019, in Washington, DC, USA -- www.asipto.com<http://www.asipto.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20190320/63bab25f/attachment.html>


More information about the sr-users mailing list