bug in RPID parsing, with patch.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In 1.10, I found what I think is a bug with RPID parsing.

Asterisk generates RPID xml that looks like this: 

<?xml version="1.0" encoding="ISO-8859-1"?>
<presence xmlns="urn:ietf:params:xml:ns:pidf" 
xmlns:pp="urn:ietf:params:xml:ns:pidf:person"
xmlns:es="urn:ietf:params:xml:ns:pidf:rpid:status:rpid-status"
xmlns:ep="urn:ietf:params:xml:ns:pidf:rpid:rpid-person"
entity="sip:321 at 10.10.3.77">
<pp:person><status>
<ep:activities><ep:away/></ep:activities>
</status></pp:person>
<note>Not online</note>
<tuple id="666">
<contact priority="1">sip:666 at 10.10.3.77</contact>
<status><basic>closed</basic></status>
</tuple>
</presence>

Note the structure for the activities tag is:
presence
-- person
-- -- status
-- -- -- activities
-- -- -- -- away

However, the code in rpid.c is looking for presence/person/activities instead of 
presence/person/status/activities.

This patch makes it work:

Index: callbridge/pjproject-1.10/pjsip/src/pjsip-simple/rpid.c
===================================================================
--- callbridge/pjproject-1.10/pjsip/src/pjsip-simple/rpid.c     (revision 33933)
+++ callbridge/pjproject-1.10/pjsip/src/pjsip-simple/rpid.c     (revision 33936)
@@ -220,7 +220,7 @@
                                       pj_pool_t *pool,
                                       pjrpid_element *elem)
 {
-    const pj_xml_node *nd_person, *nd_activities, *nd_note = NULL;
+    const pj_xml_node *nd_person, *nd_activities, *nd_status, *nd_note = NULL;
     const pj_xml_attr *attr;
 
     /* Reset */
@@ -239,8 +239,14 @@
     if (attr)
        pj_strdup(pool, &elem->id, &attr->value);
 
+    /* get <status> */
+    nd_status = find_node(nd_person, "status") ;
+
     /* Get <activities> */
-    nd_activities = find_node(nd_person, "activities");
+    if (nd_status) 
+        nd_activities = find_node(nd_status, "activities");
+    else 
+        nd_activities = NULL ;
     if (nd_activities) {
        const pj_xml_node *nd_activity;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20110707/d2c9759e/attachment.html>


[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux