Browse code

dispatcher: allow 'all' to update all destinations in group via RPC

Timmo Verlaan authored on 14/01/2018 16:04:07
Showing 2 changed files
... ...
@@ -1360,9 +1360,13 @@ static void dispatcher_rpc_set_state(rpc_t *rpc, void *ctx)
1360 1360
 		return;
1361 1361
 	}
1362 1362
 
1363
-	if(ds_reinit_state(group, &dest, stval) < 0) {
1364
-		rpc->fault(ctx, 500, "State Update Failed");
1365
-		return;
1363
+	if(strcmp(dest.s, "all") == 0) {
1364
+		ds_reinit_state_all(group, stval);
1365
+	} else {
1366
+		if(ds_reinit_state(group, &dest, stval) < 0) {
1367
+			rpc->fault(ctx, 500, "State Update Failed");
1368
+			return;
1369
+		}
1366 1370
 	}
1367 1371
 
1368 1372
 	return;
... ...
@@ -1511,7 +1511,8 @@ onreply_route {
1511 1511
 
1512 1512
 			<listitem><para>_group_: destination group id</para></listitem>
1513 1513
 
1514
-			<listitem><para>_address_: address of the destination in the _group_</para></listitem>
1514
+			<listitem><para>_address_: address of the destination in the _group_
1515
+					or 'all' to update all destinations in the group</para></listitem>
1515 1516
 		</itemizedlist>
1516 1517
 		<para>
1517 1518
 		Example:
... ...
@@ -1520,6 +1521,7 @@ onreply_route {
1520 1520
 ...
1521 1521
 # prototype: &sercmd; dispatcher.set_state _state_ _group_ _address_
1522 1522
 &sercmd; dispatcher.set_state ip 2 sip:127.0.0.1:5080
1523
+&sercmd; dispatcher.set_state ip 3 all
1523 1524
 ...
1524 1525
 </programlisting>
1525 1526
     </section>