[Kamailio-Users] kamailio as registrar server

Saúl Ibarra saghul at gmail.com
Tue Oct 6 11:57:35 CEST 2009


This should have gone to the list... :)

On Tue, Oct 6, 2009 at 12:00 PM, Rajesh <Rajesh.sreedharan at siptech.com> wrote:
> I could implement openser as a registrar(only) server .Thanks to the team
> openser for the timely help.I would like to know what all can be done using
> openser/kamailio as a registrar server alone. i.e. in the real world
> scenario how does openser can be useful as a registrar sever alone.I would
> like to make myself clear by pointing to the below example. i can integrate
> openser and asterisk and make openser as a registrar (only)server and can
> make use of asterisk for call functionality purposes.. Similarly, i would
> like to know where openser fits in (openser should only be used as a
> registrar server again).
> Your responses can speed up my research work..
>
>
> Saúl Ibarra wrote:
>
> You are doing save_location before authentication. You should first
> challenge the REGISTER for authentication and then do save_location.
>
> 2009/10/6, Rajesh <Rajesh.sreedharan at siptech.com>:
>
>
> Dear All,
>                 I would like my kamailio server to act (only) as a
> Registrar  server. I  have configured my kamilio for performing
> authentication successfully, but this time i find that authentication is
> not being done.Your views on my cfg is greatly appreciated.
>
> # ------------------ module loading ----------------------------------
> debug=3
> log_stderror=yes
> mpath="/usr/local/lib/kamailio/modules/"
>
> loadmodule "db_mysql.so"
> loadmodule "mi_fifo.so"
> loadmodule "sl.so"
> loadmodule "pv.so"
> loadmodule "usrloc.so"
> loadmodule "registrar.so"
> loadmodule "textops.so"
> loadmodule "uri_db.so"
>
> loadmodule "auth.so"
> loadmodule "auth_db.so"
>
> port=5060
> # ----------------- setting module-specific parameters ---------------
>
>
> # ----- mi_fifo params -----
> modparam("mi_fifo", "fifo_name", "/tmp/kamailio_fifo")
>
>
> # ----- auth_db params -----
> /* uncomment the following lines if you want to enable the DB based
>    authentication */
> modparam("auth_db", "calculate_ha1", yes)
> modparam("auth_db", "password_column", "password")
> modparam("auth_db", "db_url","mysql://openser:openserrw@localhost/openser")
> modparam("auth_db", "load_credentials", "")
>
> # -- usrloc params --
>
> modparam("usrloc", "db_url",
> "mysql://openser:openserrw@192.168.64.75/openser")
>
>
> modparam("usrloc", "db_mode", 3)
>
> # -------------------------  request routing logic -------------------
>
> # main routing logic
>
> route{
>
>        # initial sanity checks -- too long messages
>        if (msg:len >=  2048 ) {
>                sl_send_reply("513", "Message too big");
>                exit;
>        };
>
>        if (!uri==myself) {
>                sl_send_reply("400", "Bad destination, only register
> messages destined for this server are accepted");
>                exit;
>        };
>
>        # the only valid message for the registrar is the register message
>        # other messages are answered with an error message
>        if (uri==myself) {
>
>                if (method=="REGISTER") {
>
>                        sl_send_reply("100", "Trying");
>
>                        if(!save("location")) {
>                                sl_reply_error();
>                        };
>                        exit;
>                } else {
>                        sl_send_reply("403", "Forbidden");
>                        exit;
>                };
>        };
>
> # Authentication route
>
>
>     if (is_method("REGISTER"))
>     {
>         # authenticate the REGISTER requests (uncomment to enable auth)
>         if (!www_authorize("192.168.64.75", "subscriber"))
>         {
>             www_challenge("192.168.64.75", "0");
>             exit;
>         }
>             ###the following  lines are uncommented
>         if ($au!=$tU)
>         {
>             sl_send_reply("403","Forbidden auth ID");
>             exit;
>     }
>     }
>      else
>          {
>         # authenticate if from local subscriber (uncomment to enable auth)
>         if (from_uri==myself)
>         {
>               if (!proxy_authorize("", "subscriber"))
>              {
>                  proxy_challenge("", "0");
>                 exit;
>             }
>             if (is_method("PUBLISH"))
>             {
>             if ($au!=$tU) {
>                     sl_send_reply("403","Forbidden auth ID");
>                     exit;
>                 }
>              } else {
>                 if ($au!=$fU) {
>                     sl_send_reply("403","Forbidden auth ID");
>                     exit;
>                 }
>             }
>
>               consume_credentials();
>             # caller authenticated
>         }
>     }
>     return;
> }
>
>
>
> --
> Regards,
> Rajesh
>
>
>
>
>
> --
> Regards,
> Rajesh



-- 
/Saúl
http://www.saghul.net | http://www.sipdoc.net




More information about the sr-users mailing list