[OpenSIPS-Users] Any official instructions how to use the MI commands?
Xi Liu
lxvonion at gmail.com
Tue Apr 17 22:50:05 CEST 2012
I found the instructions on the site of kamailio, and here it is
http://www.kamailio.org/dokuwiki/doku.php/utils:fifo-relay#fifo_commands
So that answered my Question 1, still need help on Question 2.
Also, I see a lot of reference goes to this file which I assume is the original documentation of OpenSER, but the link is dead. Any one still have a copy of it?
iptel.org/~ janakj/fifo.pdf
On Apr 17, 2012, at 4:31 PM, Xi Liu wrote:
> 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
More information about the Users
mailing list