[asterisk-users] Patch for app_dial.c: exit when just one ext is busy.
Leif Neland
leifn at neland.dk
Tue Dec 1 02:40:21 CST 2009
I made a patch to app_dial.c to make Dial(ext1&ext2&ext3,tumeout,B)
return busy when just one extension is busy.
http://www.neland.dk/app_dial.c.diff
It works, but...
I can't figure out setting/reading an option.
It looks fairly easy, but the flag is always set.
*** app_dial.c.org 2009-11-04 22:15:50.000000000 +0100
--- app_dial.c 2009-12-01 09:29:19.000000000 +0100
***************
*** 98,103 ****
--- 98,105 ----
"however, the variable will be unset after use.\n\n"
" Options:\n"
" A(x) - Play an announcement to the called party, using 'x' as the
file.\n"
+ " B - When dialling multiple extensions, return BUSY as soon as
one \n"
+ " extension is BUSY.\n"
" C - Reset the CDR for this call.\n"
" c - If DIAL cancels this call, always set the flag to tell the
channel\n"
" driver that the call is answered elsewhere.\n"
***************
*** 283,288 ****
--- 285,291 ----
#define DIAL_NOFORWARDHTML ((uint64_t)1 << 32) /* flags are now 64
bits, so keep it up! */
#define OPT_CANCEL_ELSEWHERE ((uint64_t)1 << 33)
#define OPT_PEER_H ((uint64_t)1 << 34)
+ #define OPT_SINGLE_BUSY ((uint64_t)1 << 35)
enum {
OPT_ARG_ANNOUNCE = 0,
***************
*** 302,307 ****
--- 305,311 ----
AST_APP_OPTIONS(dial_exec_options, BEGIN_OPTIONS
AST_APP_OPTION_ARG('A', OPT_ANNOUNCE, OPT_ARG_ANNOUNCE),
+ AST_APP_OPTION('B', OPT_SINGLE_BUSY),
AST_APP_OPTION('C', OPT_RESETCDR),
AST_APP_OPTION('c', OPT_CANCEL_ELSEWHERE),
AST_APP_OPTION('d', OPT_DTMF_EXIT),
***************
*** 626,635 ****
--- 630,650 ----
watchers[pos++] = in;
for (o = outgoing; o; o = o->next) {
/* Keep track of important channels */
+ if (ast_test_flag64(o, OPT_SINGLE_BUSY))
+ ast_verb(2, "OPT_SINGLE_BUSY set\n"); /*
always set, why? */
if (ast_test_flag64(o, DIAL_STILLGOING) && o->chan)
watchers[pos++] = o->chan;
numlines++;
}
+ /* I'd like to test for OPT_SINGLE_BUSY set, but I can't
figure it out /*
+ /* if (ast_test_flag64(outgoing,OPT_SINGLE_BUSY) &&
num.busy) doesn't work, the flag is always set */
+ if (1 && num.busy) {
+ ast_verb(2, "One channel was busy, won't try the
others\n");
+ strcpy(pa->status, "BUSY");
+ *to = 0;
+ return NULL;
+ }
+
if (pos == 1) { /* only the input channel is available */
if (numlines == (num.busy + num.congestion +
num.nochan)) {
ast_verb(2, "Everyone is busy/congested
at this time (%d:%d/%d/%d)\n", numlines, num.busy, num.congestion,
num.nochan);
Anybody wanna look into it?
Leif
More information about the asterisk-users
mailing list