<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hello,<br>
<br>
can you send the patch to be reviewed?<br>
<br>
Cheers,<br>
Daniel<br>
<br>
<div class="moz-cite-prefix">On 07/05/14 13:15, Klaus Feichtinger
wrote:<br>
</div>
<blockquote
cite="mid:940615980.54593.1399461323191.open-xchange@webmail.upcbusiness.at"
type="cite">
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
<div> Hi Daniel, </div>
<div> Â </div>
<div> I think we´ve found the reason, why this problem occurs! </div>
<div> Â </div>
<div> The problem is caused in the "agregate_xmls" function in
file "notify_body.c" of the "presence_dialoginfo" module: </div>
<div> Â </div>
<div> Â Â Â /* loop over all bodies and create the aggregated body
*/ <br>
   for(i=0; i<j; i++) <br>
   { <br>
      /* LM_DBG("[n]=%d, [i]=%d, [j]=%d xml_array[i]=%p\n", n,
i, j, xml_array[j] ); */ <br>
      p_root= xmlDocGetRootElement(xml_array[i]); <br>
         if(p_root ==NULL) { <br>
            LM_ERR("while geting the xml_tree root
element\n"); <br>
            goto error; <br>
         } <br>
         if (p_root->children) { <br>
         for (node = p_root->children; node; node =
node->next) { <br>
            if (node->type == XML_ELEMENT_NODE) { <br>
               LM_DBG("node type: Element, name: %s\n",
node->name); <br>
               /* we do not copy the node, but unlink it
and then add it ot the new node <br>
               * this destroys the original document but
we do not need it anyway. <br>
               * using "copy" instead of "unlink" would
also copy the namespace which <br>
               * would then be declared redundant (libxml
unfortunately can not remove <br>
               * namespaces) <br>
               */ <br>
               if (!force_single_dialog || (j==1)) { <br>
                  xmlUnlinkNode(node); <br>
                  if(xmlAddChild(root_node, node)== NULL)
{ <br>
                     LM_ERR("while adding child\n"); <br>
                     goto error; <br>
                  } </div>
<div> Â </div>
<div> It seems to be not the best idea to "unlink" the XML node (=
"xmlUnlinkNode(node);"), as then no "node->next" is available
any more. Therefore, this loop will _always_ stop after one
dialog entry and ignore any additional one! </div>
<div> Â </div>
<div> But we "solved" the problem in this way that the loop will
not directly use "node->next", but a variable, which is set
within the loop. It looks like this: </div>
<div> Â Â Â Â Â Â Â Â Â Â Â xmlNodePtr next_node = NULL; </div>
<div> Â Â Â Â Â Â Â Â Â Â [...] </div>
<div> Â Â Â Â Â Â Â Â Â if (p_root->children) { <br>
         for (node = p_root->children; node; node =
next_node) { <br>
               next_node = node->next; <br>
            if (node->type == XML_ELEMENT_NODE) { </div>
<div> Â Â Â Â Â Â Â Â Â Â Â Â Â [...] </div>
<div> Â </div>
<div> This solution has been tested with 2 and 3 dialog entries in
a single PUBLISH request and it is working fine. We should
discuss if this is a problem that should be solved generally or
if it is a "private" problem in our use case. </div>
<div> Â </div>
<div> What do you mean? </div>
<div> <br>
regards, </div>
<div> Klaus </div>
<div> Â </div>
<div> P.S. debug output (excerpt) of the "adapted" src code of
release 4.1.3: <br>
May 7 13:11:07 sipsrvnode1
/usr/local/kamailio41/sbin/kamailio[21030]: DEBUG: presence
[notify.c:744]: get_p_notify_body(): Event requires aggregation
<br>
May 7 13:11:07 sipsrvnode1
/usr/local/kamailio41/sbin/kamailio[21030]: DEBUG:
presence_dialoginfo [notify_body.c:75]: dlginfo_agg_nbody():
[pres_user]=116001 [pres_domain]= 10.16.48.44, [n]=1 <br>
May 7 13:11:07 sipsrvnode1
/usr/local/kamailio41/sbin/kamailio[21030]: DEBUG:
presence_dialoginfo [notify_body.c:127]: agregate_xmls():
[pres_user]=116001 [pres_domain]= 10.16.48.44, [n]=1 <br>
May 7 13:11:07 sipsrvnode1
/usr/local/kamailio41/sbin/kamailio[21030]: DEBUG:
presence_dialoginfo [notify_body.c:146]: agregate_xmls():
parsing XML body: [n]=1, [i]=0, [j]=0 xml_array[j]=0x9311820 <br>
May 7 13:11:07 sipsrvnode1
/usr/local/kamailio41/sbin/kamailio[21030]: DEBUG:
presence_dialoginfo [notify_body.c:167]: agregate_xmls(): number
of bodies in total [n]=1, number of useful bodies [j]=1 <br>
May 7 13:11:07 sipsrvnode1
/usr/local/kamailio41/sbin/kamailio[21030]: DEBUG:
presence_dialoginfo [notify_body.c:211]: agregate_xmls(): [n]=1,
[i]=0, [j]=1 xml_array[i]=0xc0c0c0c0 <br>
May 7 13:11:07 sipsrvnode1
/usr/local/kamailio41/sbin/kamailio[21030]: DEBUG:
presence_dialoginfo [notify_body.c:222]: agregate_xmls(): node
type: Element, name: dialog <br>
May 7 13:11:07 sipsrvnode1
/usr/local/kamailio41/sbin/kamailio[21030]: DEBUG:
presence_dialoginfo [notify_body.c:222]: agregate_xmls(): node
type: Element, name: dialog <br>
May 7 13:11:07 sipsrvnode1
/usr/local/kamailio41/sbin/kamailio[21030]: DEBUG:
presence_dialoginfo [notify_body.c:222]: agregate_xmls(): node
type: Element, name: dialog <br>
May 7 13:11:07 sipsrvnode1
/usr/local/kamailio41/sbin/kamailio[21030]: DEBUG:
presence_dialoginfo [notify_body.c:81]: dlginfo_agg_nbody():
[n_body]=0xb7ab5274 <br>
May 7 13:11:07 sipsrvnode1
/usr/local/kamailio41/sbin/kamailio[21030]: DEBUG:
presence_dialoginfo [notify_body.c:84]: dlginfo_agg_nbody():
[*n_body]=<?xml version="1.0"?>#012<dialog-info
xmlns="urn:ietf:params:xml:ns:dialog-info" version="00000000000"
state="full" entity=<a class="moz-txt-link-rfc2396E" href="sip:116001@10.16.48.44">"sip:116001@10.16.48.44"</a>>#012Â <dialog
id=<a class="moz-txt-link-rfc2396E" href="mailto:CBE263FF-CEAE11E3-80E8CCBC-52135ACA@172.31.60.13">"CBE263FF-CEAE11E3-80E8CCBC-52135ACA@172.31.60.13"</a>
call-id=<a class="moz-txt-link-rfc2396E" href="mailto:CBE263FF-CEAE11E3-80E8CCBC-52135ACA@172.31.60.13">"CBE263FF-CEAE11E3-80E8CCBC-52135ACA@172.31.60.13"</a>
direction="recipient">#012<state>terminated</state>#012<remote>#012<identity><a class="moz-txt-link-freetext" href="sip:1101015004@172.31.60.13">sip:1101015004@172.31.60.13</a></identity>#012<target
uri=<a class="moz-txt-link-rfc2396E" href="sip:1101015004@172.31.60.13">"sip:1101015004@172.31.60.13"</a>/>#012</remote>#012<local>#012<identity><a class="moz-txt-link-freetext" href="sip:117103@172.31.60.87">sip:117103@172.31.60.87</a></identity>#012<target
uri=<a class="moz-txt-link-rfc2396E" href="sip:117103@172.31.60.87">"sip:117103@172.31.60.87"</a>/>#012</local>#012</dialog>#012Â
<dialog id=<a class="moz-txt-link-rfc2396E" href="mailto:1041054395-29684904-1398759995534@172.31.60.53">"1041054395-29684904-1398759995534@172.31.60.53"</a>
call-id=<a class="moz-txt-link-rfc2396E" href="mailto:1041054395-29684904-1398759995534@172.31.60.53">"1041054395-29684904-1398759995534@172.31.60.53"</a>
direction="initiator">#012<state>confirmed</state>#012<remote>#012<identity><a class="moz-txt-link-freetext" href="sip:117101@172.31.60.87">sip:117101@172.31.60.87</a></identity>#012<target
uri=<a class="moz-txt-link-rfc2396E" href="sip:117101@172.31.60.87">"sip:117101@172.31.60.87"</a>/>#012</remote>#012<local>#012<identity><a class="moz-txt-link-freetext" href="sip:117103@172.31.60.87">sip:117103@172.31.60.87</a></identity>#012<target
uri=<a class="moz-txt-link-rfc2396E" href="sip:117103@172.31.60.87">"sip:117103@172.31.60.87"</a>/>#012</local>#012</dialog>#012Â
<dialog id=<a class="moz-txt-link-rfc2396E" href="mailto:2081054457-54683129-1398759736821@172.31.60.54">"2081054457-54683129-1398759736821@172.31.60.54"</a>
call-id=<a class="moz-txt-link-rfc2396E" href="mailto:2081054457-54683129-1398759736821@172.31.60.54">"2081054457-54683129-1398759736821@172.31.60.54"</a>
direction="recipient">#012<state>alerting</state>#012<remote>#012<identity><a class="moz-txt-link-freetext" href="sip:1101015005@172.31.60.87">sip:1101015005@172.31.60.87</a></identity>#012<target
uri=<a class="moz-txt-link-rfc2396E" href="sip:1101015005@172.31.60.87">"sip:1101015005@172.31.60.87"</a>/>#012</remote>#012<local>#012<identity><a class="moz-txt-link-freetext" href="sip:117103@172.31.60.87">sip:117103@172.31.60.87</a></identity>#012<target
uri=<a class="moz-txt-link-rfc2396E" href="sip:117103@172.31.60.87">"sip:117103@172.31.60.87"</a>/>#012</local>#012</dialog>#012</dialog-info>#012
<br>
May 7 13:11:07 sipsrvnode1
/usr/local/kamailio41/sbin/kamailio[21030]: DEBUG: presence
[notify.c:1564]: send_notify_request():
headers:#012Max-Forwards: 70#015#012Event:
dialog#015#012Contact:
<a class="moz-txt-link-rfc2396E" href="sip:10.16.48.44:5060"><sip:10.16.48.44:5060></a>#015#012Subscription-State:
active;expires=1799#015#012Content-Type:
application/dialog-info+xml#015#012 <br>
May 7 13:11:07 sipsrvnode1
/usr/local/kamailio41/sbin/kamailio[21030]: DEBUG: presence
[notify.c:926]: ps_build_dlg_t(): CONTACT =
<a class="moz-txt-link-freetext" href="sip:116633@10.16.48.14:5070">sip:116633@10.16.48.14:5070</a> <br>
May 7 13:11:07 sipsrvnode1
/usr/local/kamailio41/sbin/kamailio[21030]: DEBUG: presence
[notify.c:1574]: send_notify_request(): expires 1799 status 1 <br>
May 7 13:11:07 sipsrvnode1
/usr/local/kamailio41/sbin/kamailio[21030]: DEBUG: presence
[notify.c:1727]: shm_dup_cbparam(): === 22/6/37 <br>
May 7 13:11:07 sipsrvnode1
/usr/local/kamailio41/sbin/kamailio[21030]: INFO: presence
[notify.c:1601]: send_notify_request(): NOTIFY
<a class="moz-txt-link-freetext" href="sip:116633@10.16.48.14">sip:116633@10.16.48.14</a> via <a class="moz-txt-link-freetext" href="sip:116633@10.16.48.14:5070">sip:116633@10.16.48.14:5070</a> on behalf
of <a class="moz-txt-link-freetext" href="sip:116001@10.16.48.44">sip:116001@10.16.48.44</a> for event dialog <br>
May 7 13:11:07 sipsrvnode1
/usr/local/kamailio41/sbin/kamailio[21025]: DEBUG: presence
[notify.c:1701]: p_tm_callback(): completed with status 200
[to_tag:4f7a7e54f75c89f5b968c90011d693b5-9ec9] <br>
<br>
</div>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
Daniel-Constantin Mierla - <a class="moz-txt-link-freetext" href="http://www.asipto.com">http://www.asipto.com</a>
<a class="moz-txt-link-freetext" href="http://twitter.com/#!/miconda">http://twitter.com/#!/miconda</a> - <a class="moz-txt-link-freetext" href="http://www.linkedin.com/in/miconda">http://www.linkedin.com/in/miconda</a></pre>
</body>
</html>