forgotten to CC the list.
regards
klaus
---------------------------- Original Message ----------------------------
Subject: Re: [Users] Recursive routes and retcode
From: "Klaus Darilion" <klaus.mailinglists(a)pernau.at>
Date: Mon, April 10, 2006 23:36
To: "Andreas Granig" <andreas.granig(a)inode.info>
--------------------------------------------------------------------------
Hi Andy!
What is your goal? Do you want to strip the extension till you get the
"kopfnummer" (sorry, I do not know the english term)?
Maybe a special lookup function might be useful which does some kind of
longest match matching (like the SQl query in the LCR module).
I know other which solve this problem by using a private ENUM tree with
wildcard NAPTRs for the extensions which point to the "main URI".
regards
klaus
On Mon, April 10, 2006 18:44, Andreas Granig said:
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
Users(a)openser.org
http://openser.org/cgi-bin/mailman/listinfo/users