[SR-Users] Kamailio and XMLRPC commands with POST

Daniel-Constantin Mierla miconda at gmail.com
Tue May 23 14:32:15 CEST 2017


Hello,

do you want authentication with username and password or IP based
authorization?

Cheers,
Daniel

On Tue, May 23, 2017 at 7:04 AM, Olli Attila <olli.attila at oatel.net> wrote:

> Hello,
>
> I got the POST request working now by adding the "listen tcp:
> 127.0.0.1:5060". I tested this with dialplan.reload, dialplan.dump and
> htable.reload. Works ok.
>
> Is there any way to authenticate the request in Kamailio?
>
> Now all of the valid methods included in request: "http://127.0.0.1/RPC"
> are getting executed and Kamailio returns 200 OK directly.
>
> Cheers,
>
> --Olli
>
>
>
>
> Diego Nadares kirjoitti 2017-05-22 15:06:
>
>> Hi Olli,
>>
>> Did configure kamailio to listen on tcp:127.0.0.1?
>>
>> Diego
>>
>> El 22 may. 2017, a las 02:54, Olli Attila <olli.attila at oatel.net>
>>> escribió:
>>>
>>> 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><me
>>> thodName>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
>>>
>>>
>>> _______________________________________________
>>> Kamailio (SER) - Users Mailing List
>>> sr-users at lists.kamailio.org
>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>>>
>>
>> _______________________________________________
>> Kamailio (SER) - Users Mailing List
>> sr-users at lists.kamailio.org
>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>>
>
> _______________________________________________
> Kamailio (SER) - Users Mailing List
> sr-users at lists.kamailio.org
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>



-- 
Daniel-Constantin Mierla - http://www.asipto.com
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20170523/79776e65/attachment.html>


More information about the sr-users mailing list