Skip to content

Commit

Permalink
Negative return code from dispatcher algo route will cause the entry …
Browse files Browse the repository at this point in the history
…to be automatically skipped
  • Loading branch information
vladpaiu committed Dec 12, 2023
1 parent a13e034 commit 5dfc276
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions modules/dispatcher/dispatch.c
Original file line number Diff line number Diff line change
Expand Up @@ -808,6 +808,12 @@ int ds_route_algo(struct sip_msg *msg, ds_set_p set,
fret = run_route_algo(msg, algo_route->idx, &set->dlist[i]);
set->dlist[i].route_algo_value = fret;

if (fret < 0) {
/* move to the end of the list */
sset[end_idx--] = &set->dlist[i];
continue;
}

/* search the proper position */
j = 0;
for (; j < cnt && sset[j]->route_algo_value <= fret; j++);
Expand Down
2 changes: 2 additions & 0 deletions modules/dispatcher/doc/dispatcher_admin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,8 @@ modparam("dispatcher", "attrs_avp", "$avp(script_attrs)")
The return value of the route is considered by the dispatcher module to
be the current weight of the dispatcher entry, and when using the 10
algo, the dispatcher entries are sorted in ascending weight order.

If the returned value from the algo route is negative, the current dispatcher entry will be automatically skipped from usage
</para>
<para>
<emphasis>
Expand Down

0 comments on commit 5dfc276

Please sign in to comment.