{"id":400,"date":"2011-03-24T13:26:14","date_gmt":"2011-03-24T12:26:14","guid":{"rendered":""},"modified":"2018-11-01T10:27:37","modified_gmt":"2018-11-01T09:27:37","slug":"opensips-installation-debian","status":"publish","type":"post","link":"https:\/\/nil.uniza.sk\/en\/opensips-installation-debian\/","title":{"rendered":"OpenSIPs installation on Debian"},"content":{"rendered":"<p>Installation of openSIPs on Debian(sqeeze) &#8211; 32bit:<\/p>\n<p>Edit sources.list to use new repository:&nbsp;<\/p>\n<pre><p>&nbsp;&nbsp;&nbsp; joe \/etc\/apt\/sources.list<br \/>&nbsp;&nbsp;&nbsp; deb http:\/\/www.opensips.org\/apt\/ lenny main<\/p><p>#Following 2 lines are not needed in lenny:<br \/>&nbsp;&nbsp;&nbsp; deb http:\/\/ftp.sk.debian.org\/debian\/ lenny main &nbsp; <br \/>&nbsp;&nbsp;&nbsp; deb-src http:\/\/ftp.sk.debian.org\/debian\/ lenny main<\/p><\/pre>\n<p>Update:&nbsp;&nbsp;&nbsp;<\/p>\n<pre>\r\n    apt-get update\r\n&nbsp;&nbsp;&nbsp; apt-get upgrade<\/pre>\n<p>Download:<\/p>\n<pre>\r\n    apt-get install gcc bison flex make openssl libmysqlclient-dev \r\n        libradiusclient-ng2 libradiusclient-ng-dev mysql-server libxmlrpc-c3-dev<\/pre>\n<p>Install openSIPs and modules:<\/p>\n<pre>\r\n    apt-get install opensips opensips-mysql-module opensips-postgres-module opensips-unixodbc-module \r\n                    opensips-jabber-module opensips-cpl-module opensips-radius-modules opensips-presence-modules \r\n                    opensips-xmlrpc-module opensips-perl-modules opensips-snmpstats-module opensips-xmpp-module \r\n                    opensips-carrierroute-module opensips-berkeley-module opensips-ldap-modules opensips-geoip-module \r\n                    opensips-regex-module opensips-identity-module opensips-b2bua-module opensips-dbhttp-module opensips-console\r\n<\/pre>\n<p><span id=\"1300968655011S\">&nbsp;<\/span><\/p>\n<p>Now do changes in following files:<\/p>\n<pre>\r\n&nbsp;&nbsp;&nbsp;&nbsp; joe \/etc\/opensips\/opensips.cfg\r\n &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; alias=a.local&nbsp; #{&quot;your domain&quot;}\r\n\r\n&nbsp;&nbsp;&nbsp;&nbsp; joe \/etc\/opensips\/opensipsctlrc\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #uncomment and set domain\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SIP_DOMAIN=a.local \r\n<\/pre>\n<p>Run OpenSIPs:<\/p>\n<pre>\r\n     joe \/etc\/default\/opensips\r\n        RUN_OPENSIPS=yes<\/pre>\n<p>&nbsp;<\/p>\n<p>Now you can make call with any user because the authentication is not working yet.<br \/>\n&nbsp;<\/p>\n<p>Let&#8217;s set up authentication with mysql:<\/p>\n<p>Uncomment following lines:<\/p>\n<pre><p>&nbsp;&nbsp;&nbsp;joe \/etc\/opensips\/opensipsctlrc<br \/>  &nbsp; &nbsp;&nbsp;&nbsp; SIP_DOMAIN=a.local #your domain<br \/>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; DBENGINE=MYSQL<br \/>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; DBHOST=localhost<br \/>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; DBNAME=opensips<br \/>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; DBRWUSER=opensips<br \/>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; DBRWPW=&quot;opensipsrw&quot;<br \/>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; DBROUSER=opensipsro<br \/>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; DBROPW=opensipsro<br \/>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; DBROOTUSER=&quot;root&quot;<br \/>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; USERCOL=&quot;username&quot;<br \/>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; INSTALL_EXTRA_TABLES=ask<br \/>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; INSTALL_PRESENCE_TABLES=ask<br \/> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; CTLENGINE=&quot;FIFO&quot;<br \/>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; OSIPS_FIFO=&quot;\/tmp\/opensips_fifo&quot;<br \/>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; PID_FILE=\/var\/run\/opensips\/opensips.pid&nbsp;<\/p><\/pre>\n<p>Create databese:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<\/p>\n<pre>\r\n    opensipsdbctl create<\/pre>\n<p>Now you need to set openSIPs server to use mysql database to authenticate users:<br \/>\nIn file: &nbsp;&nbsp;&nbsp;<\/p>\n<pre>\r\n    joe \/etc\/opensips\/opensips.cfg<\/pre>\n<p>change (COMMENT\/UNCOMMENT) this lines:&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;<\/p>\n<pre>\r\n        loadmodule &quot;db_mysql.so&quot;\r\n&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; loadmodule &quot;auth.so&quot;\r\n&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; loadmodule &quot;auth_db.so&quot;\r\n&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; !!! COMMENT #modparam(&quot;usrloc&quot;, &quot;db_mode&quot;,&nbsp;&nbsp; 0)\r\n&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; modparam(&quot;usrloc&quot;, &quot;db_mode&quot;,&nbsp;&nbsp; 2)\r\n&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; modparam(&quot;usrloc&quot;, &quot;db_url&quot;,&quot;mysql:\/\/opensips:opensipsrw@localhost\/opensips&quot;)\r\n&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; modparam(&quot;auth_db&quot;, &quot;calculate_ha1&quot;, yes)\r\n&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; modparam(&quot;auth_db&quot;, &quot;password_column&quot;, &quot;password&quot;)\r\n&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; modparam(&quot;auth_db&quot;, &quot;db_url&quot;,&quot;mysql:\/\/opensips:opensipsrw@localhost\/opensips&quot;)<\/pre>\n<p>and the same file down in routing logic UNCOMMENT:&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;<\/p>\n<pre>\r\n    if (is_method(&quot;REGISTER&quot;))\r\n&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # authenticate the REGISTER requests (uncomment to enable auth)\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;if (!www_authorize(&quot;IP_ADDRESS&quot;, &quot;subscriber&quot;))\r\n&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; www_challenge(&quot;IP_ADDRESS&quot;, &quot;0&quot;);\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; exit;\r\n&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<\/pre>\n<p>where IP_ADDRESS part is the IP adrress of your openSIPs server.<\/p>\n<p>&nbsp;<\/p>\n<p>To make call two users are needed. You will add them with command:&nbsp;&nbsp;&nbsp;<\/p>\n<pre>\r\n    opensipsctl add &quot;login&quot; &quot;password&quot;\r\n&nbsp;&nbsp;&nbsp; #Example: opensipsctl add miso miso<\/pre>\n<p>Now restart openSIPs server:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/p>\n<pre>\r\n    opensipsctl restart<\/pre>\n<p>The authentication is now enabled.<\/p>\n<p>The next service we can install on OpenSIPs server is PRESENCE. There are two options how to configure presence: with or without XCAP server.<\/p>\n<p>Presence <strong>without<\/strong> XCAP server:<\/p>\n<p>&nbsp;<\/p>\n<p>Uncomment following lines in config file \/etc\/opensips\/opensips.cfg<\/p>\n<pre>\r\n&nbsp;&nbsp;&nbsp; loadmodule &quot;presence.so&quot;\r\n&nbsp;&nbsp;&nbsp; loadmodule &quot;presence_xml.so&quot;\r\n\r\n    modparam(&quot;presence|presence_xml&quot;, &quot;db_url&quot;,&quot;mysql:\/\/opensips:opensipsrw@localhost\/opensips&quot;)\r\n    modparam(&quot;presence_xml&quot;, &quot;force_active&quot;, 1)\r\n<\/pre>\n<p>&nbsp;And again it&#8217;s necessary to set the address and port your OpenSIPs server is listening on (example: 158.193.139.80) in \/etc\/opensips\/opensips.cfg<\/p>\n<pre>\r\n    modparam(&quot;presence&quot;, &quot;server_address&quot;, &quot;sip:158.193.139.80:5060&quot;)\r\n<\/pre>\n<p>Finally some changes are needed in routing logic in \/etc\/opensips\/opensips.cfg<\/p>\n<p>Uncomment:<\/p>\n<pre>\r\n&nbsp;&nbsp;&nbsp; if( is_method(&quot;PUBLISH|SUBSCRIBE&quot;))\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; route(2);\r\n<\/pre>\n<p>Comment:<\/p>\n<pre>\r\n&nbsp;&nbsp;&nbsp; #if (is_method(&quot;PUBLISH&quot;))\r\n&nbsp;&nbsp;&nbsp; #{\r\n&nbsp;&nbsp;&nbsp; #&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sl_send_reply(&quot;503&quot;, &quot;Service Unavailable&quot;);\r\n&nbsp;&nbsp;&nbsp; #&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; exit;\r\n&nbsp;&nbsp;&nbsp; #}\r\n<\/pre>\n<p>and uncomment route(2):<\/p>\n<pre>\r\n    route[2] \r\n    { \r\n        if (!t_newtran()) { \r\n              sl_reply_error(); \r\n              exit; \r\n        };\r\n        if(is_method(&quot;PUBLISH&quot;))\r\n        {\r\n                handle_publish();\r\n        }\r\n        else\r\n        if( is_method(&quot;SUBSCRIBE&quot;))\r\n        {\r\n                handle_subscribe();\r\n        }\r\n\r\n        exit;\r\n    }\r\n<\/pre>\n<p>The presence service is now working. The client should be set to <strong>presence-agent mode<\/strong>.<\/p>\n<p>&nbsp;<\/p>\n<p>NOW: TESTING&nbsp;PRESENCE&nbsp;WITH&nbsp;XCAP SERVER<\/p>","protected":false},"excerpt":{"rendered":"<p>Installation of openSIPs on Debian(sqeeze) &#8211; 32bit:<\/p>\n<p>Edit sources.list to use new repository:&nbsp;<\/p>\n<pre><p>&nbsp;&nbsp;&nbsp; joe \/etc\/apt\/sources.list<br \/>&nbsp;&nbsp;&nbsp; deb http:\/\/www.opensips.org\/apt\/ lenny main<\/p><p>#Following 2 lines are not needed in lenny:<br \/>&nbsp;&nbsp;&nbsp; deb http:\/\/ftp.sk.debian.org\/debian\/ lenny main &nbsp; <br \/>&nbsp;&nbsp;&nbsp; deb-src http:\/\/ftp.sk.debian.org\/debian\/ lenny main<\/p><\/pre>\n<p>Update:&nbsp;&nbsp;&nbsp;<\/p>\n<pre>\r\n    apt-get update\r\n&nbsp;&nbsp;&nbsp; apt-get upgrade<\/pre>\n<p>Download:<\/p>","protected":false},"author":434,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_seopress_robots_primary_cat":"","_seopress_titles_title":"","_seopress_titles_desc":"","_seopress_robots_index":"","_kad_blocks_custom_css":"","_kad_blocks_head_custom_js":"","_kad_blocks_body_custom_js":"","_kad_blocks_footer_custom_js":"","_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"footnotes":""},"categories":[787],"tags":[],"class_list":["post-400","post","type-post","status-publish","format-standard","hentry","category-opensips-en"],"taxonomy_info":{"category":[{"value":787,"label":"OpenSIPS"}]},"featured_image_src_large":false,"author_info":{"display_name":"","author_link":"https:\/\/nil.uniza.sk\/en\/author\/"},"comment_info":6,"category_info":[{"term_id":787,"name":"OpenSIPS","slug":"opensips-en","term_group":0,"term_taxonomy_id":785,"taxonomy":"category","description":"","parent":771,"count":2,"filter":"raw","cat_ID":787,"category_count":2,"category_description":"","cat_name":"OpenSIPS","category_nicename":"opensips-en","category_parent":771}],"tag_info":false,"_links":{"self":[{"href":"https:\/\/nil.uniza.sk\/en\/wp-json\/wp\/v2\/posts\/400","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nil.uniza.sk\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nil.uniza.sk\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nil.uniza.sk\/en\/wp-json\/wp\/v2\/users\/434"}],"replies":[{"embeddable":true,"href":"https:\/\/nil.uniza.sk\/en\/wp-json\/wp\/v2\/comments?post=400"}],"version-history":[{"count":0,"href":"https:\/\/nil.uniza.sk\/en\/wp-json\/wp\/v2\/posts\/400\/revisions"}],"wp:attachment":[{"href":"https:\/\/nil.uniza.sk\/en\/wp-json\/wp\/v2\/media?parent=400"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nil.uniza.sk\/en\/wp-json\/wp\/v2\/categories?post=400"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nil.uniza.sk\/en\/wp-json\/wp\/v2\/tags?post=400"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}