[SR-Dev] git:andrei/switch: script parsing: C style switch() & case support

Daniel-Constantin Mierla miconda at gmail.com
Thu Feb 5 20:40:56 CET 2009



On 02/05/2009 09:22 PM, Iñaki Baz Castillo wrote:
> El Jueves, 5 de Febrero de 2009, Daniel-Constantin Mierla escribió:
>   
>> What if we decide what type of case value is by the first 'case'? If
>> first one is integer, then all should be integers and the 'switch' will
>> have integer optimizations. If not integer, then expect only strings or
>> regular expressions (which will be an useful addition) with the main
>> benefit of a nice-looking config file.
>>     
>
> What about if the first case value is a pseudo-variable whose value could be 
> an integer or string dynamically?
> (BTW I'm not sure now if Kamailio allows pseudo-variables as case value).
>   
It is not in Kamailio - it does support integer or strings in same 
switch, but both static values -- not sure if this is needed or of any 
use (I mean string and int in same switch).

I see switch useful with static values, and regexp will be a good 
addition. Main usage is to map static extensions, e.g.: 112, 911, 
voicemail menu, announcement services...

Cheers,
Daniel


-- 
Daniel-Constantin Mierla
http://www.asipto.com




More information about the sr-dev mailing list