Hi there,
For some reason I can't figure this seemingly simple Subj, may be someone can help.
In my particular case, trying to delete Contact[0] from the xavp storing Contacts after t_load_contacts()
$xavp(tm_contacts[0]) = $null;
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.
Thanks.
Hello,
I am not sure I get the issue here, maybe you can give some explicite examples with assignments operations to be able to replicate.
Just be aware, that when you delete an xavp, the list is shifted and another xavp can come in the same place (same index).
Cheers, Daniel
On 03.05.20 05:56, Sergiu Pojoga wrote:
Hi there,
For some reason I can't figure this seemingly simple Subj, may be someone can help.
In my particular case, trying to delete Contact[0] from the xavp storing Contacts after t_load_contacts()
$xavp(tm_contacts[0]) = $null;
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.
Thanks.
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Hi again,
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. modparam("tm", "contacts_avp", "tm_contacts");
Question is: how to delete Contact[x] from $xavp(tm_contacts) ?
Hope this clarifies it.
Thanks.
On Mon, May 11, 2020 at 8:03 AM Daniel-Constantin Mierla miconda@gmail.com wrote:
Hello,
I am not sure I get the issue here, maybe you can give some explicite examples with assignments operations to be able to replicate.
Just be aware, that when you delete an xavp, the list is shifted and another xavp can come in the same place (same index).
Cheers, Daniel On 03.05.20 05:56, Sergiu Pojoga wrote:
Hi there,
For some reason I can't figure this seemingly simple Subj, may be someone can help.
In my particular case, trying to delete Contact[0] from the xavp storing Contacts after t_load_contacts()
$xavp(tm_contacts[0]) = $null;
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.
Thanks.
Kamailio (SER) - Users Mailing Listsr-users@lists.kamailio.orghttps://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
-- Daniel-Constantin Mierla -- www.asipto.comwww.twitter.com/miconda -- www.linkedin.com/in/miconda Funding: https://www.paypal.me/dcmierla
Hello,
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.
Cheers, Daniel
On 11.05.20 16:17, Sergiu Pojoga wrote:
Hi again,
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. modparam("tm", "contacts_avp", "tm_contacts");
Question is: how to delete Contact[x] from $xavp(tm_contacts) ?
Hope this clarifies it.
Thanks.
On Mon, May 11, 2020 at 8:03 AM Daniel-Constantin Mierla <miconda@gmail.com mailto:miconda@gmail.com> wrote:
Hello, I am not sure I get the issue here, maybe you can give some explicite examples with assignments operations to be able to replicate. Just be aware, that when you delete an xavp, the list is shifted and another xavp can come in the same place (same index). Cheers, Daniel On 03.05.20 05:56, Sergiu Pojoga wrote:
Hi there, For some reason I can't figure this seemingly simple Subj, may be someone can help. In my particular case, trying to delete Contact[0] from the xavp storing Contacts after t_load_contacts() $xavp(tm_contacts[0]) = $null; 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. Thanks. _______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org <mailto:sr-users@lists.kamailio.org> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
-- Daniel-Constantin Mierla -- www.asipto.com <http://www.asipto.com> www.twitter.com/miconda <http://www.twitter.com/miconda> -- www.linkedin.com/in/miconda <http://www.linkedin.com/in/miconda> Funding: https://www.paypal.me/dcmierla
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Hi Daniel,
My bad, I'll try to elaborate further. Here's a real example of the xavp structure, printing it in a loop.
# Print Contacts List if(defined $xavp(tm_contacts)) { $var(i) = 0; while($xavp(tm_contacts[$var(i)]) != $null) { xlog("L_INFO", "--- Loaded Contact [$var(i)]\n"); xlog("L_INFO", "UserAgent: $xavp(tm_contacts[$var(i)]=>ua) \n"); xlog("L_INFO", "RUID: $xavp(tm_contacts[$var(i)]=>ruid) \n"); xlog("L_INFO", "Q_flag: $xavp(tm_contacts[$var(i)]=>q_flag) \n"); xlog("L_INFO", "Flags: $xavp(tm_contacts[$var(i)]=>flags) \n"); xlog("L_INFO", "Socket: $xavp(tm_contacts[$var(i)]=>sock) \n"); xlog("L_INFO", "DST_URI: $xavp(tm_contacts[$var(i)]=>dst_uri) \n"); xlog("L_INFO", "R-URI: $xavp(tm_contacts[$var(i)]=>uri) \n"); $var(i) = $var(i) + 1; } }
*Result:*
--- Loaded Contact [0] UserAgent: kamailio SIP Router - RPC Server RUID: ulcx-5e88a468-587c-3 Q_flag: 0 Flags: 0 Socket: <null> DST_URI: sip:10.10.10.10:5060 R-URI: sip:s@10.10.10.10:5060 --- Loaded Contact [1] UserAgent: kamailio SIP Router - RPC Server RUID: ulcx-5e88a468-587c-2 Q_flag: 0 Flags: 0 Socket: <null> DST_URI: sip:10.22.0.30:5070 R-URI: sip:s@10.22.0.30:5070 --- Loaded Contact [2] UserAgent: kamailio SIP Router - RPC Server RUID: ulcx-5e88a468-587c-1 Q_flag: 0 Flags: 0 Socket: <null> DST_URI: sip:10.10.10.10:5070 R-URI: sip:s@10.10.10.10:5070
Thanks.
On Mon, May 11, 2020 at 10:38 AM Daniel-Constantin Mierla miconda@gmail.com wrote:
Hello,
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.
Cheers, Daniel On 11.05.20 16:17, Sergiu Pojoga wrote:
Hi again,
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. modparam("tm", "contacts_avp", "tm_contacts");
Question is: how to delete Contact[x] from $xavp(tm_contacts) ?
Hope this clarifies it.
Thanks.
On Mon, May 11, 2020 at 8:03 AM Daniel-Constantin Mierla < miconda@gmail.com> wrote:
Hello,
I am not sure I get the issue here, maybe you can give some explicite examples with assignments operations to be able to replicate.
Just be aware, that when you delete an xavp, the list is shifted and another xavp can come in the same place (same index).
Cheers, Daniel On 03.05.20 05:56, Sergiu Pojoga wrote:
Hi there,
For some reason I can't figure this seemingly simple Subj, may be someone can help.
In my particular case, trying to delete Contact[0] from the xavp storing Contacts after t_load_contacts()
$xavp(tm_contacts[0]) = $null;
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.
Thanks.
Kamailio (SER) - Users Mailing Listsr-users@lists.kamailio.orghttps://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
-- Daniel-Constantin Mierla -- www.asipto.comwww.twitter.com/miconda -- www.linkedin.com/in/miconda Funding: https://www.paypal.me/dcmierla
Kamailio (SER) - Users Mailing Listsr-users@lists.kamailio.orghttps://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
-- Daniel-Constantin Mierla -- www.asipto.comwww.twitter.com/miconda -- www.linkedin.com/in/miconda Funding: https://www.paypal.me/dcmierla
Hi, shouldn't it be $(xavp(tm_contacts)[0]) = $null; ?
Cheers,
Federico
On Sun, May 3, 2020 at 5:57 AM Sergiu Pojoga pojogas@gmail.com wrote:
Hi there,
For some reason I can't figure this seemingly simple Subj, may be someone can help.
In my particular case, trying to delete Contact[0] from the xavp storing Contacts after t_load_contacts()
$xavp(tm_contacts[0]) = $null;
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.
Thanks. _______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Hi Federico,
So I thought too, mentioned in my 1st post.
But after assigning $null, the xavp contains the following Contact (reference to only the RUIDs):
$xavp(tm_contacts[0]) = $null => ulcx-5e88a468-587c-3 $xavp(tm_contacts[1]) = $null => ulcx-5e88a468-587c-3 & ulcx-5e88a468-587c-2 $xavp(tm_contacts[3]) = $null => empty
On Mon, May 11, 2020 at 11:34 AM Federico Cabiddu < federico.cabiddu@gmail.com> wrote:
Hi, shouldn't it be $(xavp(tm_contacts)[0]) = $null; ?
Cheers,
Federico
On Sun, May 3, 2020 at 5:57 AM Sergiu Pojoga pojogas@gmail.com wrote:
Hi there,
For some reason I can't figure this seemingly simple Subj, may be someone can help.
In my particular case, trying to delete Contact[0] from the xavp storing Contacts after t_load_contacts()
$xavp(tm_contacts[0]) = $null;
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.
Thanks. _______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
@Federico
Just to clarify, noticed a small diff in your suggested expression:
$(xavp(tm_contacts)[0]) = $null; # results in error in cfg "Can't get from cache: $(xavp(tm_contacts)[0])"
$xavp(tm_contacts[0]) = $null; # no errors, but still unexpected values
Thanks.
On Mon, May 11, 2020 at 11:41 AM Sergiu Pojoga pojogas@gmail.com wrote:
Hi Federico,
So I thought too, mentioned in my 1st post.
But after assigning $null, the xavp contains the following Contact (reference to only the RUIDs):
$xavp(tm_contacts[0]) = $null => ulcx-5e88a468-587c-3 $xavp(tm_contacts[1]) = $null => ulcx-5e88a468-587c-3 & ulcx-5e88a468-587c-2 $xavp(tm_contacts[3]) = $null => empty
On Mon, May 11, 2020 at 11:34 AM Federico Cabiddu < federico.cabiddu@gmail.com> wrote:
Hi, shouldn't it be $(xavp(tm_contacts)[0]) = $null; ?
Cheers,
Federico
On Sun, May 3, 2020 at 5:57 AM Sergiu Pojoga pojogas@gmail.com wrote:
Hi there,
For some reason I can't figure this seemingly simple Subj, may be someone can help.
In my particular case, trying to delete Contact[0] from the xavp storing Contacts after t_load_contacts()
$xavp(tm_contacts[0]) = $null;
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.
Thanks. _______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Hi Sergiu, yes I didn't test, just made the suggestion based on avps' syntax :)
Cheers,
Federico
On Mon, May 11, 2020 at 6:26 PM Sergiu Pojoga pojogas@gmail.com wrote:
@Federico
Just to clarify, noticed a small diff in your suggested expression:
$(xavp(tm_contacts)[0]) = $null; # results in error in cfg "Can't get from cache: $(xavp(tm_contacts)[0])"
$xavp(tm_contacts[0]) = $null; # no errors, but still unexpected values
Thanks.
On Mon, May 11, 2020 at 11:41 AM Sergiu Pojoga pojogas@gmail.com wrote:
Hi Federico,
So I thought too, mentioned in my 1st post.
But after assigning $null, the xavp contains the following Contact (reference to only the RUIDs):
$xavp(tm_contacts[0]) = $null => ulcx-5e88a468-587c-3 $xavp(tm_contacts[1]) = $null => ulcx-5e88a468-587c-3 & ulcx-5e88a468-587c-2 $xavp(tm_contacts[3]) = $null => empty
On Mon, May 11, 2020 at 11:34 AM Federico Cabiddu < federico.cabiddu@gmail.com> wrote:
Hi, shouldn't it be $(xavp(tm_contacts)[0]) = $null; ?
Cheers,
Federico
On Sun, May 3, 2020 at 5:57 AM Sergiu Pojoga pojogas@gmail.com wrote:
Hi there,
For some reason I can't figure this seemingly simple Subj, may be someone can help.
In my particular case, trying to delete Contact[0] from the xavp storing Contacts after t_load_contacts()
$xavp(tm_contacts[0]) = $null;
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.
Thanks. _______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users