5. Development

To use the functions for flag operations inside a module you have to include the “flags.h”, file located in OpenSER's sources directory “sip_router”. The name of the functions is the same as the ones to use from configuration file, but now you have to provide the pointer to “sip_msg” structure as the first parameter. The second parameter is the number of the flag to operate on.

The next example presents the prototypes of these functions (just look into “flags.h” file to see them).

Example 8. accounting config file

---
typedef unsigned int flag_t;

int setflag(struct sip_msg* msg, flag_t flag);
int resetflag(struct sip_msg* msg, flag_t flag);
int isflagset(struct sip_msg* msg, flag_t flag);
---