File: The asterisk. c file under the main directory
1. code snippet:
/* if the progname is rasterisk consider it a remote console */if (argv[0] && (strstr(argv[0], "rasterisk")) != NULL) { ast_set_flag(&ast_options, AST_OPT_FLAG_NO_FORK | AST_OPT_FLAG_REMOTE);}...case 'r': ast_set_flag(&ast_options, AST_OPT_FLAG_NO_FORK | AST_OPT_FLAG_REMOTE); break;
Note:
Running the rasterisk command on the terminal is equivalent to running asterisk-r, that is, the remote connection of asterisk.
2. code snippet:
if (getenv("HOME")) snprintf(filename, sizeof(filename), "%s/.asterisk_history", getenv("HOME"));
Note: commands run in rasterisk (or asterisk-r) are recorded in. asterisk in the user's home directory.In the history file (for example,/root/. asteriskHistory)
Asterisk startup parameters
Code snippet:
case 'B': /* Force black background */ ast_set_flag(&ast_options, AST_OPT_FLAG_FORCE_BLACK_BACKGROUND); ast_clear_flag(&ast_options, AST_OPT_FLAG_LIGHT_BACKGROUND); break;
Note:-B is forced to run with a black background, which is equivalent to setting forceblackbackground in the file/etc/asterisk. conf to yes.
Code snippet:
case 'X': ast_set_flag(&ast_options, AST_OPT_FLAG_EXEC_INCLUDES); break;
Note:-X can be used to configure commands such as "# exec" in the configuration file (for example, # exec/tmp/shellTest. sh), equivalent to the file/etc/asterisk. execincludes = yes in conf
Code snippet:
case 'C': ast_copy_string(cfg_paths.config_file, optarg, sizeof(cfg_paths.config_file)); ast_set_flag(&ast_options, AST_OPT_FLAG_OVERRIDE_CONFIG); break;
Note:-C file replaces the/etc/asterisk. conf file initialization program with file. The file here should be an absolute path.
Code snippet:
case 'c': ast_set_flag(&ast_options, AST_OPT_FLAG_NO_FORK | AST_OPT_FLAG_CONSOLE); break;
Note:-c runs in console mode, which is equivalent to configuring console = yes in the file/etc/asterisk. conf.
Code snippet:
case 'd': option_debug++; ast_set_flag(&ast_options, AST_OPT_FLAG_NO_FORK); break;
Note:
In-d or-ddd debugging mode, the number of d is the debugging level. For example, "-ddd" is equivalent to configuring debug = 3 in the file/etc/asterisk. conf.
Code snippet:
case 'e': if ((sscanf(&optarg[1], "%30ld", &option_minmemfree) != 1) || (option_minmemfree < 0)) { option_minmemfree = 0; } break;
Note:
-E memory is equivalent to configuring minmemfree = memory in the file/etc/asterisk. conf. When the available memory in the system is lower than the preset memory value, asterisk stops receiving new calls.
Code snippet:
case 'F': ast_set_flag(&ast_options, AST_OPT_FLAG_ALWAYS_FORK); break;
Note:
-F is equivalent to configuring alwaysfork = yes in the file/etc/asterisk. conf
Code snippet:
case 'f': ast_set_flag(&ast_options, AST_OPT_FLAG_NO_FORK); break;
Note:
-F is equivalent to configuring nofork = yes in the file/etc/asterisk. conf
Code snippet:
case 'G': rungroup = ast_strdupa(optarg); break;
Note:
-G group
Code snippet:
case 'g': ast_set_flag(&ast_options, AST_OPT_FLAG_DUMP_CORE); break;
Note:
-G fault dump Problems
Code snippet:
case 'h': show_cli_help(); exit(0);
Note:
-H: Display help information
Code snippet:
case 'I': ast_set_flag(&ast_options, AST_OPT_FLAG_INTERNAL_TIMING); break;
Note:-I enables internal Timing If the DAHDI timer is available
Code snippet:
case 'i': ast_set_flag(&ast_options, AST_OPT_FLAG_INIT_KEYS); break;
Note:
-I initialize the encryption key at startup
Code snippet:
case 'L': if ((sscanf(optarg, "%30lf", &option_maxload) != 1) || (option_maxload < 0.0)) { option_maxload = 0.0; } break;
Note:
-L <load> limit the maximum average load before rejecting a new call
Code snippet:
case 'M': if ((sscanf(optarg, "%30d", &option_maxcalls) != 1) || (option_maxcalls < 0)) { option_maxcalls = 0; } break;
Note:
-M <value> specifies the maximum number of phone numbers.
Code snippet:
case 'm': ast_set_flag(&ast_options, AST_OPT_FLAG_MUTE); break;
Note:
-M shield output in the console
Code snippet:
case 'n': ast_set_flag(&ast_options, AST_OPT_FLAG_NO_COLOR); break;
Note:-n disables the color output function, for example, asterisk-n.
Code snippet:
case 'p': ast_set_flag(&ast_options, AST_OPT_FLAG_HIGH_PRIORITY); break;
Note:
-P runs as a Pseudo Real-Time Thread
Code snippet:
case 'q': ast_set_flag(&ast_options, AST_OPT_FLAG_QUIET); break;
Note:
-Q quiet mode (Suppress output)
Code snippet:
case 'R': ast_set_flag(&ast_options, AST_OPT_FLAG_NO_FORK | AST_OPT_FLAG_REMOTE | AST_OPT_FLAG_RECONNECT); break;
Note:
-R connects to the asterisk server of the Local Machine. After being disconnected, it will reconnect.
Code snippet:
case 'r': ast_set_flag(&ast_options, AST_OPT_FLAG_NO_FORK | AST_OPT_FLAG_REMOTE); break;
Note:
-R: connect to the local asterisk Server
Code snippet:
case 's': remotesock = ast_strdupa(optarg); break;
Note:
-S <socket-file> connects to asterisk through socket, which is valid when used together with the r parameter
Code snippet:
case 'T': ast_set_flag(&ast_options, AST_OPT_FLAG_TIMESTAMP); break;
Note:
-T display time in CLI output
Code snippet:
case 't': ast_set_flag(&ast_options, AST_OPT_FLAG_CACHE_RECORD_FILES); break;
-:-T Record soundfiles in/var/tmp and move them where they belong after they are done
Code snippet:
case 'U': runuser = ast_strdupa(optarg); break;
Note:
-U <user> Run as user <user>
Code snippet:
case 'V': show_version(); exit(0);
Note:
-V: display version information
Code snippet:
case 'v': option_verbose++; ast_set_flag(&ast_options, AST_OPT_FLAG_NO_FORK); break;
Note:
-V: multiple values. More information is displayed.
Code snippet:
case 'W': /* White background */ ast_set_flag(&ast_options, AST_OPT_FLAG_LIGHT_BACKGROUND); ast_clear_flag(&ast_options, AST_OPT_FLAG_FORCE_BLACK_BACKGROUND); break;
Note:
-W: Adjust terminal color
Code snippet:
case 'x': ast_set_flag(&ast_options, AST_OPT_FLAG_EXEC | AST_OPT_FLAG_NO_COLOR); xarg = ast_strdupa(optarg); break;
Note:
-X <cmd> run cli commands and use them with r parameters, for example, asterisk-rx 'core show channels'