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

Modified Files:
        app_authenticate.c app_chanisavail.c app_dial.c 
        app_directory.c app_disa.c app_groupcount.c 
        app_hasnewvoicemail.c app_lookupblacklist.c app_md5.c 
        app_meetme.c app_osplookup.c app_playback.c app_privacy.c 
        app_queue.c app_talkdetect.c app_txtcidname.c app_voicemail.c 
Log Message:
convert a bunch of apps to use ast_goto_if_exists() (issue #5138)


Index: app_authenticate.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_authenticate.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- app_authenticate.c  23 Aug 2005 15:21:48 -0000      1.13
+++ app_authenticate.c  7 Sep 2005 19:13:00 -0000       1.14
@@ -174,8 +174,7 @@
                if (!res)
                        res = ast_waitstream(chan, "");
        } else {
-               if (jump && ast_exists_extension(chan, chan->context, 
chan->exten, chan->priority + 101, chan->cid.cid_num)) {
-                       chan->priority+=100;
+               if (jump && ast_goto_if_exists(chan, chan->context, 
chan->exten, chan->priority + 101)) {
                        res = 0;
                } else {
                        if (!ast_streamfile(chan, "vm-goodbye", chan->language))

Index: app_chanisavail.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_chanisavail.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- app_chanisavail.c   8 Jul 2005 21:14:34 -0000       1.17
+++ app_chanisavail.c   7 Sep 2005 19:13:00 -0000       1.18
@@ -125,9 +125,7 @@
        if (res < 1) {
                pbx_builtin_setvar_helper(chan, "AVAILCHAN", "");
                pbx_builtin_setvar_helper(chan, "AVAILORIGCHAN", "");
-               if (ast_exists_extension(chan, chan->context, chan->exten, 
chan->priority + 101, chan->cid.cid_num))
-                       chan->priority+=100;
-               else
+               if (!ast_goto_if_exists(chan, chan->context, chan->exten, 
chan->priority + 101))
                        return -1;
        }
 

Index: app_dial.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_dial.c,v
retrieving revision 1.164
retrieving revision 1.165
diff -u -d -r1.164 -r1.165
--- app_dial.c  30 Aug 2005 02:12:09 -0000      1.164
+++ app_dial.c  7 Sep 2005 19:13:00 -0000       1.165
@@ -449,7 +449,7 @@
                                if (f) {
                                        if (f->frametype == AST_FRAME_CONTROL) {
                                                switch(f->subclass) {
-                                           case AST_CONTROL_ANSWER:
+                                               case AST_CONTROL_ANSWER:
                                                        /* This is our guy if 
someone answered. */
                                                        if (!peer) {
                                                                if 
(option_verbose > 2)
@@ -558,7 +558,7 @@
                        f = ast_read(in);
 #if 0
                        if (f && (f->frametype != AST_FRAME_VOICE))
-                                       printf("Frame type: %d, %d\n", 
f->frametype, f->subclass);
+                               printf("Frame type: %d, %d\n", f->frametype, 
f->subclass);
                        else if (!f || (f->frametype != AST_FRAME_VOICE))
                                printf("Hangup received on %s\n", in->name);
 #endif
@@ -806,25 +806,25 @@
                        }
                  
                        if (!timelimit) {
-                               
timelimit=play_to_caller=play_to_callee=play_warning=warning_freq=0;
-                               warning_sound=NULL;
+                               timelimit = play_to_caller = play_to_callee = 
play_warning = warning_freq = 0;
+                               warning_sound = NULL;
                        }
                        /* undo effect of S(x) in case they are both used */
-                       calldurationlimit=0; 
+                       calldurationlimit = 0; 
                        /* more efficient do it like S(x) does since no 
advanced opts*/
                        if (!play_warning && !start_sound && !end_sound && 
timelimit) { 
-                               calldurationlimit=timelimit/1000;
-                               
timelimit=play_to_caller=play_to_callee=play_warning=warning_freq=0;
+                               calldurationlimit = timelimit/1000;
+                               timelimit = play_to_caller = play_to_callee = 
play_warning = warning_freq = 0;
                        } else if (option_verbose > 2) {
-                               ast_verbose(VERBOSE_PREFIX_3"Limit Data:\n");
-                               
ast_verbose(VERBOSE_PREFIX_3"timelimit=%ld\n",timelimit);
-                               
ast_verbose(VERBOSE_PREFIX_3"play_warning=%ld\n",play_warning);
-                               
ast_verbose(VERBOSE_PREFIX_3"play_to_caller=%s\n",play_to_caller ? "yes" : 
"no");
-                               
ast_verbose(VERBOSE_PREFIX_3"play_to_callee=%s\n",play_to_callee ? "yes" : 
"no");
-                               
ast_verbose(VERBOSE_PREFIX_3"warning_freq=%ld\n",warning_freq);
-                               
ast_verbose(VERBOSE_PREFIX_3"start_sound=%s\n",start_sound ? start_sound : 
"UNDEF");
-                               
ast_verbose(VERBOSE_PREFIX_3"warning_sound=%s\n",warning_sound ? warning_sound 
: "UNDEF");
-                               
ast_verbose(VERBOSE_PREFIX_3"end_sound=%s\n",end_sound ? end_sound : "UNDEF");
+                               ast_verbose(VERBOSE_PREFIX_3 "Limit Data for 
this call:\n");
+                               ast_verbose(VERBOSE_PREFIX_3 "- timelimit     = 
%ld\n", timelimit);
+                               ast_verbose(VERBOSE_PREFIX_3 "- play_warning  = 
%ld\n", play_warning);
+                               ast_verbose(VERBOSE_PREFIX_3 "- play_to_caller= 
%s\n", play_to_caller ? "yes" : "no");
+                               ast_verbose(VERBOSE_PREFIX_3 "- play_to_callee= 
%s\n", play_to_callee ? "yes" : "no");
+                               ast_verbose(VERBOSE_PREFIX_3 "- warning_freq  = 
%ld\n", warning_freq);
+                               ast_verbose(VERBOSE_PREFIX_3 "- start_sound   = 
%s\n", start_sound ? start_sound : "UNDEF");
+                               ast_verbose(VERBOSE_PREFIX_3 "- warning_sound = 
%s\n", warning_sound ? warning_sound : "UNDEF");
+                               ast_verbose(VERBOSE_PREFIX_3 "- end_sound     = 
%s\n", end_sound ? end_sound : "UNDEF");
                        }
                }
                
@@ -1000,15 +1000,12 @@
                        goto out;
                }
                else if( privdb_val == AST_PRIVACY_KILL ) {
-                       if (ast_exists_extension(chan, chan->context, 
chan->exten, chan->priority + 201, chan->cid.cid_num)) 
-                               chan->priority+=200;
-
+                       ast_goto_if_exists(chan, chan->context, chan->exten, 
chan->priority + 201);
                        res = 0;
                        goto out; /* Is this right? */
                }
                else if( privdb_val == AST_PRIVACY_TORTURE ) {
-                       if (ast_exists_extension(chan, chan->context, 
chan->exten, chan->priority + 301, chan->cid.cid_num)) 
-                               chan->priority+=300;
+                       ast_goto_if_exists(chan, chan->context, chan->exten, 
chan->priority + 301);
                        res = 0;
                        goto out; /* is this right??? */
 
@@ -1252,13 +1249,12 @@
        if (!peer) {
                if (result) {
                        res = result;
-               }
-               else if (to) 
+               } else if (to) 
                        /* Musta gotten hung up */
                        res = -1;
                else 
                        /* Nobody answered, next please? */
-                       res=0;
+                       res = 0;
                
                goto out;
        }
@@ -1482,7 +1478,7 @@
                        res = ast_autoservice_start(chan);
                        /* Now Stream the File */
                        if (!res)
-                               res = 
ast_streamfile(peer,announcemsg,peer->language);
+                               res = ast_streamfile(peer, announcemsg, 
peer->language);
                        if (!res) {
                                digit = ast_waitstream(peer, AST_DIGIT_ANY); 
                        }
@@ -1497,7 +1493,7 @@
                        res = 0;
 
                if (chan && peer && dblgoto) {
-                       for (mac=dblgoto; *mac; mac++) {
+                       for (mac = dblgoto; *mac; mac++) {
                                if(*mac == '^') {
                                        *mac = '|';
                                }
@@ -1521,7 +1517,7 @@
                        app = pbx_findapp("Macro");
 
                        if (app && !res) {
-                               for (res=0;res<strlen(macroname);res++)
+                               for (res = 0; res<strlen(macroname); res++)
                                        if (macroname[res] == '^')
                                                macroname[res] = '|';
                                res = pbx_exec(peer, app, macroname, 1);

Index: app_directory.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_directory.c,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -d -r1.40 -r1.41
--- app_directory.c     15 Jul 2005 22:06:15 -0000      1.40
+++ app_directory.c     7 Sep 2005 19:13:00 -0000       1.41
@@ -182,11 +182,7 @@
                                case '1':
                                        /* Name selected */
                                        loop = 0;
-                                       if 
(ast_exists_extension(chan,dialcontext,ext,1,chan->cid.cid_num)) {
-                                               ast_copy_string(chan->exten, 
ext, sizeof(chan->exten));
-                                               chan->priority = 0;
-                                               ast_copy_string(chan->context, 
dialcontext, sizeof(chan->context));
-                                       } else {
+                                       if (!ast_goto_if_exists(chan, 
dialcontext, ext, 1)) {
                                                ast_log(LOG_WARNING,
                                                        "Can't find extension 
'%s' in context '%s'.  "
                                                        "Did you pass the wrong 
context to Directory?\n",
@@ -293,11 +289,8 @@
                return -1;
        }
        if (digit == '0') {
-               if 
(ast_exists_extension(chan,chan->context,"o",1,chan->cid.cid_num) || 
-                       (!ast_strlen_zero(chan->macrocontext) &&
-                    ast_exists_extension(chan, chan->macrocontext, "o", 1, 
chan->cid.cid_num))) {
-                       strcpy(chan->exten, "o");
-                       chan->priority = 0;
+               if (ast_goto_if_exists(chan, chan->context, "o", 1) || 
+                        (!ast_strlen_zero(chan->macrocontext) && 
ast_goto_if_exists(chan, chan->macrocontext, "o", 1))) {
                        return 0;
                } else {
 
@@ -307,14 +300,10 @@
                }
        }       
        if (digit == '*') {
-               if 
(ast_exists_extension(chan,chan->context,"a",1,chan->cid.cid_num) || 
-                       (!ast_strlen_zero(chan->macrocontext) &&
-                    ast_exists_extension(chan, chan->macrocontext, "a", 1, 
chan->cid.cid_num))) {
-                       strcpy(chan->exten, "a");
-                       chan->priority = 0;
+               if (ast_goto_if_exists(chan, chan->context, "a", 1) || 
+                        (!ast_strlen_zero(chan->macrocontext) && 
ast_goto_if_exists(chan, chan->macrocontext, "a", 1))) {
                        return 0;
                } else {
-
                        ast_log(LOG_WARNING, "Can't find extension 'a' in 
current context.  "
                                "Not Exiting the Directory!\n");
                        res = 0;

Index: app_disa.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_disa.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- app_disa.c  19 Jul 2005 23:45:21 -0000      1.31
+++ app_disa.c  7 Sep 2005 19:13:00 -0000       1.32
@@ -318,7 +318,7 @@
                }
        }
 
-       if (k==3 && ast_exists_extension(chan,ourcontext,exten,1, 
chan->cid.cid_num))
+       if (k==3 && ast_exists_extension(chan, ourcontext, exten, 1, 
chan->cid.cid_num))
        {
                ast_playtones_stop(chan);
                /* We're authenticated and have a valid extension */
@@ -327,13 +327,12 @@
                        ast_callerid_split(ourcallerid, ourcidname, 
sizeof(ourcidname), ourcidnum, sizeof(ourcidnum));
                        ast_set_callerid(chan, ourcidnum, ourcidname, 
ourcidnum);
                }
-               strncpy(chan->exten, exten, sizeof(chan->exten) - 1);
-               strncpy(chan->context, ourcontext, sizeof(chan->context) - 1);
+
                if (!ast_strlen_zero(acctcode)) {
                        strncpy(chan->accountcode, acctcode, 
sizeof(chan->accountcode) - 1);
                }
-               chan->priority = 0;
-               ast_cdr_reset(chan->cdr,AST_CDR_FLAG_POSTED);
+               ast_cdr_reset(chan->cdr, AST_CDR_FLAG_POSTED);
+               ast_goto_if_exists(chan, ourcontext, exten, 1);
                LOCAL_USER_REMOVE(u);
                return 0;
        }

Index: app_groupcount.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_groupcount.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- app_groupcount.c    15 Jul 2005 16:13:26 -0000      1.19
+++ app_groupcount.c    7 Sep 2005 19:13:00 -0000       1.20
@@ -146,9 +146,7 @@
        if ((sscanf(limit, "%d", &max) == 1) && (max > -1)) {
                count = ast_app_group_get_count(pbx_builtin_getvar_helper(chan, 
category), category);
                if (count > max) {
-                       if (ast_exists_extension(chan, chan->context, 
chan->exten, chan->priority + 101, chan->cid.cid_num))
-                               chan->priority += 100;
-                       else
+                       if (!ast_goto_if_exists(chan, chan->context, 
chan->exten, chan->priority + 101))
                                res = -1;
                }
        } else

Index: app_hasnewvoicemail.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_hasnewvoicemail.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- app_hasnewvoicemail.c       6 Jun 2005 22:39:31 -0000       1.14
+++ app_hasnewvoicemail.c       7 Sep 2005 19:13:00 -0000       1.15
@@ -130,9 +130,7 @@
 
                if (vmcount > 0) {
                        /* Branch to the next extension */
-                       if (ast_exists_extension(chan, chan->context, 
chan->exten, chan->priority + 101, chan->cid.cid_num)) {
-                               chan->priority += 100;
-                       } else
+                       if (!ast_goto_if_exists(chan, chan->context, 
chan->exten, chan->priority + 101)) 
                                ast_log(LOG_WARNING, "VM box [EMAIL PROTECTED] 
has new voicemail, but extension %s, priority %d doesn't exist\n", vmbox, 
context, chan->exten, chan->priority + 101);
                }
        } else {

Index: app_lookupblacklist.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_lookupblacklist.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- app_lookupblacklist.c       6 Jun 2005 22:39:31 -0000       1.9
+++ app_lookupblacklist.c       7 Sep 2005 19:13:00 -0000       1.10
@@ -76,8 +76,9 @@
                }
        }
        
-       if (bl && ast_exists_extension(chan, chan->context, chan->exten, 
chan->priority + 101, chan->cid.cid_num))
-               chan->priority+=100;
+       if (bl)
+               ast_goto_if_exists(chan, chan->context, chan->exten, 
chan->priority + 101);
+
        LOCAL_USER_REMOVE (u);
        return 0;
 }

Index: app_md5.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_md5.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- app_md5.c   6 Jun 2005 22:39:31 -0000       1.6
+++ app_md5.c   7 Sep 2005 19:13:00 -0000       1.7
@@ -118,10 +118,9 @@
        }
        if (option_debug > 2)
                ast_log(LOG_DEBUG, "ERROR: MD5 not verified: %s -- %s\n", hash, 
string);
-       if (ast_exists_extension(chan, chan->context, chan->exten, 
chan->priority + 101, chan->cid.cid_num))
-               chan->priority += 100;
-       else if (option_debug > 2)
-               ast_log(LOG_DEBUG, "ERROR: Can't jump to exten+101 (e%s,p%d), 
sorry\n", chan->exten,chan->priority+101);
+       if (!ast_goto_if_exists(chan, chan->context, chan->exten, 
chan->priority + 101))
+               if (option_debug > 2)
+                       ast_log(LOG_DEBUG, "ERROR: Can't jump to exten+101 
(e%s,p%d), sorry\n", chan->exten,chan->priority+101);
        LOCAL_USER_REMOVE(u);
        return res;
 }

Index: app_meetme.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_meetme.c,v
retrieving revision 1.108
retrieving revision 1.109
diff -u -d -r1.108 -r1.109
--- app_meetme.c        7 Sep 2005 14:15:37 -0000       1.108
+++ app_meetme.c        7 Sep 2005 19:13:00 -0000       1.109
@@ -1263,13 +1263,11 @@
                                        char tmp[2];
                                        tmp[0] = f->subclass;
                                        tmp[1] = '\0';
-                                       if (ast_exists_extension(chan, 
exitcontext, tmp, 1, chan->cid.cid_num)) {
-                                               ast_copy_string(chan->context, 
exitcontext, sizeof(chan->context));
-                                               ast_copy_string(chan->exten, 
tmp, sizeof(chan->exten));
-                                               chan->priority = 0;
+                                       if (ast_goto_if_exists(chan, 
exitcontext, tmp, 1)) {
                                                ret = 0;
                                                break;
-                                       }
+                                       } else if (option_debug > 1)
+                                               ast_log(LOG_DEBUG, "Exit by 
single digit did not work in meetme. Extension %s does not exist in context 
%s\n", tmp, exitcontext);
                                } else if ((f->frametype == AST_FRAME_DTMF) && 
(f->subclass == '#') && (confflags & CONFFLAG_POUNDEXIT)) {
                                        ret = 0;
                                        break;

Index: app_osplookup.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_osplookup.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- app_osplookup.c     6 Jun 2005 22:39:31 -0000       1.8
+++ app_osplookup.c     7 Sep 2005 19:13:00 -0000       1.9
@@ -132,8 +132,7 @@
        }
        if (!res) {
                /* Look for a "busy" place */
-               if (ast_exists_extension(chan, chan->context, chan->exten, 
chan->priority + 101, chan->cid.cid_num))
-                       chan->priority += 100;
+               ast_goto_if_exists(chan, chan->context, chan->exten, 
chan->priority + 101);
        } else if (res > 0)
                res = 0;
        LOCAL_USER_REMOVE(u);
@@ -176,8 +175,7 @@
        }
        if (!res) {
                /* Look for a "busy" place */
-               if (ast_exists_extension(chan, chan->context, chan->exten, 
chan->priority + 101, chan->cid.cid_num))
-                       chan->priority += 100;
+               ast_goto_if_exists(chan, chan->context, chan->exten, 
chan->priority + 101);
        } else if (res > 0)
                res = 0;
        LOCAL_USER_REMOVE(u);
@@ -223,8 +221,7 @@
        }
        if (!res) {
                /* Look for a "busy" place */
-               if (ast_exists_extension(chan, chan->context, chan->exten, 
chan->priority + 101, chan->cid.cid_num))
-                       chan->priority += 100;
+               ast_goto_if_exists(chan, chan->context, chan->exten, 
chan->priority + 101);
        } else if (res > 0)
                res = 0;
        LOCAL_USER_REMOVE(u);

Index: app_playback.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_playback.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- app_playback.c      6 Jun 2005 22:39:31 -0000       1.18
+++ app_playback.c      7 Sep 2005 19:13:00 -0000       1.19
@@ -93,8 +93,7 @@
                                ast_stopstream(chan);
                        } else {
                                ast_log(LOG_WARNING, "ast_streamfile failed on 
%s for %s\n", chan->name, (char *)data);
-                               if (ast_exists_extension(chan, chan->context, 
chan->exten, chan->priority + 101, chan->cid.cid_num))
-                                       chan->priority+=100;
+                               ast_goto_if_exists(chan, chan->context, 
chan->exten, chan->priority + 101);
                                res = 0;
                        }
                        front = back;

Index: app_privacy.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_privacy.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- app_privacy.c       6 Jun 2005 22:39:31 -0000       1.15
+++ app_privacy.c       7 Sep 2005 19:13:00 -0000       1.16
@@ -144,9 +144,8 @@
                        if (option_verbose > 2)
                                ast_verbose (VERBOSE_PREFIX_3 "Changed 
Caller*ID to %s\n",phone);
                } else {
-                       /*Send the call to n+101 priority, where n is the 
current priority*/
-                       if (ast_exists_extension(chan, chan->context, 
chan->exten, chan->priority + 101, chan->cid.cid_num))
-                               chan->priority+=100;
+                       /* Send the call to n+101 priority, where n is the 
current priority  */
+                       ast_goto_if_exists(chan, chan->context, chan->exten, 
chan->priority + 101);
                }
                if (cfg) 
                        ast_config_destroy(cfg);

Index: app_queue.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_queue.c,v
retrieving revision 1.160
retrieving revision 1.161
diff -u -d -r1.160 -r1.161
--- app_queue.c 1 Sep 2005 22:32:29 -0000       1.160
+++ app_queue.c 7 Sep 2005 19:13:00 -0000       1.161
@@ -1007,10 +1007,7 @@
        }
 
        /* We have an exact match */
-       if (ast_exists_extension(qe->chan, qe->context, qe->digits, 1, 
qe->chan->cid.cid_num)) {
-               ast_copy_string(qe->chan->context, qe->context, 
sizeof(qe->chan->context));
-               ast_copy_string(qe->chan->exten, qe->digits, 
sizeof(qe->chan->exten));
-               qe->chan->priority = 0;
+       if (ast_goto_if_exists(qe->chan, qe->context, qe->digits, 1)) {
                return 1;
        }
        return 0;
@@ -2546,8 +2543,7 @@
 
        if (set_member_paused(queuename, interface, 1)) {
                ast_log(LOG_WARNING, "Attempt to pause interface %s, not 
found\n", interface);
-               if (ast_exists_extension(chan, chan->context, chan->exten, 
chan->priority + 101, chan->cid.cid_num)) {
-                       chan->priority += 100;
+               if (ast_goto_if_exists(chan, chan->context, chan->exten, 
chan->priority + 101)) {
                        LOCAL_USER_REMOVE(u);
                        return 0;
                }
@@ -2588,8 +2584,7 @@
 
        if (set_member_paused(queuename, interface, 0)) {
                ast_log(LOG_WARNING, "Attempt to unpause interface %s, not 
found\n", interface);
-               if (ast_exists_extension(chan, chan->context, chan->exten, 
chan->priority + 101, chan->cid.cid_num)) {
-                       chan->priority += 100;
+               if (ast_goto_if_exists(chan, chan->context, chan->exten, 
chan->priority + 101)) {
                        LOCAL_USER_REMOVE(u);
                        return 0;
                }
@@ -2645,9 +2640,7 @@
                break;
        case RES_EXISTS:
                ast_log(LOG_WARNING, "Unable to remove interface '%s' from 
queue '%s': Not there\n", interface, queuename);
-               if (ast_exists_extension(chan, chan->context, chan->exten, 
chan->priority + 101, chan->cid.cid_num)) {
-                       chan->priority += 100;
-               }
+               ast_goto_if_exists(chan, chan->context, chan->exten, 
chan->priority + 101);
                res = 0;
                break;
        case RES_NOSUCHQUEUE:
@@ -2722,9 +2715,7 @@
                break;
        case RES_EXISTS:
                ast_log(LOG_WARNING, "Unable to add interface '%s' to queue 
'%s': Already there\n", interface, queuename);
-               if (ast_exists_extension(chan, chan->context, chan->exten, 
chan->priority + 101, chan->cid.cid_num)) {
-                       chan->priority += 100;
-               }
+               ast_goto_if_exists(chan, chan->context, chan->exten, 
chan->priority + 101);
                res = 0;
                break;
        case RES_NOSUCHQUEUE:

Index: app_talkdetect.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_talkdetect.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- app_talkdetect.c    15 Jul 2005 23:00:46 -0000      1.11
+++ app_talkdetect.c    7 Sep 2005 19:13:00 -0000       1.12
@@ -155,10 +155,7 @@
                                                                        
sprintf(ms_str, "%d", ms );     
                                                                        
pbx_builtin_setvar_helper(chan, "TALK_DETECTED", ms_str);
                                                                        
-                                                                       if 
(ast_exists_extension(chan, chan->context, "talk", 1, chan->cid.cid_num)) {
-                                                                               
ast_copy_string(chan->exten, "talk", sizeof(chan->exten));
-                                                                               
chan->priority = 0;
-                                                                       }
+                                                                       
ast_goto_if_exists(chan, chan->context, "talk", 1);
                                                                        res = 0;
                                                                        
ast_frfree(fr);
                                                                        break;

Index: app_txtcidname.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_txtcidname.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- app_txtcidname.c    10 Jul 2005 23:12:25 -0000      1.14
+++ app_txtcidname.c    7 Sep 2005 19:13:00 -0000       1.15
@@ -73,15 +73,13 @@
        if (res > 0) {
                if (!ast_strlen_zero(txt)) {
                        pbx_builtin_setvar_helper(chan, "TXTCIDNAME", txt);
-#if 0
-                       ast_log(LOG_DEBUG, "TXTCIDNAME got '%s'\n", txt);
-#endif
+                       if (option_debug > 1)
+                               ast_log(LOG_DEBUG, "TXTCIDNAME got '%s'\n", 
txt);
                }
        }
        if (!res) {
                /* Look for a "busy" place */
-               if (ast_exists_extension(chan, chan->context, chan->exten, 
chan->priority + 101, chan->cid.cid_num))
-                       chan->priority += 100;
+               ast_goto_if_exists(chan, chan->context, chan->exten, 
chan->priority + 101);
        } else if (res > 0)
                res = 0;
        return res;

Index: app_voicemail.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_voicemail.c,v
retrieving revision 1.244
retrieving revision 1.245
diff -u -d -r1.244 -r1.245
--- app_voicemail.c     7 Sep 2005 18:55:03 -0000       1.244
+++ app_voicemail.c     7 Sep 2005 19:13:00 -0000       1.245
@@ -5474,9 +5474,7 @@
        if (res == ERROR_LOCK_PATH) {
                ast_log(LOG_ERROR, "Could not leave voicemail. The path is 
already locked.\n");
                /*Send the call to n+101 priority, where n is the current 
priority*/
-               if (ast_exists_extension(chan, chan->context, chan->exten, 
chan->priority + 101, chan->cid.cid_num))
-                       chan->priority+=100;
-               else
+               if (!ast_goto_if_exists(chan, chan->context, chan->exten, 
chan->priority + 101))
                        ast_log(LOG_WARNING, "Extension %s, priority %d doesn't 
exist.\n", chan->exten, chan->priority + 101);
                res = 0;
        }
@@ -5542,9 +5540,7 @@
        }
 
        if (find_user(&svm, context, box)) {
-               if (ast_exists_extension(chan, chan->context, chan->exten, 
chan->priority + 101, chan->cid.cid_num)) {
-                       chan->priority += 100;
-               } else
+               if (!ast_goto_if_exists(chan, chan->context, chan->exten, 
chan->priority + 101)) 
                        ast_log(LOG_WARNING, "VM box [EMAIL PROTECTED] exists, 
but extension %s, priority %d doesn't exist\n", box, context, chan->exten, 
chan->priority + 101);
        }
        LOCAL_USER_REMOVE(u);

_______________________________________________
Asterisk-Cvs mailing list
[email protected]
http://lists.digium.com/mailman/listinfo/asterisk-cvs

Reply via email to