Ok, thank you Dmitri. I'll need to use iteration then, which is ok too. I have a set of known contacts in Horde Groupware (https://www.horde.org/) that I would like to set the identity for when the callerid number matches. That way when someone calls, instead of getting "WIRELESS CALLER" for the callerid, I would get "John Q Public"
Since the DB query for every incoming call is rather costly, I wanted to use something like http://acalustra.com/kamailio-from-tables-to-htables.html but store the hashtable like: key: 1234567 value: John Q Public Though the $fU might be any of +1234567, 1234567, or 234567 (differing prefixes) I might play with something like: sht_iterator_start("i1", "h1"); while(sht_iterator_next("i1")) { if(h1[$shtitkey(i1)]=~$fU) { xlog("CallerID is: $shtitval(i1)\n"); append_hf("P-Asserted-Identity: tel:$shtitval(i1)\r\n"); } break; } sht_iterator_end("i1"); On Wednesday, January 31, 2018 4:52:02 PM CST Dmitri Savolainen wrote: > Hi, Anthony > Masks are not possible for getting values. But sometimes "array" approach > may be usefull > > $var(i) = 0; > $var(cache_mask) = "slice_a"; > $var(cache_size) = $sht(mycache=>$var(cache_mask)::size); > while( $var(i) < $var(cache_size) ){ > # do smth with $sht(mycache=>$var(cache_mask)[$var(i)]) > $var(i) = $var(i) + 1; > } > > > 2018-01-31 21:36 GMT+03:00 Anthony Joseph Messina <amess...@messinet.com>: > Is is possible (without iterating through all entries in a hash table) to > return the value based on a partial or regex match to the key? > > Something like... > $var(one)=$sht(a=>*$var(two))
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users