http://www.kamailio.org/wiki/cookbooks/4.1.x/core
IMS 支持接口
MSC接口,信令:ISUP over IP和SIP, 用户面: rtp协议
PCRF接口,Rx接口
HSS接口, Cx接口
Kamailio 和 openIMS, Kamailio本身就是一个SIP AS(Application server), 而且可以通过加载模块的方式在支持不同的接口,而且目前已经支持Rx Cx接口
Kamailio v4.1=============
http://www.kamailio.org
撒花。继续加载模块。
nothing is unreachable.
notes:
1. mkdir -p /usr/local/src/kamailio-devel cd /usr/local/src/kamailio-devel
make cfg
nano -w modules.lst
include_modules= db_mysql
make include_modules="db_mysql dialplan" cfg //to enable modules which are not compiled by default, 2.
make all
make install
The binaries and executable scripts were installed in:
/usr/local/sbin
- kamailio - Kamailio SIP server
- kamdbctl - script to create and manage the Databases
- kamctl - script to manage and control Kamailio SIP server
- sercmd - CLI - command line tool to interface with Kamailio SIP server
PATH=$PATH:/usr/local/sbin export PATH
Kamailio (OpenSER) modules are installed in:
/usr/local/lib/kamailio/modules/
The documentation and readme files are installed in:
/usr/local/share/doc/kamailio/
The man pages are installed in:
/usr/local/share/man/man5/ /usr/local/share/man/man8/
The configuration file was installed in:
/usr/local/etc/kamailio/kamailio.cfg
3. database
mysql -u root
mysqladmin -u root password vankom
To create the MySQL database, you have to use the database setup script. First edit kamctlrc file to set the database server type:
nano -w /usr/local/etc/kamailio/kamctlrc
Locate DBENGINE variable and set it to MYSQL:
DBENGINE=MYSQL
You can change other values in kamctlrc file, at least it is recommended to change the default passwords for the users to be created to connect to database.
Once you are done updating kamctlrc file, run the script to create the database used by Kamailio:
/usr/local/sbin/kamdbctl create
You can call this script without any parameter to get some help for the usage. You will be asked for the domain name Kamailio is going to serve (e.g., mysipserver.com) and the password of the 'root' MySQL user. The script will create a database named 'kamailio' containing the tables required by Kamailio. You can change the default settings in the kamctlrc file mentioned above.
The script will add two users in MySQL:
- kamailio - (with default password 'kamailiorw') - user which has full access rights to 'kamailio' database
- kamailioro - (with default password 'kamailioro') - user which has read-only access rights to 'kamailio' database
Do change the passwords for these two users to something different that the default values that come with sources.
4. Edit configuration file
To fit your requirements for the VoIP platform, you have to edit the configuration file.
/usr/local/etc/kamailio/kamailio.cfg
Follow the instruction in the comments to enable usage of MySQL. Basically you have to add several lines at the top of config file, like:
#!define WITH_MYSQL#!define WITH_AUTH#!define WITH_USRLOCDB
If you changed the password for the 'kamailio' user of MySQL, you have to update the value for 'db_url' parameters.
You can browse online on GIT repository.
5. The init.d script
The init.d script can be used to start/stop the Kamailio server in a nicer way. A sample of init.d script for Kamailio is provided at:
/usr/local/src/kamailio-devel/kamailio/pkg/kamailio/deb/debian/kamailio.init
Just copy the init file into the /etc/init.d/kamailio. Then change the permisions:
chmod 755 /etc/init.d/kamailio
then edit the file updating the $DAEMON and $CFGFILE values:
DAEMON=/usr/local/sbin/kamailio CFGFILE=/usr/local/etc/kamailio/kamailio.cfg
You need also setup a configuration file in the /etc/default/ directory. This file can be found at:
/usr/local/src/kamailio-devel/pkg/kamailio/debian/kamailio.default
You need to rename the file to 'kamailio' after you've copied it. Then edit this file and set RUN_KAMAILIO=yes. Edit the other options at your convenience.
Create the directory for pid file:
mkdir -p /var/run/kamailio
Default setting is to run Kamailio as user “kamailio” and group “kamailio”. For that you need to create the user:
adduser --quiet --system --group --disabled-password \ --shell /bin/false --gecos "Kamailio" \ --home /var/run/kamailio kamailio# set ownership to /var/run/kamailiochown kamailio:kamailio /var/run/kamailio
Then you can start/stop Kamailio using the following commands:
/etc/init.d/kamailio start /etc/init.d/kamailio stop
6. Ready to rock
Now everything is in place. You can start the VoIP service, creating new accounts and setting the phones.
A new account can be added using 'kamctl' tool via 'kamctl add <username> <password> <email>'. (or try without the email)
kamctl add test testpasswd test@mysipserver.com
If you are asked for SIP_DOMAIN environment variable do one of the following option.
1. export SIP_DOMAIN=mysipserver.com 2. edit '/root/.kamctlrc' and add: SIP_DOMAIN=mysipserver.com
7. Maintenance
The maintenance process is very simple right now. You have to be user 'root' and execute following commands:
cd /usr/local/src/kamailio-devel/kamailio git pull origin make all make install /etc/init.d/kamailio restart
Now you have the latest Kamailio devel running on your system.
8. Time for maintenance service
Notification about GIT commits are sent to the mailing list: sr-dev@lists.sip-router.org. Each commit notification contains the reference to the branch where the commit has been done. If the commit message contains the lines:
Module: sip-routerBranch: master
then an update has been made to Kamailio devel version and it will be available to the public GIT in no time.
5.31 i am back!
Kamailio Modules
----------------acc Accountingacc_radius Accounting with RADIUS backendalias_db Alias management in database modules async Asynchronus SIP request handling functions acp Collection of functions for handling AVP's (from SER)avpops Attribute-value pair operations ("variables")benchmark Development benchmark moduleblst Blacklisting API for configuration scriptscall_control Call timeouts and management (depends on Dialog module)carrierroute A telephony routing modulecdp C Diameter Peer - core communication enginecdp_avp C Diameter Peer - application extensionscfg_db Database driver for configuration APIcfg_rpc Update core and module parameters from RPCcfgutils Various configuration utilitiescorex Core extensionscounters Internal counter API for configurationcpl-c Implementation of SIP Call Processing Language (RFC 3880)ctl Control connector for RPC interface (fifo, unixsock, tcp, udp) db_mysql Database :: Mysql debugger Interactive configuration processing debuggerdialog Dialog ("call") state moduledialplan Dialplan managementdialog_ng Dialog tracking module - next generationdispatcher Load balancing and failoverdiversion Call redirect support (SIP Diversion: header)dmq Devel :: Distributed message queue system using SIP (early development)domain Proxy :: Multiple domain support using databases drouting Proxy :: Dynamic routingenum Enum supportexec External exec modulegeoip GeoIP API to configuration filegroup Utils :: Group membership checking htable Utils :: Hash table supportimc IM :: Instant messaging conference ims_auth IMS authentication moduleims_icscf IMS ICSCF component moduleims_isc IMS ISC component moduleims_qos IMS Diameter Rx interfaceims_registrar_pcscf IMS PCSCF registrar moduleims_registrar_scscf IMS SCSCF registrar module ipops IP and DNS related operationsiptrtpproxy NAT traversal :: Kernel based RTP proxyjabber IM :: Jabber gatewayjson Access to JSON document attributesjsonrpc-c JSON-RPC client over netstrings protocolkex Proxy :: Kamailio core functions (backwards compatibility)lcr Least cost routingldap LDAP Directory accessmalloc_test Functions for stress-testing memory manager (from SER)mangler SIP message mangling functions (from SER)matrix Matrix operationsmaxfwd SIP loop detection prevention (max-forwards header - "ttl")mediaproxy Nat traversal :: Mediaproxy (AG projects)memcached Utils :: In-memory caching support (memcached)mi_datagram Management interface :: UDPmi_fifo Management Interface :: Unix FIFOmi_rpc Management Interface :: RPC supportmi_xmlrpc Management Interface :: XML-rpcmisc_radius Various Radius functionsmsilo Text message storagemsrp Embedded MSRP relay (RFC 4975 and RFC 4976)mqueue Message queue system for configuration filenat_traversal NAT :: NAT traversal modulenathelper NAT :: NAT traversal module :: RTPproxy (SIPPY software)ndb_redis Connector to REDIS NoSQL Database engineosp Open Settlement Protocol supportoutbound SIP Outbound Implementationp_usrloc Partitioned and distributed user location servicespath Path: header supportpdb Number portability using external serverpdt Proxy :: Routing based on numeric prefixpeering SIP peering between service providerspermissions Security :: TCP-wrapper-like ACL functionspike Security :: DOS-attack preventionpipelimit Traffic shaping policiesprefix_route Execute config file route blocks based on prefixpresence Presence :: Core presence modulepresence_conference Presence :: Conference events handlingpresence_dialoginfo Presence :: Dialog infopresence_mwi Presence :: Message waiting indicationpresence_profile Presence :: User profile extensions (RFC 6080)presence_reginfo Presence :: Registration info (RFC 3680)presence_xml Presence :: XML handlerprint DEVEL :: Basic sample of a moduleprint_lib DEVEL :: Basic sample of a module with dependency on other modulespua Presence :: Common modulepua_bla Presence :: BLApua_dialoginfo Presence :: Dialog Info supportpua_mi Presence :: Management interfacepua_reginfo Presence :: Registration information (RFC 3680)pua_usrloc Presence :: USRLOC integrationpua_xmpp Presence :: XMPP/Jabber gatewaypurple Presence :: Libpurple supportpv Pseudo-variable implementationqos Dialogs :: SDP management ratelimit Traffic shaping moduleregex Regular expression supportregistrar Registrar/location server supportrls Presence :: Resource list serverrr Proxy :: Record routingrtimer Utils :: Timer based routing script processingrtpproxy NAT :: Nat traversal module for RTPproxy controlsanity Syntax checking for incoming SIP requestssca PRESENCE :: Shared call appearancessdpops SDP operationsseas Application server interfacesipcapture SIP Capture Server module (used in the Homer project)siptrace Store SIP messages in databasesiputils Various utilities for SIP call handlingsl Proxy :: Stateless handling of SIP messagessms SMS gateway supportsnmpstats SNMP support (net-snmp agentx)speeddial Per-user speed-dial controller modulesqlops SQL operationssst SIP Session Timers implementationstatistics Script statistics supporttextops Text operationstextopsx Extra Text operationstimer Execute routing blocks on core timers (From SER)tls SSL/TLS supporttm Proxy :: SIP transaction support (stateful)tmx Proxy :: Kamailio transaction extensions (TM module)topoh Topology hindinguac UAC functions (From: mangling and UAC auth)uac_redirect UAC redirection supportuid_auth_db Authentication module using unique IDs (from SER)uid_avp_db AVP Database operations using unique IDs (from SER)uid_domain Domain management using unique IDs (from SER)uid_gflags Global attributes and flags using Unique IDs (from SER)uid_uri_db Database URI operations using unique IDs (from SER)uri_db URI operation with database supportuserblacklist User-specific blacklistsusrloc Proxy :: Location serverutils Various utilities (http query, xcap status)websocket HTTP :: Websocket transport layer for proxyxcap_client Presence :: XCAP supportxcap_server Presence :: XCAP server implementationxhttp HTTP :: The serverxhttp_pi HTTP :: Provisioning interface for Kamailioxhttp_rpc HTTP :: RPC Command supportxlog Utils :: Extended logging supportxmlops XML operations using XPathxmlrpc HTTP :: XMLrpc supportxmpp Presence/IM :: XMPP/jabber gatewayxprint Functions for printing messages with specifiers (from SER)
ims_qos IMS Diameter Rx interface
2.1. Kamailio Modules
The Following mouldes must be loaded before this module:
* Dialog2 * Usrloc PCSCF * TM - Transaction Manager * CDP - C Diameter Peer * CDP_AVP - CDP AVP Applications2.2. External Libraries or Applications
This modules requires the internal IMS library.
3. Parameters
3.1. rx_dest_realm (string)
3.2. rx_forced_peer (string) 3.3. rx_auth_expiry (integer) 3.4. cdp_event_latency (integer) 3.5. cdp_event_threshold (integer) 3.6. cdp_event_latency_log (integer)3.1. rx_dest_realm (string)
This is the name of the Diameter realm of the Diameter server(typically a PCRF).Default value is 'ims.smilecoms.com'.
Example 1.1. rx_dest_realm parameter usage
...modparam("ims_qos", "rx_dest_realm", "ims.smilecoms.com")...3.2. rx_forced_peer (string)
This is the optional name of the origin host of the Diameter server(typically a PCRF). If not set then realm routing is used.Default value is ''.
Example 1.2. rx_forced_peer parameter usage
...modparam("ims_qos", "rx_forced_peer", "pcrf.ims.smilecoms.com")...3.3. rx_auth_expiry (integer)
This is the expiry length in seconds of the initiated Diameter sessions.Default value is 7200.
Example 1.3. rx_auth_expiry parameter usage
...modparam("ims_qos", "rx_auth_expiry", 14400)...3.4. cdp_event_latency (integer)
This is a flag to determine whether or slow CDP responses should be reported in the log file. 1 is enabled and 0 is disabled.Default value is 1.
Example 1.4. cdp_event_latency parameter usage
...modparam("ims_qos", "cdp_event_latency", 1)...3.5. cdp_event_threshold (integer)
This time in milliseconds is the limit we should report a CDP response as slow. i.e. if a CDP response exceeds this limit it will be reported in the log file. This is only relevant is cdp_event_latency is enabled (set to 0).
Default value is 500.
Example 1.5. cdp_event_threshold parameter usage
...modparam("ims_qos", "cdp_event_threshold", 500)...3.6. cdp_event_latency_log (integer)
This time log level at which we should report slow CDP responses. 0 is ERROR, 1 is WARN, 2 is INFO and 3 is DEBUG. This is only relevant is cdp_event_latency is enabled (set to 0)Default value is 0.
Example 1.6. cdp_event_latency_log parameter usage
...modparam("ims_qos", "cdp_event_latency_log", 1)...4. Functions
4.1. Rx_AAR_Register(domain)
4.2. Rx_AAR(domain)4.1. Rx_AAR_Register(domain)
Perform a AAR on Diameter RX interface to subscribe to signalling
status. This purpose of this is tell a Diameter server (typically a PCRF) to inform the requesting Diameter client on changes to the status of signalling bearer for the same framed IP address. For more details see 3GGP TS 29.214.Meaning of the parameters is as follows:
* domain that usrloc_pcscf uses to store user information.This function can be used from REQUEST_ROUTE.
p.s. this is executed asynchronously. See example on how to retrieve
return valueExample 1.7. Rx_AAR_Register
... Rx_AAR_Register("location");switch ($avp(s:aar_return_code)) {
case 1: xlog("L_DBG", "Diameter: AAR success on subscription to signalling\n"); break; default: xlog("L_ERR", "Diameter: AAR failed on subscription to signalling\n"); t_reply("403", "Can't register to QoS for signalling"); exit; }...
4.2. Rx_AAR(domain)
Perform a AAR on Diameter RX interface to request resource
authorisation from a Diameter server (typically a PCRF). For more details see 3GGP TS 29.214.Meaning of the parameters is as follows:
* domain that usrloc_pcscf uses to store user information.This function can be used from REQUEST_ROUTE or ONREPLY_ROUTE.
p.s. this is executed asynchronously. See example on how to retrieve
return valueExample 1.8. Rx_AAR
... Rx_AAR("location");switch ($avp(s:aar_return_code)) {
case 1: xlog("L_DBG", "Diameter: AAR success\n"); break; default: xlog("L_ERR", "Diameter: AAR failed\n"); t_reply("403", "QoS not authorized"); exit; }...
5. Statistics
5.1. AAR Timeouts (aar_timeouts)
5.2. Average AAR Response Time (aar_avg_response_time)5.1. AAR Timeouts (aar_timeouts)
The number of timeouts on sending a AAR. i.e. no response to AAR.
5.2. Average AAR Response Time (aar_avg_response_time)
The average response time in milliseconds for AAR-AAA transaction.