[SR-Users] Kamailio and XMLRPC commands with POST

Olli Attila olli.attila at oatel.net
Mon May 22 07:54:06 CEST 2017


Hi,

I'm using kamailio 5.0.0 and trying to use core commands through xmlrpc 
interface but the requests are failing towards Kamailio.
I have compiled and enabled the xmlrpc module in config and I have this 
on my kamailio.cfg:


# XMLRPC routing
#!ifdef WITH_XMLRPC
route[XMLRPC] {
   # allow XMLRPC from localhost
   if ((method=="POST" || method=="GET")
       && (src_ip==127.0.0.1)) {
     # close connection only for xmlrpclib user agents (there is a bug in
     # xmlrpclib: it waits for EOF before interpreting the response).
     if ($hdr(User-Agent) =~ "xmlrpclib")
       set_reply_close();
     set_reply_no_connect();
     dispatch_rpc();
     exit;
   }
   send_reply("403", "Forbidden");
   exit;
}
#!endif

I have tried to test this by using curl and calling "core.uptime" method 
in xml body (core.uptime works when executed through kamcmd commandline 
tool).
The curl is called from the same machine that I have Kamailio installed 
on:

  "curl -X POST -H 'Host: 127.0.0.1:5060' -H 'User-Agent: xmlrpcclient' 
-H 'Content-Type: text/xml' -d '<?xml 
version='1.0'?><methodCall><methodName>core.uptime</methodName><params></params></methodCall>' 
http://127.0.0.1:5060"

This fails and I only get: "curl: (7) Failed to connect to 127.0.0.1 
port 5060: Connection refused"

network traffic shows me this.. firewall is disabled completely when 
doing the test:
1   0.000000    127.0.0.1 -> 127.0.0.1    TCP 74 55630→5060 [SYN] Seq=0 
Win=43690 Len=0 MSS=65495 SACK_PERM=1 TSval=1347930477 TSecr=0 WS=64
2   0.000032    127.0.0.1 -> 127.0.0.1    TCP 54 5060→55630 [RST, ACK] 
Seq=1 Ack=1 Win=0 Len=0

Can anyone help me to get to the right direction with this?

Cheers,

--Olli




More information about the sr-users mailing list