MT#16827 Initial package version

- replaces ngcp-asterisk with asterisk + ngcp-asterisk-voicemail
- reduce the maintenance burden
- sync with debian jessie version
- logically separated in patches
  easier to maintain and understand

Change-Id: I363f31cf59968fee49f3330c16c29cbf9cd317f6
changes/49/3649/7
Victor Seva 10 years ago committed by Víctor Seva
parent c89b1eade3
commit 2c160e3136

5
debian/changelog vendored

@ -0,0 +1,5 @@
ngcp-asterisk-voicemail (11.13.1-1+0~mr4.2.0.0) unstable; urgency=low
* Initial version from asterisk 1:11.13.1~dsfg-2
-- Victor Seva <vseva@sipwise.com> Thu, 03 Dec 2015 13:17:01 +0100

1
debian/compat vendored

@ -0,0 +1 @@
9

30
debian/control vendored

@ -0,0 +1,30 @@
Source: ngcp-asterisk-voicemail
Priority: optional
Section: comm
Maintainer: Sipwise Development Team <support@sipwise.com>
Build-Depends: asterisk-dev (= 1:11.13.1~dfsg-2),
debhelper (>= 9~),
libpcre3-dev,
unixodbc-dev
Standards-Version: 3.9.6
Homepage: https://www.sipwise.com/
Package: ngcp-asterisk-voicemail-odbcstorage
Architecture: any
Depends: asterisk,
${misc:Depends},
${shlibs:Depends}
Provides: asterisk-voicemail-storage
Conflicts: asterisk-voicemail-storage, ngcp-asterisk
Replaces: ngcp-asterisk
Description: NGCP version ODBC voicemail storage support for the Asterisk PBX
Asterisk is an Open Source PBX and telephony toolkit.
.
This package includes an database-based voicemail storage: storing the
voicemail in a database accessed through the ODBC interface. While more
complex to set up, it may be useful in some settings.
.
This package includes patches from Sipwise.
.
For more information about the Asterisk PBX, have a look at the Asterisk
package.

32
debian/copyright vendored

