bundasmanu left a comment (kamailio/kamailio#4460)

> Looking at the diff of the PR:
> 
> ```diff
> diff --git a/src/modules/dispatcher/dispatch.c 
> b/src/modules/dispatcher/dispatch.c
> index 3c40307c1fd..627f1a621d4 100644
> --- a/src/modules/dispatcher/dispatch.c
> +++ b/src/modules/dispatcher/dispatch.c
> @@ -3529,17 +3529,29 @@ int ds_update_state(sip_msg_t *msg, int group, str 
> *address, str *iuid,
>                               }
>                       }
>  
> -                     if((ds_event_callback_mode == 0)
> -                                     || ((mode & DS_STATE_MODE_FUNC) == 0)) {
> -                             if(!ds_skip_dst(old_state)
> -                                             && 
> ds_skip_dst(idx->dlist[i].flags)) {
> -                                     ds_run_route(msg, address, 
> "dispatcher:dst-down", rctx);
> -
> -                             } else if(ds_skip_dst(old_state)
> -                                               && 
> !ds_skip_dst(idx->dlist[i].flags)) {
> -                                     ds_run_route(msg, address, 
> "dispatcher:dst-up", rctx);
> +
> +                     if((mode & DS_STATE_MODE_FUNC) == 0) {
> +                             int was_down = ds_skip_dst(old_state);
> +                             int is_down = ds_skip_dst(idx->dlist[i].flags);
> +
> +                             if(ds_event_callback_mode == 0) {
> +
> +                                     if(!was_down && is_down) {
> +                                             ds_run_route(msg, address, 
> "dispatcher:dst-down", rctx);
> +                                     } else if(was_down && !is_down) {
> +                                             ds_run_route(msg, address, 
> "dispatcher:dst-up", rctx);
> +                                     }
> +                             } else if(ds_event_callback_mode == 2) {
> +
> +                                     if((!was_down && is_down) || (old_state 
> == 0 && is_down)) {
> +                                             ds_run_route(msg, address, 
> "dispatcher:dst-down", rctx);
> +                                     } else if((was_down && !is_down)
> +                                                       || (old_state == 0 && 
> !is_down)) {
> +                                             ds_run_route(msg, address, 
> "dispatcher:dst-up", rctx);
> +                                     }
>                               }
>                       }
> ```
> 
> The OR condition of `if((ds_event_callback_mode == 0) || ((mode & 
> DS_STATE_MODE_FUNC) == 0)) ` is now an AND with:
> 
> ```
>                       if((mode & DS_STATE_MODE_FUNC) == 0) {
>                                  ....
>                               if(ds_event_callback_mode == 0) {
> ```
> 
> Is it still working as it was? I didn't analyze it thoroughly, but noticed 
> while checking the changes.

>From my tests i didn't see any particular issue.

But, do you want something like this?

```
if((ds_event_callback_mode == 0)
    || (ds_event_callback_mode == 2)
    || ((mode & DS_STATE_MODE_FUNC) == 0)) {
...
```

-- 
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/4460#issuecomment-3522858039
You are receiving this because you are subscribed to this thread.

Message ID: <kamailio/kamailio/pull/4460/[email protected]>
_______________________________________________
Kamailio - Development Mailing List -- [email protected]
To unsubscribe send an email to [email protected]
Important: keep the mailing list in the recipients, do not reply only to the 
sender!

Reply via email to