[OpenSIPS-Users] Problem with /tmp/opensips_fifo
Erick Chinchilla Berrocal
erick at netcrc.net
Fri Mar 12 18:47:34 CET 2010
Bogan
I fixed the problem with the OpenSIPS , but the other problems with the
Control Panel continues.
Now is working (Opensips)
I problem was in the file opensips.cfg. In the username and password for
the database
##
/home/netcrc# /etc/init.d/opensips status
Status of opensips: opensips is running.
##
opensipsctl -h
database engine 'MYSQL' loaded
Control engine 'FIFO' loaded
/sbin/opensipsctl $Revision: 4448 $
##
Now the problem with the Control Panel 4.0 continues
This is the situation with each module
-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 147
Array ( [0] => sorry -- cannot open write fifo )
-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 147
Array ( [0] => sorry -- cannot open write 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 147
Array ( [0] => sorry -- cannot open write fifo [1] => sorry
-- cannot open write fifo )
-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 147
-Monit = Process - opensips
Status - Execution Failed
-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 147
Array ( [0] => sorry -- cannot open write fifo )
-Statics 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 147
sorry -- cannot open write fifo
this is the current configuration from the file
"/var/www/opensips-cp/web/common/mi_comm.php"
/var/www/opensips-cp/web/common# less mi_comm.php
<?php
/*
* $Id$
* Copyright (C) 2008 Voice Sistem SRL
*
* This file is part of opensips-cp, a free Web Control Panel Application
for
* OpenSIPS SIP server.
*
* opensips-cp is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* opensips-cp is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
USA.
*/
function write2fifo($fifo_cmd, &$errors, &$status){
global $config;
/* check fifo file */
if (!file_exists($config->fifo_server)) {
$errors[]="No FIFO file to SIP Server"; return;
}
/* open fifo now */
$fifo_handle=fopen($config->fifo_server, "w");
if (!$fifo_handle) {
$errors[]="sorry -- cannot open write fifo"; return;
}
/* create fifo for replies */
@system("mkfifo -m 666 ".$config->reply_fifo_path);
/* add command separator */
$fifo_cmd=$fifo_cmd."\n";
// $fifo_cmd=$fifo_cmd."\n";
/* write fifo command */
if (fwrite($fifo_handle, $fifo_cmd)==-1) {
@unlink($config->reply_fifo_path);
@fclose($fifo_handle);
$errors[]="sorry -- fifo writing error"; return;
}
@fclose($fifo_handle);
/* read output now */
@$fp = fopen($config->reply_fifo_path, "r");
if (!$fp) {
@unlink($config->reply_fifo_path);
$errors[]="sorry -- reply fifo opening error"; return;
}
stream_set_timeout($fp, 5);
$status=fgetS($fp, 256);
$info = stream_get_meta_data($fp);
if ($info['timed_out']) {
fclose($fp);
$errors[]= 'Read from FIFO file to SIP server timed out';
return;
}
if (!$status) {
fclose($fp);
@unlink($config->reply_fifo_path);
$errors[]="sorry -- reply fifo reading error"; return;
}
$rd=fread($fp, 8192);
fclose($fp);
@unlink($config->reply_fifo_path);
return $rd;
}
function write2fifo_new($command, &$errors, &$status){
global $config;
global $fifo_file ;
$pos=strpos($command," ");
if ($pos===false) {
$cmd=$command;
$arg="";
}else {
$cmd=trim(substr($command,0,$pos));
$arg=trim(substr($command,$pos,strlen($command)));
$command_args=array();
$command_args=explode(" ",$arg);
}
if ($arg==""){
/* no args */
/*if the command contains delimiter ':' ,
then return , or else bad things happen */
$found_delimiter=strpos($cmd,":");
if ( $found_delimiter ===
false )
{
// mkay
}
else
{
$err="Bad command.
character ':' not permited here.";
$status=$err;
return $err ;
}
$fifo_cmd=":".$cmd.":".$config->reply_fifo_filename."\n";
} else {
/* command with args */
foreach($command_args as
$key=>$val){
$arg_list.=$val."\n";
}
$fifo_cmd=":".$cmd.":".$config->reply_fifo_filename."\n".$arg_list;
}
/* check fifo file */
if (!file_exists($fifo_file)) {
$errors[]="Cannot connect to OpenSIPS Server via Management
Interface ($fifo_file)"; return;
}
/* open fifo now */
$fifo_handle=fopen($fifo_file, "w");
if (!$fifo_handle) {
$errors[]="sorry -- cannot open write fifo"; return;
}
/* create fifo for replies */
@system("mkfifo -m 666 ".$config->reply_fifo_path);
/* add command separator */
$fifo_cmd=$fifo_cmd."\n";
/* write fifo command */
if (fwrite($fifo_handle, $fifo_cmd)==-1) {
@unlink($config->reply_fifo_path);
@fclose($fifo_handle);
$errors[]="sorry -- fifo writing error"; return;
}
@fclose($fifo_handle);
/* read output now */
@$fp = fopen($config->reply_fifo_path, "r");
if (!$fp) {
@unlink($config->reply_fifo_path);
$errors[]="sorry -- reply fifo opening error"; return;
}
stream_set_timeout($fp, 20);
$status=fgetS($fp, 256);
$info = stream_get_meta_data($fp);
if ($info['timed_out']) {
fclose($fp);
$errors[]= 'Read from FIFO file to SIP server timed out';
return;
}
if (!$status) {
fclose($fp);
@unlink($config->reply_fifo_path);
$errors[]="sorry -- reply fifo reading error"; return;
}
$rd=fread($fp, 8192);
fclose($fp);
@unlink($config->reply_fifo_path);
return $rd;
}
function xml_do_call($xmlrpc_host,$xmlrpc_port,$request,&$errors,&$status) {
$fp = @fsockopen($xmlrpc_host, $xmlrpc_port, $errno, $errstr);
if (!$fp) {
echo "Cannot connect to OpenSIPS Server via Management Interface
($xmlrpc_host/$xmlrpc_port)" . "<BR>";
//echo $errno ." - ". $errstr ;
return;
}
$query = "POST /RPC2 HTTP/1.0\nUser_Agent: opensips-cp\nHost:
".$xmlrpc_host."\nContent-Type: text/xml\nContent-Length:
".strlen($request)."\n\n".$request."\n";
if (!fputs($fp, $query, strlen($query))) {
$errors[] = "Write error"; return -1;
}
$contents = '';
while (!feof($fp)) {
$contents .= fgets($fp);
}
fclose($fp);
return $contents;
}
function write2xmlrpc($command,&$errors,&$status){
global $xmlrpc_host ;
global $xmlrpc_port ;
// command with arguments
$full_command=explode(" ",$command);
/* extract command , args */
$my_command=array_shift($full_command);
/* args */
$params=$full_command ;
if (!isset($params[0])) {
$params=NULL ;
}
$str = "";
$request = xmlrpc_encode_request($my_command, $params);
$response = xml_do_call($xmlrpc_host, $xmlrpc_port,
$request,$errors,$status);
$xml=(substr($response,strpos($response,"\r\n\r\n")+4));
preg_match('/HTTP\/1.1\s+\d+\s+[A-Za-z]+\s+/',$response,$match);
$status = substr($match[0],9);
preg_match('/\<fault\>/',$xml,$fault_match);
if ( count($fault_match)==0 ) {
preg_match_all('/\<string\>(.*\s+)+\<\/string\>/',$xml,$matches);
for ($j=0;$j<count($matches[0]);$j++){
$temp = substr($matches[0][$j],8);
$str = $str.substr($temp,0,-9);
}
} else {
preg_match_all('/\<string\>.*\<\/string\>/',$xml,$matches);
$temp = substr($matches[0][0],8);
$errors[] = "ERROR: ".substr($temp,0,-9);
}
return $str ;
}
function mi_command($command,&$errors,&$status){
global $comm_type ;
global $xmlrpc_host ;
global $xmlrpc_port ;
global $fifo_file ;
$config->reply_fifo_filename="webfifo_".rand();
$config->reply_fifo_path="/tmp/".$config->reply_fifo_filename;
$buf="";
if (strtolower($comm_type)=="fifo"){
$buf=write2fifo_new($command, $errors, $status);
}
if (strtolower($comm_type)=="xmlrpc"){
$buf=write2xmlrpc($command,$errors,$status);
}
return $buf ;
}
?>
(END)
-----Original Message-----
From: Erick Chinchilla Berrocal [mailto:erick at netcrc.net]
Sent: Friday, March 12, 2010 9:22 AM
To: 'OpenSIPS users mailling list'
Subject: RE: [OpenSIPS-Users] Problem with /tmp/opensips_fifo
Bogan
More info, according remember, before you install the Control Panel 4.0 ,
The OpenSIPS 1.6.1 worked well, phone register and tests.
But not for now does not work.
I reviewed the manual step by step and find nothing different from what the
manual says
opensipsctl restart
database engine 'MYSQL' loaded
Control engine 'FIFO' loaded
INFO: Restarting OpenSIPS :
ERROR: No PID file found (/var/run/opensips.pid)! OpenSIPS probably not
running
INFO: Starting OpenSIPS :
ERROR: PID file /var/run/opensips.pid does not exist -- OpenSIPS start
failed
-----Original Message-----
From: Erick Chinchilla Berrocal [mailto:erick at netcrc.net]
Sent: Friday, March 12, 2010 7:43 AM
To: 'OpenSIPS users mailling list'
Subject: RE: [OpenSIPS-Users] Problem with /tmp/opensips_fifo
Hi Bogan
The problem continuos
My comments
I use Opensips 1.6.1 with Control Panel 4.0
- Opensisps Status
# /etc/init.d/opensips status
Status of opensips: opensips is not running.
# /etc/init.d/opensips start
Starting opensips: opensipsListening on
udp: 127.0.0.1 [127.0.0.1]:5060
udp: x.x.x.x [x.x.x.x]:5060
tcp: 127.0.0.1 [127.0.0.1]:5060
tcp: x.x.x.x [x.x.x.x]:5060
Aliases:
tcp: abc:5060
tcp: abc.domian.net:5060
tcp: localhost:5060
udp: net:5060
udp: abc.domain.net:5060
udp: localhost:5060
#/etc/init.d/opensips status
Status of opensips: opensips is not running.
PATH=/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/sbin/opensips
NAME=opensips
DESC=opensips
HOMEDIR=/var/run/opensips
PIDFILE=$HOMEDIR/$NAME.pid
DEFAULTS=/etc/default/opensips
RUN_OPENSIPS=yes
- mi_fifo module
/lib/opensips/modules# ls
aaa_radius.so call_control.so diversion.so load_balancer.so
options.so rr.so textops.so
acc.so cfgutils.so domainpolicy.so localcache.so
path.so seas.so tm.so
alias_db.so closeddial.so domain.so mangler.so pdt.so
signaling.so uac_redirect.so
auth_aaa.so db_flatstore.so drouting.so maxfwd.so
peering.so siptrace.so uac.so
auth_db.so db_mysql.so enum.so mediaproxy.so
permissions.so sl.so uri.so
auth_diameter.so db_text.so exec.so mi_datagram.so
pike.so sms.so userblacklist.so
auth.so db_virtual.so gflags.so mi_fifo.so
presence_xcapdiff.so speeddial.so usrloc.so
avpops.so dialog.so group.so msilo.so qos.so
sst.so xlog.so
b2b_entities.so dialplan.so imc.so nathelper.so
ratelimit.so statistics.so
benchmark.so dispatcher.so lcr.so nat_traversal.so
registrar.so stun.so
- the fifo_name (in opensips.cfg) is configured to a different name
than /tmp/opensips_fifo
This is the same in the book (Building Telepfohne System qith OpenSIPS 1.6),
Chart 5
"Full script with all the resources above" pag.119 to 124
- /etc/opensips/opensips.cfg (my current setup)
fork=yes
children = 4 #total number of UDP SIP worker
processes per interface
tcp_children=6 #total number of TCP SIP worker
processes in total
disable_tcp=no
#disable_tls=no
####### Modules Section ########
#set module path
mpath="//lib/opensips/modules/"
/* uncomment next line for MySQL DB support */
loadmodule "db_mysql.so"
loadmodule "signaling.so"
loadmodule "sl.so"
loadmodule "tm.so"
loadmodule "rr.so"
loadmodule "maxfwd.so"
loadmodule "usrloc.so"
loadmodule "registrar.so"
loadmodule "textops.so"
loadmodule "mi_fifo.so"
loadmodule "uri.so"
loadmodule "xlog.so"
loadmodule "acc.so"
/* uncomment next lines for MySQL based
authentication support
NOTE: a DB (like db_mysql) module must be also
loaded */
loadmodule "auth.so"
loadmodule "auth_db.so"
/* uncomment next line for aliases support
NOTE: a DB (like db_mysql) module must be also
loaded */
loadmodule "alias_db.so"
/* uncomment next line for multi-domain support
NOTE: a DB (like db_mysql) module must be also
loaded
NOTE: be sure and enable multi-domain support in all
used modules
(see "multi-module params" section ) */
loadmodule "domain.so"
/* uncomment the next two lines for presence server
support
NOTE: a DB (like db_mysql) module must be also
loaded */
#loadmodule "presence.so"
#loadmodule "presence_xml.so"
# ----------------- setting module-specific
parameters ---------------
# ----- mi_fifo params -----
modparam("mi_fifo", "fifo_name",
"/tmp/opensips_fifo")
# ----- rr params -----
# add value to ;lr param to cope with most of the
UAs
modparam("rr", "enable_full_lr", 1)
# do not append from tag to the RR (no need for this
script)
modparam("rr", "append_fromtag", 0)
# ----- registrar params -----
/* uncomment the next line not to allow more than 10
contacts per AOR */
#modparam("registrar", "max_contacts", 10)
# ----- usrloc params -----
modparam("usrloc", "db_mode", 0)
/* uncomment the following lines if you want to
enable DB persistency
for location entries */
modparam("usrloc", "db_mode", 2)
modparam("usrloc", "db_url",
"mysql://opensips:(mysqlpassword)@localhost/opensips")
Another things
This is my first time with this application, but I like.
Can you help with the SerMyAdmin , I do not understand the setup in the
step 2 (pag.136)
/usr/local/apache-tomcat-6.0.16/webapps/serMyAdmin/WEB-INF/spring/resource.x
ml
I can look the web page, but the user and password don't work
username: admin at setup
password: secret
username: admin at sermyadmin.org
password: secret
Can you send me a example please.
This is the default configuration
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
<bean id="smtpAuthenticator" class="SmtpAuthenticator">
<constructor-arg value="email at sermyadmin.org" />
<constructor-arg value="password" />
</bean>
<bean id="mailSession" class="javax.mail.Session" factory-
method="getInstance">
<constructor-arg>
<props>
<prop key="mail.smtp.auth">true</prop>
<prop key="mail.smtp.socketFactory.port">465</prop>
<prop key="mail.smtp.socketFactory.class">
javax.net.ssl.SSLSocketFactory
</prop>
<prop key="mail.smtp.socketFactory.fallback">false</prop>
</props>
</constructor-arg>
<constructor-arg ref="smtpAuthenticator" />
</bean>
<bean id="mailSender"
class="org.springframework.mail.javamail.JavaMailSenderImpl">
<property name="host" value="smtp.gmail.com" />
<property name="session" ref="mailSession" />
</bean>
<bean id="mailMessage" class="org.springframework.mail.SimpleMailMessage">
<property name="from" value="email at sermyadmin.org" />
</bean>
</beans>
I know my questions can be a bit silly, but I read a lot of the manual, I've
also installed several times the server and not where I'm making mistakes.
I am also doing a translation of the manual installation (summary) in
Spanish, maybe you can serve others people.
Thanks for your help
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: Friday, March 12, 2010 6:19 AM
To: OpenSIPS users mailling list
Subject: Re: [OpenSIPS-Users] Problem with /tmp/opensips_fifo
Hi Erick,
erick at netcrc.net wrote:
>> I have with the following problem:
>>
>> The file /tmp/opensips_fifo for any reason disappears
>> for example if send the command for reboot the server.
>> The opensips using mi_fifo module.
>>
>> With the command "opensips -c" said is ok
>>
>> opensipsctl moni said (if not find the file)
>> ERROR: Error opening OpenSIPS's FIFO /tmp/opensips_fifo
>> ERROR: Make sure you have the line 'modparam("mi_fifo", "fifo_name",
>> "/tmp/opensips_fifo")' in your config
>> ERROR: and also have loaded the mi_fifo module.
>>
>> But for fix this problem I made the following
>> touch /tmp/opensips_fifo
>> chmod 755 /tmp/opensips_fifo
>>
DO NOT DO THAT!!!!!!
the fifo file must be created by opensips daemon - if you do not have it
, it means:
- opensips is not running
- mi_fifo module is not loaded
- the fifo_name (in opensips.cfg) is configured to a different name
than /tmp/opensips_fifo
>> this is temporary but it works.
>>
>> Another things is with the Control Panel 4.0
>>
>> I have problems with the following modules and this is the message of
each
>>
>> -Dialog = Array ( [0] => Cannot connect to OpenSIPS Server via Management
>> Interface (/tmp/opensips_fifo) )
>>
>> - Dispatcher = Array ( [0] => Cannot connect to OpenSIPS Server via
>> Management Interface (/tmp/opensips_fifo) [1] => Cannot connect to
>> OpenSIPS Server via Management Interface (/tmp/opensips_fifo) )
>>
>> - MI Commands = /tmp/opensips_fifo
>>
>> - Monit = Process - Opensips / Status - Execution failed
>>
>> - SIP Trace = Array ( [0] => Cannot connect to OpenSIPS Server via
>> Management Interface (/tmp/opensips_fifo) )
>>
>> - Statistics Monitor = Cannot connect to OpenSIPS Server via Management
>> Interface (/tmp/opensips_fifo)
>>
>> The common problem is " /tmp/opensips_fifo"
>>
yes, because you created a bogus file which does not provide
communication with opensips :)
Regards,
Bogdan
>> Thanks
>> Erick
>>
>>
>
>
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>
--
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
__________ 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