[asterisk-commits] trunk - r7331 in /trunk: ./ apps/
include/asterisk/ pbx/ res/
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Sun Dec 4 14:40:57 CST 2005
Author: russell
Date: Sun Dec 4 14:40:46 2005
New Revision: 7331
URL: http://svn.digium.com/view/asterisk?rev=7331&view=rev
Log:
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.
Modified:
trunk/app.c
trunk/apps/app_chanisavail.c
trunk/apps/app_controlplayback.c
trunk/apps/app_db.c
trunk/apps/app_dial.c
trunk/apps/app_enumlookup.c
trunk/apps/app_groupcount.c
trunk/apps/app_hasnewvoicemail.c
trunk/apps/app_image.c
trunk/apps/app_lookupblacklist.c
trunk/apps/app_md5.c
trunk/apps/app_osplookup.c
trunk/apps/app_playback.c
trunk/apps/app_privacy.c
trunk/apps/app_queue.c
trunk/apps/app_record.c
trunk/apps/app_sendtext.c
trunk/apps/app_system.c
trunk/apps/app_transfer.c
trunk/apps/app_txtcidname.c
trunk/apps/app_url.c
trunk/apps/app_voicemail.c
trunk/asterisk.c
trunk/channel.c
trunk/config.c
trunk/file.c
trunk/frame.c
trunk/include/asterisk/logger.h
trunk/include/asterisk/options.h
trunk/loader.c
trunk/logger.c
trunk/pbx/pbx_config.c
trunk/pbx/pbx_dundi.c
trunk/res/res_crypto.c
trunk/term.c
Modified: trunk/app.c
URL: http://svn.digium.com/view/asterisk/trunk/app.c?rev=7331&r1=7330&r2=7331&view=diff
==============================================================================
--- trunk/app.c (original)
+++ trunk/app.c Sun Dec 4 14:40:46 2005
@@ -636,7 +636,7 @@
/* Request a video update */
ast_indicate(chan, AST_CONTROL_VIDUPDATE);
- if (option_transmit_silence_during_record)
+ if (ast_opt_transmit_silence)
silgen = ast_channel_start_silence_generator(chan);
if (x == fmtcnt) {
Modified: trunk/apps/app_chanisavail.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_chanisavail.c?rev=7331&r1=7330&r2=7331&view=diff
==============================================================================
--- trunk/apps/app_chanisavail.c (original)
+++ trunk/apps/app_chanisavail.c Sun Dec 4 14:40:46 2005
@@ -143,7 +143,7 @@
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;
Modified: trunk/apps/app_controlplayback.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_controlplayback.c?rev=7331&r1=7330&r2=7331&view=diff
==============================================================================
--- trunk/apps/app_controlplayback.c (original)
+++ trunk/apps/app_controlplayback.c Sun Dec 4 14:40:46 2005
@@ -139,7 +139,7 @@
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");
}
Modified: trunk/apps/app_db.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_db.c?rev=7331&r1=7330&r2=7331&view=diff
==============================================================================
--- trunk/apps/app_db.c (original)
+++ trunk/apps/app_db.c Sun Dec 4 14:40:46 2005
@@ -264,7 +264,7 @@
} 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);
}
Modified: trunk/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_dial.c?rev=7331&r1=7330&r2=7331&view=diff
==============================================================================
--- trunk/apps/app_dial.c (original)
+++ trunk/apps/app_dial.c Sun Dec 4 14:40:46 2005
@@ -418,7 +418,7 @@
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 @@
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);
}
Modified: trunk/apps/app_enumlookup.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_enumlookup.c?rev=7331&r1=7330&r2=7331&view=diff
==============================================================================
--- trunk/apps/app_enumlookup.c (original)
+++ trunk/apps/app_enumlookup.c Sun Dec 4 14:40:46 2005
@@ -122,7 +122,7 @@
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 @@
*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;
}
Modified: trunk/apps/app_groupcount.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_groupcount.c?rev=7331&r1=7330&r2=7331&view=diff
==============================================================================
--- trunk/apps/app_groupcount.c (original)
+++ trunk/apps/app_groupcount.c Sun Dec 4 14:40:46 2005
@@ -177,7 +177,7 @@
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;
}
Modified: trunk/apps/app_hasnewvoicemail.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_hasnewvoicemail.c?rev=7331&r1=7330&r2=7331&view=diff
==============================================================================
--- trunk/apps/app_hasnewvoicemail.c (original)
+++ trunk/apps/app_hasnewvoicemail.c Sun Dec 4 14:40:46 2005
@@ -162,7 +162,7 @@
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);
}
Modified: trunk/apps/app_image.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_image.c?rev=7331&r1=7330&r2=7331&view=diff
==============================================================================
--- trunk/apps/app_image.c (original)
+++ trunk/apps/app_image.c Sun Dec 4 14:40:46 2005
@@ -96,7 +96,7 @@
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);
Modified: trunk/apps/app_lookupblacklist.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_lookupblacklist.c?rev=7331&r1=7330&r2=7331&view=diff
==============================================================================
--- trunk/apps/app_lookupblacklist.c (original)
+++ trunk/apps/app_lookupblacklist.c Sun Dec 4 14:40:46 2005
@@ -96,7 +96,7 @@
}
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
Modified: trunk/apps/app_md5.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_md5.c?rev=7331&r1=7330&r2=7331&view=diff
==============================================================================
--- trunk/apps/app_md5.c (original)
+++ trunk/apps/app_md5.c Sun Dec 4 14:40:46 2005
@@ -156,7 +156,7 @@
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);
Modified: trunk/apps/app_osplookup.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_osplookup.c?rev=7331&r1=7330&r2=7331&view=diff
==============================================================================
--- trunk/apps/app_osplookup.c (original)
+++ trunk/apps/app_osplookup.c Sun Dec 4 14:40:46 2005
@@ -171,7 +171,7 @@
}
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 @@
}
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 @@
}
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;
Modified: trunk/apps/app_playback.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_playback.c?rev=7331&r1=7330&r2=7331&view=diff
==============================================================================
--- trunk/apps/app_playback.c (original)
+++ trunk/apps/app_playback.c Sun Dec 4 14:40:46 2005
@@ -130,7 +130,7 @@
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;
Modified: trunk/apps/app_privacy.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_privacy.c?rev=7331&r1=7330&r2=7331&view=diff
==============================================================================
--- trunk/apps/app_privacy.c (original)
+++ trunk/apps/app_privacy.c Sun Dec 4 14:40:46 2005
@@ -202,7 +202,7 @@
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");
}
Modified: trunk/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_queue.c?rev=7331&r1=7330&r2=7331&view=diff
==============================================================================
--- trunk/apps/app_queue.c (original)
+++ trunk/apps/app_queue.c Sun Dec 4 14:40:46 2005
@@ -2617,7 +2617,7 @@
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 @@
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 @@
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 @@
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;
Modified: trunk/apps/app_record.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_record.c?rev=7331&r1=7330&r2=7331&view=diff
==============================================================================
--- trunk/apps/app_record.c (original)
+++ trunk/apps/app_record.c Sun Dec 4 14:40:46 2005
@@ -249,7 +249,7 @@
goto out;
}
- if (option_transmit_silence_during_record)
+ if (ast_opt_transmit_silence)
silgen = ast_channel_start_silence_generator(chan);
/* Request a video update */
Modified: trunk/apps/app_sendtext.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_sendtext.c?rev=7331&r1=7330&r2=7331&view=diff
==============================================================================
--- trunk/apps/app_sendtext.c (original)
+++ trunk/apps/app_sendtext.c Sun Dec 4 14:40:46 2005
@@ -105,7 +105,7 @@
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;
Modified: trunk/apps/app_system.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_system.c?rev=7331&r1=7330&r2=7331&view=diff
==============================================================================
--- trunk/apps/app_system.c (original)
+++ trunk/apps/app_system.c Sun Dec 4 14:40:46 2005
@@ -111,7 +111,7 @@
} 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)
Modified: trunk/apps/app_transfer.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_transfer.c?rev=7331&r1=7330&r2=7331&view=diff
==============================================================================
--- trunk/apps/app_transfer.c (original)
+++ trunk/apps/app_transfer.c Sun Dec 4 14:40:46 2005
@@ -131,7 +131,7 @@
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 {
Modified: trunk/apps/app_txtcidname.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_txtcidname.c?rev=7331&r1=7330&r2=7331&view=diff
==============================================================================
--- trunk/apps/app_txtcidname.c (original)
+++ trunk/apps/app_txtcidname.c Sun Dec 4 14:40:46 2005
@@ -119,7 +119,7 @@
}
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)
Modified: trunk/apps/app_url.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_url.c?rev=7331&r1=7330&r2=7331&view=diff
==============================================================================
--- trunk/apps/app_url.c (original)
+++ trunk/apps/app_url.c Sun Dec 4 14:40:46 2005
@@ -108,7 +108,7 @@
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 @@
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;
Modified: trunk/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_voicemail.c?rev=7331&r1=7330&r2=7331&view=diff
==============================================================================
--- trunk/apps/app_voicemail.c (original)
+++ trunk/apps/app_voicemail.c Sun Dec 4 14:40:46 2005
@@ -2382,7 +2382,7 @@
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 @@
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 @@
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
Modified: trunk/asterisk.c
URL: http://svn.digium.com/view/asterisk/trunk/asterisk.c?rev=7331&r1=7330&r2=7331&view=diff
==============================================================================
--- trunk/asterisk.c (original)
+++ trunk/asterisk.c Sun Dec 4 14:40:46 2005
@@ -136,32 +136,17 @@
Some of them can be changed in the CLI
*/
/*! @{ */
-int option_verbose=0; /*!< Verbosity level */
-int option_debug=0; /*!< Debug level */
-int option_exec_includes=0; /*!< Allow \#exec in config files? */
-int option_nofork=0; /*!< Do not fork */
-int option_quiet=0; /*!< Keep quiet */
-int option_console=0; /*!< Console mode, no background */
-int option_highpriority=0; /*!< Run in realtime Linux priority */
-int option_remote=0; /*!< Remote CLI */
-int option_exec=0; /*!< */
-int option_initcrypto=0; /*!< Initialize crypto keys for RSA auth */
-int option_nocolor; /*!< Don't use termcap colors */
-int option_dumpcore = 0; /*!< Dump core when failing */
-int option_cache_record_files = 0; /*!< Cache sound files */
-int option_timestamp = 0; /*!< Timestamp in logging */
-int option_overrideconfig = 0; /*!< */
-int option_reconnect = 0; /*!< */
-int option_transcode_slin = 1; /*!< */
-int option_maxcalls = 0; /*!< */
+
+struct ast_flags ast_options = { AST_OPT_FLAG_TRANSCODE_VIA_SLIN | AST_OPT_FLAG_PRIORITY_JUMPING };
+
+int option_verbose = 0; /*!< Verbosity level */
+int option_debug = 0; /*!< Debug level */
+
double option_maxload = 0.0; /*!< Max load avg on system */
-int option_dontwarn = 0; /*!< */
-int option_priority_jumping = 1; /*!< Enable priority jumping as result value for apps */
-int option_transmit_silence_during_record = 0; /*!< Transmit silence during record() app */
+int option_maxcalls = 0; /*!< Max number of active calls */
/*! @} */
-int fully_booted = 0;
char record_cache_dir[AST_CACHE_DIR_LEN] = AST_TMP_DIR;
char debug_filename[AST_FILENAME_MAX] = "";
@@ -831,7 +816,7 @@
if (!nice) {
/* Begin shutdown routine, hanging up active channels */
ast_begin_shutdown(1);
- if (option_verbose && option_console)
+ if (option_verbose && ast_opt_console)
ast_verbose("Beginning asterisk %s....\n", restart ? "restart" : "shutdown");
time(&s);
for(;;) {
@@ -849,7 +834,7 @@
} else {
if (nice < 2)
ast_begin_shutdown(0);
- if (option_verbose && option_console)
+ if (option_verbose && ast_opt_console)
ast_verbose("Waiting for inactivity to perform %s...\n", restart ? "restart" : "halt");
for(;;) {
if (!ast_active_channels())
@@ -861,12 +846,12 @@
}
if (!shuttingdown) {
- if (option_verbose && option_console)
+ if (option_verbose && ast_opt_console)
ast_verbose("Asterisk %s cancelled.\n", restart ? "restart" : "shutdown");
return;
}
}
- if (option_console || option_remote) {
+ if (ast_opt_console || ast_opt_remote) {
if (getenv("HOME"))
snprintf(filename, sizeof(filename), "%s/.asterisk_history", getenv("HOME"));
if (!ast_strlen_zero(filename))
@@ -880,7 +865,7 @@
ast_verbose("Executing last minute cleanups\n");
ast_run_atexits();
/* Called on exit */
- if (option_verbose && option_console)
+ if (option_verbose && ast_opt_console)
ast_verbose("Asterisk %s ending (%d).\n", ast_active_channels() ? "uncleanly" : "cleanly", num);
else if (option_debug)
ast_log(LOG_DEBUG, "Asterisk ending (%d).\n", num);
@@ -892,17 +877,18 @@
if (ast_consock > -1)
close(ast_consock);
if (ast_socket > -1)
- unlink((char *)ast_config_AST_SOCKET);
- if (!option_remote) unlink((char *)ast_config_AST_PID);
+ unlink(ast_config_AST_SOCKET);
+ if (!ast_opt_remote)
+ unlink(ast_config_AST_PID);
printf(term_quit());
if (restart) {
- if (option_verbose || option_console)
+ if (option_verbose || ast_opt_console)
ast_verbose("Preparing for Asterisk restart...\n");
/* Mark all FD's for closing on exec */
for (x=3;x<32768;x++) {
fcntl(x, F_SETFD, FD_CLOEXEC);
}
- if (option_verbose || option_console)
+ if (option_verbose || ast_opt_console)
ast_verbose("Restarting Asterisk NOW...\n");
restartnow = 1;
@@ -961,7 +947,7 @@
fflush(stdout);
if (complete) {
/* Wake up a poll()ing console */
- if (option_console && consolethread != AST_PTHREADT_NULL)
+ if (ast_opt_console && consolethread != AST_PTHREADT_NULL)
pthread_kill(consolethread, SIGURG);
}
}
@@ -1172,7 +1158,7 @@
max = 1;
fds[0].fd = ast_consock;
fds[0].events = POLLIN;
- if (!option_exec) {
+ if (!ast_opt_exec) {
fds[1].fd = STDIN_FILENO;
fds[1].events = POLLIN;
max++;
@@ -1185,7 +1171,7 @@
break;
}
- if (!option_exec && fds[1].revents) {
+ if (!ast_opt_exec && fds[1].revents) {
num_read = read(STDIN_FILENO, cp, 1);
if (num_read < 1) {
break;
@@ -1197,7 +1183,7 @@
/* if the remote side disappears exit */
if (res < 1) {
fprintf(stderr, "\nDisconnected from Asterisk server\n");
- if (!option_reconnect) {
+ if (!ast_opt_reconnect) {
quit_handler(0, 0, 0, 0);
} else {
int tries;
@@ -1222,7 +1208,7 @@
buf[res] = '\0';
- if (!option_exec && !lastpos)
+ if (!ast_opt_exec && !lastpos)
write(STDOUT_FILENO, "\r", 1);
write(STDOUT_FILENO, buf, res);
if ((buf[res-1] == '\n') || (buf[res-2] == '\n')) {
@@ -1343,7 +1329,7 @@
}
break;
case '#': /* process console or remote? */
- if (! option_remote) {
+ if (!ast_opt_remote) {
strncat(p, "#", sizeof(prompt) - strlen(prompt) - 1);
} else {
strncat(p, ">", sizeof(prompt) - strlen(prompt) - 1);
@@ -1497,7 +1483,7 @@
len = lf->cursor - ptr;
- if (option_remote) {
+ if (ast_opt_remote) {
snprintf(buf, sizeof(buf),"_COMMAND NUMMATCHES \"%s\" \"%s\"", lf->buffer, ptr);
fdprint(ast_consock, buf);
res = read(ast_consock, buf, sizeof(buf));
@@ -1707,7 +1693,7 @@
if (!ast_strlen_zero(filename))
ast_el_read_history(filename);
- if (option_exec && data) { /* hack to print output then exit if asterisk -rx is used */
+ if (ast_opt_exec && data) { /* hack to print output then exit if asterisk -rx is used */
char tempchar;
struct pollfd fds[0];
fds[0].fd = ast_consock;
@@ -1774,7 +1760,7 @@
struct ast_variable *v;
char *config = AST_CONFIG_FILE;
- if (option_overrideconfig == 1) {
+ if (ast_opt_override_config) {
cfg = ast_config_load(ast_config_AST_CONFIG_FILE);
if (!cfg)
ast_log(LOG_WARNING, "Unable to open specified master config file '%s', using built-in defaults\n", ast_config_AST_CONFIG_FILE);
@@ -1843,10 +1829,10 @@
option_verbose = atoi(v->value);
/* whether or not to force timestamping. (-T at startup) */
} else if (!strcasecmp(v->name, "timestamp")) {
- option_timestamp = ast_true(v->value);
+ ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_TIMESTAMP);
/* whether or not to support #exec in config files */
} else if (!strcasecmp(v->name, "execincludes")) {
- option_exec_includes = ast_true(v->value);
+ ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_EXEC_INCLUDES);
/* debug level (-d at startup) */
} else if (!strcasecmp(v->name, "debug")) {
option_debug = 0;
@@ -1855,40 +1841,40 @@
}
/* Disable forking (-f at startup) */
} else if (!strcasecmp(v->name, "nofork")) {
- option_nofork = ast_true(v->value);
+ ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_NO_FORK);
/* Run quietly (-q at startup ) */
} else if (!strcasecmp(v->name, "quiet")) {
- option_quiet = ast_true(v->value);
+ ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_QUIET);
/* Run as console (-c at startup, implies nofork) */
} else if (!strcasecmp(v->name, "console")) {
- option_console = ast_true(v->value);
+ ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_CONSOLE);
/* Run with highg priority if the O/S permits (-p at startup) */
} else if (!strcasecmp(v->name, "highpriority")) {
- option_highpriority = ast_true(v->value);
+ ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_HIGH_PRIORITY);
/* Initialize RSA auth keys (IAX2) (-i at startup) */
} else if (!strcasecmp(v->name, "initcrypto")) {
- option_initcrypto = ast_true(v->value);
+ ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_INIT_KEYS);
/* Disable ANSI colors for console (-c at startup) */
} else if (!strcasecmp(v->name, "nocolor")) {
- option_nocolor = ast_true(v->value);
+ ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_NO_COLOR);
/* Disable some usage warnings for picky people :p */
} else if (!strcasecmp(v->name, "dontwarn")) {
- option_dontwarn = ast_true(v->value);
+ ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_DONT_WARN);
/* Dump core in case of crash (-g) */
} else if (!strcasecmp(v->name, "dumpcore")) {
- option_dumpcore = ast_true(v->value);
+ ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_DUMP_CORE);
/* Cache recorded sound files to another directory during recording */
} else if (!strcasecmp(v->name, "cache_record_files")) {
- option_cache_record_files = ast_true(v->value);
+ ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_CACHE_RECORD_FILES);
/* Specify cache directory */
} else if (!strcasecmp(v->name, "record_cache_dir")) {
ast_copy_string(record_cache_dir, v->value, AST_CACHE_DIR_LEN);
/* Build transcode paths via SLINEAR, instead of directly */
} else if (!strcasecmp(v->name, "transcode_via_sln")) {
- option_transcode_slin = ast_true(v->value);
+ ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_TRANSCODE_VIA_SLIN);
/* Transmit SLINEAR silence while a channel is being recorded */
} else if (!strcasecmp(v->name, "transmit_silence_during_record")) {
- option_transmit_silence_during_record = ast_true(v->value);
+ ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_TRANSMIT_SILENCE);
} else if (!strcasecmp(v->name, "maxcalls")) {
if ((sscanf(v->value, "%d", &option_maxcalls) != 1) || (option_maxcalls < 0)) {
option_maxcalls = 0;
@@ -1940,8 +1926,7 @@
/* if the progname is rasterisk consider it a remote console */
if (argv[0] && (strstr(argv[0], "rasterisk")) != NULL) {
- option_remote++;
- option_nofork++;
+ ast_set_flag(&ast_options, AST_OPT_FLAG_NO_FORK | AST_OPT_FLAG_REMOTE);
}
if (gethostname(hostname, sizeof(hostname)-1))
ast_copy_string(hostname, "<Unknown>", sizeof(hostname));
@@ -1970,33 +1955,29 @@
switch(c) {
case 'd':
option_debug++;
- option_nofork++;
+ ast_set_flag(&ast_options, AST_OPT_FLAG_NO_FORK);
break;
case 'c':
- option_console++;
- option_nofork++;
+ ast_set_flag(&ast_options, AST_OPT_FLAG_NO_FORK | AST_OPT_FLAG_CONSOLE);
break;
case 'f':
- option_nofork++;
+ ast_set_flag(&ast_options, AST_OPT_FLAG_NO_FORK);
break;
case 'n':
- option_nocolor++;
+ ast_set_flag(&ast_options, AST_OPT_FLAG_NO_COLOR);
break;
case 'r':
- option_remote++;
- option_nofork++;
+ ast_set_flag(&ast_options, AST_OPT_FLAG_NO_FORK | AST_OPT_FLAG_REMOTE);
break;
case 'R':
- option_remote++;
- option_nofork++;
- option_reconnect++;
+ ast_set_flag(&ast_options, AST_OPT_FLAG_NO_FORK | AST_OPT_FLAG_REMOTE | AST_OPT_FLAG_RECONNECT);
break;
case 'p':
- option_highpriority++;
+ ast_set_flag(&ast_options, AST_OPT_FLAG_HIGH_PRIORITY);
break;
case 'v':
option_verbose++;
- option_nofork++;
+ ast_set_flag(&ast_options, AST_OPT_FLAG_NO_FORK);
break;
case 'M':
if ((sscanf(optarg, "%d", &option_maxcalls) != 1) || (option_maxcalls < 0))
@@ -2007,27 +1988,27 @@
option_maxload = 0.0;
break;
case 'q':
- option_quiet++;
+ ast_set_flag(&ast_options, AST_OPT_FLAG_QUIET);
break;
case 't':
- option_cache_record_files++;
+ ast_set_flag(&ast_options, AST_OPT_FLAG_CACHE_RECORD_FILES);
break;
case 'T':
- option_timestamp++;
+ ast_set_flag(&ast_options, AST_OPT_FLAG_TIMESTAMP);
break;
case 'x':
- option_exec++;
+ ast_set_flag(&ast_options, AST_OPT_FLAG_EXEC);
xarg = optarg;
break;
case 'C':
- ast_copy_string((char *)ast_config_AST_CONFIG_FILE,optarg,sizeof(ast_config_AST_CONFIG_FILE));
- option_overrideconfig++;
+ ast_copy_string(ast_config_AST_CONFIG_FILE, optarg, sizeof(ast_config_AST_CONFIG_FILE));
+ ast_set_flag(&ast_options, AST_OPT_FLAG_OVERRIDE_CONFIG);
break;
case 'i':
- option_initcrypto++;
+ ast_set_flag(&ast_options, AST_OPT_FLAG_INIT_KEYS);
break;
case'g':
- option_dumpcore++;
+ ast_set_flag(&ast_options, AST_OPT_FLAG_DUMP_CORE);
break;
case 'h':
show_cli_help();
@@ -2049,14 +2030,14 @@
/* For remote connections, change the name of the remote connection.
* We do this for the benefit of init scripts (which need to know if/when
* the main asterisk process has died yet). */
- if (option_remote) {
+ if (ast_opt_remote) {
strcpy(argv[0], "rasterisk");
for (x = 1; x < argc; x++) {
argv[x] = argv[0] + 10;
}
}
- if (option_dumpcore) {
+ if (ast_opt_dump_core) {
struct rlimit l;
memset(&l, 0, sizeof(l));
l.rlim_cur = RLIM_INFINITY;
@@ -2066,7 +2047,7 @@
}
}
- if (option_console && !option_verbose)
+ if (ast_opt_console && !option_verbose)
ast_verbose("[ Reading Master Configuration ]");
ast_readconfig();
@@ -2077,7 +2058,7 @@
#ifndef __CYGWIN__
if (!is_child_of_nonroot)
- ast_set_priority(option_highpriority);
+ ast_set_priority(ast_opt_high_priority);
if (!is_child_of_nonroot && rungroup) {
struct group *gr;
@@ -2120,14 +2101,14 @@
printf(term_end());
fflush(stdout);
- if (option_console && !option_verbose)
+ if (ast_opt_console && !option_verbose)
ast_verbose("[ Initializing Custom Configuration Options ]");
/* custom config setup */
register_config_cli();
read_config_maps();
- if (option_console) {
+ if (ast_opt_console) {
if (el_hist == NULL || el == NULL)
ast_el_initialize();
@@ -2137,8 +2118,8 @@
if (ast_tryconnect()) {
/* One is already running */
- if (option_remote) {
- if (option_exec) {
+ if (ast_opt_remote) {
+ if (ast_opt_exec) {
ast_remotecontrol(xarg);
quit_handler(0, 0, 0, 0);
exit(0);
@@ -2150,34 +2131,34 @@
quit_handler(0, 0, 0, 0);
exit(0);
} else {
- ast_log(LOG_ERROR, "Asterisk already running on %s. Use 'asterisk -r' to connect.\n", (char *)ast_config_AST_SOCKET);
+ ast_log(LOG_ERROR, "Asterisk already running on %s. Use 'asterisk -r' to connect.\n", ast_config_AST_SOCKET);
printf(term_quit());
exit(1);
}
- } else if (option_remote || option_exec) {
+ } else if (ast_opt_remote || ast_opt_exec) {
ast_log(LOG_ERROR, "Unable to connect to remote asterisk (does %s exist?)\n",ast_config_AST_SOCKET);
printf(term_quit());
exit(1);
}
/* Blindly write pid file since we couldn't connect */
- unlink((char *)ast_config_AST_PID);
- f = fopen((char *)ast_config_AST_PID, "w");
+ unlink(ast_config_AST_PID);
+ f = fopen(ast_config_AST_PID, "w");
if (f) {
fprintf(f, "%d\n", getpid());
fclose(f);
} else
- ast_log(LOG_WARNING, "Unable to open pid file '%s': %s\n", (char *)ast_config_AST_PID, strerror(errno));
-
- if (!option_verbose && !option_debug && !option_nofork && !option_console) {
+ ast_log(LOG_WARNING, "Unable to open pid file '%s': %s\n", ast_config_AST_PID, strerror(errno));
+
+ if (!option_verbose && !option_debug && !ast_opt_no_fork && !ast_opt_console) {
daemon(0,0);
/* Blindly re-write pid file since we are forking */
- unlink((char *)ast_config_AST_PID);
- f = fopen((char *)ast_config_AST_PID, "w");
+ unlink(ast_config_AST_PID);
+ f = fopen(ast_config_AST_PID, "w");
if (f) {
fprintf(f, "%d\n", getpid());
fclose(f);
} else
- ast_log(LOG_WARNING, "Unable to open pid file '%s': %s\n", (char *)ast_config_AST_PID, strerror(errno));
+ ast_log(LOG_WARNING, "Unable to open pid file '%s': %s\n", ast_config_AST_PID, strerror(errno));
}
/* Test recursive mutex locking. */
@@ -2192,13 +2173,13 @@
sigaddset(&sigs, SIGPIPE);
sigaddset(&sigs, SIGWINCH);
pthread_sigmask(SIG_BLOCK, &sigs, NULL);
- if (option_console || option_verbose || option_remote)
+ if (ast_opt_console || option_verbose || ast_opt_remote)
ast_register_verbose(console_verboser);
/* Print a welcome message if desired */
- if (option_verbose || option_console) {
+ if (option_verbose || ast_opt_console) {
WELCOME_MESSAGE;
}
- if (option_console && !option_verbose)
+ if (ast_opt_console && !option_verbose)
ast_verbose("[ Booting...");
signal(SIGURG, urg_handler);
@@ -2285,20 +2266,20 @@
/* We might have the option of showing a console, but for now just
do nothing... */
- if (option_console && !option_verbose)
+ if (ast_opt_console && !option_verbose)
ast_verbose(" ]\n");
- if (option_verbose || option_console)
+ if (option_verbose || ast_opt_console)
ast_verbose(term_color(tmp, "Asterisk Ready.\n", COLOR_BRWHITE, COLOR_BLACK, sizeof(tmp)));
- if (option_nofork)
+ if (ast_opt_no_fork)
consolethread = pthread_self();
- fully_booted = 1;
+ ast_set_flag(&ast_options, AST_OPT_FLAG_FULLY_BOOTED);
pthread_sigmask(SIG_UNBLOCK, &sigs, NULL);
#ifdef __AST_DEBUG_MALLOC
__ast_mm_init();
#endif
time(&ast_startuptime);
ast_cli_register_multiple(core_cli, sizeof(core_cli) / sizeof(core_cli[0]));
- if (option_console) {
+ if (ast_opt_console) {
/* Console stuff now... */
/* Register our quit function */
char title[256];
Modified: trunk/channel.c
URL: http://svn.digium.com/view/asterisk/trunk/channel.c?rev=7331&r1=7330&r2=7331&view=diff
==============================================================================
--- trunk/channel.c (original)
+++ trunk/channel.c Sun Dec 4 14:40:46 2005
@@ -2689,7 +2689,7 @@
/* if the best path is not 'pass through', then
transcoding is needed; if desired, force transcode path
to use SLINEAR between channels */
- if ((src != dst) && option_transcode_slin)
+ if ((src != dst) && ast_opt_transcode_via_slin)
dst = AST_FORMAT_SLINEAR;
if (ast_set_read_format(chan, dst) < 0) {
ast_log(LOG_WARNING, "Unable to set read format on channel %s to %d\n", chan->name, dst);
@@ -2710,7 +2710,7 @@
/* if the best path is not 'pass through', then
transcoding is needed; if desired, force transcode path
to use SLINEAR between channels */
- if ((src != dst) && option_transcode_slin)
+ if ((src != dst) && ast_opt_transcode_via_slin)
dst = AST_FORMAT_SLINEAR;
if (ast_set_read_format(peer, dst) < 0) {
ast_log(LOG_WARNING, "Unable to set read format on channel %s to %d\n", peer->name, dst);
Modified: trunk/config.c
URL: http://svn.digium.com/view/asterisk/trunk/config.c?rev=7331&r1=7330&r2=7331&view=diff
==============================================================================
--- trunk/config.c (original)
+++ trunk/config.c Sun Dec 4 14:40:46 2005
@@ -450,7 +450,7 @@
do_exec = !strcasecmp(cur, "exec");
else
do_exec = 0;
- if (do_exec && !option_exec_includes) {
+ if (do_exec && !ast_opt_exec_includes) {
ast_log(LOG_WARNING, "Cannot perform #exec unless execincludes option is enabled in asterisk.conf (options section)!\n");
do_exec = 0;
}
Modified: trunk/file.c
URL: http://svn.digium.com/view/asterisk/trunk/file.c?rev=7331&r1=7330&r2=7331&view=diff
==============================================================================
--- trunk/file.c (original)
+++ trunk/file.c Sun Dec 4 14:40:46 2005
@@ -909,7 +909,7 @@
}
}
- if (option_cache_record_files && (fd > -1)) {
+ if (ast_opt_cache_record_files && (fd > -1)) {
char *c;
[... 307 lines stripped ...]
More information about the asterisk-commits
mailing list