INSTALL 26 KB

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