1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 |
# Install And Maintain Kamailio v4.0.x Version From GIT # Prerequisites gcc compiler: apt-get install gcc flex - apt-get install flex bison - apt-get install bison libmysqlclient-dev - apt-get install libmysqlclient-dev make - apt-get install make if you want to enable more modules, some of them require extra libraries: libssl - apt-get install libssl-dev libcurl - apt-get install libcurl4-openssl-dev libxml2 - apt-get install libxml2-dev libpcre3 - apt-get install libpcre3-dev #Getting sources from GIT mkdir -p /usr/local/src/kamailio-4.0 cd /usr/local/src/kamailio-4.0 git clone --depth 1 --no-single-branch git://git.sip-router.org/sip-router kamailio cd kamailio git checkout -b 4.0 origin/4.0 # Make make cfg nano -w modules.lst # Add db_mysql to the variable include_modules. include_modules= db_mysql Save the modules.lst and exit. make include_modules="db_mysql" cfg make PREFIX="/usr/local/kamailio-4.0" include_modules="db_mysql" cfg If you set this PREFIX you have to change most of the paths below from '/usr/local/…' to '/usr/local/kamailio-4.0/…'. # ! >>>> http://sip-router.org/wiki/tutorials/makefile-system # Compile Kamailio make all make Q=0 all # Install Kamailio make install # What and where was installed /usr/local/sbin These are: # kamailio - Kamailio SIP server # kamdbctl - script to create and manage the Databases # kamctl - script to manage and control Kamailio SIP server # sercmd - CLI - command line tool to interface with Kamailio SIP server To be able to use the binaries from command line, make sure that '/usr/local/sbin' is set in PATH environment variable. You can check that with 'echo $PATH'. If not and you are using 'bash', open '/root/.bash_profile' and at the end add: PATH=$PATH:/usr/local/sbin export PATH Kamailio (OpenSER) modules are installed in: 32-Bit /usr/local/lib/kamailio/modules/ /usr/local/lib/kamailio/modules_k/ 64-Bit /usr/local/lib64/kamailio/modules/ /usr/local/lib64/kamailio/modules_k/ # Replace …/lib/… with ../lib64/… in most of 64b architectures. # The documentation and readme files are installed in: # /usr/local/share/doc/kamailio/ # The man pages are installed in: /usr/local/share/man/man5/ /usr/local/share/man/man8/ The configuration file was installed in: /usr/local/etc/kamailio/kamailio.cfg In case you set the PREFIX variable in 'make cfg …' command, then replace /usr/local in all paths above with the value of PREFIX in order to locate the files installed. # Create MySQL database nano -w /usr/local/etc/kamailio/kamctlrc Locate DBENGINE variable and set it to MYSQL: DBENGINE=MYSQL /usr/local/sbin/kamdbctl create # - kamailio - (with default password 'kamailiorw') - user which has full access rights to 'kamailio' database - kamailioro - (with default password 'kamailioro') - user which has read-only access rights to 'kamailio' database #To fit your requirements for the VoIP platform, you have to edit the configuration file. /usr/local/etc/kamailio/kamailio.cfg Follow the instruction in the comments to enable usage of MySQL. Basically you have to add several lines at the top of config file, like: #!define WITH_MYSQL #!define WITH_AUTH #!define WITH_USRLOCDB If you changed the password for the 'kamailio' user of MySQL, you have to update the value for 'db_url' parameters. You can browse kamailio.cfg online on GIT repository. # The init.d script The init.d script can be used to start/stop the Kamailio server in a nicer way. A sample of init.d script for Kamailio is provided at: /usr/local/src/kamailio-4.0/kamailio/pkg/kamailio/deb/debian/kamailio.init Just copy the init file into the /etc/init.d/kamailio. Then change the permissions: chmod 755 /etc/init.d/kamailio then edit the file updating the $DAEMON and $CFGFILE values: DAEMON=/usr/local/sbin/kamailio CFGFILE=/usr/local/etc/kamailio/kamailio.cfg You need also setup a configuration file in the /etc/default/ directory. This file can be found at: /usr/local/src/kamailio-4.0/kamailio/pkg/kamailio/debian/kamailio.default You need to rename the file to 'kamailio' after you've copied it. Then edit this file and set RUN_KAMAILIO=yes. Edit the other options at your convenience. Create the directory for pid file: mkdir -p /var/run/kamailio Default setting is to run Kamailio as user “kamailio” and group “kamailio”. For that you need to create the user: adduser --quiet --system --group --disabled-password \ --shell /bin/false --gecos "Kamailio" \ --home /var/run/kamailio kamailio # set ownership to /var/run/kamailio chown kamailio:kamailio /var/run/kamailio Then you can start/stop Kamailio using the following commands: /etc/init.d/kamailio start /etc/init.d/kamailio stop # Ready to rock Now everything is in place. You can start the VoIP service, creating new accounts and setting the phones. A new account can be added using 'kamctl' tool via 'kamctl add <username> <password> <email>'. (or try without the email) kamctl add test testpasswd test@mysipserver.com If you are asked for SIP_DOMAIN environment variable do one of the following option. # export SIP_DOMAIN=mysipserver.com # edit '/root/.kamctlrc' and add: # SIP_DOMAIN=mysipserver.com # Maintenance The maintenance process is very simple right now. You have to be user 'root' and execute following commands: cd /usr/local/src/kamailio-4.0/kamailio git pull origin make all make install /etc/init.d/kamailio restart Now you have the latest Kamailio devel running on your system. |