<div dir="ltr">Hi Daniel,<div><br></div><div>My bad, I'll try to elaborate further. Here's a real example of the xavp structure, printing it in a loop. </div><div><br></div><div><div style="color:rgb(212,212,212);background-color:rgb(30,30,30);font-family:Consolas,"Courier New",monospace;font-size:14px;line-height:19px;white-space:pre"><div>    <span style="color:rgb(106,153,85)"># Print Contacts List</span></div><div>    <span style="color:rgb(86,156,214)">if</span>(defined $xavp(tm_contacts)) {</div><div>        $var(i) = <span style="color:rgb(181,206,168)">0</span>;</div><div>        <span style="color:rgb(86,156,214)">while</span>($xavp(tm_contacts[$var(i)]) != <span style="color:rgb(86,156,214)">$null</span>) {</div><div>            xlog(<span style="color:rgb(206,145,120)">"L_INFO"</span>, <span style="color:rgb(206,145,120)">"--- Loaded Contact [$var(i)]\n"</span>);<br></div><div>            xlog(<span style="color:rgb(206,145,120)">"L_INFO"</span>, <span style="color:rgb(206,145,120)">"UserAgent:      $xavp(tm_contacts[$var(i)]=>ua) \n"</span>);</div><div>            xlog(<span style="color:rgb(206,145,120)">"L_INFO"</span>, <span style="color:rgb(206,145,120)">"RUID:           $xavp(tm_contacts[$var(i)]=>ruid) \n"</span>);</div><div>            xlog(<span style="color:rgb(206,145,120)">"L_INFO"</span>, <span style="color:rgb(206,145,120)">"Q_flag:         $xavp(tm_contacts[$var(i)]=>q_flag) \n"</span>);</div><div>            xlog(<span style="color:rgb(206,145,120)">"L_INFO"</span>, <span style="color:rgb(206,145,120)">"Flags:          $xavp(tm_contacts[$var(i)]=>flags) \n"</span>);</div><div>            xlog(<span style="color:rgb(206,145,120)">"L_INFO"</span>, <span style="color:rgb(206,145,120)">"Socket:         $xavp(tm_contacts[$var(i)]=>sock) \n"</span>);</div><div>            xlog(<span style="color:rgb(206,145,120)">"L_INFO"</span>, <span style="color:rgb(206,145,120)">"DST_URI:        $xavp(tm_contacts[$var(i)]=>dst_uri) \n"</span>);</div><div>            xlog(<span style="color:rgb(206,145,120)">"L_INFO"</span>, <span style="color:rgb(206,145,120)">"R-URI:          $xavp(tm_contacts[$var(i)]=>uri) \n"</span>);</div><div>            $var(i) = $var(i) + <span style="color:rgb(181,206,168)">1</span>;</div><div>        }</div><div>    }</div></div></div><div><br></div><div><b>Result:</b></div><div><br></div><div>--- Loaded Contact [0]<br></div><div>UserAgent:      kamailio SIP Router - RPC Server<br>RUID:           ulcx-5e88a468-587c-3<br>Q_flag:         0<br>Flags:          0<br>Socket:         <null><br>DST_URI:        sip:<a href="http://10.10.10.10:5060">10.10.10.10:5060</a><br>R-URI:          <a href="http://sip:s@10.10.10.10:5060">sip:s@10.10.10.10:5060</a><br>--- Loaded Contact [1]<br>UserAgent:      kamailio SIP Router - RPC Server<br>RUID:           ulcx-5e88a468-587c-2<br>Q_flag:         0<br>Flags:          0<br>Socket:         <null><br>DST_URI:        sip:<a href="http://10.22.0.30:5070">10.22.0.30:5070</a><br>R-URI:          <a href="http://sip:s@10.22.0.30:5070">sip:s@10.22.0.30:5070</a><br>--- Loaded Contact [2]<br>UserAgent:      kamailio SIP Router - RPC Server<br>RUID:           ulcx-5e88a468-587c-1<br>Q_flag:         0<br>Flags:          0<br>Socket:         <null><br>DST_URI:        sip:<a href="http://10.10.10.10:5070">10.10.10.10:5070</a><br>R-URI:          <a href="http://sip:s@10.10.10.10:5070">sip:s@10.10.10.10:5070</a><br></div><div><br></div><div>Thanks.</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, May 11, 2020 at 10:38 AM Daniel-Constantin Mierla <<a href="mailto:miconda@gmail.com">miconda@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
  
    
  
  <div>
    <p>Hello,</p>
    <p>I haven't implemented the t_load_contacts() to be familiar with
      how it stored data internally, because it should be more fields
      than the address. That's why I asked if you can provide some
      example with assignments, so one can reproduce the issue and
      eventually give a solution or fix the code.</p>
    <p>Cheers,<br>
      Daniel<br>
    </p>
    <div>On 11.05.20 16:17, Sergiu Pojoga wrote:<br>
    </div>
    <blockquote type="cite">
      
      <div dir="ltr">Hi again,
        <div><br>
        </div>
        <div>After calling t_load_contacts(), all Contacts are stored in
          $xavp(tm_contacts). Then, some evaluation of Contacts is done
          and some of them may need to be dropped so that branches
          aren't created.</div>
        <div>modparam("tm", "contacts_avp", "tm_contacts");<br>
        </div>
        <div><br>
        </div>
        <div>Question is: how to delete Contact[x] from
          $xavp(tm_contacts) ?</div>
        <div><br>
        </div>
        <div>Hope this clarifies it.</div>
        <div><br>
        </div>
        <div>Thanks.</div>
      </div>
      <br>
      <div class="gmail_quote">
        <div dir="ltr" class="gmail_attr">On Mon, May 11, 2020 at 8:03
          AM Daniel-Constantin Mierla <<a href="mailto:miconda@gmail.com" target="_blank">miconda@gmail.com</a>>
          wrote:<br>
        </div>
        <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
          <div>
            <p>Hello,</p>
            <p>I am not sure I get the issue here, maybe you can give
              some explicite examples with assignments operations to be
              able to replicate.</p>
            <p>Just be aware, that when you delete an xavp, the list is
              shifted and another xavp can come in the same place (same
              index).</p>
            <p>Cheers,<br>
              Daniel<br>
            </p>
            <div>On 03.05.20 05:56, Sergiu Pojoga wrote:<br>
            </div>
            <blockquote type="cite">
              <div dir="ltr">Hi there,<br>
                <div><br>
                </div>
                <div>For some reason I can't figure this
                  seemingly simple Subj, may be someone can help.</div>
                <div><br>
                </div>
                <div>In my particular case, trying to delete Contact[0]
                  from the xavp storing Contacts after t_load_contacts()</div>
                <div><br>
                </div>
                <div>$xavp(tm_contacts[0]) = $null;<br>
                </div>
                <div><br>
                </div>
                <div>Above results in all but the latest added value
                  being deleted. Assigning $null to index[1] results in
                  all but the latest 2 being delete and so on.<br>
                </div>
                <div><br>
                </div>
                <div>Thanks.</div>
              </div>
              <br>
              <fieldset></fieldset>
              <pre>_______________________________________________
