[SR-Users] kamailio/script call route(...) in switch(...) expression

Seudin Kasumovic seudin.kasumovic at gmail.com
Mon Dec 9 00:04:56 CET 2013


Hi,

Let route[FOO]{...} returns -1, 0, or 1 value.

Next example never print message in case -1:

switch (route(FOO)) {
  case -1:
xlog("L_INFO", "FOO = -1\n");
  break;
  case 0:
    xlog("L_INFO", "FOO = zero\n");
    break;
  case 1:
    xlog("L_INFO", "FOO = +1\n");
  break;
}

Result from route(FOO) less then to zero converted to 0, so never get label
-1,
but next example works properly (when use $rc):

route(FOO);
switch ($rc) {
  case -1:
xlog("L_INFO", "FOO = -1\n");
  break;
  case 0:
    xlog("L_INFO", "FOO = zero\n");
    break;
  case 1:
    xlog("L_INFO", "FOO = +1\n");
  break;
}

Is this bug, or regular behavior ?

Regards,
Seudin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20131209/8728aca9/attachment.html>


More information about the sr-users mailing list