summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Rose <jrose@digium.com>2011-12-16 22:00:37 +0000
committerJonathan Rose <jrose@digium.com>2011-12-16 22:00:37 +0000
commit1b0741c7db397114602da1e422125ad51d598b5c (patch)
tree99d387ec8549906e7d82fa87eaed6e1a4ec9ec73
parente71bad495894ec9dc8d041b9b4bbca75d35cf1a3 (diff)
Voicemail with the saycid option will now play a caller's name based on cid if available.
In order to check the availability of the caller's name, app_voicemail will check for an audio file in <astspooldir>/recordings/callerids/ This change sets a precedent for where to put recordings of names. Currently the idea is that recordings here could also be used for applications like confbridge and meetme to find recorded names in this folder from callerid (when another recording isn't available) (closes issue ASTERISK-18565) Reporter: Russell Brown Patches: r uploaded by Russel Brown (license 6182) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@348416 65c4cc65-6c06-0410-ace0-fbb531ad65f3
-rw-r--r--CHANGES7
-rw-r--r--apps/app_voicemail.c38
-rw-r--r--configs/voicemail.conf.sample5
3 files changed, 38 insertions, 12 deletions
diff --git a/CHANGES b/CHANGES
index d9124b8ed..db9f1c295 100644
--- a/CHANGES
+++ b/CHANGES
@@ -45,6 +45,13 @@ Queue changes
* Added queue options autopausebusy and autopauseunavail for automatically
pausing a queue member when their device reports busy or congestion.
+Voicemail changes
+-----------------
+ * When voicemail plays a message's envelope with saycid set to yes, when reaching
+ the caller id field it will play a recording of a file with the same base name
+ as the sender's callerid if there is a similarly named file in
+ <astspooldir>/recordings/callerids/
+
Applications
------------
* Added 'j' option to SayUnixTime. SayUnixTime no longer auto jumps to extension
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index a62a39b87..f4414d68b 100644
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -7605,7 +7605,7 @@ static int play_message_datetime(struct ast_channel *chan, struct ast_vm_user *v
-static int play_message_callerid(struct ast_channel *chan, struct vm_state *vms, char *cid, const char *context, int callback)
+static int play_message_callerid(struct ast_channel *chan, struct vm_state *vms, char *cid, const char *context, int callback, int saycidnumber)
{
int res = 0;
int i;
@@ -7637,7 +7637,8 @@ static int play_message_callerid(struct ast_channel *chan, struct vm_state *vms,
if (!res) {
snprintf(prefile, sizeof(prefile), "%s%s/%s/greet", VM_SPOOL_DIR, context, callerid);
if (!ast_strlen_zero(prefile)) {
- /* See if we can find a recorded name for this person instead of their extension number */
+ /* See if we can find a recorded name for this callerid
+ * and if found, use that instead of saying number. */
if (ast_fileexists(prefile, NULL, NULL) > 0) {
ast_verb(3, "Playing envelope info: CID number '%s' matches mailbox number, playing recorded name\n", callerid);
if (!callback)
@@ -7654,10 +7655,23 @@ static int play_message_callerid(struct ast_channel *chan, struct vm_state *vms,
}
} else if (!res) {
ast_debug(1, "VM-CID: Numeric caller id: (%s)\n", callerid);
- /* Since this is all nicely figured out, why not say "from phone number" in this case? */
- if (!callback)
- res = wait_file2(chan, vms, "vm-from-phonenumber");
- res = ast_say_digit_str(chan, callerid, AST_DIGIT_ANY, chan->language);
+ /* If there is a recording for this numeric callerid then play that */
+ if (!callback) {
+ /* See if we can find a recorded name for this person instead of their extension number */
+ snprintf(prefile, sizeof(prefile), "%s/recordings/callerids/%s", ast_config_AST_SPOOL_DIR, callerid);
+ if (!saycidnumber && ast_fileexists(prefile, NULL, NULL) > 0) {
+ ast_verb(3, "Playing recorded name for CID number '%s' - '%s'\n", callerid,prefile);
+ wait_file2(chan, vms, "vm-from");
+ res = ast_stream_and_wait(chan, prefile, "");
+ ast_verb(3, "Played recorded name result '%d'\n", res);
+ } else {
+ /* Since this is all nicely figured out, why not say "from phone number" in this case" */
+ wait_file2(chan, vms, "vm-from-phonenumber");
+ res = ast_say_digit_str(chan, callerid, AST_DIGIT_ANY, chan->language);
+ }
+ } else {
+ res = ast_say_digit_str(chan, callerid, AST_DIGIT_ANY, chan->language);
+ }
}
} else {
/* Number unknown */
@@ -7842,7 +7856,7 @@ static int play_message(struct ast_channel *chan, struct ast_vm_user *vmu, struc
res = play_message_datetime(chan, vmu, origtime, filename);
}
if ((!res) && (ast_test_flag(vmu, VM_SAYCID))) {
- res = play_message_callerid(chan, vms, cid, context, 0);
+ res = play_message_callerid(chan, vms, cid, context, 0, 0);
}
if ((!res) && (ast_test_flag(vmu, VM_SAYDURATION))) {
res = play_message_duration(chan, vms, duration, vmu->saydurationm);
@@ -13452,10 +13466,12 @@ static int advanced_options(struct ast_channel *chan, struct ast_vm_user *vmu, s
context = ast_variable_retrieve(msg_cfg, "message", "macrocontext");
switch (option) {
case 3: /* Play message envelope */
- if (!res)
+ if (!res) {
res = play_message_datetime(chan, vmu, origtime, filename);
- if (!res)
- res = play_message_callerid(chan, vms, cid, context, 0);
+ }
+ if (!res) {
+ res = play_message_callerid(chan, vms, cid, context, 0, 1);
+ }
res = 't';
break;
@@ -13515,7 +13531,7 @@ static int advanced_options(struct ast_channel *chan, struct ast_vm_user *vmu, s
ast_verb(3, "Confirm CID number '%s' is number to use for callback\n", num);
res = ast_play_and_wait(chan, "vm-num-i-have");
if (!res)
- res = play_message_callerid(chan, vms, num, vmu->context, 1);
+ res = play_message_callerid(chan, vms, num, vmu->context, 1, 1);
if (!res)
res = ast_play_and_wait(chan, "vm-tocallnum");
/* Only prompt for a caller-specified number if there is a dialout context specified */
diff --git a/configs/voicemail.conf.sample b/configs/voicemail.conf.sample
index 318f682b7..c2cbdf2e3 100644
--- a/configs/voicemail.conf.sample
+++ b/configs/voicemail.conf.sample
@@ -224,7 +224,10 @@ pagerdateformat=%A, %B %d, %Y at %r
; Useful if Windows users want wav49, but Linux users want gsm.
; [per-mailbox only]
; saycid=yes ; Say the caller id information before the message. If not described,
- ; or set to no, it will be in the envelope
+ ; or set to no, it will be in the envelope. When enabled, if a recorded file
+ ; with the same name as the caller id exists in
+ ; <astspooldir>/recordings/callerids, then that file will be played as a name
+ ; rather than saying each digit as a phone number.
; cidinternalcontexts=intern ; Internal Context for Name Playback instead of
; extension digits when saying caller id.
; sayduration=no ; Turn on/off the duration information before the message. [ON by default]