MWI improvements for voicemail.

This commit is contained in:
Mark Crane
2013-04-13 08:19:19 +00:00
parent 102d368aac
commit c85623f662
3 changed files with 8 additions and 12 deletions

View File

@@ -85,13 +85,15 @@
freeswitch.consoleLog("notice", "[voicemail] SQL: " .. sql .. "\n");
end
status = dbh:query(sql, function(row)
--send the message waiting event
local event = freeswitch.Event("message_waiting");
if (row["new_messages"] == "0") then
--send the message waiting event
local event = freeswitch.Event("message_waiting");
event:addHeader("MWI-Messages-Waiting", "no");
event:addHeader("MWI-Message-Account", "sip:"..voicemail_id.."@"..domain_name);
event:fire();
else
event:addHeader("MWI-Messages-Waiting", "yes");
end
event:addHeader("MWI-Message-Account", "sip:"..voicemail_id.."@"..domain_name);
event:fire();
end);
end
end

View File

@@ -37,6 +37,7 @@
--send the message waiting event
local event = freeswitch.Event("message_waiting");
if (row["message_count"] == "0") then
--freeswitch.consoleLog("notice", "[voicemail] mailbox: "..voicemail_id.."@"..domain_name.." messages: " .. row["message_count"] .. " no messages\n");
event:addHeader("MWI-Messages-Waiting", "no");
else
event:addHeader("MWI-Messages-Waiting", "yes");

View File

@@ -36,14 +36,7 @@
debug["info"] = false;
--connect to the database
--ODBC - data source name
if (dsn_name) then
dbh = freeswitch.Dbh(dsn_name,dsn_username,dsn_password);
end
--FreeSWITCH core db handler
if (db_type == "sqlite") then
dbh = freeswitch.Dbh("sqlite://"..db_path.."/"..db_name);
end
dbh = freeswitch.Dbh(database["system"]);
--used to stop the lua service
local file = assert(io.open(tmp_file, "w"));