Hi,
your code is not correct as the $retcode returns the ret code of the
last executed instruction, including the "if" statement - to have a
correct code, you need to save the $retcode value immediately after the
call of load_balance() function....
Most probably the "1" val you see is the "true" return code of the "if"
code. Try:
if ( uri=~"sip:92[1-9][0-...@.*" ) {
load_balance("27","white");
$var(x) = $retcode;
} else if ( uri=~"sip:3392[1-9][0-...@.*" ) {
load_balance("27","grey"); #
$var(x) = $retcode;
}
if ( $var(x) < 0 ) {
sl_send_reply("500","Service full");
exit;
}
Regards,
Bogdan
k1028 wrote:
> I figured it out.
>
> This work all the time
> if ( uri=~"sip:92[1-9][0-...@.*" ) {
> load_balance("27","white");
> } else if ( uri=~"sip:3392[1-9][0-...@.*" ) {
> load_balance("27","grey"); #
> }
> if ( $retcode < 0 ) {
> sl_send_reply("500","Service full");
> exit;
> }
>
> This work sometime
> if ( uri=~"sip:92[1-9][0-...@.*" ) {
> load_balance("27","white");
> }
> if ( uri=~"sip:3392[1-9][0-...@.*" ) {
> load_balance("27","grey"); #
> }
> if ( $retcode < 0 ) {
> sl_send_reply("500","Service full");
> exit;
> }
>
>
--
Bogdan-Andrei Iancu
OpenSIPS Bootcamp
20 - 24 September 2010, Frankfurt, Germany
www.voice-system.ro
_______________________________________________
Users mailing list
[email protected]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users