[SR-Users] obtaining htable array index

Asgaroth 00asgaroth00 at gmail.com
Tue Feb 28 17:20:03 CET 2012


I was looking to implement a hash table to select a particular 
dispatcher destination set based on the sip request method. I was hoping 
to achieve it by using an array in the hash table for a particular 
domain. so for example have a htable as follows:

domain[0]:: REGISTER-1
domain[1]:: INVITE-2
domain[2]:: 3

where I could then lookup using $rm-* and use transforms to extract the 
"1" or "2" which would then match up to a setid in the dispatcher table 
that I could select against, if no match then select the "catch-all" set 
which would associate with domain[2] above.

Is this achievable with htable or am I using the wrong tool for the job?

I guess another approach would be to hardcode a switch statement 
relating to the sip request method and use a separate htable for each 
request type.

Thoughts/comments are appreciated.


On 28/02/12 16:09, Alex Balashov wrote:
> I guess the first question would be: why would you want to? Constructs 
> like hash tables and other data structures are usually meant to be 
> used in a high-level way, their inner workings opaque from the user.  
> That tends to be true in general-purpose programming runtimes, as 
> well.  What are you trying to achieve?
>




More information about the sr-users mailing list