Skip to content

Commit

Permalink
KAZOO-5118: forcefully set caller-id on transfered calls if specified (
Browse files Browse the repository at this point in the history
…2600hz#3091)

* KAZOO-5118: forcefully set caller-id on transfered calls if specified

* make fmt

* use set instead of export
  • Loading branch information
jamhed authored and lazedo committed Jan 16, 2017
1 parent 89bbac6 commit 469823d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
9 changes: 8 additions & 1 deletion applications/crossbar/src/modules/cb_modules_util.erl
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,14 @@ originate_quickcall(Endpoints, Call, Context) ->
,{<<"Dial-Endpoint-Method">>, <<"simultaneous">>}
,{<<"Continue-On-Fail">>, 'false'}
,{<<"Custom-Channel-Vars">>, kz_json:from_list(CCVs)}
,{<<"Export-Custom-Channel-Vars">>, [<<"Account-ID">>, <<"Retain-CID">>, <<"Authorizing-ID">>, <<"Authorizing-Type">>]}
,{<<"Export-Custom-Channel-Vars">>, [
<<"Account-ID">>
, <<"Retain-CID">>
, <<"Authorizing-ID">>
, <<"Authorizing-Type">>
, <<"Outbound-Callee-ID-Number">>
, <<"Outbound-Callee-ID-Name">>
]}
| kz_api:default_headers(<<"resource">>, <<"originate_req">>, ?APP_NAME, ?APP_VERSION)
]),
kz_amqp_worker:cast(Request, fun kapi_resource:publish_originate_req/1),
Expand Down
9 changes: 9 additions & 0 deletions applications/ecallmgr/src/ecallmgr_originate.erl
Original file line number Diff line number Diff line change
Expand Up @@ -662,6 +662,7 @@ get_unset_vars(JObj) ->
,maybe_fix_ignore_early_media(Export)
,maybe_fix_group_confirm(Export)
,maybe_fix_fs_auto_answer_bug(Export)
,maybe_fix_caller_id(Export, JObj)
,"^"
]
end.
Expand All @@ -688,6 +689,14 @@ maybe_fix_fs_auto_answer_bug(Export) ->
"^unset:sip_h_Call-Info^unset:sip_h_Alert-Info^unset:alert_info^unset:sip_invite_params^set:sip_auto_answer=false"
end.

-spec maybe_fix_caller_id(strings(), kz_json:object()) -> string().
maybe_fix_caller_id(Export, JObj) ->
Fix = [
{lists:member("origination_callee_id_name", Export), kz_json:get_value(<<"Outbound-Callee-ID-Name">>, JObj), "effective_caller_id_name"}
,{lists:member("origination_callee_id_number", Export), kz_json:get_value(<<"Outbound-Callee-ID-Number">>, JObj), "effective_caller_id_number"}
],
string:join([ "^set:" ++ Key ++ "=" ++ erlang:binary_to_list(Value) || {IsTrue, Value, Key} <- Fix, IsTrue ], ":").

-spec publish_error(ne_binary(), created_uuid() | api_binary(), kz_json:object(), api_binary()) -> 'ok'.
publish_error(_, _, _, 'undefined') -> 'ok';
publish_error(Error, {_, UUID}, Request, ServerId) ->
Expand Down

0 comments on commit 469823d

Please sign in to comment.