convert most of the option_*'s to a single ast_flags structure. Also, fix some

formatting, remove some unnecessary casts, and other little code cleanups.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@7331 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Russell Bryant
2005-12-04 20:40:46 +00:00
parent b6b32ebd91
commit ec05153ac4
35 changed files with 208 additions and 180 deletions

View File

@@ -143,7 +143,7 @@ static int chanavail_exec(struct ast_channel *chan, void *data)
if (res < 1) {
pbx_builtin_setvar_helper(chan, "AVAILCHAN", "");
pbx_builtin_setvar_helper(chan, "AVAILORIGCHAN", "");
if (priority_jump || option_priority_jumping) {
if (priority_jump || ast_opt_priority_jumping) {
if (ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 101)) {
LOCAL_USER_REMOVE(u);
return -1;

View File

@@ -139,7 +139,7 @@ static int controlplayback_exec(struct ast_channel *chan, void *data)
pbx_builtin_setvar_helper(chan, "CPLAYBACKSTATUS", "USERSTOPPED");
} else {
if (res < 0) {
if (priority_jump || option_priority_jumping) {
if (priority_jump || ast_opt_priority_jumping) {
if (ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 101)) {
ast_log(LOG_WARNING, "ControlPlayback tried to jump to priority n+101 as requested, but priority didn't exist\n");
}

View File

@@ -264,7 +264,7 @@ static int get_exec(struct ast_channel *chan, void *data)
} else {
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "DBget: Value not found in database.\n");
if (priority_jump || option_priority_jumping) {
if (priority_jump || ast_opt_priority_jumping) {
/* 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);
}

View File

@@ -418,7 +418,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, struct localu
strcpy(status, "CONGESTION");
else if (numnochan)
strcpy(status, "CHANUNAVAIL");
if (option_priority_jumping || priority_jump)
if (ast_opt_priority_jumping || priority_jump)
ast_goto_if_exists(in, in->context, in->exten, in->priority + 101);
} else {
if (option_verbose > 2)
@@ -1453,7 +1453,7 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags
if ((macro_result = pbx_builtin_getvar_helper(peer, "MACRO_RESULT"))) {
if (!strcasecmp(macro_result, "BUSY")) {
ast_copy_string(status, macro_result, sizeof(status));
if (option_priority_jumping || ast_test_flag(&opts, OPT_PRIORITY_JUMP)) {
if (ast_opt_priority_jumping || ast_test_flag(&opts, OPT_PRIORITY_JUMP)) {
if (!ast_goto_if_exists(chan, NULL, NULL, chan->priority + 101)) {
ast_set_flag(peerflags, OPT_GO_ON);
}

View File

@@ -122,7 +122,7 @@ static int enumlookup_exec(struct ast_channel *chan, void *data)
res = ast_get_enum(chan, args.d, dest, sizeof(dest), tech, sizeof(tech), NULL, NULL);
if (!res) { /* Failed to do a lookup */
if (priority_jump || option_priority_jumping) {
if (priority_jump || ast_opt_priority_jumping) {
/* Look for a "busy" place */
ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 101);
}
@@ -180,7 +180,7 @@ static int enumlookup_exec(struct ast_channel *chan, void *data)
*t = 0;
pbx_builtin_setvar_helper(chan, "ENUM", tmp);
ast_log(LOG_NOTICE, "tel: ENUM set to \"%s\"\n", tmp);
if (priority_jump || option_priority_jumping) {
if (priority_jump || ast_opt_priority_jumping) {
if (ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 51))
res = 0;
}

View File

@@ -177,7 +177,7 @@ static int group_check_exec(struct ast_channel *chan, void *data)
count = ast_app_group_get_count(pbx_builtin_getvar_helper(chan, category), category);
if (count > max) {
pbx_builtin_setvar_helper(chan, "CHECKGROUPSTATUS", "OVERMAX");
if (priority_jump || option_priority_jumping) {
if (priority_jump || ast_opt_priority_jumping) {
if (!ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 101))
res = -1;
}

View File

@@ -162,7 +162,7 @@ static int hasvoicemail_exec(struct ast_channel *chan, void *data)
if (vmcount > 0) {
/* Branch to the next extension */
if (priority_jump || option_priority_jumping) {
if (priority_jump || ast_opt_priority_jumping) {
if (ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 101))
ast_log(LOG_WARNING, "VM box %s@%s has new voicemail, but extension %s, priority %d doesn't exist\n", vmbox, context, chan->exten, chan->priority + 101);
}

View File

@@ -96,7 +96,7 @@ static int sendimage_exec(struct ast_channel *chan, void *data)
if (!ast_supports_images(chan)) {
/* Does not support transport */
if (priority_jump || option_priority_jumping)
if (priority_jump || ast_opt_priority_jumping)
ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 101);
pbx_builtin_setvar_helper(chan, "SENDIMAGESTATUS", "NOSUPPORT");
LOCAL_USER_REMOVE(u);

View File

@@ -96,7 +96,7 @@ lookupblacklist_exec (struct ast_channel *chan, void *data)
}
if (bl) {
if (priority_jump || option_priority_jumping)
if (priority_jump || ast_opt_priority_jumping)
ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 101);
pbx_builtin_setvar_helper(chan, "LOOKUPBLSTATUS", "FOUND");
} else

View File

@@ -156,7 +156,7 @@ static int md5check_exec(struct ast_channel *chan, void *data)
if (option_debug > 2)
ast_log(LOG_DEBUG, "ERROR: MD5 not verified: %s -- %s\n", args.md5hash, args.string);
pbx_builtin_setvar_helper(chan, "CHECKMD5STATUS", "NOMATCH");
if (priority_jump || option_priority_jumping) {
if (priority_jump || ast_opt_priority_jumping) {
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);

View File

@@ -171,7 +171,7 @@ static int osplookup_exec(struct ast_channel *chan, void *data)
}
if (!res) {
/* Look for a "busy" place */
if (priority_jump || option_priority_jumping)
if (priority_jump || ast_opt_priority_jumping)
ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 101);
} else if (res > 0)
res = 0;
@@ -244,7 +244,7 @@ static int ospnext_exec(struct ast_channel *chan, void *data)
}
if (!res) {
/* Look for a "busy" place */
if (priority_jump || option_priority_jumping)
if (priority_jump || ast_opt_priority_jumping)
ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 101);
} else if (res > 0)
res = 0;
@@ -317,7 +317,7 @@ static int ospfinished_exec(struct ast_channel *chan, void *data)
}
if (!res) {
/* Look for a "busy" place */
if (priority_jump || option_priority_jumping)
if (priority_jump || ast_opt_priority_jumping)
ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 101);
} else if (res > 0)
res = 0;

View File

@@ -130,7 +130,7 @@ static int playback_exec(struct ast_channel *chan, void *data)
ast_stopstream(chan);
} else {
ast_log(LOG_WARNING, "ast_streamfile failed on %s for %s\n", chan->name, (char *)data);
if (priority_jump || option_priority_jumping)
if (priority_jump || ast_opt_priority_jumping)
ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 101);
res = 0;
mres = 1;

