[OpenSIPS-Users] Problem with /tmp/opensips_fifo

Erick Chinchilla Berrocal erick at netcrc.net
Wed Mar 17 17:38:36 CET 2010


Bogdan 
My comments
I made the following changes (step by step)
1- Check the Opensips Status
	- # opensips -h
version: opensips 1.6.1-notls (i386/linux)
	
	-# ps  -ef | grep opensips
netcrc    4776     1  0 Mar16 ?        00:00:00 /sbin/opensips -P
/var/run/opensips/opensips.pid -m 128 -u netcrc -g netcrc
netcrc    4777  4776  0 Mar16 ?        00:00:00 /sbin/opensips -P
/var/run/opensips/opensips.pid -m 128 -u netcrc -g netcrc
netcrc    4778  4776  0 Mar16 ?        00:00:00 /sbin/opensips -P
/var/run/opensips/opensips.pid -m 128 -u netcrc -g netcrc
netcrc    4779  4776  0 Mar16 ?        00:00:00 /sbin/opensips -P
/var/run/opensips/opensips.pid -m 128 -u netcrc -g netcrc
netcrc    4780  4776  0 Mar16 ?        00:00:00 /sbin/opensips -P
/var/run/opensips/opensips.pid -m 128 -u netcrc -g netcrc
netcrc    4781  4776  0 Mar16 ?        00:00:00 /sbin/opensips -P
/var/run/opensips/opensips.pid -m 128 -u netcrc -g netcrc
netcrc    4782  4776  0 Mar16 ?        00:00:00 /sbin/opensips -P
/var/run/opensips/opensips.pid -m 128 -u netcrc -g netcrc
netcrc    4783  4776  0 Mar16 ?        00:00:00 /sbin/opensips -P
/var/run/opensips/opensips.pid -m 128 -u netcrc -g netcrc
netcrc    4784  4776  0 Mar16 ?        00:00:00 /sbin/opensips -P
/var/run/opensips/opensips.pid -m 128 -u netcrc -g netcrc
netcrc    4785  4776  0 Mar16 ?        00:00:01 /sbin/opensips -P
/var/run/opensips/opensips.pid -m 128 -u netcrc -g netcrc
netcrc    4786  4776  0 Mar16 ?        00:00:01 /sbin/opensips -P
/var/run/opensips/opensips.pid -m 128 -u netcrc -g netcrc
netcrc    4787  4776  0 Mar16 ?        00:00:00 /sbin/opensips -P
/var/run/opensips/opensips.pid -m 128 -u netcrc -g netcrc
netcrc    4788  4776  0 Mar16 ?        00:00:00 /sbin/opensips -P
/var/run/opensips/opensips.pid -m 128 -u netcrc -g netcrc
netcrc    4790  4776  0 Mar16 ?        00:00:00 /sbin/opensips -P
/var/run/opensips/opensips.pid -m 128 -u netcrc -g netcrc
netcrc    4793  4776  0 Mar16 ?        00:00:00 /sbin/opensips -P
/var/run/opensips/opensips.pid -m 128 -u netcrc -g netcrc
netcrc    4794  4776  0 Mar16 ?        00:00:00 /sbin/opensips -P
/var/run/opensips/opensips.pid -m 128 -u netcrc -g netcrc
netcrc    4798  4776  0 Mar16 ?        00:00:00 /sbin/opensips -P
/var/run/opensips/opensips.pid -m 128 -u netcrc -g netcrc
netcrc    4800  4776  0 Mar16 ?        00:00:00 /sbin/opensips -P
/var/run/opensips/opensips.pid -m 128 -u netcrc -g netcrc
netcrc    4801  4776  0 Mar16 ?        00:00:00 /sbin/opensips -P
/var/run/opensips/opensips.pid -m 128 -u netcrc -g netcrc
root      5533  5529  0 11:19 pts/0    00:00:00 grep opensips

	- # /etc/init.d/opensips status
Status of opensips: opensips is running.


	-opensipsctl online
database engine 'MYSQL' loaded
Control engine 'FIFO' loaded
1001

	-# opensips -c
Listening on 
             udp: 127.0.0.1 [127.0.0.1]:5060
             udp: 192.168.50.10 [192.168.50.10]:5060
             tcp: 127.0.0.1 [127.0.0.1]:5060
             tcp:192.168.50.20 [192.168.50.10]:5060
Aliases: 
             tcp: net:5060
             tcp: net.dominio.com:5060
             tcp: localhost:5060
             udp: net:5060
             udp: net.dominio.com:5060
             udp: localhost:5060

