Hi,

I'd like to recursively strip off digits from the tail of a username (a numeric number in fact) and do a lookup in usrloc until an aor is found or the number underruns a lower bound, like:

route[2] {
  if(lookup("location")) return(2);
  if(!uri =~ "^sip:[0-9]{6}[0-9]*@") return(3);
  strip_tail(1);
  route(2);
}

route[3] {
  # check if numeric, then:
  route(2);
  if(retcode==1) {...}
  else if(retcode==2) {...}
  else if(retcode == 3) {...}
  # ...
}

The thing is that it obviously doesn't work (retcode is 1 as soon as one recursion happens) because I can't tell the recursive call to properly return the retcode like "return(route(2))" or "return($?)" or something like that. Any other ideas except using flags or is that the only way to go?

Thanks,
Andy

_______________________________________________
Users mailing list
[email protected]
http://openser.org/cgi-bin/mailman/listinfo/users

Reply via email to