[Asterisk-cvs] asterisk/apps app_dial.c,1.61,1.62 app_queue.c,1.56,1.57
anthm at lists.digium.com
anthm at lists.digium.com
Mon Apr 26 19:16:28 CDT 2004
Update of /usr/cvsroot/asterisk/apps
In directory mongoose.digium.com:/tmp/cvs-serv31609/apps
Modified Files:
app_dial.c app_queue.c
Log Message:
applied final release of bug 1353 per Mark's permission
Index: app_dial.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_dial.c,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -d -r1.61 -r1.62
--- app_dial.c 2 Apr 2004 07:47:23 -0000 1.61
+++ app_dial.c 26 Apr 2004 23:22:33 -0000 1.62
@@ -20,6 +20,7 @@
#include <asterisk/module.h>
#include <asterisk/translate.h>
#include <asterisk/say.h>
+#include <asterisk/config.h>
#include <asterisk/parking.h>
#include <asterisk/musiconhold.h>
#include <asterisk/callerid.h>
@@ -68,6 +69,15 @@
" 'g' -- goes on in context if the destination channel hangs up\n"
" 'A(x)' -- play an announcement to the called party, using x as file\n"
" 'S(x)' -- hangup the call after x seconds AFTER called party picked up\n"
+" 'L(x[:y][:z])' -- Limit the call to 'x' ms warning when 'y' ms are left (repeated every 'z' ms)\n"
+" -- Only 'x' is required, 'y' and 'z' are optional.\n"
+" -- The following special variables are optional:\n"
+" ** LIMIT_PLAYAUDIO_CALLER (default yes) Play sounds to the caller.\n"
+" ** LIMIT_PLAYAUDIO_CALLEE Play sounds to the callee.\n"
+" ** LIMIT_TIMEOUT_FILE File to play when time is up.\n"
+" ** LIMIT_CONNECT_FILE File to play when call begins.\n"
+" ** LIMIT_WARNING_FILE File to play as warning if 'y' is defined.\n"
+" -- 'timeleft' is a special sound macro to auto-say the time left and is the default.\n\n"
" In addition to transferring the call, a call may be parked and then picked\n"
"up by another user.\n"
" The optional URL will be sent to the called party if the channel supports\n"
@@ -390,7 +400,19 @@
unsigned int calldurationlimit=0;
char *cdl;
time_t now;
-
+ struct ast_bridge_config config;
+ long timelimit = 0;
+ long play_warning = 0;
+ long warning_freq=0;
+ char *warning_sound=NULL;
+ char *end_sound=NULL;
+ char *start_sound=NULL;
+ char *limitptr;
+ char limitdata[256];
+ char *stack,*var;
+ int play_to_caller=0,play_to_callee=0;
+ int playargs=0;
+
if (!data) {
ast_log(LOG_WARNING, "Dial requires an argument (technology1/number1&technology2/number2...|optional timeout|options)\n");
return -1;
@@ -430,13 +452,81 @@
if (transfer) {
+
/* Extract call duration limit */
if ((cdl = strstr(transfer, "S("))) {
calldurationlimit=atoi(cdl+2);
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "Setting call duration limit to %i seconds.\n",calldurationlimit);
}
-
+
+ /* XXX LIMIT SUPPORT */
+ if ((limitptr = strstr(transfer, "L("))) {
+ strncpy(limitdata, limitptr + 2, sizeof(limitdata) - 1);
+ /* Overwrite with X's what was the limit info */
+ while(*limitptr && (*limitptr != ')'))
+ *(limitptr++) = 'X';
+ if (*limitptr)
+ *limitptr = 'X';
+ /* Now find the end of the privdb */
+ limitptr = strchr(limitdata, ')');
+ if (limitptr)
+ *limitptr = '\0';
+ else {
+ ast_log(LOG_WARNING, "Limit Data lacking trailing ')'\n");
+ }
+
+ var = pbx_builtin_getvar_helper(chan,"LIMIT_PLAYAUDIO_CALLER");
+ play_to_caller = var ? ast_true(var) : 1;
+
+ var = pbx_builtin_getvar_helper(chan,"LIMIT_PLAYAUDIO_CALLEE");
+ play_to_callee = var ? ast_true(var) : 0;
+
+ if(! play_to_caller && ! play_to_callee)
+ play_to_caller=1;
+
+ var = pbx_builtin_getvar_helper(chan,"LIMIT_WARNING_FILE");
+ warning_sound = var ? var : "timeleft";
+
+ var = pbx_builtin_getvar_helper(chan,"LIMIT_TIMEOUT_FILE");
+ end_sound = var ? var : NULL;
+
+ var = pbx_builtin_getvar_helper(chan,"LIMIT_CONNECT_FILE");
+ start_sound = var ? var : NULL;
+
+ var=stack=limitdata;
+
+ var = strsep(&stack, ":");
+ if(var) {
+ timelimit = atol(var);
+ playargs++;
+ }
+ var = strsep(&stack, ":");
+ if(var) {
+ play_warning = atol(var);
+ playargs++;
+ }
+
+ var = strsep(&stack, ":");
+ if(var) {
+ warning_freq = atol(var);
+ playargs++;
+ }
+
+ if(! timelimit) {
+ timelimit=play_to_caller=play_to_callee=play_warning=warning_freq=0;
+ warning_sound=NULL;
+ }
+ calldurationlimit=0; /* undo effect of S(x) in case they are both used */
+ if(! play_warning && ! start_sound && ! end_sound && timelimit) { /* more efficient do it like S(x) does since no advanced opts*/
+ calldurationlimit=timelimit/1000;
+ timelimit=play_to_caller=play_to_callee=play_warning=warning_freq=0;
+ }
+ else
+ ast_verbose(VERBOSE_PREFIX_3"Limit Data: timelimit=%ld\n -- play_warning=%ld\n -- play_to_caller=%s\n -- play_to_callee=%s\n -- warning_freq=%ld\n -- warning_sound=%s\n -- end_sound=%s\n -- start_sound=%s\n",timelimit,play_warning,play_to_caller ? "yes" : "no",play_to_callee ? "yes" : "no",warning_freq,warning_sound ? warning_sound : "UNDEF",end_sound ? end_sound : "UNDEF",start_sound ? start_sound : "UNDEF");
+
+ }
+
/* XXX ANNOUNCE SUPPORT */
if ((ann = strstr(transfer, "A("))) {
announce = 1;
@@ -729,7 +819,20 @@
time(&now);
chan->whentohangup = now + calldurationlimit;
}
- res = ast_bridge_call(chan, peer, allowredir_in, allowredir_out, allowdisconnect);
+
+ memset(&config,0,sizeof(struct ast_bridge_config));
+ config.play_to_caller=play_to_caller;
+ config.play_to_callee=play_to_callee;
+ config.allowredirect_in = allowredir_in;
+ config.allowredirect_out = allowredir_out;
+ config.allowdisconnect = allowdisconnect;
+ config.timelimit = timelimit;
+ config.play_warning = play_warning;
+ config.warning_freq = warning_freq;
+ config.warning_sound = warning_sound;
+ config.end_sound = end_sound;
+ config.start_sound = start_sound;
+ res = ast_bridge_call(chan,peer,&config);
if (res != AST_PBX_NO_HANGUP_PEER)
ast_hangup(peer);
Index: app_queue.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_queue.c,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -d -r1.56 -r1.57
--- app_queue.c 26 Apr 2004 06:57:15 -0000 1.56
+++ app_queue.c 26 Apr 2004 23:22:33 -0000 1.57
@@ -874,6 +874,7 @@
char digit = 0;
time_t callstart;
time_t now;
+ struct ast_bridge_config config;
/* Hold the lock while we setup the outgoing calls */
ast_mutex_lock(&qe->parent->lock);
strncpy(queuename, qe->parent->name, sizeof(queuename) - 1);
@@ -1030,7 +1031,13 @@
strncpy(oldcontext, qe->chan->context, sizeof(oldcontext) - 1);
strncpy(oldexten, qe->chan->exten, sizeof(oldexten) - 1);
time(&callstart);
- bridge = ast_bridge_call(qe->chan, peer, allowredir_in, allowredir_out, allowdisconnect);
+
+ memset(&config,0,sizeof(struct ast_bridge_config));
+ config.allowredirect_in = allowredir_in;
+ config.allowredirect_out = allowredir_out;
+ config.allowdisconnect = allowdisconnect;
+ bridge = ast_bridge_call(qe->chan,peer,&config);
+
if (strcasecmp(oldcontext, qe->chan->context) || strcasecmp(oldexten, qe->chan->exten)) {
ast_queue_log(queuename, qe->chan->uniqueid, peer->name, "TRANSFER", "%s|%s", qe->chan->exten, qe->chan->context);
} else if (qe->chan->_softhangup) {
More information about the svn-commits
mailing list