From ab4d1840b42f87a536e8d520d737e22325de1489 Mon Sep 17 00:00:00 2001 From: Nate Jones Date: Wed, 29 Apr 2015 21:21:00 +0000 Subject: [PATCH] SIP: Return "NO_ANSWER" instead of "NORMAL_CLEARING" if an extension is called with voicemail disabled. Implements patch suggested in Issue 920. Thanks. --- .../conf/dialplan/999_local_extension.xml | 1 - .../install/scripts/app/voicemail/index.lua | 32 +++++++++++-------- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/app/dialplan/resources/switch/conf/dialplan/999_local_extension.xml b/app/dialplan/resources/switch/conf/dialplan/999_local_extension.xml index 8a48a99cd5..0d9ba55ad0 100644 --- a/app/dialplan/resources/switch/conf/dialplan/999_local_extension.xml +++ b/app/dialplan/resources/switch/conf/dialplan/999_local_extension.xml @@ -27,7 +27,6 @@ - diff --git a/resources/install/scripts/app/voicemail/index.lua b/resources/install/scripts/app/voicemail/index.lua index 77bc4ff048..9c305c792e 100644 --- a/resources/install/scripts/app/voicemail/index.lua +++ b/resources/install/scripts/app/voicemail/index.lua @@ -58,19 +58,6 @@ --if the session exists if (session ~= nil) then - --answer the session - if (session:ready()) then - session:answer(); - end - - --unset bind meta app - session:execute("unbind_meta_app", ""); - - --set the callback function - if (session:ready()) then - session:setVariable("playback_terminators", "#"); - session:setInputCallback("on_dtmf", ""); - end --get session variables context = session:getVariable("context"); @@ -190,6 +177,23 @@ if (voicemail_attach_file == nil) then voicemail_attach_file = "true"; end + + --valid voicemail + if (voicemail_uuid ~= nil) then + --answer the session + if (session:ready()) then + session:answer(); + end + + --unset bind meta app + session:execute("unbind_meta_app", ""); + + --set the callback function + if (session:ready()) then + session:setVariable("playback_terminators", "#"); + session:setInputCallback("on_dtmf", ""); + end + end end end end @@ -467,6 +471,8 @@ if (referred_by) then referred_by = referred_by:match('[%d]+'); session:transfer(referred_by, "XML", context); + else + session:hangup("NO_ANSWER"); end end end