Mar 17 11:21:33 [5567] NOTICE:core:main: config file ok, exiting...

	- # monit -t
Control file syntax OK

2- Remove the old file
	- /var/www# ls
index.html  opensips-cp  opensips-cp_4.0.tgz
	- rm opensips-cp_4.0.tgz
	- /var/www# ls
index.html  opensips-cp

3- Install (download the Control Panel File)
	- wget
http://sourceforge.net/projects/opensips-cp/files/opensips-cp/4.0/opensips-c
p_4.0.tgz/download (date 21010-03-16)
	2010-03-17 11:28:03 (548 KB/s) - `opensips-cp_4.0.tgz' saved
[356706/356706]	
- /var/www# ls
index.html  opensips-cp  opensips-cp_4.0.tgz
	- tar -xzvf opensips-cp_4.0.tgz
	- chown www-data:www-data opensips-cp -R

3- MDB2
	-/var/www# pear install MDB2
Ignoring installed package pear/MDB2
Nothing to install
	- /var/www# pear install MDB2#mysql
WARNING: channel "pear.php.net" has updated its protocols, use
"channel-update pear.php.net" to update
Skipping package "pear/MDB2", already installed as version 2.4.1
No valid packages found
install failed
	- pear install log
Ignoring installed package pear/log
Nothing to install

4- Configure Apache (This 
	- /etc/apache2/apache2.conf
	-After doing so, include the following line below the last line:
		Alias /cp "/var/www/opensips-cp/web"
	-Also, change the owner of the log file:
		chown www-data:www-data
/var/www/opensips-cp/config/access.log
	
5- Install Tables in MySQL
	- /var/www/opensips-cp/config/tools/admin/add_admin/
		o	mysql -Dopensips -p < ocp_admin_privileges.mysql
		o	mysql -u root -p
		o	mysql> use opensips
		o	INSERT INTO ocp_admin_privileges
(username,password,available_tools,permissions) values
('admin','admin','all','all');
		o	quit
	- /var/www/opensips-cp/config/tools/system/cdrviewer/
		o	mysql -D opensips -p < cdrs.mysql
		o	mysql -D opensips -p < opensips_cdrs_1_6.mysql
6 - Edit the cron_job/generate-cdrs.sh
	-/var/www/opensips-cp/cron_job# vim generate-cdrs_mysql.sh
		#!/bin/sh
		HOSTNAME="localhost"
		USER="root"
		PASS="(root password)"
		DATABASE="opensips"
mysql -h $HOSTNAME -u $USER -p$PASS -e "call opensips_cdrs_1_6(); "
$DATABASE

7- Edit the /etc/crontab file
	-vim /etc/crontab
		SHELL=/bin/sh
	
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

		# m h dom mon dow user  command
		17 *    * * *   root    cd / && run-parts --report
/etc/cron.hourly
		25 6    * * *   root    test -x /usr/sbin/anacron || ( cd /
&& run-parts --report /etc/cron.daily )
		47 6    * * 7   root    test -x /usr/sbin/anacron || ( cd /
&& run-parts --report /etc/cron.weekly )
		52 6    1 * *   root    test -x /usr/sbin/anacron || ( cd /
&& run-parts --report /etc/cron.monthly )
		*/3 *   * * *   root
/var/www/opensips-cp/cron_job/generate-cdrs_mysql.sh
		* *     * * *   root    php
/var/www/opensips-cp/cron_job/get_opensips_stats.php >
		/dev/null
		#

8- smonitor module
	- /var/www/opensips-cp/config/tools/system/smonitor/
		.	mysql -p opensips <tables.mysql

9- Add a cron job that collects data from the OpenSIPS machine
	- /etc/crontab
		* * * * * root php
/var/www/opensips-cp/cron_job/get_opensips_stats.php > /dev/null
10- Restart OpenSIPS and Apache
	-Apache
		# /etc/init.d/apache2  restart
Restarting web server: apache2 ... waiting .
		#/etc/init.d/apache2  status
Apache is running (pid 5635)..

	-Opensips
		/etc/init.d/opensips  restart
		Listening on 
             udp: 127.0.0.1 [127.0.0.1]:5060
             udp: 192.168.50.10 [192.168.50.10]:5060
             tcp: 127.0.0.1 [127.0.0.1]:5060
             tcp:192.168.50.20 [192.168.50.10]:5060
Aliases: 
             tcp: net:5060
             tcp: net.dominio.com:5060
             tcp: localhost:5060
             udp: net:5060
             udp: net.dominio.com:5060
             udp: localhost:5060
.	
		- /etc/init.d/opensips  status
Status of opensips: opensips is running.

11- Install Monit
	- apt-get install monit
	- /etc/monit/monitrc
	set httpd port 2812 and
     	use address localhost  # only accept connection from localhost
    	allow localhost        # allow localhost to connect to the server
and
     	allow admin:monit      # require user 'admin' with password 'monit'
	check process opensips with pidfile /var/run/opensips/opensips.pid
	#Below is actions taken by monit when service got stuck.
	start program = "/etc/init.d/opensips start"
	stop program = "/etc/init.d/opensips stop"
	# Admin will notify by mail if below of the condition satisfied.
	if cpu is greater than 70% for 2 cycles then alert
	if cpu > 90% for 5 cycles then restart
 	
	- monit -t
	Control file syntax OK

12- Edit the /etc/default/monit
	- vim /etc/default/monit
	# Defaults for monit initscript
	# sourced by /etc/init.d/monit
	# installed at /etc/default/monit by maintainer scripts
	# Fredrik Steen <stone at debian.org>
	# You must set this variable to for monit to start
	startup=1
	# To change the intervals which monit should run uncomment
	# and change this variable.
	# CHECK_INTERVALS=180

13- Configuring Control Panel
	- /var/www/opensips-cp/config
		db.inc.php

			//database host
			$config->db_host = "localhost";
			//database port - leave empty for default
			$config->db_port = "";
			//database connection user
			$config->db_user = "root";
			//database connection password
			$config->db_pass = "( root password)";
			//database name
			$config->db_name = "opensips";
			if ($config->db_port !=
"")$config->db_host=$config->db_host":" $config->db_port;

13- Configure the FIFO access
	-/var/www/opensips-cp/config/
	- boxes.global.inc.php
	- $box_id=0;
		// mi host:port pair || fifo_file
		$boxes[$box_id]['mi']['conn']="/tmp/opensips_fifo";
		// monit host:port
		$boxes[$box_id]['monit']['conn']="127.0.0.1:2812";
		$boxes[$box_id]['monit']['user']="admin";
		$boxes[$box_id]['monit']['pass']="monit";
		$boxes[$box_id]['monit']['has_ssl']=0;
		// description (appears in mi , monit )
		$boxes[$box_id]['desc']="192.168.50.10";
		$boxes[$box_id]['assoc_id']=1;
		// enable local smonitor charts on this box : 0=disabled
1=enabled
		// (cron)
		$boxes[$box_id]['smonitor']['charts']=1;

14- globals.php
	- // Password can be saved in plain text mode by setting
	// $config->admin_passwd_mode to 0 or chyphered mode, by setting it
to 1
	$config->admin_passwd_mode=0;

15- Access http://server_ip_address/cp

And  this was the result
when access the web page, after the login and passoword, select the boton
"go" and said
Fatal error: Call to undefined method MDB2_Error::setFetchMode() in
/var/www/opensips-cp/web/db_connect.php on line 31

The logs
Mar 17 12:09:09 net /sbin/opensips[2841]: INFO:core:sig_usr: signal 15
received
Mar 17 12:09:09 net /sbin/opensips[2849]: INFO:core:sig_usr: signal 15
received
Mar 17 12:09:10 net opensips: INFO:core:init_tcp: using epoll_lt as the TCP
io watch method (auto detected)
Mar 17 12:09:10 net /sbin/opensips[2913]: NOTICE:core:main: version:
opensips 1.6.1-notls (i386/linux)
Mar 17 12:09:10 net /sbin/opensips[2913]: INFO:core:main: using 128 Mb
shared memory
Mar 17 12:09:10 net /sbin/opensips[2913]: INFO:core:main: using 1 Mb private
memory per process
Mar 17 12:09:10 net /sbin/opensips[2913]: NOTICE:signaling:mod_init:
initializing module ...
Mar 17 12:09:10 net /sbin/opensips[2913]: INFO:sl:mod_init: Initializing
StateLess engine
Mar 17 12:09:10 net /sbin/opensips[2913]: INFO:tm:mod_init: TM -
initializing...
Mar 17 12:09:10 net /sbin/opensips[2913]: INFO:maxfwd:mod_init:
initializing...
Mar 17 12:09:10 net /sbin/opensips[2913]: INFO:usrloc:ul_init_locks: locks
array size 512
Mar 17 12:09:10 net /sbin/opensips[2913]: INFO:registrar:mod_init:
initializing...
Mar 17 12:09:10 net /sbin/opensips[2913]: INFO:textops:mod_init:
initializing...
Mar 17 12:09:10 net /sbin/opensips[2913]: INFO:xlog:mod_init:
initializing...
Mar 17 12:09:10 net /sbin/opensips[2913]: INFO:acc:mod_init: initializing...
Mar 17 12:09:10 net /sbin/opensips[2913]: INFO:dialog:mod_init: Dialog
module - initializing
Mar 17 12:09:10 net /sbin/opensips[2913]: INFO:auth:mod_init:
initializing...
Mar 17 12:09:10 net /sbin/opensips[2913]: INFO:auth_db:mod_init:
initializing...
Mar 17 12:09:10 net /sbin/opensips[2913]: INFO:alias_db:mod_init:
initializing...
Mar 17 12:09:10 net /sbin/opensips[2913]:
INFO:core:probe_max_receive_buffer: using a UDP receive buffer of 255 kb
Mar 17 12:09:10 net /sbin/opensips[2913]:
INFO:core:probe_max_receive_buffer: using a UDP receive buffer of 255 kb


Another things
I installed the software in other server , version1.6.2 w/control panel 4.0
use the default password for mysql (user=opensips, password= openipsrw)
Only changed the following:
1- Install phpmyadmin , for check the tables and users (this is ok)
2- Opensips Status
	- # opensips -h
version: opensips 1.6.2-notls (i386/linux)
	- /etc/init.d/opensips status
Status of opensips: opensips is running.
	- opensipsctl online
database engine 'MYSQL' loaded
Control engine 'FIFO' loaded
1001
	- # opensipsctl ul show
database engine 'MYSQL' loaded
Control engine 'FIFO' loaded
entering fifo_cmd ul_dump
Domain:: location table=512 records=1
        AOR:: 1001
                Contact::
sip:1001 at 192.168.50.211:47966;rinstance=4c55623c92dd123b Q=
                        Expires:: 3549
                        Callid::
N2U4ZDBjYzczZmJjYmJlYzAwMTUyYTk3ODJhOWMxMjc.
                        Cseq:: 2
                        User-agent:: X-Lite release 1104o stamp 56125
                        State:: CS_NEW
                        Flags:: 0
                        Cflag:: 0
                        Socket:: udp:192.168.50.106:5060
                        Methods:: 5951
FIFO command was:
:ul_dump:opensips_receiver_4523

3- /etc/init.d/opensips
	- MEMORY=$((`echo $MEMORY | sed -e 's/[^0-9]//g'`))
	[ -z "$USER" ]  && USER=netsip
	[ -z "$GROUP" ] && GROUP=netsip
	[ $MEMORY -le 0 ] && MEMORY=32

4- /etc/default/opensips
	- # User to run as
	USER=netsip

	# Group to run as
	GROUP=netsip

5- I can Access the control panel with but has the following problems
5.A - Access with login and password = admin / admin = ok
5.B - Modules
	Admin = OK 
	User = OK 
	System 
		- CDRViewer = OK
		- Dialog = Warning: fopen(/tmp/opensips_fifo)
[function.fopen]: failed to open stream: Permission denied in
/var/www/opensips-cp/web/common/mi_comm.php  on line 91
				Array ( [0] => sorry -- cannot open write
fifo )
		- Dialplan = OK 
		- Dispatcher = Warning: fopen(/tmp/opensips_fifo)
[function.fopen]: failed to open stream: Permission denied in
/var/www/opensips-cp/web/common/mi_comm.php on line 91
					Array ( [0] => sorry -- cannot open
write fifo )
		-Domian = OK
		-Dymanic Routing = OK
		-Load Balancer= ok
		-MI Commands = /tmp/opensips_fifo
					Warning: fopen(/tmp/opensips_fifo)
[function.fopen]: failed to open stream: Permission denied in
/var/www/opensips-cp/web/common/mi_comm.php  on line 91
					sorry -- cannot open write fifo
		-Monit= ok
		-Nathelper= ok
		-Permissions = OK
		-Prefix 2 Domain = OK
		-SIP trace = Warning: fopen(/tmp/opensips_fifo)
[function.fopen]: failed to open stream: Permission denied in
/var/www/opensips-cp/web/common/mi_comm.php on line 91
				Array ( [0] => sorry -- cannot open write
fifo )
		-Statistics Monitor = Warning: fopen(/tmp/opensips_fifo)
[function.fopen]: failed to open stream: Permission denied
in /var/www/opensips-cp/web/common/mi_comm.php  on line 91
						sorry -- cannot open write
fifo

6- Enable the following modules in opensips.cfg
	- loadmodule "dialog.so"
	- loadmodule "drouting.so"

#------- dialog ---------
modparam("dialog", "db_url",
"mysql://opensips:opensipsrw@localhost/opensips")
modparam("dialog", "dlg_flag", 4)

#------- drouting --------
modparam("drouting", "db_url", 
        "mysql://opensips:opensipsrw@localhost/opensips")

7- Log 
Mar 17 11:07:23 erick-server /sbin/opensips[4331]: INFO:xlog:mod_init:
initializing...
Mar 17 11:07:23 erick-server /sbin/opensips[4331]: INFO:acc:mod_init:
initializing...
Mar 17 11:07:23 erick-server /sbin/opensips[4331]: INFO:dialog:mod_init:
Dialog module - initializing
Mar 17 11:07:23 erick-server /sbin/opensips[4331]: INFO:drouting:dr_init:
Dynamic-Routing - initializing
Mar 17 11:07:23 erick-server /sbin/opensips[4331]: INFO:auth:mod_init:
initializing...
Mar 17 11:07:23 erick-server /sbin/opensips[4331]: INFO:auth_db:mod_init:
initializing...
Mar 17 11:07:23 erick-server /sbin/opensips[4331]: INFO:alias_db:mod_init:
initializing...
Mar 17 11:07:23 erick-server /sbin/opensips[4331]:
INFO:core:probe_max_receive_buffer: using a UDP receive buffer of 218 kb
Mar 17 11:07:23 erick-server /sbin/opensips[4331]:
INFO:core:probe_max_receive_buffer: using a UDP receive buffer of 218 kb
Mar 17 11:07:23 erick-server /sbin/opensips[4332]:
WARNING:drouting:dr_load_routing_info: table "dr_gateways" empty
Mar 17 11:07:23 erick-server /sbin/opensips[4332]:
WARNING:drouting:dr_load_routing_info: no valid destinations set -> ignoring
the routing rules
Mar 17 12:11:54 erick-server /sbin/opensips[4339]: new branch at
sip:1001 at 192.168.50.211:47966;rinstance=4c55623c92dd123b
Mar 17 12:11:54 erick-server /sbin/opensips[4338]: incoming reply
Mar 17 12:11:57 erick-server /sbin/opensips[4339]: incoming reply
(END)

Bodgan in two installations I have the  similar problem , I don't have any
idea , can you check the  step by step  are the correct o let me know what
is my problem.


Thanks
Erick Ch.

-----Original Message-----
From: users-bounces at lists.opensips.org
[mailto:users-bounces at lists.opensips.org] On Behalf Of Bogdan-Andrei Iancu
Sent: Tuesday, March 16, 2010 11:16 AM
To: OpenSIPS users mailling list
Subject: Re: [OpenSIPS-Users] Problem with /tmp/opensips_fifo

yes, re-install OpenSIPS-CP either from SVN, either from tarballs. See 
download section on http://opensips-cp.sourceforge.net/

Regards,
Bogdan

Erick Chinchilla Berrocal wrote:
> Alex 
> Can you send me the procedure. Only re-install?
> In my information have the following:
> http://opensips-cp.sourceforge.net/
> Book "Building Telephony Systems with OpenSIPS 1.6", / Chapter 6 / pages
> 128.
> Use the Opensips 1.6.1 and Control Panel 4.0 
> Thanks
> Erick Ch.
>
> -----Original Message-----
> From: users-bounces at lists.opensips.org
> [mailto:users-bounces at lists.opensips.org] On Behalf Of Alex Ionescu
> Sent: Tuesday, March 16, 2010 9:19 AM
> To: OpenSIPS users mailling list
> Subject: Re: [OpenSIPS-Users] Problem with /tmp/opensips_fifo
>
> Hi Erik,
>
> I have fixed the "bug". If you want you can update your CP version and 
> everything will work fine.
>
> Regards,
> Alex
>
> On 3/16/2010 00:05, erik pepermans wrote:
>   
>>   some variables are empty in the function write2fifo_new in
>> module web/common/mi_comm.php :
>>    
>>     
>
>
>   


-- 
Bogdan-Andrei Iancu
www.voice-system.ro


_______________________________________________
Users mailing list
Users at lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
 

__________ Information from ESET NOD32 Antivirus, version of virus signature
database 3997 (20090409) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com
 
 

__________ Information from ESET NOD32 Antivirus, version of virus signature
database 3997 (20090409) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com
 




More information about the Users mailing list