User Tools

Site Tools


tutorials:getting-started:main

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
tutorials:getting-started:main [2015/07/22 20:21]
miconda [From Sources]
tutorials:getting-started:main [2019/08/28 05:44] (current)
ali [Linux/Unix]
Line 1: Line 1:
-====== Getting Started with Kamailio ======+====== Kamailio - Getting Started Guide ======
  
 A collection of guidelines and useful links to smoothen the understanding and A collection of guidelines and useful links to smoothen the understanding and
Line 7: Line 7:
  
 The first version of the tutorial was written for Kamailio v4.3.x. The first version of the tutorial was written for Kamailio v4.3.x.
 +
 +It is recommended that you read first all the content of this tutorial and
 +then start installing Kamailio, because some more relevant information might be
 +found later for specific use cases.
  
 ===== Prerequisites ===== ===== Prerequisites =====
Line 83: Line 87:
  
 Troubleshooting Kamailio and SIP requires knowledge of various tools for Troubleshooting Kamailio and SIP requires knowledge of various tools for
-reading and searching log files (e.g., grep, awk), sniffing the network (e.g.,+reading and searching log files (e.g., grep, awk), sniffing the network (e.g., sngrep,
 ngrep, tcpdump, wireshark). Of course, knowing to work with text editor, ngrep, tcpdump, wireshark). Of course, knowing to work with text editor,
 especially the ones for terminal if the server is remote, is quite obvious especially the ones for terminal if the server is remote, is quite obvious
