Another batch of files from RSW. The remaining apps and a few more
authorSean Bright <sean@malleable.com>
Sun, 10 Aug 2008 20:23:50 +0000 (20:23 +0000)
committerSean Bright <sean@malleable.com>
Sun, 10 Aug 2008 20:23:50 +0000 (20:23 +0000)
files from main/

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@137089 65c4cc65-6c06-0410-ace0-fbb531ad65f3

apps/app_queue.c
apps/app_voicemail.c
main/asterisk.c
main/channel.c
main/cli.c
main/frame.c
main/indications.c
main/logger.c
main/pbx.c
main/rtp.c

index 34bdd60..40de07b 100644 (file)
@@ -1056,7 +1056,7 @@ static int insert_penaltychange (const char *list_name, const char *content, con
        char *timestr, *maxstr, *minstr, *contentdup;
        struct penalty_rule *rule = NULL, *rule_iter;
        struct rule_list *rl_iter;
-       int time, inserted = 0;
+       int penaltychangetime, inserted = 0;
 
        if (!(rule = ast_calloc(1, sizeof(*rule)))) {
                ast_log(LOG_ERROR, "Cannot allocate memory for penaltychange rule at line %d!\n", linenum);
@@ -1074,13 +1074,13 @@ static int insert_penaltychange (const char *list_name, const char *content, con
        *maxstr++ = '\0';
        timestr = contentdup;
 
-       if ((time = atoi(timestr)) < 0) {
+       if ((penaltychangetime = atoi(timestr)) < 0) {
                ast_log(LOG_WARNING, "Improper time parameter specified for penaltychange rule at line %d. Ignoring.\n", linenum);
                ast_free(rule);
                return -1;
        }
 
-       rule->time = time;
+       rule->time = penaltychangetime;
 
        if ((minstr = strchr(maxstr,',')))
                *minstr++ = '\0';
@@ -1684,7 +1684,7 @@ static int join_queue(char *queuename, struct queue_ent *qe, enum queue_result *
        int res = -1;
        int pos = 0;
        int inserted = 0;
-       enum queue_member_status stat;
+       enum queue_member_status status;
 
        if (!(q = load_realtime_queue(queuename)))
                return res;
@@ -1693,12 +1693,12 @@ static int join_queue(char *queuename, struct queue_ent *qe, enum queue_result *
        ao2_lock(q);
 
        /* This is our one */
-       stat = get_member_status(q, qe->max_penalty, qe->min_penalty);
-       if (!q->joinempty && (stat == QUEUE_NO_MEMBERS))
+       status = get_member_status(q, qe->max_penalty, qe->min_penalty);
+       if (!q->joinempty && (status == QUEUE_NO_MEMBERS))
                *reason = QUEUE_JOINEMPTY;
-       else if ((q->joinempty == QUEUE_EMPTY_STRICT) && (stat == QUEUE_NO_REACHABLE_MEMBERS || stat == QUEUE_NO_UNPAUSED_REACHABLE_MEMBERS || stat == QUEUE_NO_MEMBERS))
+       else if ((q->joinempty == QUEUE_EMPTY_STRICT) && (status == QUEUE_NO_REACHABLE_MEMBERS || status == QUEUE_NO_UNPAUSED_REACHABLE_MEMBERS || status == QUEUE_NO_MEMBERS))
                *reason = QUEUE_JOINUNAVAIL;
-       else if ((q->joinempty == QUEUE_EMPTY_LOOSE) && (stat == QUEUE_NO_REACHABLE_MEMBERS || stat == QUEUE_NO_MEMBERS))
+       else if ((q->joinempty == QUEUE_EMPTY_LOOSE) && (status == QUEUE_NO_REACHABLE_MEMBERS || status == QUEUE_NO_MEMBERS))
                *reason = QUEUE_JOINUNAVAIL;
        else if (q->maxlen && (q->count >= q->maxlen))
                *reason = QUEUE_FULL;
@@ -1959,7 +1959,7 @@ static void recalc_holdtime(struct queue_ent *qe, int newholdtime)
 static void leave_queue(struct queue_ent *qe)
 {
        struct call_queue *q;
-       struct queue_ent *cur, *prev = NULL;
+       struct queue_ent *current, *prev = NULL;
        struct penalty_rule *pr_iter;
        int pos = 0;
 
@@ -1969,8 +1969,8 @@ static void leave_queue(struct queue_ent *qe)
        ao2_lock(q);
 
        prev = NULL;
-       for (cur = q->head; cur; cur = cur->next) {
-               if (cur == qe) {
+       for (current = q->head; current; current = current->next) {
+               if (current == qe) {
                        q->count--;
 
                        /* Take us out of the queue */
@@ -1980,16 +1980,16 @@ static void leave_queue(struct queue_ent *qe)
                        ast_debug(1, "Queue '%s' Leave, Channel '%s'\n", q->name, qe->chan->name );
                        /* Take us out of the queue */
                        if (prev)
-                               prev->next = cur->next;
+                               prev->next = current->next;
                        else
-                               q->head = cur->next;
+                               q->head = current->next;
                        /* Free penalty rules */
                        while ((pr_iter = AST_LIST_REMOVE_HEAD(&qe->qe_rules, list)))
                                ast_free(pr_iter);
                } else {
                        /* Renumber the people after us in the queue based on a new count */
-                       cur->pos = ++pos;
-                       prev = cur;
+                       current->pos = ++pos;
+                       prev = current;
                }
        }
        ao2_unlock(q);
@@ -2849,7 +2849,7 @@ static int wait_our_turn(struct queue_ent *qe, int ringing, enum queue_result *r
 
        /* This is the holding pen for callers 2 through maxlen */
        for (;;) {
-               enum queue_member_status stat;
+               enum queue_member_status status;
 
                if (is_our_turn(qe))
                        break;
@@ -2860,10 +2860,10 @@ static int wait_our_turn(struct queue_ent *qe, int ringing, enum queue_result *r
                        break;
                }
 
-               stat = get_member_status(qe->parent, qe->max_penalty, qe->min_penalty);
+               status = get_member_status(qe->parent, qe->max_penalty, qe->min_penalty);
 
                /* leave the queue if no agents, if enabled */
-               if (qe->parent->leavewhenempty && (stat == QUEUE_NO_MEMBERS)) {
+               if (qe->parent->leavewhenempty && (status == QUEUE_NO_MEMBERS)) {
                        *reason = QUEUE_LEAVEEMPTY;
                        ast_queue_log(qe->parent->name, qe->chan->uniqueid, "NONE", "EXITEMPTY", "%d|%d|%ld", qe->pos, qe->opos, (long) time(NULL) - qe->start);
                        leave_queue(qe);
@@ -2871,13 +2871,13 @@ static int wait_our_turn(struct queue_ent *qe, int ringing, enum queue_result *r
                }
 
                /* leave the queue if no reachable agents, if enabled */
-               if ((qe->parent->leavewhenempty == QUEUE_EMPTY_STRICT) && (stat == QUEUE_NO_REACHABLE_MEMBERS || stat == QUEUE_NO_UNPAUSED_REACHABLE_MEMBERS)) {
+               if ((qe->parent->leavewhenempty == QUEUE_EMPTY_STRICT) && (status == QUEUE_NO_REACHABLE_MEMBERS || status == QUEUE_NO_UNPAUSED_REACHABLE_MEMBERS)) {
                        *reason = QUEUE_LEAVEUNAVAIL;
                        ast_queue_log(qe->parent->name, qe->chan->uniqueid, "NONE", "EXITEMPTY", "%d|%d|%ld", qe->pos, qe->opos, (long) time(NULL) - qe->start);
                        leave_queue(qe);
                        break;
                }
-               if ((qe->parent->leavewhenempty == QUEUE_EMPTY_LOOSE) && (stat == QUEUE_NO_REACHABLE_MEMBERS)) {
+               if ((qe->parent->leavewhenempty == QUEUE_EMPTY_LOOSE) && (status == QUEUE_NO_REACHABLE_MEMBERS)) {
                        *reason = QUEUE_LEAVEUNAVAIL;
                        ast_queue_log(qe->parent->name, qe->chan->uniqueid, "NONE", "EXITEMPTY", "%d|%d|%ld", qe->pos, qe->opos, (long) time(NULL) - qe->start);
                        leave_queue(qe);
@@ -3204,7 +3204,7 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce
        struct ast_channel *which;
        struct callattempt *lpeer;
        struct member *member;
-       struct ast_app *app;
+       struct ast_app *application;
        int res = 0, bridge = 0;
        int numbusies = 0;
        int x=0;
@@ -3715,10 +3715,10 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce
                                res = -1;
                        }
                        
-                       app = pbx_findapp("Macro");
+                       application = pbx_findapp("Macro");
 
-                       if (app) {
-                               res = pbx_exec(qe->chan, app, macroexec);
+                       if (application) {
+                               res = pbx_exec(qe->chan, application, macroexec);
                                ast_debug(1, "Macro exited with status %d\n", res);
                                res = 0;
                        } else {
@@ -3751,9 +3751,9 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce
                                res = -1;
                        }
                        
-                       app = pbx_findapp("Gosub");
+                       application = pbx_findapp("Gosub");
                        
-                       if (app) {
+                       if (application) {
                                char *gosub_args, *gosub_argstart;
 
                                /* Set where we came from */
@@ -3770,7 +3770,7 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce
                                        asprintf(&gosub_args, "%s,s,1", gosubexec);
                                }
                                if (gosub_args) {
-                                       res = pbx_exec(qe->chan, app, gosub_args);
+                                       res = pbx_exec(qe->chan, application, gosub_args);
                                        ast_pbx_run(qe->chan);
                                        free(gosub_args);
                                        if (option_debug)
@@ -3792,10 +3792,10 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce
 
                if (!ast_strlen_zero(agi)) {
                        ast_debug(1, "app_queue: agi=%s.\n", agi);
-                       app = pbx_findapp("agi");
-                       if (app) {
+                       application = pbx_findapp("agi");
+                       if (application) {
                                agiexec = ast_strdupa(agi);
-                               ret = pbx_exec(qe->chan, app, agiexec);
+                               ret = pbx_exec(qe->chan, application, agiexec);
                        } else
                                ast_log(LOG_WARNING, "Asked to execute an AGI on this channel, but could not find application (agi)!\n");
                }
@@ -4704,7 +4704,7 @@ check_turns:
                /* they may dial a digit from the queue context; */
                /* or, they may timeout. */
 
-               enum queue_member_status stat;
+               enum queue_member_status status;
 
                /* Leave if we have exceeded our queuetimeout */
                if (qe.expire && (time(NULL) > qe.expire)) {
@@ -4749,7 +4749,7 @@ check_turns:
                        goto stop;
                }
 
-               stat = get_member_status(qe.parent, qe.max_penalty, qe.min_penalty);
+               status = get_member_status(qe.parent, qe.max_penalty, qe.min_penalty);
 
                /* exit after 'timeout' cycle if 'n' option enabled */
                if (noption && tries >= qe.parent->membercount) {
@@ -4762,7 +4762,7 @@ check_turns:
                }
 
                /* leave the queue if no agents, if enabled */
-               if (qe.parent->leavewhenempty && (stat == QUEUE_NO_MEMBERS)) {
+               if (qe.parent->leavewhenempty && (status == QUEUE_NO_MEMBERS)) {
                        record_abandoned(&qe);
                        reason = QUEUE_LEAVEEMPTY;
                        ast_queue_log(args.queuename, chan->uniqueid, "NONE", "EXITEMPTY", "%d|%d|%ld", qe.pos, qe.opos, (long)(time(NULL) - qe.start));
@@ -4771,14 +4771,14 @@ check_turns:
                }
 
                /* leave the queue if no reachable agents, if enabled */
-               if ((qe.parent->leavewhenempty == QUEUE_EMPTY_STRICT) && (stat == QUEUE_NO_REACHABLE_MEMBERS || stat == QUEUE_NO_UNPAUSED_REACHABLE_MEMBERS)) {
+               if ((qe.parent->leavewhenempty == QUEUE_EMPTY_STRICT) && (status == QUEUE_NO_REACHABLE_MEMBERS || status == QUEUE_NO_UNPAUSED_REACHABLE_MEMBERS)) {
                        record_abandoned(&qe);
                        reason = QUEUE_LEAVEUNAVAIL;
                        ast_queue_log(args.queuename, chan->uniqueid, "NONE", "EXITEMPTY", "%d|%d|%ld", qe.pos, qe.opos, (long)(time(NULL) - qe.start));
                        res = 0;
                        break;
                }
-               if ((qe.parent->leavewhenempty == QUEUE_EMPTY_LOOSE) && (stat == QUEUE_NO_REACHABLE_MEMBERS)) {
+               if ((qe.parent->leavewhenempty == QUEUE_EMPTY_LOOSE) && (status == QUEUE_NO_REACHABLE_MEMBERS)) {
                        record_abandoned(&qe);
                        reason = QUEUE_LEAVEUNAVAIL;
                        res = 0;
index c0adc33..3161ea8 100644 (file)
@@ -1716,12 +1716,12 @@ static int imap_store_file(char *dir, char *mailboxuser, char *mailboxcontext, i
        int tempcopy = 0;
        STRING str;
        int ret; /* for better error checking */
-       char *imapflags = NIL;
+       char *imap_flags = NIL;
 
        /* Set urgent flag for IMAP message */
        if (!ast_strlen_zero(flag) && !strcmp(flag, "Urgent")) {
                ast_debug(3, "Setting message flag \\\\FLAGGED.\n");
-               imapflags="\\FLAGGED";
+               imap_flags="\\FLAGGED";
        }
        
        /* Attach only the first format */
@@ -1790,7 +1790,7 @@ static int imap_store_file(char *dir, char *mailboxuser, char *mailboxcontext, i
        ret = init_mailstream(vms, NEW_FOLDER);
        if (ret == 0) {
                imap_mailbox_name(mailbox, sizeof(mailbox), vms, NEW_FOLDER, 1);
-               if(!mail_append_full(vms->mailstream, mailbox, imapflags, NIL, &str))
+               if(!mail_append_full(vms->mailstream, mailbox, imap_flags, NIL, &str))
                        ast_log(LOG_ERROR, "Error while sending the message to %s\n", mailbox);
                fclose(p);
                unlink(tmp);
@@ -1905,13 +1905,13 @@ static int inboxcount(const char *mailbox_context, int *newmsgs, int *oldmsgs)
 
 static int has_voicemail(const char *mailbox, const char *folder)
 {
-       char tmp[256], *tmp2, *mbox, *context;
+       char tmp[256], *tmp2, *box, *context;
        ast_copy_string(tmp, mailbox, sizeof(tmp));
        tmp2 = tmp;
        if (strchr(tmp2, ',')) {
-               while ((mbox = strsep(&tmp2, ","))) {
-                       if (!ast_strlen_zero(mbox)) {
-                               if (has_voicemail(mbox, folder))
+               while ((box = strsep(&tmp2, ","))) {
+                       if (!ast_strlen_zero(box)) {
+                               if (has_voicemail(box, folder))
                                        return 1;
                        }
                }
@@ -2241,9 +2241,9 @@ void mm_list(MAILSTREAM * stream, int delim, char *mailbox, long attributes)
 }
 
 
-void mm_lsub(MAILSTREAM * stream, int delimiter, char *mailbox, long attributes)
+void mm_lsub(MAILSTREAM * stream, int delim, char *mailbox, long attributes)
 {
-       ast_debug(5, "Delimiter set to %c and mailbox %s\n",delimiter, mailbox);
+       ast_debug(5, "Delimiter set to %c and mailbox %s\n",delim, mailbox);
        if (attributes & LATT_NOINFERIORS)
                ast_debug(5, "no inferiors\n");
        if (attributes & LATT_NOSELECT)
@@ -4338,13 +4338,13 @@ yuck:
  */
 static int has_voicemail(const char *mailbox, const char *folder)
 {
-       char tmp[256], *tmp2 = tmp, *mbox, *context;
+       char tmp[256], *tmp2 = tmp, *box, *context;
        ast_copy_string(tmp, mailbox, sizeof(tmp));
-       while ((context = mbox = strsep(&tmp2, ","))) {
+       while ((context = box = strsep(&tmp2, ","))) {
                strsep(&context, "@");
                if (ast_strlen_zero(context))
                        context = "default";
-               if (messagecount(context, mbox, folder))
+               if (messagecount(context, box, folder))
                        return 1;
        }
        return 0;
@@ -4465,14 +4465,14 @@ static int __has_voicemail(const char *context, const char *mailbox, const char
  */
 static int has_voicemail(const char *mailbox, const char *folder)
 {
-       char tmp[256], *tmp2 = tmp, *mbox, *context;
+       char tmp[256], *tmp2 = tmp, *box, *context;
        ast_copy_string(tmp, mailbox, sizeof(tmp));
-       while ((mbox = strsep(&tmp2, ","))) {
-               if ((context = strchr(mbox, '@')))
+       while ((box = strsep(&tmp2, ","))) {
+               if ((context = strchr(box, '@')))
                        *context++ = '\0';
                else
                        context = "default";
-               if (__has_voicemail(context, mbox, folder, 1))
+               if (__has_voicemail(context, box, folder, 1))
                        return 1;
        }
        return 0;
@@ -5020,15 +5020,15 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_
                                        /* Are there to be more recipients of this message? */
                                        while (tmpptr) {
                                                struct ast_vm_user recipu, *recip;
-                                               char *exten, *context;
+                                               char *exten, *cntx;
                                        
                                                exten = strsep(&tmpptr, "&");
-                                               context = strchr(exten, '@');
-                                               if (context) {
-                                                       *context = '\0';
-                                                       context++;
+                                               cntx = strchr(exten, '@');
+                                               if (cntx) {
+                                                       *cntx = '\0';
+                                                       cntx++;
                                                }
-                                               if ((recip = find_user(&recipu, context, exten))) {
+                                               if ((recip = find_user(&recipu, cntx, exten))) {
                                                        copy_message(chan, vmu, 0, msgnum, duration, recip, fmt, dir, flag);
                                                        free_user(recip);
                                                }
@@ -5719,7 +5719,7 @@ static int get_folder2(struct ast_channel *chan, char *fn, int start)
  * This is invoked from forward_message() when performing a forward operation (option 8 from main menu).
  * \return zero on success, -1 on error.
  */
-static int vm_forwardoptions(struct ast_channel *chan, struct ast_vm_user *vmu, char *curdir, int curmsg, char *vmfmts,
+static int vm_forwardoptions(struct ast_channel *chan, struct ast_vm_user *vmu, char *curdir, int curmsg, char *vm_fmts,
                        char *context, signed char record_gain, long *duration, struct vm_state *vms, char *flag)
 {
 #ifdef IMAP_STORAGE
@@ -5761,7 +5761,7 @@ static int vm_forwardoptions(struct ast_channel *chan, struct ast_vm_user *vmu,
                        strncat(vms->introfn, "intro", sizeof(vms->introfn));
                        res = ast_play_and_wait(chan, INTRO);
                        res = ast_play_and_wait(chan, "beep");
-                       res = play_record_review(chan, NULL, vms->introfn, vmu->maxsecs, vmfmts, 1, vmu, (int *)duration, NULL, record_gain, vms, flag);
+                       res = play_record_review(chan, NULL, vms->introfn, vmu->maxsecs, vm_fmts, 1, vmu, (int *)duration, NULL, record_gain, vms, flag);
                        cmd = 't';
 #else
 
@@ -5788,7 +5788,7 @@ static int vm_forwardoptions(struct ast_channel *chan, struct ast_vm_user *vmu,
                        if (record_gain)
                                ast_channel_setoption(chan, AST_OPTION_RXGAIN, &record_gain, sizeof(record_gain), 0);
 
-                       cmd = ast_play_and_prepend(chan, NULL, msgfile, 0, vmfmts, &prepend_duration, 1, silencethreshold, maxsilence);
+                       cmd = ast_play_and_prepend(chan, NULL, msgfile, 0, vm_fmts, &prepend_duration, 1, silencethreshold, maxsilence);
                        if (record_gain)
                                ast_channel_setoption(chan, AST_OPTION_RXGAIN, &zero_gain, sizeof(zero_gain), 0);
 
@@ -5799,12 +5799,12 @@ static int vm_forwardoptions(struct ast_channel *chan, struct ast_vm_user *vmu,
                        if (prepend_duration) {
                                struct ast_category *msg_cat;
                                /* need enough space for a maximum-length message duration */
-                               char duration_str[12];
+                               char duration_buf[12];
 
                                *duration += prepend_duration;
                                msg_cat = ast_category_get(msg_cfg, "message");
-                               snprintf(duration_str, 11, "%ld", *duration);
-                               if (!ast_variable_update(msg_cat, "duration", duration_str, NULL, 0)) {
+                               snprintf(duration_buf, 11, "%ld", *duration);
+                               if (!ast_variable_update(msg_cat, "duration", duration_buf, NULL, 0)) {
                                        config_text_file_save(textfile, msg_cfg, "app_voicemail");
                                        STORE(curdir, vmu->mailbox, context, curmsg, chan, vmu, vmfmts, prepend_duration, vms, NULL);
                                }
@@ -5849,13 +5849,13 @@ static int vm_forwardoptions(struct ast_channel *chan, struct ast_vm_user *vmu,
        return cmd;
 }
 
-static void queue_mwi_event(const char *mbox, int urgent, int new, int old)
+static void queue_mwi_event(const char *box, int urgent, int new, int old)
 {
        struct ast_event *event;
        char *mailbox, *context;
 
        /* Strip off @default */
-       context = mailbox = ast_strdupa(mbox);
+       context = mailbox = ast_strdupa(box);
        strsep(&context, "@");
        if (ast_strlen_zero(context))
                context = "default";
@@ -6053,11 +6053,11 @@ static int forward_message(struct ast_channel *chan, char *context, struct vm_st
                        char old_context[sizeof(chan->context)];
                        char old_exten[sizeof(chan->exten)];
                        int old_priority;
-                       struct ast_app* app;
+                       struct ast_app* directory_app;
 
                        
-                       app = pbx_findapp("Directory");
-                       if (app) {
+                       directory_app = pbx_findapp("Directory");
+                       if (directory_app) {
                                char vmcontext[256];
                                /* make backup copies */
                                memcpy(old_context, chan->context, sizeof(chan->context));
@@ -6066,7 +6066,7 @@ static int forward_message(struct ast_channel *chan, char *context, struct vm_st
                                
                                /* call the the Directory, changes the channel */
                                snprintf(vmcontext, sizeof(vmcontext), "%s||v", context ? context : "default");
-                               res = pbx_exec(chan, app, vmcontext);
+                               res = pbx_exec(chan, directory_app, vmcontext);
                                
                                ast_copy_string(username, chan->exten, sizeof(username));
                                
@@ -6757,68 +6757,68 @@ done:
  * syntax for the above three categories which is more elegant. 
  */
 
-static int vm_play_folder_name_gr(struct ast_channel *chan, char *mbox)
+static int vm_play_folder_name_gr(struct ast_channel *chan, char *box)
 {
        int cmd;
        char *buf;
 
-       buf = alloca(strlen(mbox)+2); 
-       strcpy(buf, mbox);
+       buf = alloca(strlen(box)+2); 
+       strcpy(buf, box);
        strcat(buf,"s");
 
-       if (!strcasecmp(mbox, "vm-INBOX") || !strcasecmp(mbox, "vm-Old")){
+       if (!strcasecmp(box, "vm-INBOX") || !strcasecmp(box, "vm-Old")){
                cmd = ast_play_and_wait(chan, buf); /* "NEA / PALIA" */
                return cmd ? cmd : ast_play_and_wait(chan, "vm-messages"); /* "messages" -> "MYNHMATA" */
        } else {
                cmd = ast_play_and_wait(chan, "vm-messages"); /* "messages" -> "MYNHMATA" */
-               return cmd ? cmd : ast_play_and_wait(chan, mbox); /* friends/family/work... -> "FILWN"/"OIKOGENIAS"/"DOULEIAS"*/
+               return cmd ? cmd : ast_play_and_wait(chan, box); /* friends/family/work... -> "FILWN"/"OIKOGENIAS"/"DOULEIAS"*/
        }
 }
 
-static int vm_play_folder_name_pl(struct ast_channel *chan, char *mbox)
+static int vm_play_folder_name_pl(struct ast_channel *chan, char *box)
 {
        int cmd;
 
-       if (!strcasecmp(mbox, "vm-INBOX") || !strcasecmp(mbox, "vm-Old")) {
-               if (!strcasecmp(mbox, "vm-INBOX"))
+       if (!strcasecmp(box, "vm-INBOX") || !strcasecmp(box, "vm-Old")) {
+               if (!strcasecmp(box, "vm-INBOX"))
                        cmd = ast_play_and_wait(chan, "vm-new-e");
                else
                        cmd = ast_play_and_wait(chan, "vm-old-e");
                return cmd ? cmd : ast_play_and_wait(chan, "vm-messages");
        } else {
                cmd = ast_play_and_wait(chan, "vm-messages");
-               return cmd ? cmd : ast_play_and_wait(chan, mbox);
+               return cmd ? cmd : ast_play_and_wait(chan, box);
        }
 }
 
-static int vm_play_folder_name_ua(struct ast_channel *chan, char *mbox)
+static int vm_play_folder_name_ua(struct ast_channel *chan, char *box)
 {
        int cmd;
 
-       if (!strcasecmp(mbox, "vm-Family") || !strcasecmp(mbox, "vm-Friends") || !strcasecmp(mbox, "vm-Work")){
+       if (!strcasecmp(box, "vm-Family") || !strcasecmp(box, "vm-Friends") || !strcasecmp(box, "vm-Work")){
                cmd = ast_play_and_wait(chan, "vm-messages");
-               return cmd ? cmd : ast_play_and_wait(chan, mbox);
+               return cmd ? cmd : ast_play_and_wait(chan, box);
        } else {
-               cmd = ast_play_and_wait(chan, mbox);
+               cmd = ast_play_and_wait(chan, box);
                return cmd ? cmd : ast_play_and_wait(chan, "vm-messages");
        }
 }
 
-static int vm_play_folder_name(struct ast_channel *chan, char *mbox)
+static int vm_play_folder_name(struct ast_channel *chan, char *box)
 {
        int cmd;
 
        if (!strcasecmp(chan->language, "it") || !strcasecmp(chan->language, "es") || !strcasecmp(chan->language, "pt") || !strcasecmp(chan->language, "pt_BR")) { /* Italian, Spanish, French or Portuguese syntax */
                cmd = ast_play_and_wait(chan, "vm-messages"); /* "messages */
-               return cmd ? cmd : ast_play_and_wait(chan, mbox);
+               return cmd ? cmd : ast_play_and_wait(chan, box);
        } else if (!strcasecmp(chan->language, "gr")){
-               return vm_play_folder_name_gr(chan, mbox);
+               return vm_play_folder_name_gr(chan, box);
        } else if (!strcasecmp(chan->language, "pl")){
-               return vm_play_folder_name_pl(chan, mbox);
+               return vm_play_folder_name_pl(chan, box);
        } else if (!strcasecmp(chan->language, "ua")){  /* Ukrainian syntax */
-               return vm_play_folder_name_ua(chan, mbox);
+               return vm_play_folder_name_ua(chan, box);
        } else {  /* Default English */
-               cmd = ast_play_and_wait(chan, mbox);
+               cmd = ast_play_and_wait(chan, box);
                return cmd ? cmd : ast_play_and_wait(chan, "vm-messages"); /* "messages */
        }
 }
@@ -8397,7 +8397,7 @@ static int vm_browse_messages(struct ast_channel *chan, struct vm_state *vms, st
 
 static int vm_authenticate(struct ast_channel *chan, char *mailbox, int mailbox_size,
                        struct ast_vm_user *res_vmu, const char *context, const char *prefix,
-                       int skipuser, int maxlogins, int silent)
+                       int skipuser, int max_logins, int silent)
 {
        int useadsi=0, valid=0, logretries=0;
        char password[AST_MAX_EXTENSION]="", *passptr;
@@ -8414,7 +8414,7 @@ static int vm_authenticate(struct ast_channel *chan, char *mailbox, int mailbox_
        
        /* Authenticate them and get their mailbox/password */
        
-       while (!valid && (logretries < maxlogins)) {
+       while (!valid && (logretries < max_logins)) {
                /* Prompt for, and read in the username */
                if (!skipuser && ast_readstring(chan, mailbox, mailbox_size - 1, 2000, 10000, "#") < 0) {
                        ast_log(AST_LOG_WARNING, "Couldn't read username\n");
@@ -8467,7 +8467,7 @@ static int vm_authenticate(struct ast_channel *chan, char *mailbox, int mailbox_
                }
                logretries++;
                if (!valid) {
-                       if (skipuser || logretries >= maxlogins) {
+                       if (skipuser || logretries >= max_logins) {
                                if (ast_streamfile(chan, "vm-incorrect", chan->language)) {
                                        ast_log(AST_LOG_WARNING, "Unable to stream incorrect message\n");
                                        return -1;
@@ -8484,7 +8484,7 @@ static int vm_authenticate(struct ast_channel *chan, char *mailbox, int mailbox_
                                return -1;
                }
        }
-       if (!valid && (logretries >= maxlogins)) {
+       if (!valid && (logretries >= max_logins)) {
                ast_stopstream(chan);
                ast_play_and_wait(chan, "vm-goodbye");
                return -1;
@@ -9230,13 +9230,13 @@ static int vm_exec(struct ast_channel *chan, void *data)
                        }
                }
        } else {
-               char tmp[256];
-               res = ast_app_getdata(chan, "vm-whichbox", tmp, sizeof(tmp) - 1, 0);
+               char temp[256];
+               res = ast_app_getdata(chan, "vm-whichbox", temp, sizeof(temp) - 1, 0);
                if (res < 0)
                        return res;
-               if (ast_strlen_zero(tmp))
+               if (ast_strlen_zero(temp))
                        return 0;
-               args.argv0 = ast_strdupa(tmp);
+               args.argv0 = ast_strdupa(temp);
        }
 
        res = leave_voicemail(chan, args.argv0, &leave_options);
@@ -9250,14 +9250,14 @@ static int vm_exec(struct ast_channel *chan, void *data)
        return res;
 }
 
-static struct ast_vm_user *find_or_create(const char *context, const char *mbox)
+static struct ast_vm_user *find_or_create(const char *context, const char *box)
 {
        struct ast_vm_user *vmu;
 
        AST_LIST_TRAVERSE(&users, vmu, list) {
-               if (ast_test_flag((&globalflags), VM_SEARCH) && !strcasecmp(mbox, vmu->mailbox))
+               if (ast_test_flag((&globalflags), VM_SEARCH) && !strcasecmp(box, vmu->mailbox))
                        break;
-               if (context && (!strcasecmp(context, vmu->context)) && (!strcasecmp(mbox, vmu->mailbox)))
+               if (context && (!strcasecmp(context, vmu->context)) && (!strcasecmp(box, vmu->mailbox)))
                        break;
        }
 
@@ -9268,14 +9268,14 @@ static struct ast_vm_user *find_or_create(const char *context, const char *mbox)
                return NULL;
        
        ast_copy_string(vmu->context, context, sizeof(vmu->context));
-       ast_copy_string(vmu->mailbox, mbox, sizeof(vmu->mailbox));
+       ast_copy_string(vmu->mailbox, box, sizeof(vmu->mailbox));
 
        AST_LIST_INSERT_TAIL(&users, vmu, list);
        
        return vmu;
 }
 
-static int append_mailbox(const char *context, const char *mbox, const char *data)
+static int append_mailbox(const char *context, const char *box, const char *data)
 {
        /* Assumes lock is already held */
        char *tmp;
@@ -9287,7 +9287,7 @@ static int append_mailbox(const char *context, const char *mbox, const char *dat
 
        tmp = ast_strdupa(data);
 
-       if (!(vmu = find_or_create(context, mbox)))
+       if (!(vmu = find_or_create(context, box)))
                return -1;
        
        populate_defaults(vmu);
@@ -9304,8 +9304,8 @@ static int append_mailbox(const char *context, const char *mbox, const char *dat
        if (stringp && (s = strsep(&stringp, ","))) 
                apply_options(vmu, s);
 
-       mailbox_full = alloca(strlen(mbox) + strlen(context) + 1);
-       strcpy(mailbox_full, mbox);
+       mailbox_full = alloca(strlen(box) + strlen(context) + 1);
+       strcpy(mailbox_full, box);
        strcat(mailbox_full, "@");
        strcat(mailbox_full, context);
 
@@ -9642,11 +9642,11 @@ static void *mb_poll_thread(void *data)
 {
        while (poll_thread_run) {
                struct timespec ts = { 0, };
-               struct timeval tv;
+               struct timeval wait;
 
-               tv = ast_tvadd(ast_tvnow(), ast_samp2tv(poll_freq, 1));
-               ts.tv_sec = tv.tv_sec;
-               ts.tv_nsec = tv.tv_usec * 1000;
+               wait = ast_tvadd(ast_tvnow(), ast_samp2tv(poll_freq, 1));
+               ts.tv_sec = wait.tv_sec;
+               ts.tv_nsec = wait.tv_usec * 1000;
 
                ast_mutex_lock(&poll_lock);
                ast_cond_timedwait(&poll_cond, &poll_lock, &ts);
@@ -9906,11 +9906,11 @@ static int manager_list_voicemail_users(struct mansession *s, const struct messa
 /*! \brief Free the users structure. */
 static void free_vm_users(void) 
 {
-       struct ast_vm_user *cur;
+       struct ast_vm_user *current;
        AST_LIST_LOCK(&users);
-       while ((cur = AST_LIST_REMOVE_HEAD(&users, list))) {
-               ast_set_flag(cur, VM_ALLOCED);
-               free_user(cur);
+       while ((current = AST_LIST_REMOVE_HEAD(&users, list))) {
+               ast_set_flag(current, VM_ALLOCED);
+               free_user(current);
        }
        AST_LIST_UNLOCK(&users);
 }
@@ -9927,7 +9927,7 @@ static void free_vm_zones(void)
 
 static int load_config(int reload)
 {
-       struct ast_vm_user *cur;
+       struct ast_vm_user *current;
        struct ast_config *cfg, *ucfg;
        char *cat;
        struct ast_variable *var;
@@ -10423,10 +10423,10 @@ static int load_config(int reload)
                        for (cat = ast_category_browse(ucfg, NULL); cat ; cat = ast_category_browse(ucfg, cat)) {
                                if (!ast_true(ast_config_option(ucfg, cat, "hasvoicemail")))
                                        continue;
-                               if ((cur = find_or_create(userscontext, cat))) {
-                                       populate_defaults(cur);
-                                       apply_options_full(cur, ast_variable_browse(ucfg, cat));
-                                       ast_copy_string(cur->context, userscontext, sizeof(cur->context));
+                               if ((current = find_or_create(userscontext, cat))) {
+                                       populate_defaults(current);
+                                       apply_options_full(current, ast_variable_browse(ucfg, cat));
+                                       ast_copy_string(current->context, userscontext, sizeof(current->context));
                                }
                        }
                        ast_config_destroy(ucfg);
@@ -10446,12 +10446,12 @@ static int load_config(int reload)
                                        while (var) {
                                                struct vm_zone *z;
                                                if ((z = ast_malloc(sizeof(*z)))) {
-                                                       char *msg_format, *timezone;
+                                                       char *msg_format, *tzone;
                                                        msg_format = ast_strdupa(var->value);
-                                                       timezone = strsep(&msg_format, "|");
+                                                       tzone = strsep(&msg_format, "|");
                                                        if (msg_format) {
                                                                ast_copy_string(z->name, var->name, sizeof(z->name));
-                                                               ast_copy_string(z->timezone, timezone, sizeof(z->timezone));
+                                                               ast_copy_string(z->timezone, tzone, sizeof(z->timezone));
                                                                ast_copy_string(z->msg_format, msg_format, sizeof(z->msg_format));
                                                                AST_LIST_LOCK(&zones);
                                                                AST_LIST_INSERT_HEAD(&zones, z, list);
@@ -10937,7 +10937,7 @@ static int play_record_review(struct ast_channel *chan, char *playfile, char *re
        int max_attempts = 3;
        int attempts = 0;
        int recorded = 0;
-       int message_exists = 0;
+       int msg_exists = 0;
        signed char zero_gain = 0;
        char tempfile[PATH_MAX];
        char *acceptdtmf = "#";
@@ -10961,7 +10961,7 @@ static int play_record_review(struct ast_channel *chan, char *playfile, char *re
        while ((cmd >= 0) && (cmd != 't')) {
                switch (cmd) {
                case '1':
-                       if (!message_exists) {
+                       if (!msg_exists) {
                                /* In this case, 1 is to record a message */
                                cmd = '3';
                                break;
@@ -10987,7 +10987,7 @@ static int play_record_review(struct ast_channel *chan, char *playfile, char *re
                        cmd = ast_stream_and_wait(chan, tempfile, AST_DIGIT_ANY);
                        break;
                case '3':
-                       message_exists = 0;
+                       msg_exists = 0;
                        /* Record */
                        if (recorded == 1) 
                                ast_verb(3, "Re-recording the message\n");
@@ -11037,7 +11037,7 @@ static int play_record_review(struct ast_channel *chan, char *playfile, char *re
 #endif
                        } else {
                                /* If all is well, a message exists */
-                               message_exists = 1;
+                               msg_exists = 1;
                                cmd = 0;
                        }
                        break;
@@ -11089,7 +11089,7 @@ static int play_record_review(struct ast_channel *chan, char *playfile, char *re
                                cmd = ast_play_and_wait(chan, "vm-sorry");
                                break;
                        }
-                       if (message_exists || recorded) {
+                       if (msg_exists || recorded) {
                                cmd = ast_play_and_wait(chan, "vm-saveoper");
                                if (!cmd)
                                        cmd = ast_waitfordigit(chan, 3000);
@@ -11116,7 +11116,7 @@ static int play_record_review(struct ast_channel *chan, char *playfile, char *re
                           their OGM's */
                        if (outsidecaller && !ast_test_flag(vmu, VM_REVIEW))
                                return cmd;
-                       if (message_exists) {
+                       if (msg_exists) {
                                cmd = ast_play_and_wait(chan, "vm-review");
                                if (!cmd && outsidecaller) {
                                        if ((flag && ast_strlen_zero(flag)) || (!ast_strlen_zero(flag) && strcmp(flag, "Urgent"))) {
index 02d2d81..dc6cf9c 100644 (file)
@@ -645,7 +645,7 @@ static char *handle_show_profile(struct ast_cli_entry *e, int cmd, struct ast_cl
                        "Value", "Average", "Name");
        for (i = min; i < max; i++) {
                struct profile_entry *entry = &prof_data->e[i];
-               if (!search || strstr(prof_data->e[i].name, search))
+               if (!search || strstr(entry->name, search))
                    ast_cli(a->fd, "%6d: [%8ld] %10ld %12lld %12lld  %s\n",
                        i,
                        (long)entry->scale,
index 8798a41..83b6eea 100644 (file)
@@ -551,8 +551,8 @@ int ast_channel_cmpwhentohangup_tv(struct ast_channel *chan, struct timeval offs
 
 int ast_channel_cmpwhentohangup(struct ast_channel *chan, time_t offset)
 {
-       struct timeval tv = { offset, };
-       return ast_channel_cmpwhentohangup_tv(chan, tv);
+       struct timeval when = { offset, };
+       return ast_channel_cmpwhentohangup_tv(chan, when);
 }
 
 /*! \brief Register a new telephony channel in Asterisk */
index 377e1f0..8459ea3 100644 (file)
@@ -1625,7 +1625,7 @@ static char *handle_help(struct ast_cli_entry *e, int cmd, struct ast_cli_args *
 
 static char *parse_args(const char *s, int *argc, char *argv[], int max, int *trailingwhitespace)
 {
-       char *dup, *cur;
+       char *duplicate, *cur;
        int x = 0;
        int quoted = 0;
        int escaped = 0;
@@ -1638,10 +1638,10 @@ static char *parse_args(const char *s, int *argc, char *argv[], int max, int *tr
        if (s == NULL)  /* invalid, though! */
                return NULL;
        /* make a copy to store the parsed string */
-       if (!(dup = ast_strdup(s)))
+       if (!(duplicate = ast_strdup(s)))
                return NULL;
 
-       cur = dup;
+       cur = duplicate;
        /* scan the original string copying into cur when needed */
        for (; *s ; s++) {
                if (x >= max - 1) {
@@ -1685,7 +1685,7 @@ static char *parse_args(const char *s, int *argc, char *argv[], int max, int *tr
        argv[x] = NULL;
        *argc = x;
        *trailingwhitespace = whitespace;
-       return dup;
+       return duplicate;
 }
 
 /*! \brief Return the number of unique matches for the generator */
@@ -1777,9 +1777,9 @@ static char *__ast_cli_generator(const char *text, const char *word, int state,
        char matchstr[80] = "";
        int tws = 0;
        /* Split the argument into an array of words */
-       char *dup = parse_args(text, &x, argv, ARRAY_LEN(argv), &tws);
+       char *duplicate = parse_args(text, &x, argv, ARRAY_LEN(argv), &tws);
 
-       if (!dup)       /* malloc error */
+       if (!duplicate) /* malloc error */
                return NULL;
 
        /* Compute the index of the last argument (could be an empty string) */
@@ -1844,7 +1844,7 @@ static char *__ast_cli_generator(const char *text, const char *word, int state,
        }
        if (lock)
                AST_RWLIST_UNLOCK(&helpers);
-       ast_free(dup);
+       ast_free(duplicate);
        return ret;
 }
 
@@ -1858,12 +1858,12 @@ int ast_cli_command(int fd, const char *s)
        char *args[AST_MAX_ARGS + 1];
        struct ast_cli_entry *e;
        int x;
-       char *dup = parse_args(s, &x, args + 1, AST_MAX_ARGS, NULL);
+       char *duplicate = parse_args(s, &x, args + 1, AST_MAX_ARGS, NULL);
        char *retval = NULL;
        struct ast_cli_args a = {
                .fd = fd, .argc = x, .argv = args+1 };
 
-       if (dup == NULL)
+       if (duplicate == NULL)
                return -1;
 
        if (x < 1)      /* We need at least one entry, otherwise ignore */
@@ -1904,7 +1904,7 @@ int ast_cli_command(int fd, const char *s)
        }
        ast_atomic_fetchadd_int(&e->inuse, -1);
 done:
-       ast_free(dup);
+       ast_free(duplicate);
        return 0;
 }
 
index 29bf66a..c468a37 100644 (file)
@@ -496,9 +496,9 @@ void ast_swapcopy_samples(void *dst, const void *src, int samples)
 }
 
 
-struct ast_format_list *ast_get_format_list_index(int index) 
+struct ast_format_list *ast_get_format_list_index(int idx) 
 {
-       return &AST_FORMAT_LIST[index];
+       return &AST_FORMAT_LIST[idx];
 }
 
 struct ast_format_list *ast_get_format_list(size_t *size) 
@@ -997,16 +997,15 @@ int ast_codec_pref_string(struct ast_codec_pref *pref, char *buf, size_t size)
        return size - total_len;
 }
 
-int ast_codec_pref_index(struct ast_codec_pref *pref, int index) 
+int ast_codec_pref_index(struct ast_codec_pref *pref, int idx)
 {
        int slot = 0;
 
-       
-       if ((index >= 0) && (index < sizeof(pref->order))) {
-               slot = pref->order[index];
+       if ((idx >= 0) && (idx < sizeof(pref->order))) {
+               slot = pref->order[idx];
        }
 
-       return slot ? AST_FORMAT_LIST[slot-1].bits : 0;
+       return slot ? AST_FORMAT_LIST[slot - 1].bits : 0;
 }
 
 /*! \brief Remove codec from pref list */
@@ -1102,34 +1101,33 @@ void ast_codec_pref_prepend(struct ast_codec_pref *pref, int format, int only_if
 /*! \brief Set packet size for codec */
 int ast_codec_pref_setsize(struct ast_codec_pref *pref, int format, int framems)
 {
-       int x, index = -1;
+       int x, idx = -1;
 
        for (x = 0; x < ARRAY_LEN(AST_FORMAT_LIST); x++) {
                if (AST_FORMAT_LIST[x].bits == format) {
-                       index = x;
+                       idx = x;
                        break;
                }
        }
 
-       if (index < 0)
+       if (idx < 0)
                return -1;
 
        /* size validation */
        if (!framems)
-               framems = AST_FORMAT_LIST[index].def_ms;
-
-       if (AST_FORMAT_LIST[index].inc_ms && framems % AST_FORMAT_LIST[index].inc_ms) /* avoid division by zero */
-               framems -= framems % AST_FORMAT_LIST[index].inc_ms;
+               framems = AST_FORMAT_LIST[idx].def_ms;
 
-       if (framems < AST_FORMAT_LIST[index].min_ms)
-               framems = AST_FORMAT_LIST[index].min_ms;
+       if (AST_FORMAT_LIST[idx].inc_ms && framems % AST_FORMAT_LIST[idx].inc_ms) /* avoid division by zero */
+               framems -= framems % AST_FORMAT_LIST[idx].inc_ms;
 
-       if (framems > AST_FORMAT_LIST[index].max_ms)
-               framems = AST_FORMAT_LIST[index].max_ms;
+       if (framems < AST_FORMAT_LIST[idx].min_ms)
+               framems = AST_FORMAT_LIST[idx].min_ms;
 
+       if (framems > AST_FORMAT_LIST[idx].max_ms)
+               framems = AST_FORMAT_LIST[idx].max_ms;
 
        for (x = 0; x < ARRAY_LEN(AST_FORMAT_LIST); x++) {
-               if (pref->order[x] == (index + 1)) {
+               if (pref->order[x] == (idx + 1)) {
                        pref->framing[x] = framems;
                        break;
                }
@@ -1141,19 +1139,19 @@ int ast_codec_pref_setsize(struct ast_codec_pref *pref, int format, int framems)
 /*! \brief Get packet size for codec */
 struct ast_format_list ast_codec_pref_getsize(struct ast_codec_pref *pref, int format)
 {
-       int x, index = -1, framems = 0;
+       int x, idx = -1, framems = 0;
        struct ast_format_list fmt = { 0, };
 
        for (x = 0; x < ARRAY_LEN(AST_FORMAT_LIST); x++) {
                if (AST_FORMAT_LIST[x].bits == format) {
                        fmt = AST_FORMAT_LIST[x];
-                       index = x;
+                       idx = x;
                        break;
                }
        }
 
        for (x = 0; x < ARRAY_LEN(AST_FORMAT_LIST); x++) {
-               if (pref->order[x] == (index + 1)) {
+               if (pref->order[x] == (idx + 1)) {
                        framems = pref->framing[x];
                        break;
                }
@@ -1161,16 +1159,16 @@ struct ast_format_list ast_codec_pref_getsize(struct ast_codec_pref *pref, int f
 
        /* size validation */
        if (!framems)
-               framems = AST_FORMAT_LIST[index].def_ms;
+               framems = AST_FORMAT_LIST[idx].def_ms;
 
-       if (AST_FORMAT_LIST[index].inc_ms && framems % AST_FORMAT_LIST[index].inc_ms) /* avoid division by zero */
-               framems -= framems % AST_FORMAT_LIST[index].inc_ms;
+       if (AST_FORMAT_LIST[idx].inc_ms && framems % AST_FORMAT_LIST[idx].inc_ms) /* avoid division by zero */
+               framems -= framems % AST_FORMAT_LIST[idx].inc_ms;
 
-       if (framems < AST_FORMAT_LIST[index].min_ms)
-               framems = AST_FORMAT_LIST[index].min_ms;
+       if (framems < AST_FORMAT_LIST[idx].min_ms)
+               framems = AST_FORMAT_LIST[idx].min_ms;
 
-       if (framems > AST_FORMAT_LIST[index].max_ms)
-               framems = AST_FORMAT_LIST[index].max_ms;
+       if (framems > AST_FORMAT_LIST[idx].max_ms)
+               framems = AST_FORMAT_LIST[idx].max_ms;
 
        fmt.cur_ms = framems;
 
index f75f27b..edde12a 100644 (file)
@@ -233,55 +233,55 @@ int ast_playtones_start(struct ast_channel *chan, int vol, const char *playlst,
                separator = ",";
        s = strsep(&stringp,separator);
        while (s && *s) {
-               int freq1, freq2, time, modulate = 0, midinote = 0;
+               int freq1, freq2, duration, modulate = 0, midinote = 0;
 
                if (s[0]=='!')
                        s++;
                else if (d.reppos == -1)
                        d.reppos = d.nitems;
-               if (sscanf(s, "%d+%d/%d", &freq1, &freq2, &time) == 3) {
+               if (sscanf(s, "%d+%d/%d", &freq1, &freq2, &duration) == 3) {
                        /* f1+f2/time format */
                } else if (sscanf(s, "%d+%d", &freq1, &freq2) == 2) {
                        /* f1+f2 format */
-                       time = 0;
-               } else if (sscanf(s, "%d*%d/%d", &freq1, &freq2, &time) == 3) {
+                       duration = 0;
+               } else if (sscanf(s, "%d*%d/%d", &freq1, &freq2, &duration) == 3) {
                        /* f1*f2/time format */
                        modulate = 1;
                } else if (sscanf(s, "%d*%d", &freq1, &freq2) == 2) {
                        /* f1*f2 format */
-                       time = 0;
+                       duration = 0;
                        modulate = 1;
-               } else if (sscanf(s, "%d/%d", &freq1, &time) == 2) {
+               } else if (sscanf(s, "%d/%d", &freq1, &duration) == 2) {
                        /* f1/time format */
                        freq2 = 0;
                } else if (sscanf(s, "%d", &freq1) == 1) {
                        /* f1 format */
                        freq2 = 0;
-                       time = 0;
-               } else if (sscanf(s, "M%d+M%d/%d", &freq1, &freq2, &time) == 3) {
+                       duration = 0;
+               } else if (sscanf(s, "M%d+M%d/%d", &freq1, &freq2, &duration) == 3) {
                        /* Mf1+Mf2/time format */
                        midinote = 1;
                } else if (sscanf(s, "M%d+M%d", &freq1, &freq2) == 2) {
                        /* Mf1+Mf2 format */
-                       time = 0;
+                       duration = 0;
                        midinote = 1;
-               } else if (sscanf(s, "M%d*M%d/%d", &freq1, &freq2, &time) == 3) {
+               } else if (sscanf(s, "M%d*M%d/%d", &freq1, &freq2, &duration) == 3) {
                        /* Mf1*Mf2/time format */
                        modulate = 1;
                        midinote = 1;
                } else if (sscanf(s, "M%d*M%d", &freq1, &freq2) == 2) {
                        /* Mf1*Mf2 format */
-                       time = 0;
+                       duration = 0;
                        modulate = 1;
                        midinote = 1;
-               } else if (sscanf(s, "M%d/%d", &freq1, &time) == 2) {
+               } else if (sscanf(s, "M%d/%d", &freq1, &duration) == 2) {
                        /* Mf1/time format */
                        freq2 = -1;
                        midinote = 1;
                } else if (sscanf(s, "M%d", &freq1) == 1) {
                        /* Mf1 format */
                        freq2 = -1;
-                       time = 0;
+                       duration = 0;
                        midinote = 1;
                } else {
                        ast_log(LOG_WARNING,"%s: tone component '%s' of '%s' is no good\n",chan->name,s,playlst);
@@ -311,7 +311,7 @@ int ast_playtones_start(struct ast_channel *chan, int vol, const char *playlst,
                d.items[d.nitems].fac2 = 2.0 * cos(2.0 * M_PI * (freq2 / 8000.0)) * 32768.0;
                d.items[d.nitems].init_v2_2 = sin(-4.0 * M_PI * (freq2 / 8000.0)) * d.vol;
                d.items[d.nitems].init_v3_2 = sin(-2.0 * M_PI * (freq2 / 8000.0)) * d.vol;
-               d.items[d.nitems].duration = time;
+               d.items[d.nitems].duration = duration;
                d.items[d.nitems].modulate = modulate;
                d.nitems++;
 
index 341a624..d09d827 100644 (file)
@@ -1086,7 +1086,7 @@ void ast_log(int level, const char *file, int line, const char *function, const
        struct logmsg *logmsg = NULL;
        struct ast_str *buf = NULL;
        struct ast_tm tm;
-       struct timeval tv = ast_tvnow();
+       struct timeval now = ast_tvnow();
        int res = 0;
        va_list ap;
 
@@ -1099,11 +1099,11 @@ void ast_log(int level, const char *file, int line, const char *function, const
                 * so just log to stdout
                 */
                if (level != __LOG_VERBOSE) {
-                       int res;
+                       int result;
                        va_start(ap, fmt);
-                       res = ast_str_set_va(&buf, BUFSIZ, fmt, ap); /* XXX BUFSIZ ? */
+                       result = ast_str_set_va(&buf, BUFSIZ, fmt, ap); /* XXX BUFSIZ ? */
                        va_end(ap);
-                       if (res != AST_DYNSTR_BUILD_FAILED) {
+                       if (result != AST_DYNSTR_BUILD_FAILED) {
                                term_filter_escapes(buf->str);
                                fputs(buf->str, stdout);
                        }
@@ -1144,7 +1144,7 @@ void ast_log(int level, const char *file, int line, const char *function, const
        logmsg->type = LOGMSG_NORMAL;
 
        /* Create our date/time */
-       ast_localtime(&tv, &tm, NULL);
+       ast_localtime(&now, &tm, NULL);
        ast_strftime(logmsg->date, sizeof(logmsg->date), dateformat, &tm);
 
        /* Copy over data */
@@ -1206,25 +1206,25 @@ void *ast_bt_destroy(struct ast_bt *bt)
 void ast_backtrace(void)
 {
 #ifdef HAVE_BKTR
-       struct ast_bt *backtrace;
+       struct ast_bt *bt;
        int i = 0;
        char **strings;
 
-       if (!(backtrace = ast_bt_create())) {
+       if (!(bt = ast_bt_create())) {
                ast_log(LOG_WARNING, "Unable to allocate space for backtrace structure\n");
                return;
        }
 
-       if ((strings = backtrace_symbols(backtrace->addresses, backtrace->num_frames))) {
-               ast_debug(1, "Got %d backtrace record%c\n", backtrace->num_frames, backtrace->num_frames != 1 ? 's' : ' ');
-               for (i = 0; i < backtrace->num_frames; i++) {
-                       ast_log(LOG_DEBUG, "#%d: [%p] %s\n", i, backtrace->addresses[i], strings[i]);
+       if ((strings = backtrace_symbols(bt->addresses, bt->num_frames))) {
+               ast_debug(1, "Got %d backtrace record%c\n", bt->num_frames, bt->num_frames != 1 ? 's' : ' ');
+               for (i = 0; i < bt->num_frames; i++) {
+                       ast_log(LOG_DEBUG, "#%d: [%p] %s\n", i, bt->addresses[i], strings[i]);
                }
                free(strings);
        } else {
                ast_debug(1, "Could not allocate memory for backtrace\n");
        }
-       ast_bt_destroy(backtrace);
+       ast_bt_destroy(bt);
 #else
        ast_log(LOG_WARNING, "Must run configure with '--with-execinfo' for stack backtraces.\n");
 #endif
@@ -1241,13 +1241,13 @@ void __ast_verbose(const char *file, int line, const char *func, const char *fmt
                return;
 
        if (ast_opt_timestamp) {
-               struct timeval tv;
+               struct timeval now;
                struct ast_tm tm;
                char date[40];
                char *datefmt;
 
-               tv = ast_tvnow();
-               ast_localtime(&tv, &tm, NULL);
+               now = ast_tvnow();
+               ast_localtime(&now, &tm, NULL);
                ast_strftime(date, sizeof(date), dateformat, &tm);
                datefmt = alloca(strlen(date) + 3 + strlen(fmt) + 1);
                sprintf(datefmt, "%c[%s] %s", 127, date, fmt);
index 6968171..86cac53 100644 (file)
@@ -2977,14 +2977,14 @@ static void pbx_substitute_variables_helper_full(struct ast_channel *c, struct v
                                        cp4 = ast_func_read(c, vars, workspace, VAR_BUF_SIZE) ? NULL : workspace;
                                else {
                                        struct varshead old;
-                                       struct ast_channel *c = ast_channel_alloc(0, 0, "", "", "", "", "", 0, "Bogus/%p", vars);
-                                       if (c) {
-                                               memcpy(&old, &c->varshead, sizeof(old));
-                                               memcpy(&c->varshead, headp, sizeof(c->varshead));
-                                               cp4 = ast_func_read(c, vars, workspace, VAR_BUF_SIZE) ? NULL : workspace;
+                                       struct ast_channel *bogus = ast_channel_alloc(0, 0, "", "", "", "", "", 0, "Bogus/%p", vars);
+                                       if (bogus) {
+                                               memcpy(&old, &bogus->varshead, sizeof(old));
+                                               memcpy(&bogus->varshead, headp, sizeof(bogus->varshead));
+                                               cp4 = ast_func_read(bogus, vars, workspace, VAR_BUF_SIZE) ? NULL : workspace;
                                                /* Don't deallocate the varshead that was passed in */
-                                               memcpy(&c->varshead, &old, sizeof(c->varshead));
-                                               ast_channel_free(c);
+                                               memcpy(&bogus->varshead, &old, sizeof(bogus->varshead));
+                                               ast_channel_free(bogus);
                                        } else
                                                ast_log(LOG_ERROR, "Unable to allocate bogus channel for variable substitution.  Function results may be blank.\n");
                                }
@@ -4198,13 +4198,13 @@ int ast_context_remove_extension(const char *context, const char *extension, int
        return ast_context_remove_extension_callerid(context, extension, priority, NULL, 0, registrar);
 }
 
-int ast_context_remove_extension_callerid(const char *context, const char *extension, int priority, const char *callerid, int matchcid, const char *registrar)
+int ast_context_remove_extension_callerid(const char *context, const char *extension, int priority, const char *callerid, int matchcallerid, const char *registrar)
 {
        int ret = -1; /* default error return */
        struct ast_context *c = find_context_locked(context);
 
        if (c) { /* ... remove extension ... */
-               ret = ast_context_remove_extension_callerid2(c, extension, priority, callerid, matchcid, registrar, 1);
+               ret = ast_context_remove_extension_callerid2(c, extension, priority, callerid, matchcallerid, registrar, 1);
                ast_unlock_contexts();
        }
        return ret;
@@ -4225,7 +4225,7 @@ int ast_context_remove_extension2(struct ast_context *con, const char *extension
        return ast_context_remove_extension_callerid2(con, extension, priority, NULL, 0, registrar, already_locked);
 }
 
-int ast_context_remove_extension_callerid2(struct ast_context *con, const char *extension, int priority, const char *callerid, int matchcid, const char *registrar, int already_locked)
+int ast_context_remove_extension_callerid2(struct ast_context *con, const char *extension, int priority, const char *callerid, int matchcallerid, const char *registrar, int already_locked)
 {
        struct ast_exten *exten, *prev_exten = NULL;
        struct ast_exten *peer;
@@ -4243,14 +4243,14 @@ int ast_context_remove_extension_callerid2(struct ast_context *con, const char *
        /* FIXME For backwards compatibility, if callerid==NULL, then remove ALL
         * peers, not just those matching the callerid. */
 #ifdef NEED_DEBUG
-       ast_verb(3,"Removing %s/%s/%d%s%s from trees, registrar=%s\n", con->name, extension, priority, matchcid ? "/" : "", matchcid ? callerid : "", registrar);
+       ast_verb(3,"Removing %s/%s/%d%s%s from trees, registrar=%s\n", con->name, extension, priority, matchcallerid ? "/" : "", matchcallerid ? callerid : "", registrar);
 #endif
 #ifdef CONTEXT_DEBUG
        check_contexts(__FILE__, __LINE__);
 #endif
        /* find this particular extension */
        ex.exten = dummy_name;
-       ex.matchcid = matchcid && !ast_strlen_zero(callerid); /* don't say match if there's no callerid */
+       ex.matchcid = matchcallerid && !ast_strlen_zero(callerid); /* don't say match if there's no callerid */
        ex.cidmatch = callerid;
        ast_copy_string(dummy_name, extension, sizeof(dummy_name));
        exten = ast_hashtab_lookup(con->root_table, &ex);
@@ -4323,7 +4323,7 @@ int ast_context_remove_extension_callerid2(struct ast_context *con, const char *
        for (exten = con->root; exten; prev_exten = exten, exten = exten->next) {
                if (!strcmp(exten->exten, extension) &&
                        (!registrar || !strcmp(exten->registrar, registrar)) &&
-                       (!matchcid || (!ast_strlen_zero(callerid) && !ast_strlen_zero(exten->cidmatch) && !strcmp(exten->cidmatch, callerid)) || (ast_strlen_zero(callerid) && ast_strlen_zero(exten->cidmatch))))
+                       (!matchcallerid || (!ast_strlen_zero(callerid) && !ast_strlen_zero(exten->cidmatch) && !strcmp(exten->cidmatch, callerid)) || (ast_strlen_zero(callerid) && ast_strlen_zero(exten->cidmatch))))
                        break;
        }
        if (!exten) {
@@ -4335,10 +4335,10 @@ int ast_context_remove_extension_callerid2(struct ast_context *con, const char *
 
        /* scan the priority list to remove extension with exten->priority == priority */
        for (peer = exten, next_peer = exten->peer ? exten->peer : exten->next;
-                peer && !strcmp(peer->exten, extension) && (!matchcid || (!ast_strlen_zero(callerid) && !ast_strlen_zero(peer->cidmatch) && !strcmp(peer->cidmatch,callerid)) || (ast_strlen_zero(callerid) && ast_strlen_zero(peer->cidmatch)));
+                peer && !strcmp(peer->exten, extension) && (!matchcallerid || (!ast_strlen_zero(callerid) && !ast_strlen_zero(peer->cidmatch) && !strcmp(peer->cidmatch,callerid)) || (ast_strlen_zero(callerid) && ast_strlen_zero(peer->cidmatch)));
                        peer = next_peer, next_peer = next_peer ? (next_peer->peer ? next_peer->peer : next_peer->next) : NULL) {
                if ((priority == 0 || peer->priority == priority) &&
-                               (!callerid || !matchcid || (matchcid && !strcmp(peer->cidmatch, callerid))) &&
+                               (!callerid || !matchcallerid || (matchcallerid && !strcmp(peer->cidmatch, callerid))) &&
                                (!registrar || !strcmp(peer->registrar, registrar) )) {
                        found = 1;
 
@@ -6206,9 +6206,9 @@ int ast_build_timing(struct ast_timing *i, const char *info_in)
 int ast_check_timing(const struct ast_timing *i)
 {
        struct ast_tm tm;
-       struct timeval tv = ast_tvnow();
+       struct timeval now = ast_tvnow();
 
-       ast_localtime(&tv, &tm, NULL);
+       ast_localtime(&now, &tm, NULL);
 
        /* If it's not the right month, return */
        if (!(i->monthmask & (1 << tm.tm_mon)))
@@ -7086,14 +7086,14 @@ static int ast_pbx_outgoing_cdr_failed(void)
        return 0;  /* success */
 }
 
-int ast_pbx_outgoing_exten(const char *type, int format, void *data, int timeout, const char *context, const char *exten, int priority, int *reason, int sync, const char *cid_num, const char *cid_name, struct ast_variable *vars, const char *account, struct ast_channel **channel)
+int ast_pbx_outgoing_exten(const char *type, int format, void *data, int timeout, const char *context, const char *exten, int priority, int *reason, int synchronous, const char *cid_num, const char *cid_name, struct ast_variable *vars, const char *account, struct ast_channel **channel)
 {
        struct ast_channel *chan;
        struct async_stat *as;
        int res = -1, cdr_res = -1;
        struct outgoing_helper oh;
 
-       if (sync) {
+       if (synchronous) {
                oh.context = context;
                oh.exten = exten;
                oh.priority = priority;
@@ -7114,7 +7114,7 @@ int ast_pbx_outgoing_exten(const char *type, int format, void *data, int timeout
                                        res = 0;
                                ast_verb(4, "Channel %s was answered.\n", chan->name);
 
-                               if (sync > 1) {
+                               if (synchronous > 1) {
                                        if (channel)
                                                ast_channel_unlock(chan);
                                        if (ast_pbx_run(chan)) {
@@ -7252,7 +7252,7 @@ static void *ast_pbx_run_app(void *data)
        return NULL;
 }
 
-int ast_pbx_outgoing_app(const char *type, int format, void *data, int timeout, const char *app, const char *appdata, int *reason, int sync, const char *cid_num, const char *cid_name, struct ast_variable *vars, const char *account, struct ast_channel **locked_channel)
+int ast_pbx_outgoing_app(const char *type, int format, void *data, int timeout, const char *app, const char *appdata, int *reason, int synchronous, const char *cid_num, const char *cid_name, struct ast_variable *vars, const char *account, struct ast_channel **locked_channel)
 {
        struct ast_channel *chan;
        struct app_tmp *tmp;
@@ -7269,7 +7269,7 @@ int ast_pbx_outgoing_app(const char *type, int format, void *data, int timeout,
                res = -1;
                goto outgoing_app_cleanup;
        }
-       if (sync) {
+       if (synchronous) {
                chan = __ast_request_and_dial(type, format, data, timeout, reason, cid_num, cid_name, &oh);
                if (chan) {
                        ast_set_variables(chan, vars);
@@ -7286,7 +7286,7 @@ int ast_pbx_outgoing_app(const char *type, int format, void *data, int timeout,
                                        if (appdata)
                                                ast_copy_string(tmp->data, appdata, sizeof(tmp->data));
                                        tmp->chan = chan;
-                                       if (sync > 1) {
+                                       if (synchronous > 1) {
                                                if (locked_channel)
                                                        ast_channel_unlock(chan);
                                                ast_pbx_run_app(tmp);
index 03f19ef..bca955d 100644 (file)
@@ -1610,8 +1610,10 @@ struct ast_frame *ast_rtp_read(struct ast_rtp *rtp)
                    (rtp->them.sin_port != sock_in.sin_port)) {
                        rtp->them = sock_in;
                        if (rtp->rtcp) {
+                               int h = 0;
                                memcpy(&rtp->rtcp->them, &sock_in, sizeof(rtp->rtcp->them));
-                               rtp->rtcp->them.sin_port = htons(ntohs(rtp->them.sin_port)+1);
+                               h = ntohs(rtp->them.sin_port);
+                               rtp->rtcp->them.sin_port = htons(h + 1);
                        }
                        rtp->rxseqno = 0;
                        ast_set_flag(rtp, FLAG_NAT_ACTIVE);