[svn-commits] trunk - r7865 in /trunk: configs/features.conf.sample res/res_features.c

svn-commits at lists.digium.com svn-commits at lists.digium.com
Sat Jan 7 18:25:32 CST 2006


Author: mogorman
Date: Sat Jan  7 18:25:31 2006
New Revision: 7865

URL: http://svn.digium.com/view/asterisk?rev=7865&view=rev
Log:
added small feature from bug 5682 with one typo fix.


Modified:
    trunk/configs/features.conf.sample
    trunk/res/res_features.c

Modified: trunk/configs/features.conf.sample
URL: http://svn.digium.com/view/asterisk/trunk/configs/features.conf.sample?rev=7865&r1=7864&r2=7865&view=diff
==============================================================================
--- trunk/configs/features.conf.sample (original)
+++ trunk/configs/features.conf.sample Sat Jan  7 18:25:31 2006
@@ -12,6 +12,8 @@
 ;courtesytone = beep		; Sound file to play to the parked caller 
 				; when someone dials a parked call
 				; or the Touch Monitor is activated/deactivated.
+;parkedplay = caller		; Who to play the courtesy tone to when picking up a parked call
+				; one of: parked, caller, both  (default is caller)
 ;xfersound = beep		; to indicate an attended transfer is complete
 ;xferfailsound = beeperr	; to indicate a failed transfer
 ;adsipark = yes			; if you want ADSI parking announcements

Modified: trunk/res/res_features.c
URL: http://svn.digium.com/view/asterisk/trunk/res/res_features.c?rev=7865&r1=7864&r2=7865&view=diff
==============================================================================
--- trunk/res/res_features.c (original)
+++ trunk/res/res_features.c Sat Jan  7 18:25:31 2006
@@ -93,6 +93,9 @@
 static char courtesytone[256];
 static char xfersound[256];
 static char xferfailsound[256];
+
+/* Who to play the courtesy tone to */
+static int parkedplay = 0;
 
 /* First available extension for parking */
 static int parking_start;
@@ -1742,19 +1745,45 @@
 	}
 
 	if (peer) {
-		/* Play a courtesy beep in the calling channel to prefix the bridge connecting */	
+		/* Play a courtesy to the source(s) configured to prefix the bridge connecting */
+		
 		if (!ast_strlen_zero(courtesytone)) {
-			if (!ast_streamfile(chan, courtesytone, chan->language)) {
-				if (ast_waitstream(chan, "") < 0) {
-					ast_log(LOG_WARNING, "Failed to play courtesy tone!\n");
-					ast_hangup(peer);
-					return -1;
+			if (parkedplay == 0) {
+				if (!ast_streamfile(chan, courtesytone, chan->language)) {
+					if (ast_waitstream(chan, "") < 0) {
+						ast_log(LOG_WARNING, "Failed to play courtesy tone!\n");
+						ast_hangup(peer);
+						return -1;
+					}
+				}
+				ast_moh_stop(peer);
+				ast_indicate(peer, AST_CONTROL_UNHOLD);
+			} else {
+				ast_moh_stop(peer);
+				ast_indicate(peer, AST_CONTROL_UNHOLD);
+				if (parkedplay == 2) {
+					if (!ast_streamfile(chan, courtesytone, chan->language) && !ast_streamfile(peer, courtesytone, chan->language)) {
+						res = ast_waitstream(chan, "");
+						if (res >= 0)
+							res = ast_waitstream(peer, "");
+						if (res < 0) {
+							ast_log(LOG_WARNING, "Failed to play courtesy tones!\n");
+							ast_hangup(peer);
+							return -1;
+						}
+					}
+				} else if (parkedplay == 1) {
+					if (!ast_streamfile(peer, courtesytone, chan->language)) {
+						if (ast_waitstream(peer, "") < 0) {
+							ast_log(LOG_WARNING, "Failed to play courtesy tone!\n");
+							ast_hangup(peer);
+							return -1;
+						}
+					}
 				}
 			}
 		}
  
-		ast_moh_stop(peer);
-		ast_indicate(peer, AST_CONTROL_UNHOLD);
 		res = ast_channel_make_compatible(chan, peer);
 		if (res < 0) {
 			ast_log(LOG_WARNING, "Could not make channels %s and %s compatible for bridge\n", chan->name, peer->name);
@@ -2029,6 +2058,13 @@
 				}
 			} else if (!strcasecmp(var->name, "courtesytone")) {
 				ast_copy_string(courtesytone, var->value, sizeof(courtesytone));
+			}  else if (!strcasecmp(var->name, "parkedplay")) {
+				if (!strcasecmp(var->value, "both"))
+					parkedplay = 2;
+				else if (!strcasecmp(var->value, "parked"))
+					parkedplay = 1;
+				else
+					parkedplay = 0;
 			} else if (!strcasecmp(var->name, "xfersound")) {
 				ast_copy_string(xfersound, var->value, sizeof(xfersound));
 			} else if (!strcasecmp(var->name, "xferfailsound")) {



More information about the svn-commits mailing list