[asterisk-commits] jrose: trunk r348416 - in /trunk: ./ apps/ configs/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Dec 16 16:00:41 CST 2011


Author: jrose
Date: Fri Dec 16 16:00:37 2011
New Revision: 348416

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=348416
Log:
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)

Modified:
    trunk/CHANGES
    trunk/apps/app_voicemail.c
    trunk/configs/voicemail.conf.sample

Modified: trunk/CHANGES
URL: http://svnview.digium.com/svn/asterisk/trunk/CHANGES?view=diff&rev=348416&r1=348415&r2=348416
==============================================================================
--- trunk/CHANGES (original)
+++ trunk/CHANGES Fri Dec 16 16:00:37 2011
@@ -44,6 +44,13 @@
 -------------
  * 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
 ------------

Modified: trunk/apps/app_voicemail.c
URL: http://svnview.digium.com/svn/asterisk/trunk/apps/app_voicemail.c?view=diff&rev=348416&r1=348415&r2=348416
==============================================================================
--- trunk/apps/app_voicemail.c (original)
+++ trunk/apps/app_voicemail.c Fri Dec 16 16:00:37 2011
@@ -7605,7 +7605,7 @@
 
 
 
-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 @@
 			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 @@
 			}
 		} 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 @@
 		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 @@
 		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 @@
 					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 */

Modified: trunk/configs/voicemail.conf.sample
URL: http://svnview.digium.com/svn/asterisk/trunk/configs/voicemail.conf.sample?view=diff&rev=348416&r1=348415&r2=348416
==============================================================================
--- trunk/configs/voicemail.conf.sample (original)
+++ trunk/configs/voicemail.conf.sample Fri Dec 16 16:00:37 2011
@@ -224,7 +224,10 @@
 			; 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]




More information about the asterisk-commits mailing list