View File

@@ -202,7 +202,7 @@ static int privacy_exec (struct ast_channel *chan, void *data)
ast_verbose (VERBOSE_PREFIX_3 "Changed Caller*ID to %s\n",phone);
pbx_builtin_setvar_helper(chan, "PRIVACYMGRSTATUS", "SUCCESS");
} else {
if (priority_jump || option_priority_jumping)
if (priority_jump || ast_opt_priority_jumping)
ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 101);
pbx_builtin_setvar_helper(chan, "PRIVACYMGRSTATUS", "FAILED");
}

View File

@@ -2617,7 +2617,7 @@ static int pqm_exec(struct ast_channel *chan, void *data)
if (set_member_paused(args.queuename, args.interface, 1)) {
ast_log(LOG_WARNING, "Attempt to pause interface %s, not found\n", args.interface);
if (priority_jump || option_priority_jumping) {
if (priority_jump || ast_opt_priority_jumping) {
if (ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 101)) {
pbx_builtin_setvar_helper(chan, "PQMSTATUS", "NOTFOUND");
LOCAL_USER_REMOVE(u);
@@ -2673,7 +2673,7 @@ static int upqm_exec(struct ast_channel *chan, void *data)
if (set_member_paused(args.queuename, args.interface, 0)) {
ast_log(LOG_WARNING, "Attempt to unpause interface %s, not found\n", args.interface);
if (priority_jump || option_priority_jumping) {
if (priority_jump || ast_opt_priority_jumping) {
if (ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 101)) {
pbx_builtin_setvar_helper(chan, "UPQMSTATUS", "NOTFOUND");
LOCAL_USER_REMOVE(u);
@@ -2738,7 +2738,7 @@ static int rqm_exec(struct ast_channel *chan, void *data)
break;
case RES_EXISTS:
ast_log(LOG_WARNING, "Unable to remove interface '%s' from queue '%s': Not there\n", args.interface, args.queuename);
if (priority_jump || option_priority_jumping)
if (priority_jump || ast_opt_priority_jumping)
ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 101);
pbx_builtin_setvar_helper(chan, "RQMSTATUS", "NOTINQUEUE");
res = 0;
@@ -2814,7 +2814,7 @@ static int aqm_exec(struct ast_channel *chan, void *data)
break;
case RES_EXISTS:
ast_log(LOG_WARNING, "Unable to add interface '%s' to queue '%s': Already there\n", args.interface, args.queuename);
if (priority_jump || option_priority_jumping)
if (priority_jump || ast_opt_priority_jumping)
ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 101);
pbx_builtin_setvar_helper(chan, "AQMSTATUS", "MEMBERALREADY");
res = 0;

View File

@@ -249,7 +249,7 @@ static int record_exec(struct ast_channel *chan, void *data)
goto out;
}
if (option_transmit_silence_during_record)
if (ast_opt_transmit_silence)
silgen = ast_channel_start_silence_generator(chan);
/* Request a video update */

View File

@@ -105,7 +105,7 @@ static int sendtext_exec(struct ast_channel *chan, void *data)
if (!chan->tech->send_text) {
ast_mutex_unlock(&chan->lock);
/* Does not support transport */
if (priority_jump || option_priority_jumping)
if (priority_jump || ast_opt_priority_jumping)
ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 101);
LOCAL_USER_REMOVE(u);
return 0;

View File

@@ -111,7 +111,7 @@ static int system_exec_helper(struct ast_channel *chan, void *data, int failmode
} else {
if (res < 0)
res = 0;
if (option_priority_jumping && res)
if (ast_opt_priority_jumping && res)
ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 101);
if (res != 0)

View File

@@ -131,7 +131,7 @@ static int transfer_exec(struct ast_channel *chan, void *data)
if (res < 0) {
status = "FAILURE";
if (priority_jump || option_priority_jumping)
if (priority_jump || ast_opt_priority_jumping)
ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 101);
res = 0;
} else {

View File

@@ -119,7 +119,7 @@ static int txtcidname_exec(struct ast_channel *chan, void *data)
}
if (!res) {
/* Look for a "busy" place */
if (priority_jump || option_priority_jumping)
if (priority_jump || ast_opt_priority_jumping)
ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 101);
pbx_builtin_setvar_helper(chan, "TXTCIDNAMESTATUS", "FAILED");
} else if (res > 0)

View File

@@ -108,7 +108,7 @@ static int sendurl_exec(struct ast_channel *chan, void *data)
if (!ast_channel_supports_html(chan)) {
/* Does not support transport */
if (local_option_jump || option_priority_jumping)
if (local_option_jump || ast_opt_priority_jumping)
ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 101);
pbx_builtin_setvar_helper(chan, "SENDURLSTATUS", "UNSUPPORTED");
LOCAL_USER_REMOVE(u);
@@ -144,7 +144,7 @@ static int sendurl_exec(struct ast_channel *chan, void *data)
case AST_HTML_NOSUPPORT:
/* Does not support transport */
status ="UNSUPPORTED";
if (local_option_jump || option_priority_jumping)
if (local_option_jump || ast_opt_priority_jumping)
ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 101);
res = 0;
goto out;

