Hello Alec,

I'm happy you managed to make it work.

Regards,

Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
http://www.opensips-solutions.com

On 11.02.2014 06:18, Alec Doran-Twyford wrote:
Hi Bogdan,

Thanks for the help it working a charm now the code look like this for anyone else who is interested:

        if(check_source_address("0")) {
                xlog("IP Allow Routing");
        } else {
                xlog("authentication required for call from $si");
                if (!is_method("REGISTER")) {
                        # EC - auth
                        if (!proxy_authorize("", "subscriber")) {
                                xlog("proxy challenge!");
proxy_challenge("", "0"); # Realm will be autogenerated
                                exit;
                        }
                        if (!db_check_from()) {
                             xlog("forbidden!");
                             sl_send_reply("403","Forbidden auth ID");
                             exit;
                        }
                        consume_credentials();
                }
                 else {
                        if (!www_authorize("", "subscriber")) {
                                xlog("www challenge!");
www_challenge("", "0"); # Realm will be autogenerated
                                exit;
                        }

                        if (!db_check_from()) {
                             xlog("forbidden!");
                             sl_send_reply("403","Forbidden auth ID");
                             exit;
                        }

                        if (!save("location")) {
                                xlog("failed to save location!");
                                sl_reply_error();
                        }


                        xlog("registered - $from");
                        exit;
                }
        }


and currently add IP like this in to the database
insert into opensips.address (ip, port) VALUES ("192.168.168.55", 5060);

and then use the command to refresh the current cache of entries
opensipsctl fifo address_reload

Alec Doran-Twyford

| Junior Support Enginner for IVSTel
| E-mail: a.dorantwyf...@ivstel.com <mailto:a.dorantwyf...@ivstel.com> | Phone: +61 2 9288 8890 |


_______________________________________________
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

Reply via email to