<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";
        mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";
        mso-fareast-language:EN-US;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-GB" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal">Hello Daniel / List,<o:p></o:p></p>
<p class="MsoNormal">I think I have found some issues with the usrloc/serial forking/ul attributes functionality. I hope the following explanation is not too complicated!<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">The registrar.lookup() function loads contacts into the ruri and branch[] structures. If there are ulattrs associated with the record, these are loaded into an XAVP indexed by branch.<o:p></o:p></p>
<p class="MsoNormal">This means that if I immediately run t_relay(), I can use $xavp(ulattrs[$T_branch_idx]=>key) in the branch_route to access per-location attributes.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Issue 1:<o:p></o:p></p>
<p class="MsoNormal">As far as I see, if I run t_load_contacts() & t_next_contacts(), the ulattrs XAVP stack is not loaded along with the branches and may cause the branches and ulattrs XAVP to be mismatched. I believe the fix is to load each XAVP along with
 the branch info, and then reassign back to the correct index in t_next_contacts/t_next_contact_flow. Does this sound correct?<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Issue 2:<o:p></o:p></p>
<p class="MsoNormal">When a usrloc contact record is created, the XAVP associated with each contact is cloned from the existing ‘ulattrs’ XAVP if one is already attached to the transaction. The code in usrloc/ucontact.c lines 53-84 does this cloning and was
 added by Daniel in Dec 2012 as part of the original xavp feature (<a href="https://github.com/kamailio/kamailio/commit/e6ad428f6699621b7ee622984eeea3e3e2f6cb80/modules_k/usrloc/ucontact.c">https://github.com/kamailio/kamailio/commit/e6ad428f6699621b7ee622984eeea3e3e2f6cb80/modules_k/usrloc/ucontact.c</a>).<o:p></o:p></p>
<p class="MsoNormal">This code is used when save() is called, to store the attributes into the record before saving to the database.<o:p></o:p></p>
<p class="MsoNormal">It is also run when lookup() is called and in some cases this can lead to the attributes loaded from the database being discarded or incorrect ones being cloned. I need this xavp cloning to be turned off on a lookup. Was the intention to
 have the option to clone changeable depending on where it was called from? There is a function to set the option, but it is never called from anywhere.
<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I don’t have a fix for the 2<sup>nd</sup> issue yet. Is it too late to get these into 4.3.0?<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Regards,<o:p></o:p></p>
<p class="MsoNormal">Hugh<o:p></o:p></p>
</div>
<hr>
<p class="MsoNormal"><span style="font-size:7.5pt;line-height:115%;font-family:
"Arial","sans-serif";mso-fareast-font-family:"Times New Roman";color:gray">This e-mail and any attachment
<span class="GramE">is</span> for <span class="SpellE">authorised</span> use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained
 or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you for understanding.</span></p>
</body>
</html>