View File

@@ -2382,7 +2382,7 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_
if (!(vmu = find_user(&svm, context, ext))) {
ast_log(LOG_WARNING, "No entry in voicemail config file for '%s'\n", ext);
if (ast_test_flag(options, OPT_PRIORITY_JUMP) || option_priority_jumping)
if (ast_test_flag(options, OPT_PRIORITY_JUMP) || ast_opt_priority_jumping)
ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 101);
pbx_builtin_setvar_helper(chan, "VMSTATUS", "FAILED");
return res;
@@ -5543,7 +5543,7 @@ static int vm_exec(struct ast_channel *chan, void *data)
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_test_flag(&leave_options, OPT_PRIORITY_JUMP) || option_priority_jumping)
if (ast_test_flag(&leave_options, OPT_PRIORITY_JUMP) || ast_opt_priority_jumping)
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);
pbx_builtin_setvar_helper(chan, "VMSTATUS", "FAILED");
@@ -5633,7 +5633,7 @@ static int vm_box_exists(struct ast_channel *chan, void *data)
if (find_user(&svm, context, args.mbox)) {
pbx_builtin_setvar_helper(chan, "VMBOXEXISTSSTATUS", "SUCCESS");
if (priority_jump || option_priority_jumping)
if (priority_jump || ast_opt_priority_jumping)
if (ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 101))
ast_log(LOG_WARNING, "VM box %s@%s exists, but extension %s, priority %d doesn't exist\n", box, context, chan->exten, chan->priority + 101);
} else