<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Hi, Xi!<br>
<br>
In order to use the MI fifo, you should first take a look at the
module documentation[1]. You have there an example[2] of how a
request should be built, and also the syntax grammar[3].<br>
Just out of curiosity, why don't you use directly the opensipsctl
tool?<br>
<br>
[1]
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<a
href="http://www.opensips.org/html/docs/modules/devel/mi_fifo.html">http://www.opensips.org/html/docs/modules/devel/mi_fifo.html</a><br>
[2]
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<a
href="http://www.opensips.org/html/docs/modules/devel/mi_fifo.html#id250088">http://www.opensips.org/html/docs/modules/devel/mi_fifo.html#id250088</a><br>
[3]
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<a
href="http://www.opensips.org/html/docs/modules/devel/mi_fifo.html#id248321">http://www.opensips.org/html/docs/modules/devel/mi_fifo.html#id248321</a><br>
<br>
Regards,<br>
Răzvan<br>
<br>
On 04/17/2012 11:31 PM, Xi Liu wrote:
<blockquote
cite="mid:50CB3D9C-1668-4555-929C-5D972B0B7A16@gmail.com"
type="cite">
<pre wrap="">Hi All,
I'm trying to find the official documentation about how to use MI interface with named pipe, while I searched all over the web but can't find any...
Though I found an example in the list and able to repeat it, but still have two questions,
1, How can I pass parameters along with the command? Currently I can run those functions that does not require parameters, e.g. address_dump, uptime.
But I would like to use ul_add, ul_show_contact, etc.
2, I wrote a perl code which expected to read out put from opensips which for some reason never worked. When I wrote the perl code I took /example/web_MI/*.php as examples..
Any help would be appreciated!
================
Example I found,
mkfifo /tmp/my_fifo
cat /tmp/my_fifo&
echo -e ":address_dump:my_fifo\n\n" > /tmp/opensips_fifo
*returns*
200 OK
48 <1.2.3.4,2, 0, 0, NULL, NULL>
** cat process ends
================
Perl code I wrote,
#!/usr/bin/perl
use strict;
# Initial values
my $os_fifo="/tmp/opensips_fifo";
# Open OS fifo and wait for cmd
open OSFIFO, $os_fifo or die "Can't open opensips fifo: ".$os_fifo;
# open reply fifo
my $fifo_reply_filename = "fifo_".int(rand(100));
my $fifo_path = "/tmp/".$fifo_reply_filename;
system("mkfifo -m 666 ".$fifo_path);
# fifo cmd
my $fifo_cmd = ":uptime:".$fifo_path."\n\n";
# execute fifo cmd
print OSFIFO $fifo_cmd;
close OSFIFO;
# Read output
open FIFO, $fifo_path or die "Can't open fifo: ".$fifo_path;
my $line_num = 1;
while (<FIFO>) {
print "line $line_num: ".$_;
$line_num++;
}
close FIFO;
unlink $fifo_path;
================
Thanks,
Xi
_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a>
<a class="moz-txt-link-freetext" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
</blockquote>
<br>
</body>
</html>