Skip to content

Commit

Permalink
3.17: query all connected nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
k-anderson committed Sep 6, 2014
1 parent 6a6eb9c commit e93a53c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
2 changes: 1 addition & 1 deletion applications/ecallmgr/doc/acls.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,4 @@ You can test whether an IP would be accepted by the Carrier or SBC ACLs:
* `sup -necallmgr ecallmgr_maintenance test_carrier_ip {CARRIER_IP} [{FREESWITCH_NODE}]`
* `sup -necallmgr ecallmgr_maintenance test_sbc_ip {SBC_IP} [{FREESWITCH_NODE}]`

If you don't provide a FreeSWITCH node, a random one will be chosen to be queried. `{FREESWITCH_NODE}` should be formatted as the mod_kazoo node name (`[email protected]`).
If you don't provide a FreeSWITCH node, all connected nodes will be queried. `{FREESWITCH_NODE}` should be formatted as the mod_kazoo node name (`[email protected]`).
22 changes: 16 additions & 6 deletions applications/ecallmgr/src/ecallmgr_maintenance.erl
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,15 @@ carrier_acls('false') ->
list_acls(get_acls(), ?FS_CARRIER_ACL_LIST).

-spec test_carrier_ip(ne_binary()) -> 'ok'.
-spec test_carrier_ip(ne_binary(), ne_binary()) -> 'ok'.
-spec test_carrier_ip(ne_binary(), ne_binary() | ne_binaries()) -> 'ok'.
test_carrier_ip(IP) ->
[N|_] = wh_util:shuffle_list(ecallmgr_fs_nodes:connected()),
test_carrier_ip(IP, N).
Nodes = ecallmgr_fs_nodes:connected(),
test_carrier_ip(IP, Nodes).

test_carrier_ip(_, []) -> 'no_return';
test_carrier_ip(IP, [Node|Nodes]) ->
_ = test_ip_against_acl(IP, Node, ?FS_CARRIER_ACL_LIST),
test_carrier_ip(IP, Nodes);
test_carrier_ip(IP, Node) ->
test_ip_against_acl(IP, Node, ?FS_CARRIER_ACL_LIST).

Expand Down Expand Up @@ -219,10 +224,15 @@ sbc_acls('false') ->
list_acls(get_acls(), ?FS_SBC_ACL_LIST).

-spec test_sbc_ip(ne_binary()) -> 'ok'.
-spec test_sbc_ip(ne_binary(), ne_binary()) -> 'ok'.
-spec test_sbc_ip(ne_binary(), ne_binary() | ne_binaries()) -> 'ok'.
test_sbc_ip(IP) ->
[N|_] = wh_util:shuffle_list(ecallmgr_fs_nodes:connected()),
test_sbc_ip(IP, N).
Nodes = ecallmgr_fs_nodes:connected(),
test_sbc_ip(IP, Nodes).

test_sbc_ip(_, []) -> 'no_return';
test_sbc_ip(IP, [Node|Nodes]) ->
_ = test_ip_against_acl(IP, Node, ?FS_SBC_ACL_LIST),
test_sbc_ip(IP, Nodes);
test_sbc_ip(IP, Node) ->
test_ip_against_acl(IP, Node, ?FS_SBC_ACL_LIST).

Expand Down

0 comments on commit e93a53c

Please sign in to comment.