Kamailio

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

kamailio install

SIP SERVER

INSTALL   INSTALL2

 

 

 

opensis

ngrep

 

less than one hour



撒花。继续加载模块。

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

 试试:service mysqld start 

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 kamailio.cfg 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/kamailio
chown 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-router
Branch: master

then an update has been made to Kamailio devel version and it will be available to the public GIT in no time.


OpenSUR

















5.31 i am back!



Kamailio Modules
----------------
acc Accounting
acc_radius Accounting with RADIUS backend
alias_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 module
blst Blacklisting API for configuration scripts
call_control Call timeouts and management (depends on Dialog module)
carrierroute A telephony routing module
cdp C Diameter Peer - core communication engine
cdp_avp C Diameter Peer - application extensions
cfg_db Database driver for configuration API
cfg_rpc Update core and module parameters from RPC
cfgutils Various configuration utilities
corex Core extensions
counters Internal counter API for configuration
cpl-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 debugger
dialog Dialog ("call") state module
dialplan Dialplan management
dialog_ng Dialog tracking module - next generation
dispatcher Load balancing and failover
diversion 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 routing
enum Enum support
exec External exec module
geoip GeoIP API to configuration file
group Utils :: Group membership checking
 
htable Utils :: Hash table support
imc IM :: Instant messaging conference


ims_auth IMS authentication module
ims_icscf IMS ICSCF component module
ims_isc IMS ISC component module
ims_qos IMS Diameter Rx interface
ims_registrar_pcscf IMS PCSCF registrar module
ims_registrar_scscf IMS SCSCF registrar module


ipops IP and DNS related operations
iptrtpproxy NAT traversal :: Kernel based RTP proxy
jabber IM :: Jabber gateway
json Access to JSON document attributes
jsonrpc-c JSON-RPC client over netstrings protocol
kex Proxy :: Kamailio core functions (backwards compatibility)
lcr Least cost routing
ldap LDAP Directory access
malloc_test Functions for stress-testing memory manager (from SER)
mangler SIP message mangling functions (from SER)
matrix Matrix operations
maxfwd 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 :: UDP
mi_fifo Management Interface :: Unix FIFO
mi_rpc Management Interface :: RPC support
mi_xmlrpc Management Interface :: XML-rpc
misc_radius Various Radius functions
msilo Text message storage
msrp Embedded MSRP relay (RFC 4975 and RFC 4976)
mqueue Message queue system for configuration file
nat_traversal NAT :: NAT traversal module
nathelper NAT :: NAT traversal module :: RTPproxy (SIPPY software)
ndb_redis Connector to REDIS NoSQL Database engine
osp Open Settlement Protocol support
outbound SIP Outbound Implementation
p_usrloc Partitioned and distributed user location services
path Path: header support
pdb Number portability using external server
pdt Proxy :: Routing based on numeric prefix
peering SIP peering between service providers
permissions Security :: TCP-wrapper-like ACL functions
pike Security :: DOS-attack prevention
pipelimit Traffic shaping policies
prefix_route Execute config file route blocks based on prefix
presence Presence :: Core presence module
presence_conference Presence :: Conference events handling
presence_dialoginfo Presence :: Dialog info
presence_mwi Presence :: Message waiting indication
presence_profile Presence :: User profile extensions (RFC 6080)
presence_reginfo Presence :: Registration info (RFC 3680)
presence_xml Presence :: XML handler
print DEVEL :: Basic sample of a module
print_lib DEVEL :: Basic sample of a module with dependency on other modules
pua Presence :: Common module
pua_bla Presence :: BLA
pua_dialoginfo Presence :: Dialog Info support
pua_mi Presence :: Management interface
pua_reginfo Presence :: Registration information (RFC 3680)
pua_usrloc Presence :: USRLOC integration
pua_xmpp Presence :: XMPP/Jabber gateway
purple Presence :: Libpurple support
pv Pseudo-variable implementation
qos Dialogs :: SDP management
ratelimit Traffic shaping module
regex Regular expression support
registrar Registrar/location server support
rls Presence :: Resource list server
rr Proxy :: Record routing
rtimer Utils :: Timer based routing script processing
rtpproxy NAT :: Nat traversal module for RTPproxy control
sanity Syntax checking for incoming SIP requests
sca PRESENCE :: Shared call appearances
sdpops SDP operations
seas Application server interface
sipcapture SIP Capture Server module (used in the Homer project)
siptrace Store SIP messages in database
siputils Various utilities for SIP call handling
sl Proxy :: Stateless handling of SIP messages
sms SMS gateway support
snmpstats SNMP support (net-snmp agentx)
speeddial Per-user speed-dial controller module
sqlops SQL operations
sst SIP Session Timers implementation
statistics Script statistics support
textops Text operations
textopsx Extra Text operations
timer Execute routing blocks on core timers (From SER)
tls SSL/TLS support
tm Proxy :: SIP transaction support (stateful)
tmx Proxy :: Kamailio transaction extensions (TM module)
topoh Topology hinding
uac UAC functions (From: mangling and UAC auth)
uac_redirect UAC redirection support
uid_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 support
userblacklist User-specific blacklists
usrloc Proxy :: Location server
utils Various utilities (http query, xcap status)
websocket HTTP :: Websocket transport layer for proxy
xcap_client Presence :: XCAP support
xcap_server Presence :: XCAP server implementation
xhttp HTTP :: The server
xhttp_pi HTTP :: Provisioning interface for Kamailio
xhttp_rpc HTTP :: RPC Command support
xlog Utils :: Extended logging support
xmlops XML operations using XPath
xmlrpc HTTP :: XMLrpc support
xmpp Presence/IM :: XMPP/jabber gateway
xprint 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 Applications

2.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 value

Example 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 value

Example 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.









posted @ 2014-04-22 16:21  好哥TOP  阅读(4930)  评论(0编辑  收藏  举报