Title: SERSIP Express Router
1SER(SIP Express Router)
- Speaker Changyu Wu
- Adviser Quincy Wu
- Date2007/02/07
2Overview
- Introduction
- Configuration file architecture
- Global parameter
- External module loading
- Module parameters
- Routing blocks
- Example program
- AVPOPS
- Exported Parameters
- Exported Functions
- Conclusion
- Reference
3Introduction
- 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
4Configuration file architecture
.. listen163.22.16.33 aliasjohn.ipv6.club
.tw port5060 .. loadmodule
/usr/local/lib/ser/ser/modules/mysql.so loadmodu
le /usr/local/lib/ser/ser/modules/auth_db.so
. mdoparam(auth_db, db_url,
mysql//serpassword_at_localhost/ser) modparam(au
th_db, calculate_ha1, yes) . route if
(!uri163.22.16.33)
. break
Global parameter
External module loading
Module parameters
Routing blocks
/usr/local/etc/ser/ser.cfg (OSFreeBSD5.4)
5Global parameter
- alias All requests with hostname matching an
alias will satisfy the condition "urimyself". - Ex alias ms11.voip.edu.tw
- listen list of all IP addresses or hostnames SER
should listen on. - Ex listen163.22.16.40
- port Listens on the specified port (default
5060). - Ex port5060
6External module loading
- loadmodule Specifies a module to be loaded
- loadmodule /path/modules name
- Ex
- loadmodule /usr/local/lib/ser/ser/modules/mysql.s
o - loadmodule /usr/local/lib/ser/ser/modules/auth_db
.so
7Module 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)
- Exmodparam(auth_db, calculate_ha1, yes)
8Routing blocks
- routenumber... - 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. - route0
- call routing block number 2
- route(2)
-
- route2
- forward(163.22.16.40", 5060)
9Conditional statements
- A very useful feature is the ability to make
routing logic depend on a condition. - If (urisip0-9._at_ms11.voip.edu.tw)
-
-
- Else
-
- ..
10Domain matching
- The easiest way to decide whether a request
belongs a served domain is using the myself
operand. - aliasms11.voip.edu.tw"
- route0
- if (urimyself)
- log(1,"request for served domain")
-
- else
- log(1,"request for outbound domain")
- outbound forwarding
- t_relay()
-
-
11Request URL Rewriting
- SER has the ability to change request URI in many
ways. - rewritehost(hostname)
- Exrewritehost(163.22.16.40)
- rewriteuri(uri)
- Exrewriteuri(sipchangyu_at_163.22.16.40)
- If (methodINVITE)
- if(uri(0-9)._at_)
- rewritehost(163.22.20.154)
- forward(urihost,
uriport) -
-
12Authentication
- Load auth modules
- loadmodule /usr/local/lib/ser/modules/auth.so
- loadmodule /usr/local/lib/ser/modules/auth_db.so
- Module parameters
- modparm(auth_db, calculate_ha1, yes)
- modparm(auth_db, password_column, password)
13Authentication (cont)
- If (urimyself)
- if (methodREGISTER)
- 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)
14Reply message
- sl module
- For the current request, a reply is sent back
having the given code and text reason. - sl_send_reply(code, reason)
- Ex If (!lookup(location))
- sl_send_reply(404, Not found)
-
15AVPops
- AVPops modules
- Implementing services and preferences per user or
domain. - The AVPops module exports functions for
interfacing DB resources. - Exported Parameters.
- Exported Functions.
16Exported Parameters
- avp_url (string)
- modparam("avpops","avp_url","mysql//serpasswd_at_lo
calhost/ser") - avp_table (string)
- modparam("avpops","avp_table","subscriber")
- avp_aliases (string)
- modparam("avpops","avp_aliases","uuidi660email
semail_address")
17Exported 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","i678")
18Exported Functions (cont)
- avp_write(value,name)
- Value
- ruri - write RURI
- value - write the value
- Name
- The name of the new written AVP
- avp_write(4762",sphone")
19Exported Functions (cont)
- avp_pushto(destination,name)
- destination
- ruri
- username
- domain
- name
- The name of the new written AVP
-
- avp_pushto(ruri/username, sphone)
20Exported 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("sperson","eq/from/I")
21Rewrite uri
- route
- avp_db_load(ruri/username, stele)
- avp_write(4762, sphone)
- if (avp_check(stele, eq/sphone/g))
- .
- .
-
-
22Conclusion
- How can configuring SER
- Four main sections
- Routing block design
- How use AVPops module
23Reference
- SER
- http//www.iptel.org/ser/
- Install SER
- http//ms11.voip.edu.tw/changyu/Technological20f
ile/20061114_Changyu_SER.ppt - AVPops modules
- http//www.voice-sistem.ro/docs/avpops/
- Registrar modules
- http//www.openser.org/docs/modules/1.1.x/registra
r.html - Auth_db modules
- http//www.openser.org/docs/modules/1.1.x/auth_db.
html - sl modules
- http//www.openser.org/docs/modules/1.1.x/sl.html
- RFC2617
- HTTP Authentication Basic and Digest Access
Authentication