dect
/
asterisk
Archived
13
0
Fork 0

Adding support for "urgent" voicemail messages. Messages which are

marked "urgent" are considered to be higher priority than other messages
and so they will be played before any other messages in a user's mailbox.

There are two ways to leave an urgent message. 
1. send the 'U' option to VoiceMail().
2. Set review=yes in voicemail.conf. This will give instructions for 
   a caller to mark a message as urgent after the message has been recorded.

I have tested that this works correctly with file and ODBC storage, and James
Rothenberger (who wrote initial support for this feature) has tested its use
with IMAP storage.

(closes issue #11817)
Reported by: jaroth
	Based on branch http://svn.digium.com/svn/asterisk/team/jrothenberger/asterisk-urgent
Tested by: putnopvut, jaroth



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@115588 f38db490-d61c-443f-a65b-d21fe96a405b
This commit is contained in:
mmichelson 2008-05-09 21:22:42 +00:00
parent d2e5ffcec0
commit 71a41a28b1
10 changed files with 1042 additions and 820 deletions

View File

@ -417,6 +417,12 @@ Voicemail Changes
voicemail boxes. The SMDI interface can also poll for MWI changes when some
outside entity is modifying the state of the mailbox (such as IMAP storage or
a web interface of some kind).
* Added the support for marking messages as "urgent." There are two methods to accomplish
this. One is to pass the 'U' option to VoiceMail(). Another way to mark a message as urgent
is to specify "review=yes" in voicemail.conf. Doing this will cause allow the user to mark
the message as urgent after he has recorded a voicemail by following the voice instructions.
When listening to voicemails using VoiceMailMain urgent messages will be presented before other
messages
Queue changes
-------------

View File

@ -74,6 +74,8 @@ Voicemail:
checking mailboxes for changes so that they can send MWI information to users.
Examples of situations that would require this option are web interfaces to
voicemail or an email client in the case of using IMAP storage.
* The externnotify script should accept an additional (last) parameter
containing the string "URGENT" if there are new urgent messages in the INBOX.
Applications:

File diff suppressed because it is too large Load Diff

View File

@ -6862,7 +6862,7 @@ static int update_registry(struct sockaddr_in *sin, int callno, char *devtype, i
iax_ie_append_addr(&ied, IAX_IE_APPARENT_ADDR, &p->addr);
if (!ast_strlen_zero(p->mailbox)) {
struct ast_event *event;
int new, old;
int new, old, urgent;
char *mailbox, *context;
context = mailbox = ast_strdupa(p->mailbox);
@ -6881,8 +6881,10 @@ static int update_registry(struct sockaddr_in *sin, int callno, char *devtype, i
old = ast_event_get_ie_uint(event, AST_EVENT_IE_OLDMSGS);
ast_event_destroy(event);
} else /* Fall back on checking the mailbox directly */
ast_app_inboxcount(p->mailbox, &new, &old);
ast_app_inboxcount(p->mailbox, &urgent, &new, &old);
if (urgent > 255)
urgent = 255;
if (new > 255)
new = 255;
if (old > 255)

View File

@ -19354,7 +19354,7 @@ static int sip_send_mwi_to_peer(struct sip_peer *peer, const struct ast_event *e
{
/* Called with peerl lock, but releases it */
struct sip_pvt *p;
int newmsgs = 0, oldmsgs = 0;
int newmsgs = 0, oldmsgs = 0, urgentmsgs = 0;
if (ast_test_flag((&peer->flags[1]), SIP_PAGE2_SUBSCRIBEMWIONLY) && !peer->mwipvt)
return 0;
@ -19373,7 +19373,7 @@ static int sip_send_mwi_to_peer(struct sip_peer *peer, const struct ast_event *e
} else { /* Fall back to manually checking the mailbox */
struct ast_str *mailbox_str = ast_str_alloca(512);
peer_mailboxes_to_str(&mailbox_str, peer);
ast_app_inboxcount(mailbox_str->str, &newmsgs, &oldmsgs);
ast_app_inboxcount(mailbox_str->str, &urgentmsgs, &newmsgs, &oldmsgs);
}
if (peer->mwipvt) {

File diff suppressed because it is too large Load Diff

View File

@ -4375,7 +4375,7 @@ static int unistim_sendtext(struct ast_channel *ast, const char *text)
static int unistim_send_mwi_to_peer(struct unistimsession *s, unsigned int tick)
{
struct ast_event *event;
int new, old;
int new, old, urgent;
char *mailbox, *context;
struct unistim_line *peer = s->device->lines;
@ -4396,7 +4396,7 @@ static int unistim_send_mwi_to_peer(struct unistimsession *s, unsigned int tick)
old = ast_event_get_ie_uint(event, AST_EVENT_IE_OLDMSGS);
ast_event_destroy(event);
} else /* Fall back on checking the mailbox directly */
ast_app_inboxcount(peer->mailbox, &new, &old);
ast_app_inboxcount(peer->mailbox, &urgent, &new, &old);
peer->nextmsgcheck = tick + TIMER_MWI;

View File

@ -104,7 +104,7 @@ int ast_app_getdata(struct ast_channel *c, const char *prompt, char *s, int maxl
int ast_app_getdata_full(struct ast_channel *c, char *prompt, char *s, int maxlen, int timeout, int audiofd, int ctrlfd);
void ast_install_vm_functions(int (*has_voicemail_func)(const char *mailbox, const char *folder),
int (*inboxcount_func)(const char *mailbox, int *newmsgs, int *oldmsgs),
int (*inboxcount_func)(const char *mailbox, int *urgentmsgs, int *newmsgs, int *oldmsgs),
int (*messagecount_func)(const char *context, const char *mailbox, const char *folder),
int (*sayname_func)(struct ast_channel *chan, const char *mailbox, const char *context));
@ -113,8 +113,8 @@ void ast_uninstall_vm_functions(void);
/*! \brief Determine if a given mailbox has any voicemail */
int ast_app_has_voicemail(const char *mailbox, const char *folder);
/*! \brief Determine number of new/old messages in a mailbox */
int ast_app_inboxcount(const char *mailbox, int *newmsgs, int *oldmsgs);
/*! \brief Determine number of urgent/new/old messages in a mailbox */
int ast_app_inboxcount(const char *mailbox, int *urgentmsgs, int *newmsgs, int *oldmsgs);
/*! Given a mailbox and context, play that mailbox owner's name to the channel specified */
int ast_app_sayname(struct ast_channel *chan, const char *mailbox, const char *context);

View File

@ -176,12 +176,12 @@ int ast_app_getdata_full(struct ast_channel *c, char *prompt, char *s, int maxle
}
static int (*ast_has_voicemail_func)(const char *mailbox, const char *folder) = NULL;
static int (*ast_inboxcount_func)(const char *mailbox, int *newmsgs, int *oldmsgs) = NULL;
static int (*ast_inboxcount_func)(const char *mailbox, int *urgentmsgs, int *newmsgs, int *oldmsgs) = NULL;
static int (*ast_sayname_func)(struct ast_channel *chan, const char *mailbox, const char *context) = NULL;
static int (*ast_messagecount_func)(const char *context, const char *mailbox, const char *folder) = NULL;
void ast_install_vm_functions(int (*has_voicemail_func)(const char *mailbox, const char *folder),
int (*inboxcount_func)(const char *mailbox, int *newmsgs, int *oldmsgs),
int (*inboxcount_func)(const char *mailbox, int *urgentmsgs, int *newmsgs, int *oldmsgs),
int (*messagecount_func)(const char *context, const char *mailbox, const char *folder),
int (*sayname_func)(struct ast_channel *chan, const char *mailbox, const char *context))
{
@ -213,15 +213,17 @@ int ast_app_has_voicemail(const char *mailbox, const char *folder)
}
int ast_app_inboxcount(const char *mailbox, int *newmsgs, int *oldmsgs)
int ast_app_inboxcount(const char *mailbox, int *urgentmsgs, int *newmsgs, int *oldmsgs)
{
static int warned = 0;
if (newmsgs)
*newmsgs = 0;
if (oldmsgs)
*oldmsgs = 0;
if (urgentmsgs)
*urgentmsgs = 0;
if (ast_inboxcount_func)
return ast_inboxcount_func(mailbox, newmsgs, oldmsgs);
return ast_inboxcount_func(mailbox, urgentmsgs, newmsgs, oldmsgs);
if (!warned) {
warned++;

View File

@ -2336,29 +2336,31 @@ static char mandescr_mailboxcount[] =
"Variables: (Names marked with * are required)\n"
" *Mailbox: Full mailbox ID <mailbox>@<vm-context>\n"
" ActionID: Optional ActionID for message matching.\n"
"Returns number of new and old messages.\n"
"Returns number of urgent, new and old messages.\n"
" Message: Mailbox Message Count\n"
" Mailbox: <mailboxid>\n"
" UrgentMessages: <count>\n"
" NewMessages: <count>\n"
" OldMessages: <count>\n"
"\n";
static int action_mailboxcount(struct mansession *s, const struct message *m)
{
const char *mailbox = astman_get_header(m, "Mailbox");
int newmsgs = 0, oldmsgs = 0;
int newmsgs = 0, oldmsgs = 0, urgentmsgs = 0;;
if (ast_strlen_zero(mailbox)) {
astman_send_error(s, m, "Mailbox not specified");
return 0;
}
ast_app_inboxcount(mailbox, &newmsgs, &oldmsgs);
ast_app_inboxcount(mailbox, &urgentmsgs, &newmsgs, &oldmsgs);
astman_start_ack(s, m);
astman_append(s, "Message: Mailbox Message Count\r\n"
"Mailbox: %s\r\n"
"UrgMessages: %d\r\n"
"NewMessages: %d\r\n"
"OldMessages: %d\r\n"
"\r\n",
mailbox, newmsgs, oldmsgs);
mailbox, urgentmsgs, newmsgs, oldmsgs);
return 0;
}