...
|
...
|
@@ -10,14 +10,14 @@
|
10
|
10
|
Welcome! This is an amazingly flexible, robust and secure SIP server
|
11
|
11
|
built on years of experience in several Open Source projects. It's a merge
|
12
|
12
|
of the SIP Express Router (SER) and the Kamailio (OpenSER) products produced
|
13
|
|
- by a joint development team.
|
|
13
|
+ by a joint development team.
|
14
|
14
|
|
15
|
15
|
This memo gives you hints on how to set up the Kamailio quickly.
|
16
|
|
-
|
|
16
|
+
|
17
|
17
|
You can find a similar tutorial and many more on project's web site:
|
18
|
|
- - http://www.kamailio.org/w/documentation/
|
19
|
|
- - http://www.kamailio.org/wiki/
|
20
|
|
-
|
|
18
|
+ - https://www.kamailio.org/w/documentation/
|
|
19
|
+ - https://www.kamailio.org/wiki/
|
|
20
|
+
|
21
|
21
|
|
22
|
22
|
Table of Contents
|
23
|
23
|
=================
|
...
|
...
|
@@ -63,7 +63,7 @@ There are various configuration options defined in the Makefile.
|
63
|
63
|
|
64
|
64
|
Requirements:
|
65
|
65
|
|
66
|
|
-- gcc or clang:
|
|
66
|
+- gcc or clang:
|
67
|
67
|
gcc >= 2.9x; 3.[12] recommended (it will work with older version
|
68
|
68
|
but it might require some options tweaking for best performance)
|
69
|
69
|
clang >= version 3.3
|
...
|
...
|
@@ -76,10 +76,10 @@ Requirements:
|
76
|
76
|
- GNU install, BSD install or Solaris install if you want "make
|
77
|
77
|
install", "make bin", "make sunpkg" to work
|
78
|
78
|
- libmysqlclient & libz (zlib) if you want MySQL support (the db_mysql module)
|
79
|
|
-- libxml2 if you want to compile the cpl-c (CPL support) or pa (presence)
|
|
79
|
+- libxml2 if you want to compile the cpl-c (CPL support) or pa (presence)
|
80
|
80
|
modules
|
81
|
|
-- freeradius or libradiusclient-ng (> 5.0) if you need RADIUS support (the auth_radius,
|
82
|
|
- group_radius, uri_radius and avp_radius modules)
|
|
81
|
+- freeradius, radcli or libradiusclient-ng (> 5.0) if you need RADIUS support
|
|
82
|
+ (the auth_radius, acc_radius and misc_radius modules)
|
83
|
83
|
- libpq if you need PostgreSQL support (the db_postgres module)
|
84
|
84
|
- libexpat if you want the jabber gateway support (the jabber module) or the
|
85
|
85
|
XMPP gateway support
|
...
|
...
|
@@ -91,7 +91,7 @@ Requirements:
|
91
|
91
|
DB underlayer
|
92
|
92
|
- libperl - libs and devel headers - if you want the perl connector to support
|
93
|
93
|
perl scripting from your config file (perl module)
|
94
|
|
-- libsnmp9 - libs and devel headers - if you want SNMP client functionality
|
|
94
|
+- libsnmp9 - libs and devel headers - if you want SNMP client functionality
|
95
|
95
|
(SNMP AgentX subagent) for Kamailio
|
96
|
96
|
- libldap libs and devel headers v2.1 or greater - if you want LDAP support
|
97
|
97
|
- libpcre libs and devel headers - if you want to compile the lcr and dialplan
|
...
|
...
|
@@ -109,7 +109,7 @@ in the README for the specific module.
|
109
|
109
|
OS Notes:
|
110
|
110
|
|
111
|
111
|
FreeBSD/OpenBSD/NetBSD: make sure gmake, bison or yacc & flex are installed.
|
112
|
|
-
|
|
112
|
+
|
113
|
113
|
FreeBSD 5.4:
|
114
|
114
|
------------
|
115
|
115
|
If you want to compile all the modules, you will need the following packages:
|
...
|
...
|
@@ -119,10 +119,10 @@ OS Notes:
|
119
|
119
|
libpq
|
120
|
120
|
- expat-1.95.8 (/usr/ports/textproc/expat2) for libexpat
|
121
|
121
|
- libxml2-2.6.18 (/usr/ports/textproc/libxml2) for libxml2
|
122
|
|
- - radiusclient-0.4.7 (/usr/ports/net/radiusclient) for libradiusclient-ng
|
|
122
|
+ - radiusclient-0.4.7 (/usr/ports/net/radiusclient) for libradiusclient-ng
|
123
|
123
|
NOTE: you'll need to add radiusclient_ng=4 to the gmake command line if you
|
124
|
124
|
use the 0.4.* version.
|
125
|
|
-
|
|
125
|
+
|
126
|
126
|
Compile example (all the modules and SIP server core in a tar.gz):
|
127
|
127
|
gmake bin radiusclient_ng=4 include_modules="mysql jabber cpl-c auth_radius group_radius uri_radius postgres pa"
|
128
|
128
|
|
...
|
...
|
@@ -131,10 +131,10 @@ OS Notes:
|
131
|
131
|
- mysql-client-4.0.23 (/usr/ports/databases/mysql) for libmysqlclient
|
132
|
132
|
- expat-1.95.6 (/usr/ports/textproc/expat) for libexpat
|
133
|
133
|
- libxml-2.6.16p0 (/usr/ports/textproc/libxml) for libxml2
|
134
|
|
- - radiusclient-ng-0.5.1 from
|
|
134
|
+ - radiusclient-ng-0.5.1 from
|
135
|
135
|
http://download.berlios.de/radiusclient-ng/radiusclient-ng-0.5.1.tar.gz
|
136
|
|
- (you need to download and install it, since there is no "official"
|
137
|
|
- openbsd port for it) for libradiusclient-ng
|
|
136
|
+ (you need to download and install it, since there is no "official"
|
|
137
|
+ openbsd port for it) for libradiusclient-ng
|
138
|
138
|
|
139
|
139
|
Compile example (all the modules and SIP server core in a tar.gz):
|
140
|
140
|
gmake bin include_modules="mysql jabber cpl-c auth_radius group_radius uri_radius pa"
|
...
|
...
|
@@ -145,7 +145,7 @@ OS Notes:
|
145
|
145
|
- expat-1.95.8nb2 (/usr/pkgsrc/textproc/expat) for libexpat
|
146
|
146
|
- libxml2-2.6.19 (/usr/pkgsrc/textproc/libxml2) for libxml2
|
147
|
147
|
- radiusclient-ng-0.5.1 (see OpenBSD)
|
148
|
|
-
|
|
148
|
+
|
149
|
149
|
Compile example (all the modules and SIP server in a tar.gz):
|
150
|
150
|
gmake bin include_modules="mysql jabber cpl-c auth_radius group_radius uri_radius pa"
|
151
|
151
|
|
...
|
...
|
@@ -156,7 +156,7 @@ OS Notes:
|
156
|
156
|
install, just make sure it's in the PATH (it's usually in /usr/sbin) and
|
157
|
157
|
add INSTALL=install either to the environment or to the make command line
|
158
|
158
|
(e.g.: gmake INSTALL=install all).
|
159
|
|
-
|
|
159
|
+
|
160
|
160
|
Compile example (all the modules and SIP server in a tar.gz):
|
161
|
161
|
gmake bin INSTALL=install include_modules="mysql jabber cpl-c auth_radius group_radius uri_radius postgres pa"
|
162
|
162
|
|
...
|
...
|
@@ -183,11 +183,11 @@ OS Notes:
|
183
|
183
|
--------------------------------------
|
184
|
184
|
make sure make, bison, flex, minires and minires-devel (needed for the
|
185
|
185
|
resolver functions) are installed.
|
186
|
|
-
|
|
186
|
+
|
187
|
187
|
Only building Kamailio's core and some static modules is supported for now.
|
188
|
188
|
Stuff known not to work:
|
189
|
189
|
- IPv6 (cygwin doesn't support it yet)
|
190
|
|
- - TCP (the tcp code heavily depends on file descriptor passing
|
|
190
|
+ - TCP (the tcp code heavily depends on file descriptor passing
|
191
|
191
|
between processes, which is not yet supported by cygwin)
|
192
|
192
|
- dynamic modules (non statically linked -- not supported because
|
193
|
193
|
backlinking doesn't work in windows by design)
|
...
|
...
|
@@ -224,7 +224,7 @@ tls, run:
|
224
|
224
|
make install
|
225
|
225
|
|
226
|
226
|
2.2 Details - Installing From Source Code
|
227
|
|
-.......................................
|
|
227
|
+.........................................
|
228
|
228
|
|
229
|
229
|
Build Commands
|
230
|
230
|
|
...
|
...
|
@@ -236,8 +236,8 @@ Build Commands
|
236
|
236
|
make
|
237
|
237
|
|
238
|
238
|
Compile modules except some explicitly excepted (see below)
|
239
|
|
- make modules - all modules in the modules/ directory
|
240
|
|
- make modules-all or make every-module - all the modules
|
|
239
|
+ make modules - all modules in the modules/ directory
|
|
240
|
+ make modules-all or make every-module - all the modules
|
241
|
241
|
|
242
|
242
|
* Compile all:
|
243
|
243
|
make all
|
...
|
...
|
@@ -296,7 +296,7 @@ are grouped based on Debian packaging rules. For example:
|
296
|
296
|
Ex. to make a standard installation with MySQL, use:
|
297
|
297
|
make group_include="standard mysql" all
|
298
|
298
|
|
299
|
|
- In addition to group_include (or instead), you can use
|
|
299
|
+ In addition to group_include (or instead), you can use
|
300
|
300
|
include_modules="modA modB"
|
301
|
301
|
to specify exactly the modules you want to include, ex.
|
302
|
302
|
make include_modules="mymodule" modules
|
...
|
...
|
@@ -326,18 +326,18 @@ are grouped based on Debian packaging rules. For example:
|
326
|
326
|
make mode=debug PROFILE=-pg all
|
327
|
327
|
- compile only the print module
|
328
|
328
|
make modules=modules/print modules
|
329
|
|
- - compile by default only the print module, in debuging mode and with
|
|
329
|
+ - compile by default only the print module, in debuging mode and with
|
330
|
330
|
profiling:
|
331
|
331
|
make cfg modules=modules/print mode=debug PROFILE=-pg
|
332
|
332
|
make all
|
333
|
333
|
- change & save the modules list without rebuilding the whole config
|
334
|
|
- (so that already compiled modules won't be re-compiled by
|
|
334
|
+ (so that already compiled modules won't be re-compiled by
|
335
|
335
|
make all/make modules):
|
336
|
336
|
make modules-cfg include_modules="mysql postgress"
|
337
|
337
|
- change only the compile/build options, without changing the modules list:
|
338
|
338
|
make cfg-defs CPU=ultrasparc PROFILE=-pg
|
339
|
|
- - compile by default all the usual modules + mysql and postgres, optimized
|
340
|
|
- for pentium-m and for space (saves both the build options and the module
|
|
339
|
+ - compile by default all the usual modules + mysql and postgres, optimized
|
|
340
|
+ for pentium-m and for space (saves both the build options and the module
|
341
|
341
|
list)
|
342
|
342
|
make cfg include_modules="mysql postgres" CPU=pentium-m CC_EXTRA_OPTS=-Os
|
343
|
343
|
make all
|
...
|
...
|
@@ -370,16 +370,16 @@ Make Local Build Config:
|
370
|
370
|
|
371
|
371
|
* make cfg or make config - force config and module list regeneration
|
372
|
372
|
|
373
|
|
- Example:
|
|
373
|
+ Example:
|
374
|
374
|
make cfg include_modules=mysql mode=debug
|
375
|
375
|
|
376
|
376
|
All future make invocations will include the mysql module and will build in debug mode
|
377
|
377
|
|
378
|
|
- Note: If config.mak doesn't exist (e.g. initial checkout or after a make
|
|
378
|
+ Note: If config.mak doesn't exist (e.g. initial checkout or after a make
|
379
|
379
|
proper) or if Makefile.defs was changed, the config will be re-generated
|
380
|
380
|
automatically by the first make command. For example:
|
381
|
381
|
make cfg include_modules=db_mysql; make all
|
382
|
|
- is equivalent to
|
|
382
|
+ is equivalent to
|
383
|
383
|
rm config.mak modules.lst; make include_modules=db_mysql.
|
384
|
384
|
|
385
|
385
|
* make cfg-defs (force config regeneration, but don't touch the module list)
|
...
|
...
|
@@ -400,7 +400,7 @@ Clean:
|
400
|
400
|
* make clean - clean the base and modules too
|
401
|
401
|
* make proper - clean also the dependencies and the config, but not the module list
|
402
|
402
|
* make distclean - the same as proper
|
403
|
|
- * make maintainer-clean - clean everything, including make's config, saved
|
|
403
|
+ * make maintainer-clean - clean everything, including make's config, saved
|
404
|
404
|
module list, auto generated files, tags, *.dbg a.s.o
|
405
|
405
|
* make clean-all - clean all the modules in modules/*
|
406
|
406
|
* make proper-all - like make proper but for all the modules in modules/*
|
...
|
...
|
@@ -427,7 +427,7 @@ Compile:
|
427
|
427
|
* make proper-utils - like make proper, but only for utils
|
428
|
428
|
* make
|
429
|
429
|
or gmake on non-Linux systems
|
430
|
|
- * make modules
|
|
430
|
+ * make modules
|
431
|
431
|
or make modules exclude_modules="CVS print" etc.
|
432
|
432
|
|
433
|
433
|
Other Make Targets:
|
...
|
...
|
@@ -473,9 +473,9 @@ Install:
|
473
|
473
|
to use this parameter in previous make commands, i.e. make, make modules,
|
474
|
474
|
or make all. If you fail to do this then Kamailio will look for the default
|
475
|
475
|
configuration file in a wrong directory, because the directory of the
|
476
|
|
- default configuration file is hardcoded into Kamailio during compile time.
|
477
|
|
- When you use a different prefix parameter when installing then the
|
478
|
|
- directory hard coded in Kamailio and the directory in which the file will be
|
|
476
|
+ default configuration file is hardcoded into Kamailio during compile time.
|
|
477
|
+ When you use a different prefix parameter when installing then the
|
|
478
|
+ directory hard coded in Kamailio and the directory in which the file will be
|
479
|
479
|
installed by make install will not match. (You can specify exact location
|
480
|
480
|
of the configuration file using -f parameter of Kamailio).
|
481
|
481
|
|
...
|
...
|
@@ -507,7 +507,7 @@ A) Getting Help
|
507
|
507
|
check the documentation at the Kamailio web site
|
508
|
508
|
http://www.kamailio.org to learn how to configure Kamailio for your site.
|
509
|
509
|
|
510
|
|
- If the documentation does not resolve your problem you may try contacting
|
|
510
|
+ If the documentation does not resolve your problem you may try contacting
|
511
|
511
|
our user forum by E-mail at sr-users@lists.sip-router.org -- that is the
|
512
|
512
|
mailing list of the Kamailio community. To participate in the mailing list,
|
513
|
513
|
please subscribe at the following web address:
|
...
|
...
|
@@ -515,16 +515,16 @@ A) Getting Help
|
515
|
515
|
https://lists.sip-router.org/cgi-bin/mailman/listinfo
|
516
|
516
|
|
517
|
517
|
B) Disclaimers
|
518
|
|
-
|
519
|
|
- Note well the default "quick-start" configuration is very simple in order
|
520
|
|
- to be easily installable. It provides minimum features. Particularly,
|
|
518
|
+
|
|
519
|
+ Note well the default "quick-start" configuration is very simple in order
|
|
520
|
+ to be easily installable. It provides minimum features. Particularly,
|
521
|
521
|
authentication is by default disabled, which means anyone can register using
|
522
|
|
- any name with the server. (This is on purpose to avoid installation
|
|
522
|
+ any name with the server. (This is on purpose to avoid installation
|
523
|
523
|
dependencies on a database, which is needed for storing user credentials.)
|
524
|
524
|
|
525
|
525
|
C) Quick Start
|
526
|
526
|
|
527
|
|
- The following step-by step guide gives you instructions how to install the
|
|
527
|
+ The following step-by step guide gives you instructions how to install the
|
528
|
528
|
SQL-free distribution of Kamailio. If you need persistence and
|
529
|
529
|
authentication, then you have to install additional database support --
|
530
|
530
|
proceed to section D) after you are finished with C).
|
...
|
...
|
@@ -547,7 +547,7 @@ C) Quick Start
|
547
|
547
|
dpkg -i <package_name>
|
548
|
548
|
gentoo:
|
549
|
549
|
emerge kamailio
|
550
|
|
- (or if use only stable packets:
|
|
550
|
+ (or if use only stable packets:
|
551
|
551
|
ACCEPT_KEYWORDS="~x86" emerge kamailio )
|
552
|
552
|
tar.gz:
|
553
|
553
|
cd /; tar zxvf <package_name>_os_arch.tar.gz
|
...
|
...
|
@@ -557,7 +557,7 @@ C) Quick Start
|
557
|
557
|
gunzip <package_name>.gz ; pkgadd -d <package_name>
|
558
|
558
|
*BSD:
|
559
|
559
|
pkg_add package_name
|
560
|
|
-
|
|
560
|
+
|
561
|
561
|
3) Start the server
|
562
|
562
|
|
563
|
563
|
RPM + gentoo:
|
...
|
...
|
@@ -572,10 +572,10 @@ C) Quick Start
|
572
|
572
|
pkg/kamailio/rpm/kamailio.init, pkg/kamailio/deb/debian/kamailio.init, a.s.o.)
|
573
|
573
|
You can start Kamailio directly with
|
574
|
574
|
/usr/local/sbin/kamailio.
|
575
|
|
-
|
|
575
|
+
|
576
|
576
|
4) Optionally, watch server's health using the kamctl utility
|
577
|
577
|
|
578
|
|
- - to do so, first set the environment variable SIP_DOMAIN to your domain
|
|
578
|
+ - to do so, first set the environment variable SIP_DOMAIN to your domain
|
579
|
579
|
name, e.g., in Bourne shell, call
|
580
|
580
|
export SIP_DOMAIN="myserver.foobar.com"
|
581
|
581
|
- if you are using other than 'localhost' mysql server for maintaining
|
...
|
...
|
@@ -589,7 +589,7 @@ C) Quick Start
|
589
|
589
|
|
590
|
590
|
5) Connect SIP phones
|
591
|
591
|
|
592
|
|
- Register with the server using your favorite SIP User Agent (phone).
|
|
592
|
+ Register with the server using your favorite SIP User Agent (phone).
|
593
|
593
|
|
594
|
594
|
In most cases, you need to set the following options:
|
595
|
595
|
|
...
|
...
|
@@ -602,10 +602,10 @@ C) Quick Start
|
602
|
602
|
D) Kamailio With Persistent Data Storage
|
603
|
603
|
------------------------------------------
|
604
|
604
|
|
605
|
|
- The default configuration is very simple and features many simplifications.
|
606
|
|
- In particular, it does not authenticate users and loses User Location database
|
607
|
|
- on reboot. To provide persistence, keep user credentials and remember users'
|
608
|
|
- locations across reboots, Kamailio can be configured to use a database, like MySQL.
|
|
605
|
+ The default configuration is very simple and features many simplifications.
|
|
606
|
+ In particular, it does not authenticate users and loses User Location database
|
|
607
|
+ on reboot. To provide persistence, keep user credentials and remember users'
|
|
608
|
+ locations across reboots, Kamailio can be configured to use a database, like MySQL.
|
609
|
609
|
|
610
|
610
|
Before you proceed, you need to make sure MySQL is installed on your box. Your
|
611
|
611
|
MySQL server must be configured to deal with a large number of
|
...
|
...
|
@@ -615,10 +615,10 @@ D) Kamailio With Persistent Data Storage
|
615
|
615
|
set-variable = max_connections=500
|
616
|
616
|
|
617
|
617
|
1) Download the package containing mysql support for Kamailio from the links
|
618
|
|
- you find on:
|
|
618
|
+ you find on:
|
619
|
619
|
https://www.kamailio.org/wiki/
|
620
|
620
|
|
621
|
|
- (rpm and deb provided, most of the binary tar.gz distributions and the
|
|
621
|
+ (rpm and deb provided, most of the binary tar.gz distributions and the
|
622
|
622
|
solaris package include it; if it is not present you'll have to rebuild
|
623
|
623
|
from the source).
|
624
|
624
|
For gentoo please include 'mysql' to your USE variable in /etc/make.conf
|
...
|
...
|
@@ -633,9 +633,9 @@ D) Kamailio With Persistent Data Storage
|
633
|
633
|
(if do not want to put 'mysql' into your USE variable you can type:
|
634
|
634
|
USE="mysql" emerge kamailio)
|
635
|
635
|
|
636
|
|
- 3) create MySQL tables for Kamailio
|
|
636
|
+ 3) create MySQL tables for Kamailio
|
637
|
637
|
- if you have a previously installed Kamailio on your system, use
|
638
|
|
- /usr/local/sbin/kamdbctl reinstall
|
|
638
|
+ /usr/local/sbin/kamdbctl reinstall
|
639
|
639
|
to convert your Kamailio database into new structures
|
640
|
640
|
- otherwise, if this is your very first installation, use
|
641
|
641
|
/usr/local/sbin/kamdbctl create
|
...
|
...
|
@@ -651,16 +651,16 @@ D) Kamailio With Persistent Data Storage
|
651
|
651
|
- modparam("auth", "calculate_ha1", yes)
|
652
|
652
|
- modparam("auth_db", "password_column", "password")
|
653
|
653
|
- if (!www_authorize("example.com", "subscriber")) {
|
654
|
|
- www_challenge("example.com", "0");
|
|
654
|
+ www_challenge("example.com", "0");
|
655
|
655
|
break;
|
656
|
656
|
}
|
657
|
657
|
|
658
|
|
- 5) be sure to replace realm, the first parameter in www_* actions,
|
659
|
|
- with name of your server; some broken UAC implementations don't
|
|
658
|
+ 5) be sure to replace realm, the first parameter in www_* actions,
|
|
659
|
+ with name of your server; some broken UAC implementations don't
|
660
|
660
|
authenticate otherwise; the authentication command in your
|
661
|
661
|
configuration script should look then like this:
|
662
|
662
|
if (!www_authorize("myserver.foobar.com", "subscriber")) {
|
663
|
|
- www_challenge("myserver.foobar.com", "0");
|
|
663
|
+ www_challenge("myserver.foobar.com", "0");
|
664
|
664
|
break;
|
665
|
665
|
}
|
666
|
666
|
|
...
|
...
|
@@ -668,25 +668,25 @@ D) Kamailio With Persistent Data Storage
|
668
|
668
|
|
669
|
669
|
/etc/init.d/kamailio restart
|
670
|
670
|
|
671
|
|
- 7) you can now start managing the server using the kamctl utility;
|
672
|
|
- you need to first set the environment variable SIP_DOMAIN to your
|
|
671
|
+ 7) you can now start managing the server using the kamctl utility;
|
|
672
|
+ you need to first set the environment variable SIP_DOMAIN to your
|
673
|
673
|
local SIP realm, e.g.,
|
674
|
674
|
export SIP_DOMAIN="myserver.example.com"
|
675
|
675
|
|
676
|
676
|
a) watch the server status using 'kamctl moni'
|
677
|
677
|
b) try to login with your SIP client as user 'admin' with password 'heslo'
|
678
|
|
- c) try adding new users using
|
|
678
|
+ c) try adding new users using
|
679
|
679
|
'kamctl add <username> <password>'
|
680
|
680
|
|
681
|
681
|
|
682
|
682
|
4. Troubleshooting
|
683
|
683
|
------------------
|
684
|
684
|
|
685
|
|
-Q: SIP requests are replied by Kamailio with "483 Too Many Hops" or
|
|
685
|
+Q: SIP requests are replied by Kamailio with "483 Too Many Hops" or
|
686
|
686
|
"513 Message Too Large"
|
687
|
687
|
|
688
|
|
-A: In both cases, the reason is probably an error in request routing script
|
689
|
|
- which caused an infinite loop. You can easily verify whether this happens
|
|
688
|
+A: In both cases, the reason is probably an error in request routing script
|
|
689
|
+ which caused an infinite loop. You can easily verify whether this happens
|
690
|
690
|
by watching SIP traffic on loopback interface. A typical reason for
|
691
|
691
|
misrouting is a failure to match local domain correctly. If a server
|
692
|
692
|
fails to recognize a request for itself, it will try to forward it to
|