Skip to content

Commit

Permalink
PISTON-188: update agent_listener queue id during originate, not conn…
Browse files Browse the repository at this point in the history
…ect_resp (#6560)
  • Loading branch information
danielfinke authored and jamesaimonetti committed Jun 2, 2020
1 parent 1ad1933 commit 81d70b4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion applications/acdc/src/acdc_agent_fsm.erl
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@ ready('cast', {'member_connect_win', JObj}, #state{agent_listener=AgentListener
_OtherId ->
lager:debug("monitoring agent ~s to connect to caller in queue ~s", [AgentId, QueueId]),

acdc_agent_listener:monitor_call(AgentListener, Call, CDRUrl, RecordingUrl),
acdc_agent_listener:monitor_call(AgentListener, Call, JObj, RecordingUrl),

{'next_state', 'ringing', State#state{wrapup_timeout=WrapupTimer
,member_call_id=CallId
Expand Down
17 changes: 10 additions & 7 deletions applications/acdc/src/acdc_agent_listener.erl
Original file line number Diff line number Diff line change
Expand Up @@ -232,9 +232,10 @@ hangup_call(Srv) ->
bridge_to_member(Srv, Call, WinJObj, EPs, CDRUrl, RecordingUrl) ->
gen_listener:cast(Srv, {'bridge_to_member', Call, WinJObj, EPs, CDRUrl, RecordingUrl}).

-spec monitor_call(pid(), kapps_call:call(), kz_term:api_binary(), kz_term:api_binary()) -> 'ok'.
monitor_call(Srv, Call, CDRUrl, RecordingUrl) ->
gen_listener:cast(Srv, {'monitor_call', Call, CDRUrl, RecordingUrl}).
-spec monitor_call(pid(), kapps_call:call(), kz_json:object(), kz_term:api_binary()) ->
'ok'.
monitor_call(Srv, Call, WinJObj, RecordingUrl) ->
gen_listener:cast(Srv, {'monitor_call', Call, WinJObj, RecordingUrl}).

-spec channel_hungup(pid(), kz_term:ne_binary()) -> 'ok'.
channel_hungup(Srv, CallId) ->
Expand Down Expand Up @@ -612,6 +613,7 @@ handle_cast({'bridge_to_member', Call, WinJObj, EPs, CDRUrl, RecordingUrl}, #sta
lager:debug("originate sent, waiting on successful bridge now"),
update_my_queues_of_change(AcctId, AgentId, Qs),
{'noreply', State#state{call=Call
,acdc_queue_id=kz_json:get_value(<<"Queue-ID">>, WinJObj)
,record_calls=ShouldRecord
,msg_queue_id=kz_json:get_value(<<"Server-ID">>, WinJObj)
,agent_call_ids=AgentCallIds
Expand Down Expand Up @@ -640,6 +642,7 @@ handle_cast({'bridge_to_member', Call, WinJObj, _, CDRUrl, RecordingUrl}, #state
kapps_call_command:pickup(kapps_call:call_id(Agent), <<"now">>, Call),

{'noreply', State#state{call=Call
,acdc_queue_id=kz_json:get_value(<<"Queue-ID">>, WinJObj)
,msg_queue_id=kz_json:get_value(<<"Server-ID">>, WinJObj)
,agent_call_ids=[AgentCallId]
,cdr_urls=dict:store(kapps_call:call_id(Call), CDRUrl,
Expand Down Expand Up @@ -702,9 +705,7 @@ handle_cast({'member_connect_resp', ReqJObj}, #state{agent_id=AgentId
lager:debug("responding to member_connect_req"),

send_member_connect_resp(ReqJObj, MyQ, AgentId, MyId, LastConn),
{'noreply', State#state{acdc_queue_id = ACDcQueue
,msg_queue_id = kz_json:get_value(<<"Server-ID">>, ReqJObj)
}
{'noreply', State#state{msg_queue_id=kz_json:get_value(<<"Server-ID">>, ReqJObj)}
,'hibernate'}
end;

Expand Down Expand Up @@ -732,14 +733,16 @@ handle_cast({'hangup_call'}, #state{my_id=MyId
}
,'hibernate'};

handle_cast({'monitor_call', Call, _CDRUrl, RecordingUrl}, State) ->
handle_cast({'monitor_call', Call, WinJObj, RecordingUrl}, State) ->
_ = kapps_call:put_callid(Call),

acdc_util:bind_to_call_events(Call),

lager:debug("monitoring member call ~s", [kapps_call:call_id(Call)]),

{'noreply', State#state{call=Call
,acdc_queue_id=kz_json:get_value(<<"Queue-ID">>, WinJObj)
,msg_queue_id=kz_json:get_value(<<"Server-ID">>, WinJObj)
,agent_call_ids=[]
,recording_url=RecordingUrl
}
Expand Down

0 comments on commit 81d70b4

Please sign in to comment.