BugFix-add missing default ringback to lua (#1682)

add processing of when ringback is set to default_ringback and correctly
set it to the current value of the globalvar for ringback
This commit is contained in:
Mafoo
2016-07-28 03:06:41 +01:00
committed by FusionPBX
parent 5a66d97dc2
commit e3a3bbcd9f

View File

@@ -7,8 +7,13 @@
api = freeswitch.API();
--handle ringback
if (ringback == nil or ringback == "") then
--get the default ring back
--get the default hold_music
ringback = trim(api:execute("global_getvar", "hold_music"));
elseif (ringback == "default_ringback") then
--get the default ringback variable
ringback = trim(api:execute("global_getvar", "ringback"));
--convert to tone_stream
ringback = "tone_stream://" .. ringback .. ";loops=-1";
elseif (ringback:match("%${.*}")) then
--strip the ${ and }
ringback = ringback:gsub("%${", "");