Skip to content

Commit

Permalink
Use cached document for greeting media
Browse files Browse the repository at this point in the history
  • Loading branch information
vladimirralev authored and jamesaimonetti committed Feb 9, 2015
1 parent a99f751 commit 19845a5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions applications/callflow/src/module/cf_voicemail.erl
Original file line number Diff line number Diff line change
Expand Up @@ -819,12 +819,12 @@ record_unavailable_greeting(AttachmentName, #mailbox{unavailable_media_id='undef
MediaId = recording_media_doc(<<"unavailable greeting">>, Box, Call),
record_unavailable_greeting(AttachmentName, Box#mailbox{unavailable_media_id=MediaId}, Call);
record_unavailable_greeting(AttachmentName, #mailbox{unavailable_media_id=MediaId}=Box, Call) ->
case couch_mgr:open_doc(whapps_call:account_db(Call), MediaId) of
case couch_mgr:open_cache_doc(whapps_call:account_db(Call), MediaId) of
{'ok', JObj} ->
case wh_json:get_value(<<"media_source">>, JObj) of
<<"upload">> ->
lager:debug("The voicemail media is a web upload, let's not touch it,"
++ " it may be in use in some other maibox and create new media document"),
lager:debug("The voicemail greeting media is a web upload, let's not touch it,"
++ " it may be in use in some other maibox. We create new media document."),
record_unavailable_greeting(AttachmentName, Box#mailbox{unavailable_media_id='undefined'}, Call);
_ ->
overwrite_unavailable_greeting(AttachmentName, Box, Call)
Expand Down

0 comments on commit 19845a5

Please sign in to comment.