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.
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?
thanks ./Kristofer
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.
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?
For example, siremis uses the xmlrpc interface and all is ok with handling the replies. It uses a library from php pear.
Cheers, Daniel
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.implementation.**limitationshttp://www.kamailio.org/docs/modules/stable/modules/xmlrpc.html#xmlrpc.implementation.limitations
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/**micondahttp://www.linkedin.com/in/miconda
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 mailto: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.implementation.limitations 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 <http://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 <mailto: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 <http://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 <http://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 <http://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 http://sip:jkp-02@192.168.0.214:35060 Q= Expires:: 1961 Callid:: rcilzqsjfpnuihl@vera.foo.se mailto: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 http://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 http://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 http://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://twitter.com/#%21/miconda> - http://www.linkedin.com/in/miconda
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.
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.comhttp://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
Hi,
i use the XML-RPC-Client from the ZendFramework, at it works like a charm:
private function getCPEInfo($id) { $xml_servers = array( 'http://127.0.0.1:5060/RPC', );
try { if (!$this->xml_client) { // Choose random Server $this->xml_client = new Zend_XmlRpc_Client($xml_servers[rand(0,count($xml_servers)-1)]); }
$result = array(); $cpe = array(); $query_result = $this->xml_client->call('mi', array('ul_show_contact', 'location', $id.'@localhost')); foreach($query_result as $line) { $cpe = array(); list($cpe['contact'], $rest) = explode('>', $line, 2); $cpe['contact'] = substr($cpe['contact'], 11); $contents = explode(';', $rest); foreach($contents as $entry) { list($key, $value) = explode('=', $entry); switch($key) { case 'expires': case 'cflags': case 'user_agent': case 'received': $cpe[$key] = $value; break; default: } } if (isset($cpe['user_agent'])) $cpe['user_agent'] = substr($cpe['user_agent'], 1, -1); if (isset($cpe['received'])) $cpe['received'] = substr($cpe['received'], 1, -1); $result[] = $cpe; }
return $result; } catch ( Exception $e ) { return "Unable to connect (".$e->getMessage().")"; } }
I definitely cannot explain, no matter how many entries i have per account:
1. Endgerät: Kontakt-URI: sip:xxx@xxx:4099 Gültigkeit: noch 3392 Sekunden NAT: kein NAT erkannt Endgerät: Genexis OCG1018MX v1.7.1.1c
2. Endgerät: Kontakt-URI: sip:xxx@xxx:5060 Gültigkeit: noch 3469 Sekunden NAT: kein NAT erkannt Endgerät: Patton SN-DTA 1BIS2V 00A0BA075803 R6.2 2012-07-13 H323 SIP M5T SIP Stack/4.0.30.30
3. Endgerät: Kontakt-URI: sip:xxx@xxx:5060 Gültigkeit: noch 954 Sekunden NAT: kein NAT erkannt Endgerät: Patton SN-DTA 1BIS2V 00A0BA0761CC R6.2 2012-07-13 H323 SIP M5T SIP Stack/4.0.30.30
Kind regards, Carsten
2012/11/13 Carlos Ruiz Díaz carlos.ruizdiaz@gmail.com
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.
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
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
-- Carsten Bock CEO (Geschäftsführer)
ng-voice GmbH Schomburgstr. 80 D-22767 Hamburg / Germany
http://www.ng-voice.com mailto:carsten@ng-voice.com
Office +49 40 34927219 Fax +49 40 34927220
Sitz der Gesellschaft: Hamburg Registergericht: Amtsgericht Hamburg, HRB 120189 Geschäftsführer: Carsten Bock Ust-ID: DE279344284
Hier finden Sie unsere handelsrechtlichen Pflichtangaben: http://www.ng-voice.com/imprint/
Does it print out all the contacts for one id or does it print out all id:s? Strange if il_show_contact retrieves all id:s
any how, which modules have you enbaled to be able to do such a call?
On Tue, Nov 13, 2012 at 7:22 AM, Carsten Bock carsten@ng-voice.com wrote:
Hi,
i use the XML-RPC-Client from the ZendFramework, at it works like a charm:
private function getCPEInfo($id) { $xml_servers = array( 'http://127.0.0.1:5060/RPC', ); try { if (!$this->xml_client) { // Choose random Server $this->xml_client = new
Zend_XmlRpc_Client($xml_servers[rand(0,count($xml_servers)-1)]); }
$result = array(); $cpe = array(); $query_result = $this->xml_client->call('mi',
array('ul_show_contact', 'location', $id.'@localhost')); foreach($query_result as $line) { $cpe = array(); list($cpe['contact'], $rest) = explode('>', $line, 2); $cpe['contact'] = substr($cpe['contact'], 11); $contents = explode(';', $rest); foreach($contents as $entry) { list($key, $value) = explode('=', $entry); switch($key) { case 'expires': case 'cflags': case 'user_agent': case 'received': $cpe[$key] = $value; break; default: } } if (isset($cpe['user_agent'])) $cpe['user_agent'] = substr($cpe['user_agent'], 1, -1); if (isset($cpe['received'])) $cpe['received'] = substr($cpe['received'], 1, -1); $result[] = $cpe; }
return $result; } catch ( Exception $e ) { return "Unable to connect (".$e->getMessage().")"; } }
I definitely cannot explain, no matter how many entries i have per account:
- Endgerät:
Kontakt-URI: sip:xxx@xxx:4099 Gültigkeit: noch 3392 Sekunden NAT: kein NAT erkannt Endgerät: Genexis OCG1018MX v1.7.1.1c
- Endgerät:
Kontakt-URI: sip:xxx@xxx:5060 Gültigkeit: noch 3469 Sekunden NAT: kein NAT erkannt Endgerät: Patton SN-DTA 1BIS2V 00A0BA075803 R6.2 2012-07-13 H323 SIP M5T SIP Stack/4.0.30.30
- Endgerät:
Kontakt-URI: sip:xxx@xxx:5060 Gültigkeit: noch 954 Sekunden NAT: kein NAT erkannt Endgerät: Patton SN-DTA 1BIS2V 00A0BA0761CC R6.2 2012-07-13 H323 SIP M5T SIP Stack/4.0.30.30
Kind regards, Carsten
2012/11/13 Carlos Ruiz Díaz carlos.ruizdiaz@gmail.com
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.
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
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
-- Carsten Bock CEO (Geschäftsführer)
ng-voice GmbH Schomburgstr. 80 D-22767 Hamburg / Germany
http://www.ng-voice.com mailto:carsten@ng-voice.com
Office +49 40 34927219 Fax +49 40 34927220
Sitz der Gesellschaft: Hamburg Registergericht: Amtsgericht Hamburg, HRB 120189 Geschäftsführer: Carsten Bock Ust-ID: DE279344284
Hier finden Sie unsere handelsrechtlichen Pflichtangaben: http://www.ng-voice.com/imprint/
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
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
If you write your own parser you will be writing your own implementation of the xmlrpc decoder which I believe could be very complicated not even mentioning that it's close to reinventing the wheel.
I think Carsten's solution is the best right now. I'll try his approach myself.
Best Regards.
Thank you all for you questions.
On Tue, Nov 13, 2012 at 1:51 PM, Carlos Ruiz Díaz carlos.ruizdiaz@gmail.com wrote:
If you write your own parser you will be writing your own implementation of the xmlrpc decoder which I believe could be very complicated not even mentioning that it's close to reinventing the wheel.
I think Carsten's solution is the best right now. I'll try his approach myself.
Another solution is to use the 'mi' method together with the 'ul_dump' mi-command <?xml version='1.0'?> <methodCall> <methodName>mi</methodName> <params> <param> <value><string>ul_dump</string></value> </param> </params> </methodCall>
This call will return an array which is xmlrpc-correct Then I can use any xmlrpc parser to get the data and when the xmlrpc library is done I'll have an string array where every string is a key-value pair which I can take care of.
It is similar to Carstens solution but you don't need to serialize it to CVS format.
./Kristofer
Best Regards.
-- Carlos http://caruizdiaz.com +595981146623
On Tue, Nov 13, 2012 at 8:24 AM, Kristofer Signer kristofer.signer@gmail.com wrote:
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
-- Carlos http://caruizdiaz.com +595981146623
Hello,
On 11/13/12 8:29 AM, Kristofer Signer wrote:
Thank you all for you questions.
On Tue, Nov 13, 2012 at 1:51 PM, Carlos Ruiz Díaz carlos.ruizdiaz@gmail.com wrote:
If you write your own parser you will be writing your own implementation of the xmlrpc decoder which I believe could be very complicated not even mentioning that it's close to reinventing the wheel.
I think Carsten's solution is the best right now. I'll try his approach myself.
Another solution is to use the 'mi' method together with the 'ul_dump' mi-command
<?xml version='1.0'?>
<methodCall> <methodName>mi</methodName> <params> <param> <value><string>ul_dump</string></value> </param> </params> </methodCall>
This call will return an array which is xmlrpc-correct
isn't it more like the text printed by mi command enclosed in the xmlrpc reply? Does it result in a valid xmlrpc array?
Anyhow, we should add support for xmrpc arrays if that's the right approach, should not be that complex, just we thought we don't need. I know that all the records were returned in the xmlreply, but I understand that some parsers overwrite if they get same structure many tines.
Cheers, Daniel
Then I can use any xmlrpc parser to get the data and when the xmlrpc library is done I'll have an string array where every string is a key-value pair which I can take care of.
It is similar to Carstens solution but you don't need to serialize it to CVS format.
./Kristofer
Best Regards.
-- Carlos http://caruizdiaz.com +595981146623
On Tue, Nov 13, 2012 at 8:24 AM, Kristofer Signer kristofer.signer@gmail.com wrote:
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
-- Carlos http://caruizdiaz.com +595981146623
On Wed, Nov 14, 2012 at 12:43 PM, Daniel-Constantin Mierla miconda@gmail.com wrote:
Another solution is to use the 'mi' method together with the 'ul_dump' mi-command
<?xml version='1.0'?>
<methodCall> <methodName>mi</methodName> <params> <param> <value><string>ul_dump</string></value> </param> </params> </methodCall>
This call will return an array which is xmlrpc-correct
isn't it more like the text printed by mi command enclosed in the xmlrpc reply? Does it result in a valid xmlrpc array?
Anyhow, we should add support for xmrpc arrays if that's the right approach, should not be that complex, just we thought we don't need. I know that all the records were returned in the xmlreply, but I understand that some parsers overwrite if they get same structure many tines.
Yes, it's enclosed in a xmlrpc replay and it's a valid xmlrpc array. And your second conclusion is also right in my opinion :)
thanks ./Kristofer
Cheers, Daniel
Then I can use any xmlrpc parser to get the data and when the xmlrpc library is done I'll have an string array where every string is a key-value pair which I can take care of.
It is similar to Carstens solution but you don't need to serialize it to CVS format.
./Kristofer
Best Regards.
-- Carlos http://caruizdiaz.com +595981146623
On Tue, Nov 13, 2012 at 8:24 AM, Kristofer Signer kristofer.signer@gmail.com wrote:
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
-- Carlos http://caruizdiaz.com +595981146623
-- Daniel-Constantin Mierla - http://www.asipto.com http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda