Skip to content

Commit

Permalink
Merge pull request 2600hz#476 from 2600hz/KAZOO-2163
Browse files Browse the repository at this point in the history
Kazoo 2163
  • Loading branch information
k-anderson committed Aug 26, 2014
2 parents 6ff8524 + 80bb349 commit 8c2b3ea
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 10 deletions.
29 changes: 22 additions & 7 deletions applications/ecallmgr/src/ecallmgr_fs_config.erl
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,16 @@ code_change(_OldVsn, State, _Extra) ->
%%% Internal functions
%%%===================================================================
-spec handle_config_req(atom(), ne_binary(), ne_binary(), wh_proplist() | 'undefined') -> fs_sendmsg_ret().
handle_config_req(Node, Id, <<"acl.conf">>, _) ->
put('callid', Id),
handle_config_req(Node, Id, <<"acl.conf">>, _Props) ->
wh_util:put_callid(Id),

SysconfResp = ecallmgr_config:fetch(<<"acls">>, wh_json:new()),

try generate_acl_xml(SysconfResp) of
'undefined' ->
lager:warning("failed to query for ACLs; is sysconf running?"),
{'ok', Resp} = ecallmgr_fs_xml:not_found(),
freeswitch:fetch_reply(Node, Id, 'configuration', Resp);
ConfigXml ->
lager:debug("sending acl XML to ~s: ~s", [Node, ConfigXml]),
freeswitch:fetch_reply(Node, Id, 'configuration', ConfigXml)
Expand All @@ -172,8 +178,9 @@ handle_config_req(Node, Id, <<"acl.conf">>, _) ->
{'ok', Resp} = ecallmgr_fs_xml:not_found(),
freeswitch:fetch_reply(Node, Id, 'configuration', iolist_to_binary(Resp))
end;
handle_config_req(Node, Id, <<"sofia.conf">>, _) ->
put('callid', Id),
handle_config_req(Node, Id, <<"sofia.conf">>, _Props) ->
wh_util:put_callid(Id),

case wh_util:is_true(ecallmgr_config:get(<<"sofia_conf">>)) of
'false' ->
lager:info("sofia conf disabled"),
Expand All @@ -194,7 +201,8 @@ handle_config_req(Node, Id, <<"sofia.conf">>, _) ->
end
end;
handle_config_req(Node, Id, <<"conference.conf">>, Data) ->
put('callid', Id),
wh_util:put_callid(Id),

Profile = props:get_value(<<"profile_name">>, Data, <<"default">>),
Cmd =
[{<<"Profile">>, Profile}
Expand Down Expand Up @@ -222,16 +230,21 @@ handle_config_req(Node, Id, <<"conference.conf">>, Data) ->
lager:debug("sending conference profile XML to ~s: ~s", [Node, XmlResp]),
freeswitch:fetch_reply(Node, Id, 'configuration', iolist_to_binary(XmlResp));
handle_config_req(Node, Id, _Conf, _) ->
put('callid', Id),
wh_util:put_callid(Id),

lager:debug("ignoring conf ~s: ~s", [_Conf, Id]),
{'ok', Resp} = ecallmgr_fs_xml:not_found(),
freeswitch:fetch_reply(Node, Id, 'configuration', iolist_to_binary(Resp)).

-spec generate_acl_xml(api_object()) -> api_binary().
generate_acl_xml('undefined') ->
'undefined';
generate_acl_xml(SysconfResp) ->
'false' = wh_json:is_empty(SysconfResp),
{'ok', ConfigXml} = ecallmgr_fs_xml:acl_xml(SysconfResp),
erlang:iolist_to_binary(ConfigXml).

-spec default_sip_profiles(atom()) -> wh_json:object().
default_sip_profiles(Node) ->
Gateways = case wh_util:is_true(ecallmgr_config:get(<<"process_gateways">>, 'false')) of
'false' -> wh_json:new();
Expand All @@ -245,8 +258,10 @@ default_sip_profiles(Node) ->
]),
wh_json:set_value([wh_util:to_binary(?DEFAULT_FS_PROFILE), <<"Gateways">>]
,Gateways
,JObj).
,JObj
).

-spec default_sip_profile() -> wh_proplist().
default_sip_profile() ->
[{<<"Settings">>, wh_json:from_list(default_sip_settings())}
,{<<"Gateways">>, wh_json:from_list(default_sip_gateways())}
Expand Down
2 changes: 1 addition & 1 deletion applications/registrar/src/registrar_shared_listener.erl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
%%%-------------------------------------------------------------------
%%% @copyright (C) 2011-2012, VoIP INC
%%% @copyright (C) 2011-2014, 2600Hz INC
%%% @doc
%%% Listener for authn_req, reg_success, and reg_query AMQP requests
%%% @end
Expand Down
3 changes: 1 addition & 2 deletions core/whistle_apps-1.0.0/src/whapps_maintenance.erl
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,7 @@ refresh(?WH_SIP_DB) ->
|| JObj <- JObjs
];
_ -> 'ok'
end,
wh_amqp_worker:cast([], fun(_) -> wapi_switch:publish_reload_acls() end);
end;
refresh(?WH_SCHEMA_DB) ->
couch_mgr:db_create(?WH_SCHEMA_DB),
couch_mgr:revise_docs_from_folder(?WH_SCHEMA_DB, 'crossbar', "schemas"),
Expand Down

0 comments on commit 8c2b3ea

Please sign in to comment.