[Asterisk-cvs] asterisk/res res_features.c,1.12,1.13

markster at lists.digium.com markster at lists.digium.com
Wed Sep 15 15:48:06 CDT 2004


Update of /usr/cvsroot/asterisk/res
In directory mongoose.digium.com:/tmp/cvs-serv28290/res

Modified Files:
	res_features.c 
Log Message:
Merge ADSI parking announcement (bug #2211)


Index: res_features.c
===================================================================
RCS file: /usr/cvsroot/asterisk/res/res_features.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- res_features.c	10 Sep 2004 15:11:38 -0000	1.12
+++ res_features.c	15 Sep 2004 19:49:33 -0000	1.13
@@ -27,6 +27,7 @@
 #include <asterisk/cli.h>
 #include <asterisk/manager.h>
 #include <asterisk/utils.h>
+#include <asterisk/adsi.h>
 #include <stdlib.h>
 #include <errno.h>
 #include <unistd.h>
@@ -59,6 +60,8 @@
 /* Last available extension for parking */
 static int parking_stop = 750;
 
+static int adsipark = 0;
+
 static int transferdigittimeout = DEFAULT_TRANSFER_DIGIT_TIMEOUT;
 
 /* Default courtesy tone played when party joins conference */
@@ -120,6 +123,22 @@
 	return pickup_ext;
 }
 
+static int adsi_announce_park(struct ast_channel *chan, int parkingnum)
+{
+	int res;
+	int justify[5] = {ADSI_JUST_CENT, ADSI_JUST_CENT, ADSI_JUST_CENT, ADSI_JUST_CENT};
+	char tmp[256] = "";
+	char *message[5] = {NULL, NULL, NULL, NULL, NULL};
+
+	snprintf(tmp, sizeof(tmp), "Parked on %d", parkingnum);
+	message[0] = tmp;
+	res = adsi_load_session(chan, NULL, 0, 1);
+	if (res == -1) {
+		return res;
+	}
+	return adsi_print(chan, message, justify, 1);
+}
+
 int ast_park_call(struct ast_channel *chan, struct ast_channel *peer, int timeout, int *extout)
 {
 	/* We put the user in the parking list, then wake up the parking thread to be sure it looks
@@ -194,7 +213,13 @@
                                 );
 
 			if (peer) {
+				if (adsipark && adsi_available(peer)) {
+					adsi_announce_park(peer, pu->parkingnum);
+				}
 				ast_say_digits(peer, pu->parkingnum, "", peer->language);
+				if (adsipark && adsi_available(peer)) {
+					adsi_unload_session(peer);
+				}
 				if (pu->notquiteyet) {
 					/* Wake up parking thread if we're really done */
 					ast_moh_start(pu->chan, NULL);
@@ -862,6 +887,8 @@
 					parking_start = start;
 					parking_stop = end;
 				}
+			} else if (!strcasecmp(var->name, "adsipark")) {
+				adsipark = ast_true(var->value);
 			} else if(!strcasecmp(var->name, "transferdigittimeout")) {
 				if ((sscanf(var->value, "%d", &transferdigittimeout) != 1) || (transferdigittimeout < 1)) {
 					ast_log(LOG_WARNING, "%s is not a valid transferdigittimeout\n", var->value);




More information about the svn-commits mailing list