Docstoc

20070130_changyu_ser

Document Sample
20070130_changyu_ser Powered By Docstoc
					   SER(SIP Express Router)


Speaker: Changyu Wu
Adviser: Quincy Wu
Date:2007/01/30
Overview
 Introduction
 Configuration file architecture
    Global parameter
    External module loading
    Module parameters
    Routing blocks
        Example program

 AVPOPS
    Exported Parameters
    Exported Functions
 Conclusion
 Reference

                                    2
Introduction
 SIP Express Router (SER) is a high-
  performance, configurable, free SIP server
      It can act as SIP registrar, proxy or redirect
       server.
 SER’ s configuration file is divided into four
  main sections.
      Global parameter
      External module loading
      Module parameters
      Routing blocks

                                                        3
Configuration file architecture
…………………..
listen=163.22.16.33
alias=john.ipv6.club.tw            Global parameter
port=5060
………………..
loadmodule “/usr/local/lib/ser/ser/modules/mysql.so”
                                                               External module loading
loadmodule “/usr/local/lib/ser/ser/modules/auth_db.so”
……………….
mdoparam(“auth_db”, “db_url”, “mysql://ser:password@localhost/ser”)
modparam(“auth_db”, “calculate_ha1”, yes)
……………….
                                                                Module parameters
route{
            if (!uri==163.22.16.33){
                                             Routing blocks
            ………………….
                                                              /usr/local/etc/ser/ser.cfg
            break;                                                                4

            }                                                 (OS:FreeBSD5.4)
Global parameter
 alias: All requests with hostname matching an
  alias will satisfy the condition "uri==myself".
      Ex: alias= ms11.voip.edu.tw
 listen: list of all IP addresses or hostnames
  SER should listen on.
      Ex: listen=163.22.16.40
 port: Listens on the specified port (default
  5060).
      Ex: port=5060

                                                    5
External module loading
 loadmodule: Specifies a module to be loaded
 loadmodule “/path/modules name”
     Ex:
     loadmodule “/usr/local/lib/ser/ser/modules/mysql.so”
     loadmodule “/usr/local/lib/ser/ser/modules/auth_db.so”




                                                               6
Module parameters
 modparam: Module parameter configuration.
  The commands takes three parameters:
     module - Module in which the parameter
      resides.
     parameter - Name of the parameter to be
      configured.
     value - New value of the parameter.
     modparam (“module”, “parameter”, “value”)
          Ex:modparam(“auth_db”, “calculate_ha1”, yes)

                                                          7
Routing blocks
 route[number]{...} - This marks a "route block" in configuration
  files.
 route blocks are basic building blocks of ser scripts.
 route(n), where n is number of the block. The action break exits
  currently executed route block.

route[0] {
   # call routing block number 2
   route(2);
}
route[2] {
   forward(“163.22.16.40", 5060);
}

                                                                     8
Conditional statements
 A very useful feature is the ability to make routing
  logic depend on a condition.

If (uri=~”^sip:[0-9].*@ms11.voip.edu.tw”){
                       ……
    }
Else
    {
                       …..
                };
                                                         9
Domain matching
 The easiest way to decide whether a request belongs a served
   domain is using the myself operand.

alias=“ms11.voip.edu.tw"

route[0] {
   if (uri==myself) {

                   log(1,"request for served domain")
   }
   else {
                   log(1,"request for outbound domain");
                   # outbound forwarding
                   t_relay();
            };
   }

                                                                 10
Request URL Rewriting
 SER has the ability to change request URI in many ways.
       rewritehost(“hostname”)
            Ex:rewritehost(“163.22.16.33”)
       rewriteuri(“uri”)
            Ex:rewriteuri(“sip:changyu@163.22.16.33”)

If (method==INVITE){
        if(uri~=“^(0-9).*@”){
                  rewritehost(“163.22.20.154”);
                  forward(uri:host, uri:port);
                 };
}


                                                            11
Authentication
If (uri==myself){
    if (method==“REGISTER”){
          If (!(www_authorize(“ms11.voip.edu.tw”, “subscriber”))){
                   www_challenge(“ms11.voip.edu.tw”, “0”);
                   break;
          };
          save(“location”);
          break;
};

If (!lookup(“location”)){
     sl_send_reply(“404”, “Not found”);
};

                                                                     12
AVPops
 AVPops modules
     Implementing services and preferences per
      user or domain.
     The AVPops module exports functions for
      interfacing DB resources.
     Exported Parameters.
     Exported Functions.




                                                  13
Exported Parameters
 avp_url (string)
      modparam("avpops","avp_url","mysql://ser:passwd@localhost/ser")

 avp_table (string)
      modparam("avpops","avp_table","subscriber")

 avp_aliases (string)
      modparam("avpops","avp_aliases","uuid=I:660;email=s:email_addr
       ess")




                                                                     14
Exported Functions
 avp_db_load(source,name)
     source
          $ruri - use information from RURI
          $avp_alias - use the content of the AVP (defined
           by alias) as UUID
     name
          which AVPs will be loaded from DB into memory
Ex:
       avp_db_load("$ruri","i:678");

                                                              15
Exported Functions (cont)
 avp_write(value,name)
     Value
          $ruri - write RURI
          value - write the value
     Name
          The name of the new written AVP


  avp_write("$ruri/username","$email");


                                             16
Exported Functions (cont)
 avp_check(name,op_value)
    name
       which AVP(s) should be checked

    op_value
       eq - AVP value equal to value

       lt - AVP value less than value

       gt - AVP value greater than value

    The value can be:
       $ruri - check against RURI

       $from - check against FROM URI




       avp_check("s:person","eq/$from/I");
                                             17
Test For Caller == Callee?

route{
      avp_write(“$from”, “i:54”);
      if (avp_check(“i:54”, “eq/$ruri/i”)){
             …….
             …….
      };
      }


                                              18
Conclusion
 How can configuring SER
     Four main sections
 Routing block design
 How use AVPops module




                            19
Reference
 SER
    http://www.iptel.org/ser/
 AVPops
    http://www.voice-sistem.ro/docs/avpops/
 Install SER
      http://ms11.voip.edu.tw/~changyu/Technological%20file/20061114_
       Changyu_SER.ppt




                                                                    20

				
DOCUMENT INFO
Shared By:
Categories:
Tags:
Stats:
views:7
posted:9/13/2011
language:English
pages:20