INSTALL 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704
  1. ==================================================
  2. Kamailio SIP Server Installation Notes
  3. https://www.kamailio.org
  4. ==================================================
  5. Welcome! This is an amazingly flexible, robust and secure SIP server
  6. built on years of experience in several Open Source projects. It's a merge
  7. of the SIP Express Router (SER) and the Kamailio (OpenSER) products produced
  8. by a joint development team.
  9. This memo gives you hints on how to set up the Kamailio quickly.
  10. You can find a similar tutorial and many more on project's web site:
  11. - https://www.kamailio.org/w/documentation/
  12. - https://www.kamailio.org/wikidocs/
  13. Table of Contents
  14. =================
  15. 1. Supported Architectures And Requirements
  16. 2. How-To Build Kamailio From The Source Code Distribution
  17. 2.1 Kamailio Fast Track Installation
  18. 2.2 Details Installing From Source Code
  19. A) Build Commands
  20. 3. Quick-Start Installation Guide
  21. A) Getting Help
  22. B) Disclaimers
  23. C) Quick Start
  24. D) Kamailio With Persistent Data Storage
  25. 4. Troubleshooting
  26. 1. Supported Architectures And Requirements
  27. -------------------------------------------
  28. Supported operating systems:
  29. - Linux (Debian, Ubuntu, Fedora, RedHat, CentOS, OpenSUSE, Gentoo, a.s.o.)
  30. - FreeBSD, NetBSD, OpenBSD, Dragonfly BSD
  31. - Solaris
  32. - OS/X, Darwin
  33. Note that some modules have dependencies on the Linux operating system.
  34. This is clearly noted in the README files.
  35. Partially supported
  36. - Windows+Cygwin (core + static modules only, no IPv6, no
  37. TCP, no dynamic modules)
  38. Supported architectures
  39. - i386, x86_64 (amd64), armv4l, sparc64, powerpc, powerpc64
  40. Experimental architectures:
  41. - mips1, mips2, sparc32, alpha
  42. (for other architectures the Makefiles might need to be edited)
  43. There are various configuration options defined in the Makefile.
  44. Requirements:
  45. - gcc or clang:
  46. gcc >= 2.9x; 3.[12] recommended (it will work with older version
  47. but it might require some options tweaking for best performance)
  48. clang >= version 3.3
  49. - bison or yacc (Berkeley Yacc)
  50. - flex
  51. - GNU make (on Linux this is the standard "make", on *BSD and Solaris it is
  52. called "gmake") version >= 3.80 (recommended 3.81).
  53. - sed and tr (used in the makefiles)
  54. - GNU tar ("gtar" on Solaris) and gzip if you want "make tar" to work
  55. - GNU install, BSD install or Solaris install if you want "make
  56. install", "make bin", "make sunpkg" to work
  57. - libmysqlclient & libz (zlib) if you want MySQL support (the db_mysql module)
  58. - libxml2 if you want to compile the cpl-c (CPL support) or pa (presence)
  59. modules
  60. - freeradius, radcli or libradiusclient-ng (> 5.0) if you need RADIUS support
  61. (the auth_radius, acc_radius and misc_radius modules)
  62. - libpq if you need PostgreSQL support (the db_postgres module)
  63. - libexpat if you want the jabber gateway support (the jabber module) or the
  64. XMPP gateway support
  65. - libxml2 if you want to use the cpl-c (Call Processing Language) or
  66. the presence modules (presence and pua*)
  67. - libradius-ng -libs and devel headers- if you want to use functionalities
  68. with radius support - authentication, accounting, group support, etc
  69. - unixodbc - libs and devel headers - if you want UNIXODBC support as
  70. DB underlayer
  71. - libperl - libs and devel headers - if you want the perl connector to support
  72. perl scripting from your config file (perl module)
  73. - libsnmp9 - libs and devel headers - if you want SNMP client functionality
  74. (SNMP AgentX subagent) for Kamailio
  75. - libldap libs and devel headers v2.1 or greater - if you want LDAP support
  76. - libpcre libs and devel headers - if you want to compile the lcr and dialplan
  77. modules
  78. - libsctp devel headers - if you want to compile the SCTP transport in the core
  79. - libssl devel headers (openssl project) - if you want to compile the TLS module
  80. - libunistring - for the WebSocket module
  81. - python and devel headers for the Python module
  82. - jdk and gcj for Java module
  83. - the jansson library for the jansson module used for JSON document handling
  84. - libsqlite3 if you need SQLite support (the db_sqlite module)
  85. Some modules have other requirements on third-party libraries. This is documented
  86. in the README for the specific module.
  87. OS Notes:
  88. FreeBSD/OpenBSD/NetBSD: make sure gmake, bison or yacc & flex are installed.
  89. FreeBSD 5.4:
  90. ------------
  91. If you want to compile all the modules, you will need the following packages:
  92. - mysql-client-* (any version, install one of the mysql*-client ports) for
  93. libmysqlclient
  94. - postgresql-libpqxx-2.4.2_1 (/usr/ports/databases/postgresql-libpqxx) for
  95. libpq
  96. - expat-1.95.8 (/usr/ports/textproc/expat2) for libexpat
  97. - libxml2-2.6.18 (/usr/ports/textproc/libxml2) for libxml2
  98. - radiusclient-0.4.7 (/usr/ports/net/radiusclient) for libradiusclient-ng
  99. - sqlite3-3.35.5 (/usr/ports/databases/sqlite3) for libsqlite3
  100. NOTE: you'll need to add radiusclient_ng=4 to the gmake command line if you
  101. use the 0.4.* version.
  102. Compile example (all the modules and SIP server core in a tar.gz):
  103. gmake bin radiusclient_ng=4 include_modules="mysql jabber cpl-c auth_radius group_radius uri_radius postgres pa"
  104. OpenBSD 3.7
  105. -----------
  106. - mysql-client-4.0.23 (/usr/ports/databases/mysql) for libmysqlclient
  107. - expat-1.95.6 (/usr/ports/textproc/expat) for libexpat
  108. - libxml-2.6.16p0 (/usr/ports/textproc/libxml) for libxml2
  109. - radiusclient-ng-0.5.1 from
  110. http://download.berlios.de/radiusclient-ng/radiusclient-ng-0.5.1.tar.gz
  111. (you need to download and install it, since there is no "official"
  112. openbsd port for it) for libradiusclient-ng
  113. - sqlite3-3.35.5 (/usr/ports/databases/sqlite3) for libsqlite3
  114. Compile example (all the modules and SIP server core in a tar.gz):
  115. gmake bin include_modules="mysql jabber cpl-c auth_radius group_radius uri_radius pa"
  116. NetBSD 2.0
  117. ----------
  118. - mysql-client-4.1.12 (/usr/pkgsrc/databases/mysql4-client) for libmysqlclient
  119. - expat-1.95.8nb2 (/usr/pkgsrc/textproc/expat) for libexpat
  120. - libxml2-2.6.19 (/usr/pkgsrc/textproc/libxml2) for libxml2
  121. - radiusclient-ng-0.5.1 (see OpenBSD)
  122. - sqlite3-3.36.0 (/usr/pkgsrc/databases/sqlite3) for libsqlite
  123. Compile example (all the modules and SIP server in a tar.gz):
  124. gmake bin include_modules="mysql jabber cpl-c auth_radius group_radius uri_radius pa"
  125. Solaris 10
  126. ----------
  127. As above; you can use Solaris' yacc instead of bison. You might also
  128. need gtar and ginstall. If you don't have ginstall you can use Solaris
  129. install, just make sure it's in the PATH (it's usually in /usr/sbin) and
  130. add INSTALL=install either to the environment or to the make command line
  131. (e.g.: gmake INSTALL=install all).
  132. Compile example (all the modules and SIP server in a tar.gz):
  133. gmake bin INSTALL=install include_modules="mysql jabber cpl-c auth_radius group_radius uri_radius postgres pa"
  134. Linux
  135. -----
  136. Kamailio is part of the official Debian distribution. You can download binary modules
  137. directly using normal packet management.
  138. Needed packages for compiling all the modules:
  139. * Debian:
  140. - libmysqlclient-dev for libmysqlclient
  141. - libpq-dev for libpq
  142. - libexpat1-dev for libexpat
  143. - libxml2-dev for libxml2
  144. - libradiusclient-ng-dev for libradiusclient
  145. - libsqlite3-dev for libsqlite
  146. - other libraries are needed for some other modules,
  147. see README of the module you want to use
  148. Kamailio have APT deb repositories that allow you to
  149. install the binaries easily - see the web site for more details:
  150. - https://kamailio.org
  151. Cygwin (alpha state, partial support)
  152. --------------------------------------
  153. make sure make, bison, flex, minires and minires-devel (needed for the
  154. resolver functions) are installed.
  155. Only building Kamailio's core and some static modules is supported for now.
  156. Stuff known not to work:
  157. - IPv6 (cygwin doesn't support it yet)
  158. - TCP (the tcp code heavily depends on file descriptor passing
  159. between processes, which is not yet supported by cygwin)
  160. - dynamic modules (non statically linked -- not supported because
  161. backlinking doesn't work in windows by design)
  162. Compile example (all the modules and Kamailio in a tar.gz):
  163. make bin include_modules="mysql jabber cpl-c auth_radius group_radius uri_radius postgres pa"
  164. 2. Howto Build Kamailio From Source Code Distribution
  165. -------------------------------------------------------
  166. (NOTE: if make doesn't work try gmake instead)
  167. 2.1 Kamailio Fast Track Installation
  168. ....................................
  169. If you are familiar with Unix/Linux build tools aready and you installed
  170. the required dependencies, then you can just follow this section, otherwise
  171. skip over it.
  172. To get Kamailio installed, in the folder with source code run:
  173. make cfg
  174. make all
  175. make install
  176. If you want to install with additional modules, for example with mysql and
  177. tls, run:
  178. make include_modules="db_mysql tls" cfg
  179. make all
  180. make install
  181. 2.2 Details - Installing From Source Code
  182. .........................................
  183. Build Commands
  184. Kamailio is split in four main parts: The core, the modules, the
  185. utilities, and the various scripts/examples. When you build, you can decide to build
  186. only the core, the modules, both, or all.
  187. * Compile Kamailio core only:
  188. make
  189. Compile modules except some explicitly excepted (see below)
  190. make modules - all modules in the modules/ directory
  191. make modules-all or make every-module - all the modules
  192. * Compile all:
  193. make all
  194. * Explicitly excepted modules:
  195. By default make all will not build modules that require external libraries or
  196. that are considered to be "experimental". For example, modules that have external
  197. dependencies are: db_mysql, jabber, cpl-c, auth_radius, group_radius, uri_radius,
  198. avp_radius, db_postgres, db_berkeley, carrierroute, ...
  199. Including groups of modules:
  200. Instead of compiling the default modules only, you can specify groups of
  201. modules to include, according to their status:
  202. - standard - Modules in this group are considered a standard part of Kamailio
  203. (due to widespread usage) but they have no dependencies (note that some of
  204. these interplay with external systems. However, they don't have compile
  205. or link dependencies).
  206. - db - Modules in this group use databases and need a database driver to run.
  207. Included are drivers for the text mode db (dbtext) and for dumping
  208. large amount of data to files (db_flatstore). See also the mysql,
  209. postgres, or sqlite groups.
  210. - standard_dep - Modules in this group are considered a standard part of Kamailio
  211. (due to widespread usage) but they have dependencies that must be satisfied
  212. for compilation.
  213. NOTE! All presence modules (dialog, pa, presence_b2b, rls, xcap) have been
  214. included in this group due to interdependencies
  215. - stable - Modules in this group satisfy specific or niche applications,
  216. and are considered stable for production use. They may or may not have dependencies
  217. - experimental - Modules in this group are either not complete, untested, or
  218. without enough reports of usage to allow the module into the stable group.
  219. They may or may not have dependencies.
  220. There is another set of groups mainly used by Kamailio, where modules
  221. are grouped based on Debian packaging rules. For example:
  222. - kstandard - Kamailio standard modules
  223. - kpresence - Kamailio SIMPLE presence server modules
  224. * To compile core with standard modules:
  225. make group_include="standard" all
  226. * To compile all modules (provided you have all the required libraries installed) use:
  227. make group_include="standard standard-dep stable experimental" all
  228. There are also in addition some "convenience" groups:
  229. mysql - Include all the db modules dependent and the MySQL db driver
  230. postgres - Include all the db modules and the PostgreSQL db driver
  231. sqlite - Include all the db modules and the SQLite db driver
  232. radius - Include all modules on radiusclient
  233. presence - Include all the presence modules
  234. Ex. to make a standard installation with MySQL, use:
  235. make group_include="standard mysql" all
  236. In addition to group_include (or instead), you can use
  237. include_modules="modA modB"
  238. to specify exactly the modules you want to include, ex.
  239. make include_modules="mymodule" modules
  240. You can also explicitly skip modules using skip_modules. Let's say you want all
  241. the standard and standard-dep modules except domain:
  242. make group_include="standard standard-dep" skip_modules="domain" all
  243. NOTE!!! As this mechanism is very powerful, you may be uncertain which
  244. modules that will be included. Just replace all (or modules) with print-modules
  245. and you will see which modules will be included and excluded, ex:
  246. make print-modules
  247. will show which modules are excluded by default.
  248. If you want to install or to build a binary package (a tar.gz with
  249. Kamailio core and the modules), substitute "all" in the above command with
  250. "install" or "bin".
  251. * More compile examples:
  252. - compile with profiling
  253. make PROFILE=-pg all
  254. - compile debug mode version
  255. make mode=debug all
  256. - compile debug version with profiling
  257. make mode=debug PROFILE=-pg all
  258. - compile only the print module
  259. make modules=modules/print modules
  260. - compile by default only the print module, in debugging mode and with
  261. profiling:
  262. make cfg modules=modules/print mode=debug PROFILE=-pg
  263. make all
  264. - change & save the modules list without rebuilding the whole config
  265. (so that already compiled modules won't be re-compiled by
  266. make all/make modules):
  267. make modules-cfg include_modules="mysql postgress"
  268. - change only the compile/build options, without changing the modules list:
  269. make cfg-defs CPU=ultrasparc PROFILE=-pg
  270. - compile by default all the usual modules + mysql and postgres, optimized
  271. for pentium-m and for space (saves both the build options and the module
  272. list)
  273. make cfg include_modules="mysql postgres" CPU=pentium-m CC_EXTRA_OPTS=-Os
  274. make all
  275. - compile all the "default" modules except textops and vm
  276. make skip_modules="textops vm" modules
  277. - save the above option in the make config, so that all make commands
  278. will use it by default:
  279. make cfg skip_modules="textops vm"
  280. - compile all default modules and include uri_radius (not compiled by default):
  281. make include_modules="uri_radius" modules
  282. - compile all the modules from the modules subdirectory (even the one excluded
  283. by default):
  284. make exclude_modules="" modules
  285. - compile all the modules from the modules subdirectory excluding vm:
  286. make exclude_modules=vm modules
  287. or
  288. make exclude_modules="" skip_modules=vm modules
  289. - compile with the "tm" module statically linked and with profiling
  290. make static_modules=tm PROFILE=-pg all
  291. - compile with gcc-3.2 instead of gcc
  292. make CC=gcc-3.2 all
  293. or
  294. CC=gcc-3.2 make all
  295. Make targets:
  296. =============
  297. Make Local Build Config:
  298. ------------------------
  299. * make cfg or make config - force config and module list regeneration
  300. Example:
  301. make cfg include_modules=mysql mode=debug
  302. All future make invocations will include the mysql module and will build in debug mode
  303. Note: If config.mak doesn't exist (e.g. initial checkout or after a make
  304. proper) or if Makefile.defs was changed, the config will be re-generated
  305. automatically by the first make command. For example:
  306. make cfg include_modules=db_mysql; make all
  307. is equivalent to
  308. rm config.mak modules.lst; make include_modules=db_mysql.
  309. * make cfg-defs (force config regeneration, but don't touch the module list)
  310. Example:
  311. make cfg-defs CPU=ultrasparc CC_EXTRA_OPTS=-Os PROFILE=-pg
  312. make modules-cfg
  313. or
  314. make modules-list
  315. saves the module list, without regenerating the build config
  316. Example:
  317. make modules-list include_modules="tls" skip_modules="print"
  318. Clean:
  319. ------
  320. * make clean - clean the base and modules too
  321. * make proper - clean also the dependencies and the config, but not the module list
  322. * make distclean - the same as proper
  323. * make maintainer-clean - clean everything, including make's config, saved
  324. module list, auto generated files, tags, *.dbg a.s.o
  325. * make clean-all - clean all the modules in modules/*
  326. * make proper-all - like make proper but for all the modules in modules/*
  327. Config clean:
  328. * make clean-cfg - cleans the compile config
  329. * make clean-modules-cfg - cleans the modules list
  330. Reduced clean:
  331. * make local-clean - cleans only the core, no libs, utils or modules
  332. * make clean-modules - like make clean, but cleans only the modules
  333. * make clean-libs - like make clean, but cleans only the libs
  334. * make clean-utils - like make clean, but cleans only the utils
  335. Compile:
  336. --------
  337. * make proper
  338. optional: make cfg <various cfg. options that should be saved>
  339. * make proper-modules - like make proper, but only for modules
  340. * make proper-libs - like make proper, but only for libs
  341. * make proper-utils - like make proper, but only for utils
  342. * make
  343. or gmake on non-Linux systems
  344. * make modules
  345. or make modules exclude_modules="acc_json print" etc.
  346. Other Make Targets:
  347. -------------------
  348. Make tags:
  349. make TAGS
  350. Create a tar.gz with the sources (in ../):
  351. make tar
  352. Create a tar.gz with the binary distribution (in ../):
  353. make bin
  354. Create a gzipped solaris package (in ../):
  355. make sunpkg
  356. Create debian packages (in ../):
  357. make deb
  358. or
  359. dpkg-buildpackage
  360. Documentation:
  361. --------------
  362. Regenerate the README for all the "default" modules (include_modules,
  363. skip_modules a.s.o can be used to alter the module list).
  364. make README
  365. Generates a manpage for all the modules that support it (.xml file in the
  366. module directory).
  367. make man
  368. Generates README file for modules/foo.
  369. make modules=modules/foo modules-readme
  370. Install:
  371. --------
  372. make prefix=/usr/local install
  373. Note: If you use prefix parameter in make install then you also need
  374. to use this parameter in previous make commands, i.e. make, make modules,
  375. or make all. If you fail to do this then Kamailio will look for the default
  376. configuration file in a wrong directory, because the directory of the
  377. default configuration file is hardcoded into Kamailio during compile time.
  378. When you use a different prefix parameter when installing then the
  379. directory hard coded in Kamailio and the directory in which the file will be
  380. installed by make install will not match. (You can specify exact location
  381. of the configuration file using -f parameter of Kamailio).
  382. For example, if you do the following:
  383. make all
  384. make prefix=/ install
  385. Then the installation will put the default configuration file into
  386. /etc/kamailio/kamailio.cfg (because prefix is /),
  387. but Kamailio will look for the file in /usr/local/etc/kamailio/kamailio.cfg
  388. (because there was no prefix parameter make all and /usr/local is the default value of prefix).
  389. The workaround is trivial, use the same parameters in all make commands:
  390. make prefix=/ all
  391. make prefix=/ install
  392. or save the desired prefix in the make config (e.g.: make cfg prefix=/).
  393. That applies to other make parameters as well (for example parameters
  394. "modules" or "excluded_modules").
  395. 3. Quick-Start Installation Guide
  396. ---------------------------------
  397. A) Getting Help
  398. This guide gives you instructions on how to set up the Kamailio
  399. on your box quickly. In case the default configuration does not fly, please
  400. check the documentation at the Kamailio web site
  401. https://www.kamailio.org to learn how to configure Kamailio for your site.
  402. If the documentation does not resolve your problem you may try contacting
  403. our user forum by E-mail at [email protected] -- that is the
  404. mailing list of the Kamailio community. To participate in the mailing list,
  405. please subscribe at the following web address:
  406. https://lists.kamailio.org/
  407. B) Disclaimers
  408. Note well the default "quick-start" configuration is very simple in order
  409. to be easily installable. It provides minimum features. Particularly,
  410. authentication is by default disabled, which means anyone can register using
  411. any name with the server. (This is on purpose to avoid installation
  412. dependencies on a database, which is needed for storing user credentials.)
  413. C) Quick Start
  414. The following step-by step guide gives you instructions how to install the
  415. SQL-free distribution of Kamailio. If you need persistence and
  416. authentication, then you have to install additional database support --
  417. proceed to section D) after you are finished with C).
  418. 1) Download an RPM or Debian package from the links on the wiki
  419. https://www.kamailio.org/wikidocs/
  420. If you don't use an rpm or debian based distribution, try our tar.gz'ed
  421. binaries
  422. https://www.kamailio.org/pub/kamailio/latest/src/
  423. If you use Solaris 8 you can try our solaris package.
  424. If you use Gentoo Linux you do not have to download a package.
  425. 2) Install the package
  426. RPM:
  427. rpm -i <package_name>
  428. debian:
  429. dpkg -i <package_name>
  430. Solaris:
  431. gunzip <package_name>.gz ; pkgadd -d <package_name>
  432. *BSD:
  433. pkg_add package_name
  434. 3) Start the server
  435. RPM:
  436. /etc/init.d/kamailio start
  437. debian:
  438. Kamailio is started automatically after the install
  439. (in case something fails you can start it with '/etc/init.d/kamailio start')
  440. tar.gz:
  441. Solaris:
  442. the tar.gz does not include an init.d script, you'll have to create one of
  443. your own or adapt one from the source distribution (pkg/debian/init.d,
  444. pkg/kamailio/rpm/kamailio.init, pkg/kamailio/deb/debian/kamailio.init, a.s.o.)
  445. You can start Kamailio directly with
  446. /usr/local/sbin/kamailio.
  447. 4) Optionally, watch server's health using the kamctl utility
  448. - to do so, first set the environment variable SIP_DOMAIN to your domain
  449. name, e.g., in Bourne shell, call
  450. export SIP_DOMAIN="myserver.foobar.com"
  451. - if you are using other than 'localhost' mysql server for maintaining
  452. subscriber database, change the variable 'SQL_HOST' to the proper
  453. host name in the kamctl script
  454. - run the kamctl utility
  455. /usr/sbin/kamctl moni
  456. or
  457. /usr/local/sbin/kamctl moni (if you installed Kamailio from a
  458. tar.gz or solaris package)
  459. 5) Connect SIP phones
  460. Register with the server using your favorite SIP User Agent (phone).
  461. In most cases, you need to set the following options:
  462. Proxy server: host name of your server
  463. Domain: the sip domain your server is configured to handle
  464. User name: the account name for your device
  465. Auth user: the ID used for authentication
  466. Secret/Password: The configured authentication password
  467. D) Kamailio With Persistent Data Storage
  468. ------------------------------------------
  469. The default configuration is very simple and features many simplifications.
  470. In particular, it does not authenticate users and loses User Location database
  471. on reboot. To provide persistence, keep user credentials and remember users'
  472. locations across reboots, Kamailio can be configured to use a database, like MySQL.
  473. Before you proceed, you need to make sure MySQL is installed on your box. Your
  474. MySQL server must be configured to deal with a large number of
  475. connection. To increase it, set the following line in [mysqld] section
  476. of your my.ini configuration file:
  477. set-variable = max_connections=500
  478. 1) Download the package containing mysql support for Kamailio from the links
  479. you find on:
  480. https://www.kamailio.org/wikidocs/
  481. (rpm and deb provided, most of the binary tar.gz distributions and the
  482. solaris package include it; if it is not present you'll have to rebuild
  483. from the source).
  484. 2) install the package
  485. rpm -i <package_name>
  486. or
  487. dpkg -i <package_name>
  488. or
  489. emerge kamailio
  490. (if do not want to put 'mysql' into your USE variable you can type:
  491. USE="mysql" emerge kamailio)
  492. 3) create MySQL tables for Kamailio
  493. - if you have a previously installed Kamailio on your system, use
  494. /usr/local/sbin/kamdbctl reinstall
  495. to convert your Kamailio database into new structures
  496. - otherwise, if this is your very first installation, use
  497. /usr/local/sbin/kamdbctl create
  498. to create Kamailio database structures
  499. (you will be prompted for password of MySql "root" user)
  500. 4) configure Kamailio to use SQL
  501. uncomment all lines in configuration file kamailio.cfg which are related to authentication:
  502. - loadmodule "db_mysql.so"
  503. - loadmodule "auth.so"
  504. - loadmodule "auth_db.so"
  505. - modparam("usrloc", "db_mode", 2)
  506. - modparam("auth", "calculate_ha1", yes)
  507. - modparam("auth_db", "password_column", "password")
  508. - if (!www_authorize("example.com", "subscriber")) {
  509. www_challenge("example.com", "0");
  510. break;
  511. }
  512. 5) be sure to replace realm, the first parameter in www_* actions,
  513. with name of your server; some broken UAC implementations don't
  514. authenticate otherwise; the authentication command in your
  515. configuration script should look then like this:
  516. if (!www_authorize("myserver.foobar.com", "subscriber")) {
  517. www_challenge("myserver.foobar.com", "0");
  518. break;
  519. }
  520. 6) restart the server
  521. /etc/init.d/kamailio restart
  522. 7) you can now start managing the server using the kamctl utility;
  523. you need to first set the environment variable SIP_DOMAIN to your
  524. local SIP realm, e.g.,
  525. export SIP_DOMAIN="myserver.example.com"
  526. a) watch the server status using 'kamctl moni'
  527. b) try to login with your SIP client as user 'admin' with password 'heslo'
  528. c) try adding new users using
  529. 'kamctl add <username> <password>'
  530. 4. Troubleshooting
  531. ------------------
  532. Q: SIP requests are replied by Kamailio with "483 Too Many Hops" or
  533. "513 Message Too Large"
  534. A: In both cases, the reason is probably an error in request routing script
  535. which caused an infinite loop. You can easily verify whether this happens
  536. by watching SIP traffic on loopback interface. A typical reason for
  537. misrouting is a failure to match local domain correctly. If a server
  538. fails to recognize a request for itself, it will try to forward it to
  539. current URI in believe it would forward them to a foreign
  540. domain. Alas, it forwards the request to itself again. This continues
  541. to happen until value of max_forwards header field reaches zero or
  542. the request grows too big. Solutions is easy: make sure that domain
  543. matching is correctly configured. A quick way to achieve that is to
  544. introduce a config option to ser.cfg or kamailio.cfg: alias=domainname,
  545. where domainname shall be replaced with name of domain, which you wish to
  546. server and which appears in request-URIs.
  547. Q: Where to report issues?
  548. A: Use bug tracker at: https://github.com/kamailio/kamailio/issues
  549. Q: Any F.A.Q. that could be helpful to check before reporting an issue?
  550. A: See: https://www.kamailio.org/wikidocs/tutorials/faq/main