Hello,
On Tue, Nov 13, 2012 at 5:03 AM, Carlos Ruiz Díaz carlos.ruizdiaz@gmail.com wrote:
Hello,
I've been through this problem a few weeks ago with my module that exports nested structures through xmlrpc. Apparently, there's a limitation in the technology itself that makes the nested structures to be overwritten everytime the response XML is parsed, if you look closely, you will notice that this makes sense since the structures are indexed by the name of the field, which is the same for every record. That's the reason of only one row being displayed even though the whole recordset was sent out.
Yes, I have noticed this. And the problem is that a struct is just a key-value-pair datatype which in normal situation does not support multiple key with the same name.
A more correct implementation would be to represent the AoRs in an array.
I think I will also write a work around for this. just parsing the return xml.
I tried with three different php libraries, even with xmlrpc_decode() that is the official function for decoding xmlrpc responses in php.
I didn't find a solution but I ended up using a workaround sending the values using CSV format which was later parsed by the PHP in charge of displaying the data.
Regards.
Carlos.
On Mon, Nov 12, 2012 at 11:43 PM, Daniel-Constantin Mierla miconda@gmail.com wrote:
Hello,
I am not a python parameter, but seems a limitation of the xmlrpc_test2.py tool, the tcp dump shows that the records are sent back in the xmlrpc response.
You will have to look inside/troubleshoot the xmlrpc_test2.py and see why it fails.
Cheers, Daniel
On 11/12/12 9:58 AM, Kristofer Signer wrote:
Hello,
running kamailio 3.3.2.
On Mon, Nov 12, 2012 at 1:48 PM, Daniel-Constantin Mierla miconda@gmail.com wrote:
Hello,
On 11/12/12 10:02 AM, Kristofer Signer wrote:
Hello,
I'm trying to dig in to the kamailio XMLRPC interfaces and the limitations I read in http://www.kamailio.org/docs/modules/stable/modules/xmlrpc.html#xmlrpc.imple...
is really a no go for us.
which one is a 'no go'? Nested structures are supported in the last version, iirc, the readme does not seem to be updated for this case.
the 'no go' is the structure {AoR, HashID, Contact, AoR, HashID, Contacts, ...}
For example, when to retrieve user locations and list of dialogs we get a xml document which is not so well formatted and we can not successfully parse it in an xmlrpc-parser.
Is there other options for xmlrpc module?
If the body is not successfully parsed, it is a bug. The limitation is about not supporting all the data types, but when a reply is xmlrpc sent, it should be valid. Can you test it with 1-2 location records that fail and post the xmrpc here as well as the log error messages from the xml parser?
Actually, I don't get any errors. I'm using the python example provided in kamailio src and that example will only parse out one record.
[krsi@vera examples]$ python xmlrpc_test2.py ul.dump foo {'Domain': 'location', 'Stats': {'Records': 2, 'Max-Slots': 1}, 'AoRs': {'HashID': 1731621673, 'AoR': 'jkp-01', 'Contacts': {'Contact': {'Ruid': 'uloc-50a0ea3c-124bf-1', 'Received': '[not set]', 'Path': '[not set]', 'Reg-Id': 0, 'Expires': 99, 'Flags': 0, 'User-Agent': 'Jitsi1.0-Linux', 'Q': 0.0, 'Instance': '[not set]', 'State': 'CS_SYNC', 'CSeq': 11, 'Methods': 18446744073709551615L, 'CFlags': 0, 'Address': 'sip:jkp-01@192.168.0.214:25060;transport=udp;registering_acc=foo_bar_com', 'Call-ID': '61ac73a44826f3887a5db2371b044275@0:0:0:0:0:0:0:0', 'Socket': 'udp:192.168.0.82:5060'}}}, 'Size': 512}
As you can see,. there should be two records but only one is parsed.
Here is the response body from tcpdump
<?xml version="1.0"?>
<methodResponse> <params> <param> <value><struct>
<member><name>Domain</name><value><string>location</string></value></member> <member><name>Size</name><value><int>512</int></value></member>
<member> <name>AoRs</name> <value><struct>
<member><name>AoR</name><value><string>jkp-02</string></value></member>
<member><name>HashID</name><value><int>1731621670</int></value></member> <member> <name>Contacts</name> <value><struct> <member> <name>Contact</name> <value><struct>
<member><name>Address</name><value><string>sip:jkp-02@192.168.0.214:35060</string></value></member>
<member><name>Expires</name><value><int>768</int></value></member>
<member><name>Q</name><value><double>0.000000</double></value></member>
<member><name>Call-ID</name><value><string>rcilzqsjfpnuihl@vera.foo.com</string></value></member>
<member><name>CSeq</name><value><int>383</int></value></member>
<member><name>User-Agent</name><value><string>Twinkle/1.4.2</string></value></member> <member><name>Received</name><value><string>[not set]</string></value></member> <member><name>Path</name><value><string>[not set]</string></value></member>
<member><name>State</name><value><string>CS_SYNC</string></value></member>
<member><name>Flags</name><value><int>0</int></value></member>
<member><name>CFlags</name><value><int>0</int></value></member>
<member><name>Socket</name><value><string>udp:192.168.0.82:5060</string></value></member>
<member><name>Methods</name><value><int>6111</int></value></member>
<member><name>Ruid</name><value><string>uloc-50a0ea3c-124c0-1</string></value></member> <member><name>Instance</name><value><string>[not set]</string></value></member>
<member><name>Reg-Id</name><value><int>0</int></value></member> </struct></value> </member> </struct></value> </member> <member> <name>AoR</name><value><string>jkp-01</string></value></member>
<member><name>HashID</name><value><int>1731621673</int></value></member> <member> <name>Contacts</name> <value><struct> <member> <name>Contact</name> <value><struct>
<member><name>Address</name><value><string>sip:jkp-01@192.168.0.214:25060</string></value></member>
<member><name>Expires</name><value><int>185</int></value></member>
<member><name>Q</name><value><double>0.000000</double></value></member>
<member><name>Call-ID</name><value><string>61ac73a44826f3887a5db2371b044275@0:0:0:0:0:0:0:0</string></value></member>
<member><name>CSeq</name><value><int>12</int></value></member>
<member><name>User-Agent</name><value><string>Jitsi1.0-Linux</string></value></member> <member><name>Received</name><value><string>[not set]</string></value></member> <member><name>Path</name><value><string>[not set]</string></value></member>
<member><name>State</name><value><string>CS_SYNC</string></value></member>
<member><name>Flags</name><value><int>0</int></value></member>
<member><name>CFlags</name><value><int>0</int></value></member>
<member><name>Socket</name><value><string>udp:192.168.0.82:5060</string></value></member>
<member><name>Methods</name><value><int>18446744073709551615</int></value></member>
<member><name>Ruid</name><value><string>uloc-50a0ea3c-124bf-1</string></value></member> <member><name>Instance</name><value><string>[not set]</string></value></member>
<member><name>Reg-Id</name><value><int>0</int></value></member> </struct></value> </member> </struct></value> </member> </struct></value> </member> <member> <name>Stats</name> <value><struct> <member><name>Records</name><value><int>2</int></value></member> <member><name>Max-Slots</name><value><int>1</int></value></member> </struct></value> </member> </struct></value>
</param> </params> </methodResponse>
and for reference, the same command from kamctl:
[krsi@sipproxy1 ~]$ kamctl mi ul_dump Domain:: location table=512 records=2 max_slot=1 AOR:: jkp-02 Contact:: sip:jkp-02@192.168.0.214:35060 Q= Expires:: 1961 Callid:: rcilzqsjfpnuihl@vera.foo.se Cseq:: 383 User-agent:: Twinkle/1.4.2 State:: CS_SYNC Flags:: 0 Cflag:: 0 Socket:: udp:192.168.0.82:5060 Methods:: 6111 Ruid:: uloc-50a0ea3c-124c0-1 Reg-Id:: 0 AOR:: jkp-01 Contact:: sip:jkp-01@192.168.0.214:25060 Q= Expires:: 298 Callid:: 61ac73a44826f3887a5db2371b044275@0:0:0:0:0:0:0:0 Cseq:: 10 User-agent:: Jitsi1.0-Linux State:: CS_SYNC Flags:: 0 Cflag:: 0 Socket:: udp:192.168.0.82:5060 Methods:: 4294967295 Ruid:: uloc-50a0ea3c-124bf-1 Reg-Id:: 0
Thanks ./Kristofer
For example, siremis uses the xmlrpc interface and all is ok with handling the replies. It uses a library from php pear.
Cheers, Daniel
-- Daniel-Constantin Mierla - http://www.asipto.com http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
-- Daniel-Constantin Mierla - http://www.asipto.com http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users