Kamailio (SER) - Users Mailing List
<a href="mailto:sr-users@lists.kamailio.org" target="_blank">sr-users@lists.kamailio.org</a>
<a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" target="_blank">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
            </blockquote>
            <pre cols="72">-- 
Daniel-Constantin Mierla -- <a href="http://www.asipto.com" target="_blank">www.asipto.com</a>
<a href="http://www.twitter.com/miconda" target="_blank">www.twitter.com/miconda</a> -- <a href="http://www.linkedin.com/in/miconda" target="_blank">www.linkedin.com/in/miconda</a>
Funding: <a href="https://www.paypal.me/dcmierla" target="_blank">https://www.paypal.me/dcmierla</a></pre>
          </div>
        </blockquote>
      </div>
      <br>
      <fieldset></fieldset>
      <pre>_______________________________________________
Kamailio (SER) - Users Mailing List
<a href="mailto:sr-users@lists.kamailio.org" target="_blank">sr-users@lists.kamailio.org</a>
<a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" target="_blank">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
    </blockquote>
    <pre cols="72">-- 
Daniel-Constantin Mierla -- <a href="http://www.asipto.com" target="_blank">www.asipto.com</a>
<a href="http://www.twitter.com/miconda" target="_blank">www.twitter.com/miconda</a> -- <a href="http://www.linkedin.com/in/miconda" target="_blank">www.linkedin.com/in/miconda</a>
Funding: <a href="https://www.paypal.me/dcmierla" target="_blank">https://www.paypal.me/dcmierla</a></pre>
  </div>

</blockquote></div>