Skip to content

Commit

Permalink
dispatcher: allow 'all' to update all destinations in group via RPC
Browse files Browse the repository at this point in the history
  • Loading branch information
tverlaan committed Jan 14, 2018
1 parent d8cc862 commit d4003b9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
10 changes: 7 additions & 3 deletions src/modules/dispatcher/dispatcher.c
Expand Up @@ -1360,9 +1360,13 @@ static void dispatcher_rpc_set_state(rpc_t *rpc, void *ctx)
return;
}

if(ds_reinit_state(group, &dest, stval) < 0) {
rpc->fault(ctx, 500, "State Update Failed");
return;
if(strcmp(dest.s, "all") == 0) {
ds_reinit_state_all(group, stval);
} else {
if(ds_reinit_state(group, &dest, stval) < 0) {
rpc->fault(ctx, 500, "State Update Failed");
return;
}
}

return;
Expand Down
4 changes: 3 additions & 1 deletion src/modules/dispatcher/doc/dispatcher_admin.xml
Expand Up @@ -1511,7 +1511,8 @@ onreply_route {

<listitem><para>_group_: destination group id</para></listitem>

<listitem><para>_address_: address of the destination in the _group_</para></listitem>
<listitem><para>_address_: address of the destination in the _group_
or 'all' to update all destinations in the group</para></listitem>
</itemizedlist>
<para>
Example:
Expand All @@ -1520,6 +1521,7 @@ onreply_route {
...
# prototype: &sercmd; dispatcher.set_state _state_ _group_ _address_
&sercmd; dispatcher.set_state ip 2 sip:127.0.0.1:5080
&sercmd; dispatcher.set_state ip 3 all
...
</programlisting>
</section>
Expand Down

0 comments on commit d4003b9

Please sign in to comment.