Leif Neland
2009-Dec-01 08:40 UTC
[asterisk-users] Patch for app_dial.c: exit when just one ext is busy.
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
Rob Hillis
2009-Dec-01 10:35 UTC
[asterisk-users] Patch for app_dial.c: exit when just one ext is busy.
Leif Neland wrote:> I made a patch to app_dial.c to make Dial(ext1&ext2&ext3,tumeout,B) > return busy when just one extension is busy. >Forgive me for the question, but /why/ do you want this behaviour? Isn't the whole point of dialling multiple extensions so that a call has a greater chance of being answered?
Leif Madsen
2009-Dec-01 14:02 UTC
[asterisk-users] Patch for app_dial.c: exit when just one ext is busy.
Leif Neland wrote:> I made a patch to app_dial.c to make Dial(ext1&ext2&ext3,tumeout,B) > return busy when just one extension is busy.In order to have your patch considered at all, you will need to file an issue in the issue tracker and attach your file to it after signing the license agreement. Otherwise, the developers (at least at Digium) won't look at the code or be able to offer any feedback. Thanks! Leif Madsen.
Possibly Parallel Threads
- Any help Address 0xfffffffe out of bounds in app_confbridge.casterisk-11.5.1 using confbridge.conf
- asterisk11.5.1 module not load why ? any help
- module load Crash Asterisk 11.5.1 app_confbridge.c
- Asterisk WebRTC Support : WSS connection setup fails with error:00000000
- Any Help ? user defined application .module load Crash Asterisk 11.5.1 app_confbridge.c