Skip to content

Commit

Permalink
Persist forwarded calls recordings when caller hangs (#871)
Browse files Browse the repository at this point in the history
If the caller hangs the call during a forwarding, we want to
keep the recording anyway.

See #860
See #859
  • Loading branch information
matiasgarciaisaia authored Apr 14, 2020
1 parent 6503297 commit 02acc8e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion broker/src/commands/dial.erl
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ run(Args, Session = #session{pbx = Pbx, channel = CurrentChannel, js_context = J

try
Result = Pbx:dial(Channel, Number, CallerId, LocalFilename, AsteriskFilename),
persist_recording(AsteriskFilename, [Contact, Project, CallLog:id(), Key, Description]),
ResultJS = erjs_context:set(dial_status, Result, JS),
NewJS = maybe_mark_session_successful(DialStart, SuccessAfterSeconds, ResultJS),

Expand All @@ -53,6 +52,8 @@ run(Args, Session = #session{pbx = Pbx, channel = CurrentChannel, js_context = J
hangup ->
UpdatedJS = maybe_mark_session_successful(DialStart, SuccessAfterSeconds, JS),
throw({hangup, Session#session{js_context = UpdatedJS}})
after
persist_recording(AsteriskFilename, [Contact, Project, CallLog:id(), Key, Description])
end.

persist_recording(undefined, _) -> undefined;
Expand Down

0 comments on commit 02acc8e

Please sign in to comment.