[Serusers] developer related question

Andrei Pelinescu-Onciul pelinescu-onciul at fokus.fraunhofer.de
Tue Jul 20 09:02:27 CEST 2004


On Jul 19, 2004 at 21:35, Joseph Cheung <Joseph.Cheung2 at TELUS.COM> wrote:
> Hi.
> 
> I think there is another email address I would use for this kinds of question. If so, much appreciate if someone could let me know.

serdev at lists.iptel.org
> 
> Here is my question.
> 
> I have created a module that will lookup the database and determine if I should forward, redirect, or reject the request.
> 
> Since there is no switch statement in the script, I am wondering if I would save the "action" into a static variable and export a function to check and determine the action.
> 
> I know the above could be done and it should be ok as we do a fork - should duplicate the memory as well.  
> 
> I would much appreciate if someone could give me a YES or NO answer or any idea how this is done.

Yes. :-)
To see if you don't use a previously saved value, you can check against
the message id (which is unique per process).
e.g.:

 /* set var */
 saved_id=msg->id;
 saved_value= ...;

 /* check val */

 if (saved_id==msg_id){
    return f(saved_value);
 }else{ /* no value was saved for this message, use the default one */
    return f(default_value);
 }


Andrei




More information about the sr-users mailing list