[OpenSIPS-Users] Break in while loop

Husnain Taseer husnain.taseer at gmail.com
Tue Jun 14 14:05:57 CEST 2016


Dear Users,
I am trying to break the while loop in opensips.cfg when a particular
condition meet. For that I am using 'break' statement inside a while loop.
But when I type break it gives me sytax error :

Jun 14 06:56:00 s81519 opensips: CRITICAL:core:yyerror: parse error in
config file /usr/local/etc/opensips/opensips.cfg, line 697, column 5-10:
syntax error
Jun 14 06:56:00 s81519 opensips: CRITICAL:core:yyerror: parse error in
config file /usr/local/etc/opensips/opensips.cfg, line 697, column 5-10:
bad command!)
Jun 14 06:56:00 s81519 opensips: CRITICAL:core:yyerror: parse error in
config file /usr/local/etc/opensips/opensips.cfg, line 697, column 5-10:
bad command!)
Jun 14 06:56:00 s81519 opensips: ERROR:core:main: bad config file (3 errors)
Jun 14 06:56:00 s81519 opensips: NOTICE:core:main: Exiting....

If I will use return instead of break it will return from the current route
which is also not my requirement. Below is the code snippet.

                            $var(i) = 0;
                while($var(i) < 10) {
usleep("20000");
cache_raw_query("redis:group2","HGETALL $avp(dialed)","$avp(result)");
if ($avp(result) != NULL) {
$avp(CALLER) = $(avp(result)[1]);
$avp(LRN) = $(avp(result)[3]);
xlog("L_NOTICE","[$Ts:$avp(cid)]: LRN Returned '$avp(LRN)'");
break; #Line number 697
}
$var(i) = $var(i) + 1;
}

Please guide.

Regards,
Husnain Taseer
VoIP Developer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20160614/575a5d47/attachment-0001.htm>


More information about the Users mailing list