<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hello,<br>
    <br>
    thanks, I applied the patch to master and 4.1, plus adapted for 4.0
    branches.<br>
    <br>
    Cheers,<br>
    Daniel<br>
    <br>
    <div class="moz-cite-prefix">On 07/05/14 16:39, Klaus Feichtinger
      wrote:<br>
    </div>
    <blockquote
cite="mid:836273175.546.1399473561567.open-xchange@webmail.upcbusiness.at"
      type="cite">
      <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
      <div>
        <div> Pls find attached the patch for version 4.1.3. The three
          lines of code are equal for all affected version (incl. 3.2.4,
          3.3.5, 4.0.6 and 4.1.3). </div>
        <div>   </div>
        <div> regards, </div>
        Klaus </div>
      <blockquote style="position: relative; margin-left: 0px;
        padding-left: 10px; border-left: solid 1px blue;" type="cite">
        Daniel-Constantin Mierla <a class="moz-txt-link-rfc2396E" href="mailto:miconda@gmail.com"><miconda@gmail.com></a> hat am 7. Mai
        2014 um 15:45 geschrieben: <br>
        <br>
        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: </div>
        <blockquote type="cite">
          <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>
        </blockquote>
      </blockquote>
    </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>