in the cmd_fucntion, i want to check whether the flag 4 is set.

```
static int update_zone_code (struct sip_msg* msg, char *param) {
    LM_DBG("update_zone_code %s\n", param);
    LM_DBG("========start print method src_ip dst_ip\n");
    LM_DBG("method: %s, ru: %s\n", 
msg->first_line.u.request.method.s, GET_RURI(msg)->s);
    LM_DBG("src_ip: %s, src_port: %d\n", 
ip_addr2a(&msg->rcv.src_ip), msg->rcv.src_port);
    LM_DBG("dst_ip: %s, dst_port: %d\n", 
ip_addr2a(&msg->rcv.dst_ip), msg->rcv.src_port);


    //
    LM_DBG("========start print Flags: %u\n", msg->flags);


&nbsp; &nbsp; if (msg-&gt;flags &amp; (1<<4)) {
&nbsp; &nbsp; &nbsp; &nbsp; LM_DBG("Flag 4 is set\n");
&nbsp; &nbsp; } else {
&nbsp; &nbsp; &nbsp; &nbsp; LM_DBG("Flag 4 is not set\n");
&nbsp; &nbsp; }

```


in the opensips.cfg


```
modparam("demo_module","static_zone_map", "1510217=0728")
modparam("demo_module","static_zone_map", "1510218=0720")
modparam("demo_module","static_zone_map", "1510219=0723")
modparam("demo_module","static_zone_map", "1510219=0723")


route{
&nbsp; &nbsp; xlog("hello");
&nbsp; &nbsp; setflag(4);
&nbsp; &nbsp; setflag(5);
&nbsp; &nbsp; setflag(6);
&nbsp; &nbsp; if (isflagset(6)) {
&nbsp; &nbsp; &nbsp; &nbsp; xlog("flag 6 is set");
&nbsp; &nbsp; } else {
&nbsp; &nbsp; &nbsp; &nbsp; xlog("flag 6 is set");
&nbsp; &nbsp; }
&nbsp; &nbsp; update_zone_code("1210219");
}

```


in the log


```
Nov&nbsp; 3 15:55:34 [6178] DBG:demo_module:update_zone_code: ========start 
print Flags: 7
Nov&nbsp; 3 15:55:34 [6178] DBG:demo_module:update_zone_code: Flag 4 is not set

```


it print the flag is not set,
_______________________________________________
Devel mailing list
[email protected]
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel

Reply via email to