@ -0,0 +1,32 @@
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: ngcp-asterisk-voicemail
Source: git://github.com/sipwise/asterisk-voicemail
Files: *
Copyright: 2013-2014 Sipwise GmbH, Austria
License: GPL-2
Files: apps/app_voicemail.c
Copyright: 1999-2015, Digium, Inc
License: GPL-2
Files: debian/*
Copyright: 2015 Sipwise Development Team <support@sipwise.com>
License: GPL-2
License: GPL-2
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
.
This package is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Comment:
On Debian systems, the complete text of the GNU General
Public License version 2 can be found in "/usr/share/common-licenses/GPL-2".

@ -0,0 +1,6 @@
sipwise_define_module.patch
sipwise_vm_uuid_mailbox.patch
sipwise_vm_romanian_syntax.patch
sipwise_vm_find_user_by_alias.patch
sipwise_vm_add_pcre_support.patch
sipwise_vm_play_prompt_on_change_to_empty_folder.patch

@ -0,0 +1,11 @@
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -134,6 +134,8 @@
#include "asterisk/threadstorage.h"
#endif
+#define AST_MODULE "voicemail"
+
/*** DOCUMENTATION
<application name="VoiceMail" language="en_US">
<synopsis>

@ -0,0 +1,272 @@
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -40,6 +40,7 @@
/*** MODULEINFO
<use type="module">res_adsi</use>
<use type="module">res_smdi</use>
+ <depend>pcre</depend>
<support_level>core</support_level>
***/
@@ -136,6 +137,9 @@
#define AST_MODULE "voicemail"
+#include <ctype.h>
+#include <pcre.h>
+
/*** DOCUMENTATION
<application name="VoiceMail" language="en_US">
<synopsis>
@@ -927,6 +931,8 @@
static int maxlogins;
static int minpassword;
static int passwordlocation;
+static char sw_normalize_user_match[256];
+static char sw_normalize_user_replace[256];
/*! Poll mailboxes for changes since there is something external to
* app_voicemail that may change them. */
@@ -1134,6 +1140,114 @@
static int __has_voicemail(const char *context, const char *mailbox, const char *folder, int shortcircuit);
#endif
+/* sipwise pcre helper functions taken from contrib of pcre:
+
+ Written by: Bert Driehuis <driehuis@playbeing.org>
+ Copyright (c) 2000 Bert Driehuis
+
+ Permission is granted to anyone to use this software for any purpose on any
+ computer system, and to redistribute it freely, subject to the following
+ restrictions:
+
+ 1. This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ 2. The origin of this software must not be misrepresented, either by
+ explicit claim or by omission.
+
+ 3. Altered versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+
+ 4. If PCRE is embedded in any software that is released under the GNU
+ General Purpose Licence (GPL), then the terms of that licence shall
+ supersede any condition above with which it is incompatible.
+*/
+#define MAXCAPTURE 50
+
+static int findreplen(const char *rep, int nmat, const int *replen)
+{
+ int len = 0;
+ int val;
+ char *cp = (char *)rep;
+ while(*cp) {
+ if (*cp == '$' && isdigit(cp[1])) {
+ val = strtoul(&cp[1], &cp, 10);
+ if (val && val <= nmat + 1)
+ len += replen[val -1];
+ else
+ fprintf(stderr, "repl %d out of range\n", val);
+ } else {
+ cp++;
+ len++;
+ }
+ }
+ return len;
+}
+
+static void doreplace(char *out, const char *rep,
+ int nmat, int *replen, const char **repstr)
+{
+ int val;
+ char *cp = (char *)rep;
+ while(*cp) {
+ if (*cp == '$' && isdigit(cp[1])) {
+ val = strtoul(&cp[1], &cp, 10);
+ if (val && val <= nmat + 1) {
+ strncpy(out, repstr[val - 1], replen[val - 1]);
+ out += replen[val -1];
+ }
+ } else {
+ *out++ = *cp++;
+ }
+ }
+}
+
+static char *edit(const char *str, int len, const char *rep,
+ int nmat, const int *ovec)
+{
+ int i, slen, rlen;
+ const int *mvec = ovec;
+ char *res, *cp;
+ int replen[MAXCAPTURE];
+ const char *repstr[MAXCAPTURE];
+ nmat--;
+ ovec += 2;
+ for (i = 0; i < nmat; i++) {
+ replen[i] = ovec[i * 2 + 1] - ovec[i * 2];
+ repstr[i] = &str[ovec[i * 2]];
+ }
+ slen = len;
+ len -= mvec[1] - mvec[0];
+ len += rlen = findreplen(rep, nmat, replen);
+ cp = res = pcre_malloc(len + 1);
+ if (mvec[0] > 0) {
+ strncpy(cp, str, mvec[0]);
+ cp += mvec[0];
+ }
+ doreplace(cp, rep, nmat, replen, repstr);
+ cp += rlen;
+ if (mvec[1] < slen)
+ strcpy(cp, &str[mvec[1]]);
+ res[len] = 0;
+ return res;
+}
+
+static char *pcre_subst(const pcre *ppat, const pcre_extra *extra,
+ const char *str, int len,
+ int offset, int options, const char *rep)
+{
+ int nmat;
+ int ovec[MAXCAPTURE * 3];
+ nmat = pcre_exec(ppat, extra, str, len, offset, options,
+ ovec, sizeof(ovec));
+ if (nmat <= 0)
+ return NULL;
+ return(edit(str, len, rep, nmat, ovec));
+}
+
+/* end of pcre helper functions */
+
/*!
* \brief Strips control and non 7-bit clean characters from input string.
*
@@ -7646,6 +7760,8 @@
* This is invoked from forward_message() when performing a forward operation (option 8 from main menu).
* \return zero on success, -1 on error.
*/
+
+#if 0
static int vm_forwardoptions(struct ast_channel *chan, struct ast_vm_user *vmu, char *curdir, int curmsg, char *vm_fmts,
char *context, signed char record_gain, long *duration, struct vm_state *vms, char *flag)
{
@@ -7806,6 +7922,7 @@
cmd = 0;
return cmd;
}
+#endif
static void queue_mwi_event(const char *box, int urgent, int new, int old)
{
@@ -7983,6 +8100,8 @@
*
* \return zero on success, -1 on error.
*/
+
+#if 0
static int forward_message(struct ast_channel *chan, char *context, struct vm_state *vms, struct ast_vm_user *sender, char *fmt, int is_new_message, signed char record_gain, int urgent)
{
#ifdef IMAP_STORAGE
@@ -8299,6 +8418,7 @@
}
return res ? res : cmd;
}
+#endif
static int wait_file2(struct ast_channel *chan, struct vm_state *vms, char *file)
{
@@ -10711,6 +10831,11 @@
int useadsi = 0, valid = 0, logretries = 0;
char password[AST_MAX_EXTENSION]="", *passptr;
struct ast_vm_user vmus, *vmu = NULL;
+ const char *err;
+ int erroffset;
+ pcre_extra *extra = NULL;
+ pcre *ppat = NULL;
+ char *normalized_mailbox;
/* If ADSI is supported, setup login screen */
adsi_begin(chan, &useadsi);
@@ -10721,6 +10846,22 @@
return -1;
}
+ if(sw_normalize_user_match[0] != '\0' && sw_normalize_user_replace[0] != '\0') {
+ // TODO: could be done once on start
+ ppat = pcre_compile(sw_normalize_user_match, 0, &err, &erroffset, NULL);
+ if(ppat == NULL) {
+ ast_log(LOG_WARNING, "Couldn't compile user match regex '%s': %s at offset %d\n",
+ sw_normalize_user_match, err, erroffset);
+ return -1;
+ }
+ extra = pcre_study(ppat, 0, &err);
+ if(err) {
+ ast_log(LOG_WARNING, "Couldn't study regex '%s': %s\n",
+ sw_normalize_user_match, err);
+ return -1;
+ }
+ }
+
/* Authenticate them and get their mailbox/password */
while (!valid && (logretries < max_logins)) {
@@ -10750,6 +10891,18 @@
if (useadsi)
adsi_password(chan);
+ if(ppat && extra) {
+ ast_log(LOG_NOTICE, "Trying to rewrite user input '%s' using s/%s/%s/\n",
+ mailbox, sw_normalize_user_match, sw_normalize_user_replace);
+ normalized_mailbox = pcre_subst(ppat, extra, mailbox, strlen(mailbox), 0, 0, sw_normalize_user_replace);
+ if(normalized_mailbox) {
+ ast_log(LOG_NOTICE, "Rewrote mailbox user input '%s' to %s\n",
+ mailbox, normalized_mailbox);
+ ast_copy_string(mailbox, normalized_mailbox, mailbox_size);
+ free(normalized_mailbox);
+ }
+ }
+
if (!ast_strlen_zero(prefix)) {
char fullusername[80] = "";
ast_copy_string(fullusername, prefix, sizeof(fullusername));
@@ -13098,6 +13251,8 @@
int x;
unsigned int tmpadsi[4];
char secretfn[PATH_MAX] = "";
+ const char *ast_sw_normalize_user_match = NULL;
+ const char *ast_sw_normalize_user_replace = NULL;
#ifdef IMAP_STORAGE
ast_copy_string(imapparentfolder, "\0", sizeof(imapparentfolder));
@@ -13149,6 +13304,19 @@
ast_copy_string(odbc_table, val, sizeof(odbc_table));
}
#endif
+
+ /* sipwise sw_normalize_user_match/replace */
+ if ((ast_sw_normalize_user_match = ast_variable_retrieve(cfg, "general", "sw_normalize_user_match"))) {
+ ast_copy_string(sw_normalize_user_match, ast_sw_normalize_user_match, sizeof(sw_normalize_user_match));
+ } else {
+ sw_normalize_user_match[0] = '\0';
+ }
+ if ((ast_sw_normalize_user_replace = ast_variable_retrieve(cfg, "general", "sw_normalize_user_replace"))) {
+ ast_copy_string(sw_normalize_user_replace, ast_sw_normalize_user_replace, sizeof(sw_normalize_user_replace));
+ } else {
+ sw_normalize_user_replace[0] = '\0';
+ }
+
/* Mail command */
strcpy(mailcmd, SENDMAIL);
if ((val = ast_variable_retrieve(cfg, "general", "mailcmd")))
--- a/Makefile
+++ b/Makefile
@@ -15,7 +15,7 @@
OPTIMIZE=-O2
DEBUG=-g
-LIBS+=
+LIBS+=-lpcre
CFLAGS+=-pipe -fPIC
CFLAGS+=-Wall -Wextra -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations
CFLAGS+=-D_REENTRANT -D_GNU_SOURCE -DODBC_STORAGE

@ -0,0 +1,93 @@
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -1027,6 +1027,9 @@
static char pagerdateformat[32] = "%A, %B %d, %Y at %r";
/* Forward declarations - generic */
+#ifdef ODBC_STORAGE
+static struct ast_vm_user *find_user_realtime_by_alias(struct ast_vm_user *ivm, const char *context, const char *alias);
+#endif
static int open_mailbox(struct vm_state *vms, struct ast_vm_user *vmu, int box);
static int close_mailbox(struct vm_state *vms, struct ast_vm_user *vmu);
static int advanced_options(struct ast_channel *chan, struct ast_vm_user *vmu, struct vm_state *vms, int msg, int option, signed char record_gain);
@@ -1655,7 +1658,13 @@
}
} else {
ast_log (LOG_DEBUG,"call find_user_realtime for '%s@%s'\n", mailbox, context);
- vmu = find_user_realtime(ivm, context, mailbox);
+
+ // agranig: always find user by alias
+#ifdef ODBC_STORAGE
+ vmu = find_user_realtime_by_alias(ivm, context, mailbox);
+#else
+ vmu = find_user_realtime(ivm, context, mailbox);
+#endif
}
AST_LIST_UNLOCK(&users);
return vmu;
@@ -3799,6 +3808,65 @@
return x - 1;
}
+#ifdef ODBC_STORAGE
+static struct ast_vm_user *find_user_realtime_by_alias(struct ast_vm_user *ivm, const char *context, const char *alias)
+{
+ int res;
+ char mailbox[256] = "";
+ char *argv[] = { (char*) alias };
+ char *sql = "select distinct(vmusers.mailbox) from kamailio.voicemail_users vmusers " \
+ "left join provisioning.voip_subscribers pvs on vmusers.customer_id = pvs.uuid " \
+ "left join provisioning.voip_dbaliases vda on pvs.id = vda.subscriber_id " \
+ "where vda.username = ?";
+ struct generic_prepare_struct gps = { .sql = sql, .argc = 1, .argv = argv };
+ char *sql_uuid = "select distinct(mailbox) from kamailio.voicemail_users "\
+ "where customer_id = ?";
+ struct generic_prepare_struct gps_uuid = { .sql = sql_uuid, .argc = 1, .argv = argv };
+ struct odbc_obj *obj = NULL;
+ SQLHSTMT stmt = NULL;
+
+ obj = ast_odbc_request_obj(odbc_database, 0);
+ stmt = ast_odbc_prepare_and_execute(obj, generic_prepare, &gps);
+ if (!stmt) {
+ ast_log(LOG_WARNING, "SQL Execute error!\n[%s]\n\n", sql);
+ ast_odbc_release_obj(obj);
+ return NULL;
+ }
+ res = SQLFetch(stmt);
+ if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
+ ast_log(LOG_NOTICE, "Failed to fetch mailbox for alias '%s', falling back to uuid search\n", alias);
+ SQLFreeHandle (SQL_HANDLE_STMT, stmt);
+
+ stmt = ast_odbc_prepare_and_execute(obj, generic_prepare, &gps_uuid);
+ if (!stmt) {
+ ast_log(LOG_WARNING, "SQL Execute error!\n[%s]\n\n", sql_uuid);
+ ast_odbc_release_obj(obj);
+ return NULL;
+ }
+ res = SQLFetch(stmt);
+ if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
+ ast_log(LOG_NOTICE, "Failed to fetch mailbox for alias '%s' via uuid\n", alias);
+ SQLFreeHandle (SQL_HANDLE_STMT, stmt);
+
+ ast_odbc_release_obj(obj);
+ return NULL;
+ }
+ }
+ res = SQLGetData(stmt, 1, SQL_CHAR, mailbox, sizeof(mailbox), NULL);
+ if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
+ ast_log(LOG_WARNING, "SQL Get Data error!\n[%s]\n\n", sql);
+ SQLFreeHandle (SQL_HANDLE_STMT, stmt);
+ ast_odbc_release_obj(obj);
+ return NULL;
+ }
+ SQLFreeHandle(SQL_HANDLE_STMT, stmt);
+ ast_odbc_release_obj(obj);
+
+ ast_log(LOG_NOTICE, "Found mailbox '%s' for alias '%s'\n", mailbox, alias);
+ return find_user_realtime(ivm, context, mailbox);
+}
+#endif
+
/*!
* \brief Determines the highest message number in use for a given user and mailbox folder.
* \param vmu

@ -0,0 +1,35 @@
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -11141,6 +11141,7 @@
signed char record_gain = 0;
int play_auto = 0;
int play_folder = 0;
+ int folder_change = 0;
int in_urgent = 0;
#ifdef IMAP_STORAGE
int deleted = 0;
@@ -11401,6 +11402,7 @@
cmd = vm_browse_messages(chan, &vms, vmu);
break;
case '2': /* Change folders */
+ folder_change = 1;
ast_test_suite_event_notify("CHANGEFOLDER", "Message: browsing to a different folder");
if (useadsi)
adsi_folders(chan, 0, "Change to folder...");
@@ -11817,6 +11819,16 @@
adsi_status(chan, &vms);
break;
default: /* Nothing */
+ if (folder_change && vms.lastmsg == -1) {
+ if(!strcasecmp(ast_channel_language(chan), "ro")) {
+ ast_play_and_wait(chan, "vm-dir-empty");
+ } else {
+ res = ast_play_and_wait(chan, "vm-no");
+ if (!res)
+ res = ast_play_and_wait(chan, "vm-messages");
+ }
+ }
+ folder_change = 0;
ast_test_suite_event_notify("PLAYBACK", "Message: instructions");
cmd = vm_instructions(chan, vmu, &vms, 0, in_urgent);
break;

