aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2004-09-15 19:49:33 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2004-09-15 19:49:33 +0000
commit71c82f51e525259efe4094f31e3d91703a173dc1 (patch)
treed867760c908979979af67790ebf89db6be2a36a9
parentc6a28e3774596324a20c5003dcb0a2311fc1264f (diff)
Merge ADSI parking announcement (bug #2211)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@3787 f38db490-d61c-443f-a65b-d21fe96a405b
-rwxr-xr-xconfigs/features.conf.sample1
-rwxr-xr-xres/res_features.c27
2 files changed, 28 insertions, 0 deletions
diff --git a/configs/features.conf.sample b/configs/features.conf.sample
index 6d3181932..0b037e249 100755
--- a/configs/features.conf.sample
+++ b/configs/features.conf.sample
@@ -11,3 +11,4 @@ context => parkedcalls ; Which context parked calls are in
;transferdigittimeout => 3 ; Number of seconds to wait between digits when transfering a call
;courtesytone = beep ; Sound file to play to the parked caller
; when someone dials a parked call
+;adsipark = yes ; if you want ADSI parking announcements
diff --git a/res/res_features.c b/res/res_features.c
index e9cb7e7c3..5daa0b5e2 100755
--- a/res/res_features.c
+++ b/res/res_features.c
@@ -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 @@ static int parking_start = 701;
/* 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 @@ char *ast_pickup_ext(void)
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 @@ int ast_park_call(struct ast_channel *chan, struct ast_channel *peer, int timeou
);
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 @@ int load_module(void)
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);