[SR-Users] Problem with 'break' in a 'Switch' body

Daniel-Constantin Mierla miconda at gmail.com
Thu May 28 20:54:35 CEST 2009



On 05/28/2009 09:32 PM, Edson - Lists wrote:
> Sorry... I forgot to mention that:
>  Kamailio 1.5.1-notls SVN 2:5858
then you missed the right mailing list, for kamailio stable versions 
users at lists.kamailio.org is still available.

Only devel lists of kamailio and ser have been combined with sr-dev, as 
development happens in the same place - sip-router.org project.

>
> Just retested on the real script and it gives me "syntax error" on 
> each line that had the break statement...

kamailio 1.5 does not support inside 'break', only at the end of case list:

switch($rc)
{
case 1:
...
break;
case 2:
break:
}

Next version that is based on sip-router will get rid of this 
limitation. You can try it:
http://sip-router.org/wiki/migration/kamailio-3.0-config

Cheers,
Daniel

>
> Edson.
>
> Daniel-Constantin Mierla escreveu:
>> Hello,
>>
>> are you using latest sr from git of http://sip-router.org?
>>
>> I just tested something similar and it starts.
>>
>> Cheers,
>> Daniel
>>
>>
>> On 05/28/2009 09:01 PM, Edson - Lists wrote:
>>> Hi, Guys...
>>>
>>> I use a 'switch' block to drive decisions after a failed 'lookup' 
>>> (on router-block). In theory all Ok, but....
>>>
>>> In the body of this switch, if I use a 'break' inside an 'if' it 
>>> gives me error, saying that it's not allowed.
>>>
>>> See below the code.
>>>
>>> What am I doing wrong?
>>>
>>> Edson.
>>>
>>> ========================================================
>>> route[1] {
>>>   if (!lookup("location") {
>>>     switch ($retcode) {
>>>       case -1:
>>>       case -3:
>>>           if ('situation A') {
>>>             t_on_failure("1");
>>>             break;
>>>           } else {
>>>             if ('condition b') {
>>>               if ('condition b.1') {
>>>                 t_on_failure("2");
>>>                 break;
>>>               };
>>>             };
>>>           };
>>>           exit;
>>>       case -2:
>>>           sl_send_reply("500", "Internal lookup error");
>>>           exit;
>>>     }
>>>   }
>>>   if (!t_relay()) {
>>>     sl_reply_error();
>>>   }
>>>   exit;
>>> }
>>>
>>> _______________________________________________
>>> sr-users mailing list
>>> sr-users at lists.sip-router.org
>>> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>>>   
>>

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





More information about the sr-users mailing list