@ -0,0 +1,152 @@
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -660,6 +660,7 @@
\arg \b es - Spanish
\arg \b fr - French
\arg \b it - Italian
+ \arg \b ro - Romanian
\arg \b nl - Dutch
\arg \b pt - Portuguese
\arg \b pt_BR - Portuguese (Brazil)
@@ -5437,14 +5438,16 @@
} else {
/* Dispose just in case */
DISPOSE(fn, -1);
- /*
- res = ast_stream_and_wait(chan, "vm-theperson", ecodes);
- if (res)
- {
- ast_log(LOG_WARNING, "failed to stream/wait vm-theperson\n");
- return res;
+
+ if(!strcasecmp(ast_channel_language(chan), "ro")) { /* ROMANIAN */
+ res = ast_stream_and_wait(chan, "vm-theperson", ecodes);
+ if (res)
+ {
+ ast_log(LOG_WARNING, "failed to stream/wait vm-theperson\n");
+ return res;
+ }
}
- */
+
ast_log(LOG_DEBUG, "stream/wait dialed_num\n");
res = ast_say_digit_str(chan, dialed_num, ecodes, ast_channel_language(chan));
if (res)
@@ -8307,6 +8310,8 @@
res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, ast_channel_language(chan), "'vm-received' q H 'digits/kai' M ", NULL);
} else if (!strncasecmp(ast_channel_language(chan), "it", 2)) { /* ITALIAN syntax */
res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, ast_channel_language(chan), "'vm-received' q 'digits/at' 'digits/hours' k 'digits/e' M 'digits/minutes'", NULL);
+ } else if (!strncasecmp(ast_channel_language(chan), "ro", 2)) { /* ITALIAN syntax */
+ res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, ast_channel_language(chan), "'vm-received' q 'digits/at' 'digits/hours' k 'vm-and' M 'digits/minutes'", NULL);
} else if (!strncasecmp(ast_channel_language(chan), "nl", 2)) { /* DUTCH syntax */
res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, ast_channel_language(chan), "'vm-received' q 'digits/nl-om' HM", NULL);
} else if (!strncasecmp(ast_channel_language(chan), "no", 2)) { /* NORWEGIAN syntax */
@@ -8905,7 +8910,8 @@
{
int cmd;
- if ( !strncasecmp(ast_channel_language(chan), "it", 2) ||
+ if ( !strncasecmp(ast_channel_language(chan), "ro", 2) ||
+ !strncasecmp(ast_channel_language(chan), "it", 2) ||
!strncasecmp(ast_channel_language(chan), "es", 2) ||
!strncasecmp(ast_channel_language(chan), "pt", 2)) { /* Italian, Spanish, or Portuguese syntax */
cmd = ast_play_and_wait(chan, "vm-messages"); /* "messages */
@@ -9137,6 +9143,54 @@
}
return res;
}
+
+/* ROMANIAN syntax */
+static int vm_intro_ro(struct ast_channel *chan, struct vm_state *vms)
+{
+ /* Introduce messages they have */
+ int res;
+ if (!vms->oldmessages && !vms->newmessages)
+ res = ast_play_and_wait(chan, "vm-no") ||
+ ast_play_and_wait(chan, "vm-youhave") ||
+ ast_play_and_wait(chan, "vm-messages");
+ else
+ res = ast_play_and_wait(chan, "vm-youhave");
+ if (!res && vms->newmessages) {
+ if(vms->newmessages == 1) {
+ res =
+ ast_play_and_wait(chan, "digits/1a") ||
+ ast_play_and_wait(chan, "vm-message") ||
+ ast_play_and_wait(chan, "vm-INBOXa");
+ } else {
+ if(vms->newmessages == 2)
+ res = ast_play_and_wait(chan, "digits/2f");
+ else
+ res = say_and_wait(chan, vms->newmessages, ast_channel_language(chan));
+ if(!res)
+ res = ast_play_and_wait(chan, "vm-messages") ||
+ ast_play_and_wait(chan, "vm-INBOX");
+
+ }
+ }
+ if (!res && vms->oldmessages) {
+ if(vms->oldmessages == 1) {
+ res =
+ ast_play_and_wait(chan, "digits/1a") ||
+ ast_play_and_wait(chan, "vm-message") ||
+ ast_play_and_wait(chan, "vm-Old");
+ } else {
+ if(vms->oldmessages == 2)
+ res = ast_play_and_wait(chan, "digits/2f");
+ else
+ res = say_and_wait(chan, vms->oldmessages, ast_channel_language(chan));
+ if(!res)
+ res = ast_play_and_wait(chan, "vm-messages") ||
+ ast_play_and_wait(chan, "vm-Old");
+
+ }
+ }
+ return res;
+}
/* Default English syntax */
static int vm_intro_en(struct ast_channel *chan, struct vm_state *vms)
@@ -9861,6 +9915,8 @@
return vm_intro_he(chan, vms);
} else if (!strncasecmp(ast_channel_language(chan), "it", 2)) { /* ITALIAN syntax */
return vm_intro_it(chan, vms);
+ } else if (!strncasecmp(ast_channel_language(chan), "ro", 2)) { /* ROMANIAN syntax */
+ return vm_intro_ro(chan, vms);
} else if (!strncasecmp(ast_channel_language(chan), "nl", 2)) { /* DUTCH syntax */
return vm_intro_nl(chan, vms);
} else if (!strncasecmp(ast_channel_language(chan), "no", 2)) { /* NORWEGIAN syntax */
@@ -10423,6 +10479,25 @@
return cmd;
}
+/* ROMANIAN syntax */
+static int vm_browse_messages_ro(struct ast_channel *chan, struct vm_state *vms, struct ast_vm_user *vmu)
+{
+ int cmd=0;
+
+ if (vms->lastmsg > -1) {
+ cmd = play_message(chan, vmu, vms);
+ } else {
+ cmd = ast_play_and_wait(chan, "vm-no");
+ if (!cmd)
+ cmd = ast_play_and_wait(chan, "vm-message");
+ if (!cmd) {
+ snprintf(vms->fn, sizeof(vms->fn), "vm-%s", vms->curbox);
+ cmd = ast_play_and_wait(chan, vms->fn);
+ }
+ }
+ return cmd;
+}
+
/*!
* \brief Spanish syntax for 'You have N messages' greeting.
* \param chan
@@ -10548,6 +10623,8 @@
return vm_browse_messages_he(chan, vms, vmu);
} else if (!strncasecmp(ast_channel_language(chan), "it", 2)) { /* ITALIAN */
return vm_browse_messages_it(chan, vms, vmu);
+ } else if (!strncasecmp(ast_channel_language(chan), "ro", 2)) { /* ROMANIAN */
+ return vm_browse_messages_ro(chan, vms, vmu);
} else if (!strncasecmp(ast_channel_language(chan), "pt", 2)) { /* PORTUGUESE */
return vm_browse_messages_pt(chan, vms, vmu);
} else if (!strncasecmp(ast_channel_language(chan), "vi", 2)) { /* VIETNAMESE */

@ -0,0 +1,573 @@
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -48,7 +48,7 @@
<member name="FILE_STORAGE" displayname="Storage of Voicemail using filesystem">
<conflict>ODBC_STORAGE</conflict>
<conflict>IMAP_STORAGE</conflict>
- <defaultenabled>yes</defaultenabled>
+ <defaultenabled>no</defaultenabled>
<support_level>core</support_level>
</member>
<member name="ODBC_STORAGE" displayname="Storage of Voicemail using ODBC">
@@ -56,7 +56,7 @@
<depend>ltdl</depend>
<conflict>IMAP_STORAGE</conflict>
<conflict>FILE_STORAGE</conflict>
- <defaultenabled>no</defaultenabled>
+ <defaultenabled>yes</defaultenabled>
<support_level>core</support_level>
</member>
<member name="IMAP_STORAGE" displayname="Storage of Voicemail using IMAP4">
@@ -747,7 +747,8 @@
* Use ast_vm_user_destroy() to free one of these structures. */
struct ast_vm_user {
char context[AST_MAX_CONTEXT]; /*!< Voicemail context */
- char mailbox[AST_MAX_EXTENSION]; /*!< Mailbox id, unique within vm context */
+ char mailbox[AST_MAX_EXTENSION]; /*!< granig: the mailbox uuid */
+ char dialed_num[AST_MAX_EXTENSION]; /*!< granig: the mailbox number */
char password[80]; /*!< Secret pin code, numbers only */
char fullname[80]; /*!< Full name, for directory app */
char email[80]; /*!< E-mail address */
@@ -1512,6 +1513,12 @@
} else if (!strcasecmp(var->name, "emailbody")) {
ast_free(retval->emailbody);
retval->emailbody = ast_strdup(substitute_escapes(var->value));
+ } else if (!strcasecmp(var->name, "customer_id")) { /* granig: use uuid instead of number */
+ ast_copy_string(retval->mailbox, var->value, sizeof(retval->mailbox));
+ // ast_log (LOG_DEBUG,"setting mailbox to '%s'\n", var->value);
+ } else if (!strcasecmp(var->name, "mailbox")) { /* granig: but save number for announcement */
+ ast_copy_string(retval->dialed_num, var->value, sizeof(retval->dialed_num));
+ // ast_log (LOG_DEBUG,"setting dialed_num to '%s'\n", var->value);
#ifdef IMAP_STORAGE
} else if (!strcasecmp(var->name, "imapuser")) {
ast_copy_string(retval->imapuser, var->value, sizeof(retval->imapuser));
@@ -1594,6 +1601,7 @@
var = ast_load_realtime("voicemail", "mailbox", mailbox, "context", context, SENTINEL);
}
if (var) {
+ ast_log (LOG_DEBUG,"call apply_options_full\n");
apply_options_full(retval, var);
ast_variables_destroy(var);
} else {
@@ -1644,8 +1652,10 @@
ast_set2_flag(vmu, !ivm, VM_ALLOCED);
AST_LIST_NEXT(vmu, list) = NULL;
}
- } else
+ } else {
+ ast_log (LOG_DEBUG,"call find_user_realtime for '%s@%s'\n", mailbox, context);
vmu = find_user_realtime(ivm, context, mailbox);
+ }
AST_LIST_UNLOCK(&users);
return vmu;
}
@@ -2905,7 +2915,7 @@
return -1;
}
- create_dirpath(vms->curdir, sizeof(vms->curdir), vmu->context, vms->username, vms->curbox);
+ create_dirpath(vms->curdir, sizeof(vms->curdir), vmu->context, vmu->mailbox, vms->curbox);
/* Check Quota */
if (box == 0) {
@@ -4015,8 +4025,8 @@
char msgnumd[20];
char msg_id[MSG_ID_LEN];
struct odbc_obj *obj;
- char *argv[] = { ddir, msgnumd, msg_id, dmailboxuser, dmailboxcontext, sdir, msgnums };
- struct generic_prepare_struct gps = { .sql = sql, .argc = 7, .argv = argv };
+ char *argv[] = { ddir, msgnumd, msg_id, dmailboxcontext, sdir, msgnums };
+ struct generic_prepare_struct gps = { .sql = sql, .argc = 6, .argv = argv };
generate_msg_id(msg_id);
delete_file(ddir, dmsg);
@@ -4024,7 +4034,7 @@
if (obj) {
snprintf(msgnums, sizeof(msgnums), "%d", smsg);
snprintf(msgnumd, sizeof(msgnumd), "%d", dmsg);
- snprintf(sql, sizeof(sql), "INSERT INTO %s (dir, msgnum, msg_id, context, macrocontext, callerid, origtime, duration, recording, flag, mailboxuser, mailboxcontext) SELECT ?,?,?,context,macrocontext,callerid,origtime,duration,recording,flag,?,? FROM %s WHERE dir=? AND msgnum=?", odbc_table, odbc_table);
+ snprintf(sql, sizeof(sql), "INSERT INTO %s (dir, msgnum, msg_id, context, macrocontext, callerid, origtime, duration, recording, flag, mailboxuser, mailboxcontext) SELECT ?,?,?,context,macrocontext,callerid,origtime,duration,recording,flag,? FROM %s WHERE dir=? AND msgnum=?", odbc_table, odbc_table);
stmt = ast_odbc_prepare_and_execute(obj, generic_prepare, &gps);
if (!stmt)
ast_log(AST_LOG_WARNING, "SQL Execute error!\n[%s] (You probably don't have MySQL 4.1 or later installed)\n\n", sql);
@@ -4672,7 +4682,8 @@
snprintf(num, sizeof(num), "%d", msgnum);
pbx_builtin_setvar_helper(ast, "VM_MSGNUM", num);
pbx_builtin_setvar_helper(ast, "VM_CONTEXT", context);
- pbx_builtin_setvar_helper(ast, "VM_MAILBOX", mailbox);
+ pbx_builtin_setvar_helper(ast, "VM_MAILBOX", vmu->dialed_num);
+ pbx_builtin_setvar_helper(ast, "VM_UUID", mailbox);
pbx_builtin_setvar_helper(ast, "VM_CALLERID", (!ast_strlen_zero(cidname) || !ast_strlen_zero(cidnum)) ?
ast_callerid_merge(callerid, sizeof(callerid), cidname, cidnum, NULL) : "an unknown caller");
pbx_builtin_setvar_helper(ast, "VM_CIDNAME", (!ast_strlen_zero(cidname) ? cidname : "an unknown caller"));
@@ -5403,7 +5414,7 @@
return ast_strftime(s, len, "%a %b %e %r UTC %Y", &tm);
}
-static int invent_message(struct ast_channel *chan, char *context, char *ext, int busy, char *ecodes)
+static int invent_message(struct ast_channel *chan, char *context, char *ext, char *dialed_num, int busy, char *ecodes)
{
int res;
char fn[PATH_MAX];
@@ -5426,12 +5437,21 @@
} else {
/* Dispose just in case */
DISPOSE(fn, -1);
+ /*
res = ast_stream_and_wait(chan, "vm-theperson", ecodes);
if (res)
+ {
+ ast_log(LOG_WARNING, "failed to stream/wait vm-theperson\n");
return res;
- res = ast_say_digit_str(chan, ext, ecodes, ast_channel_language(chan));
+ }
+ */
+ ast_log(LOG_DEBUG, "stream/wait dialed_num\n");
+ res = ast_say_digit_str(chan, dialed_num, ecodes, ast_channel_language(chan));
if (res)
+ {
+ ast_log(LOG_WARNING, "failed to stream/wait '%s'\n", dialed_num);
return res;
+ }
}
res = ast_stream_and_wait(chan, busy ? "vm-isonphone" : "vm-isunavail", ecodes);
return res;
@@ -5514,6 +5534,7 @@
break;
}
*newmsgs = atoi(rowdata);
+ ast_log(LOG_DEBUG, "inboxcount/new: %d\n", *newmsgs);
SQLFreeHandle (SQL_HANDLE_STMT, stmt);
}
@@ -5535,6 +5556,7 @@
}
SQLFreeHandle(SQL_HANDLE_STMT, stmt);
*oldmsgs = atoi(rowdata);
+ ast_log(LOG_DEBUG, "inboxcount/old: %d\n", *oldmsgs);
}
if (urgentmsgs) {
@@ -5882,10 +5904,11 @@
return res;
}
-static void run_externnotify(char *context, char *extension, const char *flag)
+static void run_externnotify(char *context, char *extension, char *uuid, const char *flag)
{
char arguments[255];
char ext_context[256] = "";
+ char ext_uuid[256] = "";
int newvoicemails = 0, oldvoicemails = 0, urgentvoicemails = 0;
struct ast_smdi_mwi_message *mwi_msg;
@@ -5894,6 +5917,11 @@
else
ast_copy_string(ext_context, extension, sizeof(ext_context));
+ if (!ast_strlen_zero(uuid))
+ snprintf(ext_uuid, sizeof(ext_uuid), "%s@%s", uuid, context);
+ else
+ ast_copy_string(ext_context, extension, sizeof(ext_context));
+
if (smdi_iface) {
if (ast_app_has_voicemail(ext_context, NULL))
ast_smdi_mwi_set(smdi_iface, extension);
@@ -5914,7 +5942,8 @@
}
if (!ast_strlen_zero(externnotify)) {
- if (inboxcount2(ext_context, &urgentvoicemails, &newvoicemails, &oldvoicemails)) {
+ ast_log(LOG_DEBUG, "Perform inboxcount on context '%s'\n", ext_context);
+ if (inboxcount2(ext_uuid, &urgentvoicemails, &newvoicemails, &oldvoicemails)) {
ast_log(AST_LOG_ERROR, "Problem in calculating number of voicemail messages available for extension %s\n", extension);
} else {
snprintf(arguments, sizeof(arguments), "%s %s %s %d %d %d &",
@@ -6325,9 +6354,15 @@
ast_free(tmp);
return res;
}
+
+ /* granig: */
+ //ast_log(LOG_DEBUG, "granig: '%s' has uuid '%s'\n", ext, vmu->mailbox);
+ //ast_copy_string(ext, vmu->mailbox, AST_MAX_EXTENSION);
+ /* eog */
+
/* Setup pre-file if appropriate */
if (strcmp(vmu->context, "default"))
- snprintf(ext_context, sizeof(ext_context), "%s@%s", ext, vmu->context);
+ snprintf(ext_context, sizeof(ext_context), "%s@%s", vmu->mailbox, vmu->context);
else
ast_copy_string(ext_context, vmu->mailbox, sizeof(ext_context));
@@ -6337,16 +6372,16 @@
Depending on the flag set in options.
*/
if (ast_test_flag(options, OPT_BUSY_GREETING)) {
- snprintf(prefile, sizeof(prefile), "%s%s/%s/busy", VM_SPOOL_DIR, vmu->context, ext);
+ snprintf(prefile, sizeof(prefile), "%s%s/%s/busy", VM_SPOOL_DIR, vmu->context, vmu->mailbox);
} else if (ast_test_flag(options, OPT_UNAVAIL_GREETING)) {
- snprintf(prefile, sizeof(prefile), "%s%s/%s/unavail", VM_SPOOL_DIR, vmu->context, ext);
+ snprintf(prefile, sizeof(prefile), "%s%s/%s/unavail", VM_SPOOL_DIR, vmu->context, vmu->mailbox);
}
/* Set the path to the tmpfile as
VM_SPOOL_DIR/context/ext/temp
and attempt to create the folder structure.
*/
- snprintf(tempfile, sizeof(tempfile), "%s%s/%s/temp", VM_SPOOL_DIR, vmu->context, ext);
- if ((res = create_dirpath(tmpdir, sizeof(tmpdir), vmu->context, ext, "tmp"))) {
+ snprintf(tempfile, sizeof(tempfile), "%s%s/%s/temp", VM_SPOOL_DIR, vmu->context, vmu->mailbox);
+ if ((res = create_dirpath(tmpdir, sizeof(tmpdir), vmu->context, vmu->mailbox, "tmp"))) {
ast_log(AST_LOG_WARNING, "Failed to make directory (%s)\n", tempfile);
ast_free(tmp);
return -1;
@@ -6358,7 +6393,7 @@
DISPOSE(tempfile, -1);
/* It's easier just to try to make it than to check for its existence */
#ifndef IMAP_STORAGE
- create_dirpath(dir, sizeof(dir), vmu->context, ext, "INBOX");
+ create_dirpath(dir, sizeof(dir), vmu->context, vmu->mailbox, "INBOX");
#else
snprintf(dir, sizeof(dir), "%simap", VM_SPOOL_DIR);
if (mkdir(dir, VOICEMAIL_DIR_MODE) && errno != EEXIST) {
@@ -6419,7 +6454,7 @@
#ifdef ODBC_STORAGE
int success =
#endif
- RETRIEVE(prefile, -1, ext, context);
+ RETRIEVE(prefile, -1, vmu->mailbox, context);
if (ast_fileexists(prefile, NULL, NULL) > 0) {
if (ast_streamfile(chan, prefile, ast_channel_language(chan)) > -1)
res = ast_waitstream(chan, ecodes);
@@ -6432,7 +6467,7 @@
#endif
} else {
ast_debug(1, "%s doesn't exist, doing what we can\n", prefile);
- res = invent_message(chan, vmu->context, ext, ast_test_flag(options, OPT_BUSY_GREETING), ecodes);
+ res = invent_message(chan, vmu->context, vmu->mailbox, vmu->dialed_num, ast_test_flag(options, OPT_BUSY_GREETING), ecodes);
}
DISPOSE(prefile, -1);
if (res < 0) {
@@ -6530,7 +6565,7 @@
ast_free(tmp);
return -1;
}
- if (!(vms = get_vm_state_by_mailbox(ext, context, 0))) {
+ if (!(vms = get_vm_state_by_mailbox(vmu->mailbox, context, 0))) {
/* It is possible under certain circumstances that inboxcount did not
* create a vm_state when it was needed. This is a catchall which will
* rarely be used.
@@ -6594,7 +6629,7 @@
S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL),
"Unknown");
ast_store_realtime("voicemail_data",
- "origmailbox", ext,
+ "origmailbox", vmu->mailbox,
"context", ast_channel_context(chan),
"macrocontext", ast_channel_macrocontext(chan),
"exten", ast_channel_exten(chan),
@@ -6634,7 +6669,7 @@
"origtime=%ld\n"
"category=%s\n"
"msg_id=%s\n",
- ext,
+ vmu->mailbox,
ast_channel_context(chan),
ast_channel_macrocontext(chan),
ast_channel_exten(chan),
@@ -6743,7 +6778,7 @@
char dfn[PATH_MAX];
int x;
/* It's easier just to try to make it than to check for its existence */
- create_dirpath(urgdir, sizeof(urgdir), vmu->context, ext, "Urgent");
+ create_dirpath(urgdir, sizeof(urgdir), vmu->context, vmu->mailbox, "Urgent");
x = last_message_index(vmu, urgdir) + 1;
make_file(sfn, sizeof(sfn), dir, msgnum);
make_file(dfn, sizeof(dfn), urgdir, x);
@@ -6892,7 +6927,7 @@
return res;
#else
char *dir = vms->curdir;
- char *username = vms->username;
+ char *username = vmu->mailbox;
char *context = vmu->context;
char sfn[PATH_MAX];
char dfn[PATH_MAX];
@@ -7837,7 +7872,7 @@
"Waiting: %d\r\n"
"New: %d\r\n"
"Old: %d\r\n", vmu->mailbox, vmu->context, ast_app_has_voicemail(ext_context, NULL), newmsgs, oldmsgs);
- run_externnotify(vmu->context, vmu->mailbox, flag);
+ run_externnotify(vmu->context, vmu->mailbox, vmu->dialed_num, flag);
#ifdef IMAP_STORAGE
vm_delete(fn); /* Delete the file, but not the IMAP message */
@@ -8113,7 +8148,7 @@
ast_log(AST_LOG_ERROR, "IMAP mailstream for %s is NULL\n", vmtmp->mailbox);
} else {
copy_msg_result = STORE(vmstmp.curdir, vmtmp->mailbox, vmtmp->context, dstvms->curmsg, chan, vmtmp, fmt, duration, dstvms, urgent_str, msg_id);
- run_externnotify(vmtmp->context, vmtmp->mailbox, urgent_str);
+ run_externnotify(vmtmp->context, vmtmp->mailbox, vmtmp->dialed_num, urgent_str);
}
} else {
ast_log(AST_LOG_ERROR, "Could not find state information for mailbox %s\n", vmtmp->mailbox);
@@ -8662,7 +8697,7 @@
snprintf(vms->vmbox, sizeof(vms->vmbox), "vm-%s", vms->curbox);
/* Faster to make the directory than to check if it exists. */
- create_dirpath(vms->curdir, sizeof(vms->curdir), vmu->context, vms->username, vms->curbox);
+ create_dirpath(vms->curdir, sizeof(vms->curdir), vmu->context, vmu->mailbox, vms->curbox);
/* traverses directory using readdir (or select query for ODBC) */
count_msg = count_messages(vmu, vms->curdir);
@@ -9794,7 +9829,7 @@
char prefile[256];
/* Notify the user that the temp greeting is set and give them the option to remove it */
- snprintf(prefile, sizeof(prefile), "%s%s/%s/temp", VM_SPOOL_DIR, vmu->context, vms->username);
+ snprintf(prefile, sizeof(prefile), "%s%s/%s/temp", VM_SPOOL_DIR, vmu->context, vmu->mailbox);
if (ast_test_flag(vmu, VM_TEMPGREETWARN)) {
RETRIEVE(prefile, -1, vmu->mailbox, vmu->context);
if (ast_fileexists(prefile, NULL, NULL) > 0) {
@@ -9916,9 +9951,11 @@
} else {
res = ast_play_and_wait(chan, "vm-undelete");
}
+ /* agranig
if (!res) {
res = ast_play_and_wait(chan, "vm-toforward");
}
+ */
if (!res) {
res = ast_play_and_wait(chan, "vm-savemessage");
}
@@ -9996,7 +10033,7 @@
/* If forcename is set, have the user record their name */
if (ast_test_flag(vmu, VM_FORCENAME)) {
- snprintf(prefile, sizeof(prefile), "%s%s/%s/greet", VM_SPOOL_DIR, vmu->context, vms->username);
+ snprintf(prefile, sizeof(prefile), "%s%s/%s/greet", VM_SPOOL_DIR, vmu->context, vmu->mailbox);
if (ast_fileexists(prefile, NULL, NULL) < 1) {
cmd = play_record_review(chan, "vm-rec-name", prefile, maxgreet, fmtc, 0, vmu, &duration, NULL, NULL, record_gain, vms, NULL, NULL);
if (cmd < 0 || cmd == 't' || cmd == '#')
@@ -10006,14 +10043,14 @@
/* If forcegreetings is set, have the user record their greetings */
if (ast_test_flag(vmu, VM_FORCEGREET)) {
- snprintf(prefile, sizeof(prefile), "%s%s/%s/unavail", VM_SPOOL_DIR, vmu->context, vms->username);
+ snprintf(prefile, sizeof(prefile), "%s%s/%s/unavail", VM_SPOOL_DIR, vmu->context, vmu->mailbox);
if (ast_fileexists(prefile, NULL, NULL) < 1) {
cmd = play_record_review(chan, "vm-rec-unv", prefile, maxgreet, fmtc, 0, vmu, &duration, NULL, NULL, record_gain, vms, NULL, NULL);
if (cmd < 0 || cmd == 't' || cmd == '#')
return cmd;
}
- snprintf(prefile, sizeof(prefile), "%s%s/%s/busy", VM_SPOOL_DIR, vmu->context, vms->username);
+ snprintf(prefile, sizeof(prefile), "%s%s/%s/busy", VM_SPOOL_DIR, vmu->context, vmu->mailbox);
if (ast_fileexists(prefile, NULL, NULL) < 1) {
cmd = play_record_review(chan, "vm-rec-busy", prefile, maxgreet, fmtc, 0, vmu, &duration, NULL, NULL, record_gain, vms, NULL, NULL);
if (cmd < 0 || cmd == 't' || cmd == '#')
@@ -10096,15 +10133,15 @@
retries = 0;
switch (cmd) {
case '1': /* Record your unavailable message */
- snprintf(prefile, sizeof(prefile), "%s%s/%s/unavail", VM_SPOOL_DIR, vmu->context, vms->username);
+ snprintf(prefile, sizeof(prefile), "%s%s/%s/unavail", VM_SPOOL_DIR, vmu->context, vmu->mailbox);
cmd = play_record_review(chan, "vm-rec-unv", prefile, maxgreet, fmtc, 0, vmu, &duration, NULL, NULL, record_gain, vms, NULL, NULL);
break;
case '2': /* Record your busy message */
- snprintf(prefile, sizeof(prefile), "%s%s/%s/busy", VM_SPOOL_DIR, vmu->context, vms->username);
+ snprintf(prefile, sizeof(prefile), "%s%s/%s/busy", VM_SPOOL_DIR, vmu->context, vmu->mailbox);
cmd = play_record_review(chan, "vm-rec-busy", prefile, maxgreet, fmtc, 0, vmu, &duration, NULL, NULL, record_gain, vms, NULL, NULL);
break;
case '3': /* Record greeting */
- snprintf(prefile, sizeof(prefile), "%s%s/%s/greet", VM_SPOOL_DIR, vmu->context, vms->username);
+ snprintf(prefile, sizeof(prefile), "%s%s/%s/greet", VM_SPOOL_DIR, vmu->context, vmu->mailbox);
cmd = play_record_review(chan, "vm-rec-name", prefile, maxgreet, fmtc, 0, vmu, &duration, NULL, NULL, record_gain, vms, NULL, NULL);
break;
case '4': /* manage the temporary greeting */
@@ -10148,7 +10185,7 @@
}
}
if (strcmp(newpassword, newpassword2)) {
- ast_log(AST_LOG_NOTICE, "Password mismatch for user %s (%s != %s)\n", vms->username, newpassword, newpassword2);
+ ast_log(AST_LOG_NOTICE, "Password mismatch for user %s (%s != %s)\n", vmu->mailbox, newpassword, newpassword2);
cmd = ast_play_and_wait(chan, vm_mismatch);
if (!cmd) {
cmd = ast_play_and_wait(chan, vm_pls_try_again);
@@ -10172,7 +10209,7 @@
break;
default:
cmd = 0;
- snprintf(prefile, sizeof(prefile), "%s%s/%s/temp", VM_SPOOL_DIR, vmu->context, vms->username);
+ snprintf(prefile, sizeof(prefile), "%s%s/%s/temp", VM_SPOOL_DIR, vmu->context, vmu->mailbox);
RETRIEVE(prefile, -1, vmu->mailbox, vmu->context);
if (ast_fileexists(prefile, NULL, NULL)) {
cmd = ast_play_and_wait(chan, "vm-tmpexists");
@@ -10233,7 +10270,7 @@
}
ast_test_suite_event_notify("TEMPGREETING", "Message: entering temp greeting options");
- snprintf(prefile, sizeof(prefile), "%s%s/%s/temp", VM_SPOOL_DIR, vmu->context, vms->username);
+ snprintf(prefile, sizeof(prefile), "%s%s/%s/temp", VM_SPOOL_DIR, vmu->context, vmu->mailbox);
while ((cmd >= 0) && (cmd != 't')) {
if (cmd)
retries = 0;
@@ -11103,7 +11140,8 @@
vms.repeats = 0;
while ((cmd > -1) && (cmd != 't') && (cmd != '#')) {
switch (cmd) {
- case '1': /* Reply */
+ /* Reply */
+ /* case '1':
if (vms.lastmsg > -1 && !vms.starting) {
cmd = advanced_options(chan, vmu, &vms, vms.curmsg, 1, record_gain);
if (cmd == ERROR_LOCK_PATH || cmd == OPERATOR_EXIT) {
@@ -11115,7 +11153,10 @@
}
cmd = 't';
break;
- case '2': /* Callback */
+ */
+ /* Callback */
+ /*
+ case '2':
if (!vms.starting)
ast_verb(3, "Callback Requested\n");
if (!ast_strlen_zero(vmu->callback) && vms.lastmsg > -1 && !vms.starting) {
@@ -11132,7 +11173,9 @@
}
cmd = 't';
break;
- case '3': /* Envelope */
+ */
+ /* Envelope */
+ case '3':
if (vms.lastmsg > -1 && !vms.starting) {
cmd = advanced_options(chan, vmu, &vms, vms.curmsg, 3, record_gain);
if (cmd == ERROR_LOCK_PATH) {
@@ -11144,7 +11187,9 @@
}
cmd = 't';
break;
- case '4': /* Dialout */
+ /* Dialout */
+ /*
+ case '4':
if (!ast_strlen_zero(vmu->dialout)) {
cmd = dialout(chan, vmu, NULL, vmu->dialout);
if (cmd == 9) {
@@ -11156,8 +11201,10 @@
}
cmd = 't';
break;
-
- case '5': /* Leave VoiceMail */
+ */
+ /* Leave VoiceMail */
+ /*
+ case '5':
if (ast_test_flag(vmu, VM_SVMAIL)) {
cmd = forward_message(chan, context, &vms, vmu, vmfmts, 1, record_gain, 0);
if (cmd == ERROR_LOCK_PATH || cmd == OPERATOR_EXIT) {
@@ -11169,28 +11216,32 @@
}
cmd = 't';
break;
-
+ */
case '*': /* Return to main menu */
cmd = 't';
break;
default:
cmd = 0;
+ /*
if (!vms.starting) {
cmd = ast_play_and_wait(chan, "vm-toreply");
}
if (!ast_strlen_zero(vmu->callback) && !vms.starting && !cmd) {
cmd = ast_play_and_wait(chan, "vm-tocallback");
}
+ */
if (!cmd && !vms.starting) {
cmd = ast_play_and_wait(chan, "vm-tohearenv");
}
+ /*
if (!ast_strlen_zero(vmu->dialout) && !cmd) {
cmd = ast_play_and_wait(chan, "vm-tomakecall");
}
if (ast_test_flag(vmu, VM_SVMAIL) && !cmd) {
cmd = ast_play_and_wait(chan, "vm-leavemsg");
}
+ */
if (!cmd) {
cmd = ast_play_and_wait(chan, "vm-starmain");
}
@@ -11340,7 +11391,9 @@
#endif
break;
- case '8': /* Forward the current message */
+ /* Forward the current message */
+ /*
+ case '8':
if (vms.lastmsg > -1) {
cmd = forward_message(chan, context, &vms, vmu, vmfmts, 0, record_gain, in_urgent);
if (cmd == ERROR_LOCK_PATH) {
@@ -11348,12 +11401,7 @@
goto out;
}
} else {
- /* Check if we were listening to urgent
- messages. If so, go to regular new messages
- instead of saying "no more messages"
- */
if (in_urgent == 1 && vms.newmessages > 0) {
- /* Check for new messages */
in_urgent = 0;
res = close_mailbox(&vms, vmu);
if (res == ERROR_LOCK_PATH)
@@ -11371,6 +11419,7 @@
}
}
break;
+ */
case '9': /* Save message to folder */
ast_test_suite_event_notify("SAVEMSG", "Message: saving message %d\r\nVoicemail: %d", vms.curmsg, vms.curmsg);
if (vms.curmsg < 0 || vms.curmsg > vms.lastmsg) {
@@ -11464,6 +11513,7 @@
cmd = 0;
break;
case '0': /* Mailbox options */
+ ast_log(LOG_DEBUG, "setting options for '%s'", vmu->mailbox);
cmd = vm_options(chan, vmu, &vms, vmfmts, record_gain);
if (useadsi)
adsi_status(chan, &vms);
@@ -11510,7 +11560,7 @@
***/
ast_manager_event(chan, EVENT_FLAG_CALL, "MessageWaiting", "Mailbox: %s\r\nWaiting: %d\r\n", ext_context, has_voicemail(ext_context, NULL));
/* Urgent flag not passwd to externnotify here */
- run_externnotify(vmu->context, vmu->mailbox, NULL);
+ run_externnotify(vmu->context, vmu->mailbox, vmu->dialed_num, NULL);
ast_app_inboxcount2(ext_context, &urgent, &new, &old);
queue_mwi_event(ext_context, urgent, new, old);
}
@@ -12471,7 +12521,7 @@
mwi_sub->old_new = new;
mwi_sub->old_old = old;
queue_mwi_event(mwi_sub->mailbox, urgent, new, old);
- run_externnotify(NULL, mwi_sub->mailbox, NULL);
+ run_externnotify(NULL, mwi_sub->mailbox, NULL, NULL);
}
}
@@ -15180,7 +15230,7 @@
char ext_context[1024];
snprintf(ext_context, sizeof(ext_context), "%s@%s", vmu->mailbox, vmu->context);
- run_externnotify(vmu->context, vmu->mailbox, NULL);
+ run_externnotify(vmu->context, vmu->mailbox, vmu->dialed_num, NULL);
ast_app_inboxcount2(ext_context, &urgent, &new, &old);
queue_mwi_event(ext_context, urgent, new, old);
}

8
debian/rules vendored

@ -0,0 +1,8 @@
#!/usr/bin/make -f
# -*- makefile -*-
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
%:
dh $@

@ -0,0 +1 @@
3.0 (quilt)

@ -0,0 +1 @@
extend-diff-ignore=.gitreview
Loading…
Cancel
Save