I have an unusual need: If a contact in the usrloc database is unreachable for any reason, I must immediately delete it from the usrloc database. I know how to do the deletion, but I don't know the right way to write my configuration script.
Below is the script that I want to write. But I think it won't work, because I think it's illegal for a failure_route block to call a route() command. (Am I correct about that?)
Can anyone tell me what I should do instead of the following?
Thank you in advance!
Tim
==============
route {
[...irrelevant stuff omitted...]
if (method==INVITE) { route(1); } }
route[1] { if (lookup("location")) { t_on_failure("99"); t_relay(); } else { t_reply("404","Not Found"); } }
failure_route[99] { delete_location_from_usrloc(); # I will write this function. route(1); }
==============
route can be called from failure_route. Just make sure your function is safe (i.e a failure_route will on a parallell fork be called several times with different messages) g-) ----- Original Message ----- From: "Tim Klein" tkpublic@timklein.fastmail.fm To: serusers@lists.iptel.org Sent: Friday, October 21, 2005 01:12 AM Subject: [Serusers] How to avoid calling route() in a failure_route block?
Greger,
Thank you very much for your help! The documentation says only a few types of actions are legal in failure_route blocks, and route() commands are not listed among them. I'm happy to know that route() commands are OK there though, since that makes some kinds of "retry" strategies easy to program.
Tim
On 10/24/05 18:33, Tim Klein wrote:
there might be problems when calling a route() from a failure_route, if the functions from the route block are not legal in failure_route blocks. The check done in SER does not test the top route type, but current route type. You can port from OpenSER the '-C' option which does such check and should avoid having troubles in this situation.
Daniel