Skip to content

Commit

Permalink
random fixes (2600hz#6137)
Browse files Browse the repository at this point in the history
* fix cf_exe queue_name

* cf_resources is publishing the wrong Server-ID

* honor the returned value from cb module

* set call-control info

* Fetch-UUID is not in CCVs

* add b_answer_now

* add reseller_id to resource profile
  • Loading branch information
lazedo authored Nov 6, 2019
1 parent a309253 commit 3aa7699
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 15 deletions.
4 changes: 3 additions & 1 deletion applications/callflow/src/cf_exe.erl
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ callid(_, Call) ->

-spec queue_name(kapps_call:call() | pid()) -> kz_term:ne_binary().
queue_name(Srv) when is_pid(Srv) ->
gen_server:call(Srv, 'control_queue_name');
gen_server:call(Srv, 'queue_name');
queue_name(Call) ->
Srv = cf_exe_pid(Call),
queue_name(Srv).
Expand Down Expand Up @@ -370,6 +370,8 @@ handle_call('get_call', _From, #state{call=Call}=State) ->
{'reply', {'ok', Call}, State};
handle_call('callid', _From, #state{call=Call}=State) ->
{'reply', kapps_call:call_id_direct(Call), State};
handle_call('queue_name', _From, #state{queue=Q}=State) ->
{'reply', Q, State};
handle_call('control_queue_name', _From, #state{call=Call}=State) ->
{'reply', kapps_call:control_queue_direct(Call), State};
handle_call('get_branch_keys', _From, #state{flow = Flow}=State) ->
Expand Down
2 changes: 1 addition & 1 deletion applications/crossbar/src/api_util.erl
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ req_noun_requires_envelope(Context, [{Mod, Params} | _]) ->
Event = create_event_name(Context, <<"requires_envelope.", Mod/binary>>),
Payload = [Context | Params],
case crossbar_bindings:pmap(Event, Payload) of
[Value | _] -> not Value;
[Value | _] -> Value;
_Else -> 'true'
end.

Expand Down
15 changes: 5 additions & 10 deletions applications/ecallmgr/src/call_control/ecallmgr_call_control.erl
Original file line number Diff line number Diff line change
Expand Up @@ -649,16 +649,11 @@ set_control_info(UUID, #state{node=Node
})->
Cmd = 'kz_uuid_setvar_multi_encoded',
Arg = list_to_binary([UUID
," ^^;Call-Control-Queue="
,kapi:encode_pid(ControlQ)
,";Call-Control-PID="
,kz_term:to_binary(self())
,";ecallmgr_Ecallmgr-Node="
,kz_term:to_binary(node())
,";Call-Control-Node="
,kz_term:to_binary(node())
,";"
,?SET_CCV(<<"Fetch-ID">>, FetchId)
," ^^;Call-Control-Queue=", kapi:encode_pid(ControlQ)
,";Call-Control-PID=", kz_term:to_binary(self())
,";ecallmgr_Ecallmgr-Node=", kz_term:to_binary(node())
,";Call-Control-Node=", kz_term:to_binary(node())
,";Fetch-UUID=", FetchId
]),
_ = freeswitch:api(Node, Cmd, Arg),
'ok'.
Expand Down
9 changes: 8 additions & 1 deletion core/kazoo_call/src/kapps_call_command.erl
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@
,privacy/2
]).

-export([b_answer/1, b_hangup/1, b_hangup/2, b_fetch/1, b_fetch/2]).
-export([b_answer/1, b_answer_now/1, b_hangup/1, b_hangup/2, b_fetch/1, b_fetch/2]).
-export([b_echo/1]).
-export([b_ring/1]).

Expand Down Expand Up @@ -991,6 +991,13 @@ b_answer(Call) ->
answer(Call),
wait_for_message(Call, <<"answer">>).

-spec b_answer_now(kapps_call:call()) ->
kapps_api_error() |
{'ok', kz_json:object()}.
b_answer_now(Call) ->
answer_now(Call),
wait_for_message(Call, <<"answer">>).

%%------------------------------------------------------------------------------
%% @doc Produces the low level AMQP request to echo the channel.
%% @end
Expand Down
8 changes: 6 additions & 2 deletions core/kazoo_directory/src/kz_directory_resource.erl
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,18 @@ number(Options) ->
set_account_id(#{ccvs := CCVs, profile := Profile, number := #{account_id := AccountId}} = Map) ->
{'ok', MasterAccountId} = kapps_util:get_master_account_id(),
{'ok', Account} = kzd_accounts:fetch(AccountId, 'accounts'),
ResellerId = kzd_accounts:reseller_id(Account),
Realm = kzd_accounts:realm(Account),
Map#{ccvs => [{<<"Account-ID">>, AccountId}
,{<<"Account-Realm">>, Realm}
,{<<"Realm">>, Realm}
,{<<"Reseller-ID">>, kzd_accounts:reseller_id(Account)}
,{<<"Reseller-ID">>, ResellerId}
| CCVs
]
,profile => [{<<"Account-ID">>, AccountId} | Profile]
,profile => [{<<"Account-ID">>, AccountId}
,{<<"Reseller-ID">>, ResellerId}
| Profile
]
,account_id => AccountId
,master_id => MasterAccountId
,anonymous_cid_number => kz_privacy:anonymous_caller_id_number(AccountId)
Expand Down

0 comments on commit 3aa7699

Please sign in to comment.