Joachim Fabini wrote:
Hi,
Again a question regarding the OpenSER documentation, specifically the usage of flags: What is the context and visibility scope of flags in openser? What is their lifetime?
The visability is the transaction: Thus the flags are valid in the reply route and also in the failure route (honestly I've never used them in reply route but it AFAIK it should work).
Maybe some piece of code to clarify things:
route { if (method=="REGISTER") { setflag(10); # do some processing }
if ((method=="INVITE")||(method=="BYE")) { setflag(11); }
# do some more processing t_relay(); }
onreply_route() { if (isflagset(10)) { # received a reply on register, process it } if (isflagset(11)) { # reply on invite or bye } }
a) Can we expect the flags 10/11 to be identical for route and onreply_route - i.e. in the example above, are the flags in status "set" when processing the onreply_route? I.e. isflagset(10) returns true if we process the 200 OK in reply to a REGISTER?
yes
b) Do we need to explicitely reset the flag or is it automatically cleared? Specifically: If an INVITE and the matching OK are processed, is it required to reset the flag afterwards in onreply_route? I.e., if after the 200OK to INVITE a 200 OK reply to a SUBSCRIBE is processed by onreply_route and we did _not_ reset the flag 11, does isflagset(11) return true or false on the 200 OK for SUBSCRIBE?
Once the transaction (eg INVITE) is over, the transaction will be deleted from memory with all flags belonging to this transaction
Finally another question: must onreply_route be explicitely triggered (like for onreply_route[1] using t_on_reply("1")) or is the default onreply_route anyhow executed automatically on any stateful reply?
the default on_reply route will be executed automatically if present.
klaus