Hi Helmut,
Could you put all this in an usable format (a README file, the script
file, etc) - if so, I can upload this on SVN as an usage example.
Thanks and regards,
Bogdan
Helmut Kuper wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hello,
ok I found it. My client's request wasn't correct. The path for POST
request was / instead of /RPC2 ... hmhmhm :/
Well, to make this for others easier here some code snippets to test
mi_xmlrpc with openser 1.4 and xmlrpc-1.06.23
openser:
loadmodule "mi_xmlrpc.so"
modparam("mi_xmlrpc", "port", 8080)
modparam("mi_xmlrpc", "log_file",
"/var/log/voip/abyss.log")
modparam("mi_xmlrpc", "reply_option", 1)
modparam("mi_xmlrpc", "buffer_size", 8192)
Take attention that reply_option is set here to 1!
PHP script for calling by a webserver or executed on CLI via "php
stats.php":
Copy following code into a file called "stats.php"
<?php
include "ixr_xmlrpc/ixr_xmlrpc.inc.php";
//if(check_session())
if(1)
{
?>
~ <html>
~ <head>
~ </head>
~ <body>
<?php
//Create and configure Client
~ $c=new IXR_Client('<your openser IP here>:8080');
~ $c->debug=false;
$c->useragent="me";
~ $c->path="/RPC2";
//Do the Request
~ if($c->query("get_statistics", "all"))
~ {
//openser sent back a 200-OK-reply
//So we print out the result here
//Get content from openser's reply
~ $result=$c->getResponse();
//We expect an array here. This is why
//reply_option is set to 1 in openser. Print
// out each array element (all strings here)
~ foreach ($result as $r)
~ {
~ print "$r<br>\n";
~ }
~ }
~ else // Errors (no 200-OK-replys from openser) goes here
~ {
~ print 'An error
occurred!<br>'.$c->getErrorCode().":
".$c->getErrorMessage();
~ }
?>
~ </body>
~ </html>
<?php
}
?>
Make a directory called "ixr_xmlrpc" in directory where stats.php
resides. Create a file called "ixr_rpcxml.inc.php" and copy the code from
http://scripts.incutio.com/xmlrpc/IXR_Library.inc.php.txt
into it. That's all!
When you successful execute "stats.php" via CLI or Web-Browser you
should see at least some statistics from openser's core and maybe more
dependig on your used modules. Otherwise you should see the error code
and error message.
You can use every other xmlrpc client library. But make sure your client
's request to openser match the example XMLRPC-request described in
mi_xmlrpc's documentation:
http://www.openser.org/docs/modules/1.4.x/mi_xmlrpc.html#AEN130
The working request produced by this client sends is exactly this:
POST /RPC2 HTTP/1.0
Host: <your openser's ip here>
Content-Type: text/xml
User-Agent: me
Content-length: 157
<?xml version="1.0"?>
<methodCall>
<methodName>get_statistics</methodName>
<params>
<param><value><string>all</string></value></param>
</params></methodCall>
regards
helmut
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla -
http://enigmail.mozdev.org
iD8DBQFHxFkT4tZeNddg3dwRAq3GAKCOJJzBw1rARaEc5iqGwRxyJus/tACgsIDJ
bkLfB5nrMhkT6xvcrunoPSA=
=AgBH
-----END PGP SIGNATURE-----
_______________________________________________
Users mailing list
Users(a)lists.openser.org
http://lists.openser.org/cgi-bin/mailman/listinfo/users