[Serusers] How to avoid calling route() in a failure_route block?

Greger V. Teigre greger at teigre.com
Fri Oct 21 08:37:52 CEST 2005


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 at timklein.fastmail.fm>
To: <serusers at lists.iptel.org>
Sent: Friday, October 21, 2005 01:12 AM
Subject: [Serusers] How to avoid calling route() in a failure_route block?


>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);
> }
>
> ==============
>
>
> _______________________________________________
> Serusers mailing list
> serusers at lists.iptel.org
> http://lists.iptel.org/mailman/listinfo/serusers
>
> 




More information about the sr-users mailing list