[OpenSIPS-Users] Cloud not proxy authorize when domain contains opensips ip instead of Caller ip.

Aqs Younas aqsyounas at gmail.com
Wed Mar 9 00:41:55 CET 2016


Hi,

I want proxy authorization of invite be handled dynamically. But I see if
domain column contains ip address of opensips, authorization is being
rejected with cause -2.

But if domain contains ip address of caller everything is fine.

Here is my code snippet.

 if (is_method("INVITE")) {

                xlog("Receieved First Invite [$fu/$tu/$ru/$ci]");
                $var(auth_code) = proxy_authorize("", "subscriber");
                if ( $var(auth_code) == -1 || $var(auth_code) == -2 ) {
                        xlog("L_NOTICE","Auth error for $fU@$fd from $si
cause $var(auth_code)");
                }
                if ( $var(auth_code) < 0 ) {
                        proxy_challenge("", "1");
                        exit;
                }
                xlog("Successfully Authenticated [$fu/$tu/$ru/$ci]");
                consume_credentials();
                rewritehostport("54.171.201.88:5060");
                setflag(ACC_DO); # do accounting
        }

#### Auth Module
loadmodule "auth.so"
modparam("auth", "secret", "johndoessecretphrase")
modparam("auth", "nonce_expire", 30)
modparam("auth", "realm_prefix", "sip.")
modparam("auth", "username_spec", "$var(username)")
modparam("auth", "password_spec", "$avp(password)")
modparam("auth", "calculate_ha1", 0)

#### Auth_db module
loadmodule "auth_db.so"
modparam("auth_db", "db_url", "mysql://root:password@localhost/opensips")
modparam("auth_db", "user_column", "username")
modparam("auth_db", "password_column", "ha1")
modparam("auth_db", "password_column_2", "ha1b")
modparam("auth_db", "calculate_ha1", 0)

I want to do authorization solely on username and password without
considering caller IP.

That is how i add users in subscriber.

./opensipsctl add username at opensipsIP password


Is there something wrong i am doing?

Any suggestion is much appreciated.

Thanks in advance.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20160309/dc551462/attachment.htm>


More information about the Users mailing list