Permalink
Browse files

WHISTLE-42: temporary Q bindings for conferences, and default to the …

…account realm when doing a simple provision
  • Loading branch information...
k-anderson committed Feb 17, 2012
1 parent 11d8c12 commit b9d0ef412ba1c8441a214a6ba20aae468a4403b7
@@ -392,8 +392,10 @@ start_amqp(ConfId) ->
_ = amqp_util:callmgr_exchange(),
_ = amqp_util:callevt_exchange(),
true = is_binary(Q = amqp_util:new_conference_queue(ConfId)),
- ok = amqp_util:bind_q_to_callmgr(Q, ?KEY_AUTHN_REQ),
- ok = amqp_util:bind_q_to_callmgr(Q, ?KEY_ROUTE_REQ),
+%% ok = amqp_util:bind_q_to_callmgr(Q, ?KEY_AUTHN_REQ),
+%% ok = amqp_util:bind_q_to_callmgr(Q, ?KEY_ROUTE_REQ),
+ wapi_route:bind_q(Q, []),
+ wapi_authn:bind_q(Q, []),
ok = amqp_util:bind_q_to_conference(Q, service, ConfId),
ok = amqp_util:bind_q_to_conference(Q, events, ConfId),
ok = amqp_util:bind_q_to_targeted(Q),
@@ -631,16 +631,17 @@ send_awesome_provisioning_request(ProvisionRequest, MACAddress) ->
%% @end
%%--------------------------------------------------------------------
-spec do_simple_provision/1 :: (#cb_context{}) -> 'ok'.
-do_simple_provision(#cb_context{doc=JObj}) ->
+do_simple_provision(#cb_context{doc=JObj}=Context) ->
Url = whapps_config:get_string(<<"crossbar.devices">>, <<"provisioning_url">>),
+ AccountRealm = crossbar_util:get_account_realm(Context),
Headers = [{K, V}
|| {K, V} <- [{"Host", whapps_config:get_string(<<"crossbar.devices">>, <<"provisioning_host">>)}
,{"Referer", whapps_config:get_string(<<"crossbar.devices">>, <<"provisioning_referer">>)}
,{"User-Agent", wh_util:to_list(erlang:node())}
,{"Content-Type", "application/x-www-form-urlencoded"}]
,V =/= undefined],
HTTPOptions = [],
- Body = [{"api[realm]", wh_json:get_string_value([<<"sip">>, <<"realm">>], JObj)}
+ Body = [{"api[realm]", wh_json:get_string_value([<<"sip">>, <<"realm">>], JObj, AccountRealm)}
,{"mac", re:replace(wh_json:get_string_value(<<"mac_address">>, JObj, ""), "[^0-9a-fA-F]", "", [{return, list}, global])}
,{"label", wh_json:get_string_value(<<"name">>, JObj)}
,{"sip[username]", wh_json:get_string_value([<<"sip">>, <<"username">>], JObj)}

0 comments on commit b9d0ef4

Please sign in to comment.