Line 99: Line 103:
  
   * [[install:devel:git|Install Kamailio Devel Version From GIT]]   * [[install:devel:git|Install Kamailio Devel Version From GIT]]
 +
 +When installing from sources:
 +
 +  * configuration files are deployed in: /usr/local/etc/kamailio
 +  * binary files are deployed in: /usr/local/sbin/
 ==== Debian ==== ==== Debian ====
 +
 +Kamailio is part of latest official stable Debian distributions (and its Ubuntu cousin), but might be an older version.
 +
 +To use most recent Kamailio release, you can use the APT repositories hosted by Kamailio project, see details at:
 +
 +  * [[packages:debs|KAMAILIO DEBS Repositories]]
 +
 +Then, the typical way of installing packages can be used:
 +
 +<code>
 +apt-get update
 +apt-get install kamailio
 +</code>
 +
 +Various modules are packaged separately, you can search the repository to see what is available:
 +
 +<code>
 +apt-cache search kamailio
 +</code>
 +
 +Install the other packages of the modules you may need, like mysql or tls modules -- they can be installed with:
 +
 +<code>
 +apt-get install kamailio-mysql-modules kamailio-tls-modules
 +</code>
 +
 +When installing from deb packages:
 +
 +  * configuration files are deployed in: /etc/kamailio/
 +  * binary files are deployed in: /usr/sbin/
  
 ==== CentoOS ==== ==== CentoOS ====
  
 +Kamailio RPMs are available for several distributions, such as RedHat
 +Enterprise, CentOS, OpenSuse and Fedora. For more details, see:
 +
 +  * [[packages:rpms|KAMAILIO RPMS Repositories]]
 +
 +You can add them to YUM configuration and then install Kamailio with usual yum
 +commands:
 +
 +<code>
 +yum install kamailio
 +...
 +yum install kamailio-mysql-modules kamailio-tls-modules
 +</code>
 +
 +When installing from rpm packages:
 +
 +  * configuration files are deployed in: /etc/kamailio/
 +  * binary files are deployed in: /usr/sbin/
 ===== Configuration File ===== ===== Configuration File =====
  
 ==== Overview ==== ==== Overview ====
  
 +If you installed from sources, then the configuration file is located at:
 +
 +  * /usr/local/etc/kamailio/kamailio.cfg
 +
 +If you installed from packages, then the configuration file is located at:
 +
 +  * /etc/kamailio/kamailio.cfg
 +
 +==== Configuration Scripting Language ====
 +
 +Kamailio uses its own configuration file language. Its structure is described in the Core Cookbook:
 +
 +  * [[cookbooks:devel:core|Devel Core Cookbook]]
 ==== Default Configuration File ==== ==== Default Configuration File ====
 +
 +The default configuration file is trying to provide the features for a simple
 +VoIP (telephony) provider.
 +
 +
 +  * user authentication
 +  * IP authorization
 +  * accounting
 +  * registrar and location services
 +  * attacks detection and blocking (anti-flood protection)
 +  * NAT traversal
 +  * short dialing on server
 +  * multiple identities (aliases) for subscribers
 +  * multi-domain support
 +  * routing to a PSTN gateway
 +  * routing to a voicemail server
 +  * TLS encryption
 +  * instant messaging (pager mode with MESSAGE requests)
 +  * presence services
 +
 +Not all the above features are enabled by default -- read the comments at the
 +top of **kamailio.cfg** in order to find what tokens must be defined.
 +
 +=== Enabling User Authentication ===
 +
 +Initial installation doesn't ask users for authentication.
 +Enabling that means defining WITH_MYSQL and WITH_AUTH --
 +that means adding the next two lines after the first line (after the one with
 +#!KAMAILIO).
 +
 +<code c>
 +#!define WITH_MYSQL
 +#!define WITH_AUTH
 +</code>
 +
 +Obviously, for the above to really work, you need to install MySQL server and
 +create the database required by Kamailio (see **kamdbctl** tool). You need
 +also to add subscribers (username/password to subscriber database table). You
 +can use **kamctl** tool for managing subscriber records.
 +
 +
 +=== Enabling Persistent Location ===
 +
 +Initial installation doesn't have persistent location enabled, meaning that if
 +you restart Kamailio, the registration records are lost. If you enable it,
 +registration records are saved to database and reload at restart.
 +
 +To enable persistent location records, you have to define WITH_USRLOCDB -- add
 +the next line in **kamailio.org** after those line you added in the previous
 +section:
 +
 +<code c>
 +#!define WITH_USRLOCDB
 +</code>
 +
 +=== Enabling NAT Traversal ===
 +
 +The default **kamailio.cfg** comes with NAT traversal support, relying on
 +RTPProxy for RTP relaying. The NAT traversal support has to be enabled by
 +defining WITH_NAT:
 +
 +<code c>
 +#!define WITH_NAT
 +</code>
 +
 +You have to install RTPProxy applicationand configure it to use the same
 +control socket as in **kamailio.cfg** parameter for **rtpproxy** module.
  
 ===== Tools ===== ===== Tools =====
  
 ==== kamctl ==== ==== kamctl ====
 +
 +Kamctl is part of Kamailio project (in the same source tree) and installed by default.
 +
 +It has a configuration file named **kamctlrc**, located in the same folder with **kamailio.cfg**. You have to edit it to set your SIP domain, the database engine, username/password/... to connect to database, etc.
 +
 +This is the tool to manage kamailio from command line, providing lots of operations, such as adding/removing/updating SIP users, controlling the ACL for users, managing the records for LCR or load balancing, viewing registered users and internal statistics, etc.
 +
 +When needed to interact with Kamailio, it does it via FIFO file created by **mi_fifo** module. Operations to the database are done by connecting directly to the database server.
 +
 +==== kamdbctl ====
 +
 +Kamctl is part of Kamailio project (in the same source tree) and installed by default.
 +
 +It uses the same configuration file like **kamctl**, respectively the **kamctlrc**.
 +
 +The tool can be used to create and manage the database structure needed by Kamailio, therefore it should be immediately after Kamailio installation, in case you plan to run Kamailio with a database backend.
 +
 +It is not used for managing the records inside the database tables, just for database structure and access to the database (e.g., granting/revoking access to database server). For managing the records inside database table, **kamctl** is the tool that has to be used.
  
 ==== kamcmd ==== ==== kamcmd ====
 +
 +Kamctl is part of Kamailio project (in the same source tree) and installed by default.
 +
 +This is an application that can send RPC commands to Kamailio from command line. It requires that the **ctl** module is loaded by Kamailio.
  
 ==== siremis ==== ==== siremis ====
 +
 +It is a web management interface for Kamailio, written in PHP -- more at:
 +
 +  * http://www.siremis.org
  
 ==== kamcli ==== ==== kamcli ====
  
-===== Typical Use Cases =====+It is a command line application write in Python, more or less an alternative to **kamctl**. It has a modular architecture, allowing to extend it by writing new plugins.
  
-==== NAT Traversal ====+See more at: 
 + 
 +  * https://github.com/asipto/kamcli 
 + 
 +===== Typical Use Cases =====
  
 ==== VoIP Provider ==== ==== VoIP Provider ====
 +
 +The default **kamailio.cfg** is practically an implementation of simple SIP
 +operator services. See the section above dedicated to default configuration
 +file for more details.
  
 ==== Load Balancing ==== ==== Load Balancing ====
 +
 +See dispatcher module:
 +
 +  * http://kamailio.org/docs/modules/stable/modules/dispatcher.html
  
 ==== Least Cost Routing ==== ==== Least Cost Routing ====
 +
 +See the modules:
 +
 +  * http://kamailio.org/docs/modules/stable/modules/lcr.html
 +  * http://kamailio.org/docs/modules/stable/modules/carrierroute.html
 +  * http://kamailio.org/docs/modules/stable/modules/drouting.html
  
 ==== IMS/VoLTE ==== ==== IMS/VoLTE ====
 +
 +Look at the modules that have the name prefixed with **ims_** or starting with
 +**cdp** (the later are for Diameter):
 +
 +  * http://kamailio.org/docs/modules/stable/
 +
 +Example of configuration files for different IMS roles (eg., ICSCF, PCSCF,
 +SCSCF) are available in the source tree, look inside the sub-directory
 +**examples/**.
  
 ==== Instant Messaging and Presence ==== ==== Instant Messaging and Presence ====
 +
 +Look at the modules that have the name prefixed with **presence** (presence
 +server) or **pua** (presence user agent):
 +
 +  * http://kamailio.org/docs/modules/stable/
 +
  
 ==== WebRTC ==== ==== WebRTC ====
 +
 +See the module:
 +
 +  * http://kamailio.org/docs/modules/stable/modules/websocket.html
  
 ===== Useful Resources ===== ===== Useful Resources =====
  
-==== Books ====+==== Kamailio Books ==== 
 + 
 +  * [[http://www.asipto.com/sw/kamailio-admin-book/|SIP Routing with Kamailio]]
  
-  * SIP Routing with Kamailio+==== Kamailio Online Tutorials ====
  
-==== Online ====+  * [[http://www.asipto.com/pub/kamailio-devel-guide/|Kamailio Devel Tutorial]] 
 +  * [[http://kamailio.org/docs/ser-getting-started/SER-GettingStarted.pdf|SER Getting Started]]
  
-  * Kamailio Devel Tutorial +==== Related Open Source Projects ====
-  * SER Getting Started+
  
 +Open source projects embedding Kamailio that can help rolling out specific use cases.
  
 +  * [[https://www.sipwise.org/products/spce/|sip:provider CE]] - telephony operator platform
 +  * [[https://github.com/2600hz/kazoo|kazoo]] - cloud PBX platform
 +  * [[http://www.elastix.org/|Elastix MT]] - multi-tenant PBX system
tutorials/getting-started/main.1437589275.txt.gz · Last modified: 2015/07/22 20:21 by miconda