|
static void | __init_result_buf (void) |
|
static void | __init_tmp_buf (void) |
|
static void | __reg_module (void) |
|
static void | __unreg_module (void) |
|
static int | acf_strftime (struct ast_channel *chan, const char *cmd, char *parse, char *buf, size_t buflen) |
|
static int | acf_strptime (struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen) |
|
static int | array (struct ast_channel *chan, const char *cmd, char *var, const char *value) |
|
struct ast_module * | AST_MODULE_SELF_SYM (void) |
|
| AST_TEST_DEFINE (test_FIELDNUM) |
|
| AST_TEST_DEFINE (test_REPLACE) |
|
| AST_TEST_DEFINE (test_FILTER) |
|
| AST_TEST_DEFINE (test_STRREPLACE) |
|
static void | clearvar_prefix (struct ast_channel *chan, const char *prefix) |
|
static int | csv_quote (struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len) |
|
static int | exec_clearhash (struct ast_channel *chan, const char *data) |
|
static int | filter (struct ast_channel *chan, const char *cmd, char *parse, char *buf, size_t len) |
|
static int | function_eval (struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen) |
|
static int | function_eval2 (struct ast_channel *chan, const char *cmd, char *data, struct ast_str **buf, ssize_t buflen) |
|
static int | function_fieldnum (struct ast_channel *chan, const char *cmd, char *parse, char *buf, size_t len) |
|
static int | function_fieldnum_helper (struct ast_channel *chan, const char *cmd, char *parse, char *buf, struct ast_str **sbuf, ssize_t len) |
|
static int | function_fieldnum_str (struct ast_channel *chan, const char *cmd, char *parse, struct ast_str **buf, ssize_t len) |
|
static int | function_fieldqty (struct ast_channel *chan, const char *cmd, char *parse, char *buf, size_t len) |
|
static int | function_fieldqty_helper (struct ast_channel *chan, const char *cmd, char *parse, char *buf, struct ast_str **sbuf, ssize_t len) |
|
static int | function_fieldqty_str (struct ast_channel *chan, const char *cmd, char *parse, struct ast_str **buf, ssize_t len) |
|
static const char * | get_key (const struct ast_str *prefix, const struct ast_var_t *var) |
|
static int | hash_read (struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len) |
|
static int | hash_write (struct ast_channel *chan, const char *cmd, char *var, const char *value) |
|
static int | hashkeys_read (struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len) |
|
static int | hashkeys_read2 (struct ast_channel *chan, const char *cmd, char *data, struct ast_str **buf, ssize_t len) |
|
static int | keypadhash (struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen) |
|
static int | len (struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen) |
|
static int | listfilter (struct ast_channel *chan, const char *cmd, char *parse, char *buf, struct ast_str **bufstr, ssize_t len) |
|
static int | listfilter_read (struct ast_channel *chan, const char *cmd, char *parse, char *buf, size_t len) |
|
static int | listfilter_read2 (struct ast_channel *chan, const char *cmd, char *parse, struct ast_str **buf, ssize_t len) |
|
static int | load_module (void) |
|
static int | passthru (struct ast_channel *chan, const char *cmd, char *data, struct ast_str **buf, ssize_t len) |
|
static int | quote (struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len) |
|
static int | regex (struct ast_channel *chan, const char *cmd, char *parse, char *buf, size_t len) |
|
static int | replace (struct ast_channel *chan, const char *cmd, char *data, struct ast_str **buf, ssize_t len) |
|
static int | shift_pop (struct ast_channel *chan, const char *cmd, char *data, struct ast_str **buf, ssize_t len) |
|
static int | string_tolower (struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen) |
|
static int | string_tolower2 (struct ast_channel *chan, const char *cmd, char *data, struct ast_str **buf, ssize_t buflen) |
|
static int | string_toupper (struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen) |
|
static int | string_toupper2 (struct ast_channel *chan, const char *cmd, char *data, struct ast_str **buf, ssize_t buflen) |
|
static int | strreplace (struct ast_channel *chan, const char *cmd, char *data, struct ast_str **buf, ssize_t len) |
|
static int | unload_module (void) |
|
static int | unshift_push (struct ast_channel *chan, const char *cmd, char *data, const char *new_value) |
|
|
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "String handling dialplan functions" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = "30ef0c93b36035ec78c9cfd712d36d9b" , .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_DEFAULT, .support_level = AST_MODULE_SUPPORT_CORE, } |
|
static char * | app_clearhash = "ClearHash" |
|
static struct ast_custom_function | array_function |
|
static const struct ast_module_info * | ast_module_info = &__mod_info |
|
static struct ast_custom_function | csv_quote_function |
|
static struct ast_custom_function | eval_function |
|
static struct ast_custom_function | fieldnum_function |
|
static struct ast_custom_function | fieldqty_function |
|
static struct ast_custom_function | filter_function |
|
static struct ast_custom_function | hash_function |
|
static struct ast_custom_function | hashkeys_function |
|
static struct ast_custom_function | keypadhash_function |
|
static struct ast_custom_function | len_function |
|
static struct ast_custom_function | listfilter_function |
|
static struct ast_custom_function | passthru_function |
|
static struct ast_custom_function | pop_function |
|
static struct ast_custom_function | push_function |
|
static struct ast_custom_function | quote_function |
|
static struct ast_custom_function | regex_function |
|
static struct ast_custom_function | replace_function |
|
static struct ast_threadstorage | result_buf = { .once = PTHREAD_ONCE_INIT , .key_init = __init_result_buf , .custom_init = NULL , } |
|
static struct ast_custom_function | shift_function |
|
static struct ast_custom_function | strftime_function |
|
static struct ast_custom_function | strptime_function |
|
static struct ast_custom_function | strreplace_function |
|
static struct ast_threadstorage | tmp_buf = { .once = PTHREAD_ONCE_INIT , .key_init = __init_tmp_buf , .custom_init = NULL , } |
|
static struct ast_custom_function | tolower_function |
|
static struct ast_custom_function | toupper_function |
|
static struct ast_custom_function | unshift_function |
|
String manipulation dialplan functions.
- Author
- Tilghman Lesher
-
Anothony Minessale II
Definition in file func_strings.c.
static int len |
( |
struct ast_channel * |
chan, |
|
|
const char * |
cmd, |
|
|
char * |
data, |
|
|
char * |
buf, |
|
|
size_t |
buflen |
|
) |
| |
|
static |
- Examples:
- /usr/src/asterisk-18.5.0/include/asterisk/strings.h, and /usr/src/asterisk-18.5.0/main/app.c.
Definition at line 1344 of file func_strings.c.
Referenced by __analog_ss_thread(), __ast_cli_register(), __ast_cli_register_multiple(), __ast_dsp_call_progress(), __ast_dsp_silence_noise(), __ast_frdup(), __big_return(), __bt_defcmp(), __bt_defpfx(), OrderedDict::__eq__(), __get_header(), OrderedDict::__init__(), __rec_fmap(), __rec_fpipe(), __rec_vpipe(), __rtp_recvfrom(), __rtp_sendto(), MultiOrderedDict::__setitem__(), __stub__ast_agi_unregister(), _parse(), AbsQuantW(), acf_escape(), action_command(), FaxPcap::add(), add_sdp(), adsi_careful_send(), ael_token_subst(), alsa_write(), amdf_pitch(), anaFilter(), analog_ss_thread(), anti_injection(), ao2_container_check(), aoc_parse_ie(), append_interface(), append_var_and_value_to_filter(), apply_outgoing(), ast_agi_register_multiple(), ast_agi_unregister_multiple(), ast_app_group_set_channel(), ast_app_options2str64(), ast_audiosocket_receive_frame(), ast_beep_start(), ast_bucket_alloc(), ast_bucket_file_alloc(), ast_channel_get_cc_agent_type(), ast_channel_get_device_name(), ast_cli_complete(), ast_cli_unregister_multiple(), ast_dns_test_write_string(), ast_dsp_process(), ast_dsp_silence_noise_with_energy(), ast_format_str_reduce(), ast_get_namedgroups(), ast_http_send(), ast_http_uri_link(), ast_iostream_gets(), ast_iostream_printf(), ast_join_delim(), ast_json_utf8_check_len(), ast_mkdir(), ast_msg_data_alloc(), ast_read_image(), ast_register_cleanup(), ast_rtcp_generate_report(), ast_rtcp_generate_sdes(), ast_rtp_interpret(), ast_say_number_full_ka(), ast_srtp_protect(), ast_srtp_unprotect(), ast_statsd_log_string(), ast_str_buffer(), ast_str_substitute_variables_full(), ast_tdd_gen_ecdisa(), AST_TEST_DEFINE(), ast_translate(), ast_websocket_write_string(), ast_xml_escape(), ast_xmldoc_printable(), auth_exec(), authenticate(), bucket_copy(), bucket_file_wizard_retrieve(), bucket_wizard_retrieve(), build_device(), build_facility(), build_ha(), build_regex(), build_route(), calc_energy(), category_set_sublevels(), CB_ADD_LEN(), cdr_read(), channel_do_masquerade(), chararray_handler_fn(), cleaned_basedn(), clearvar_prefix(), cli_complete(), cli_console_sendtext(), sip_to_pjsql::cli_options(), sip_to_pjsip::cli_options(), closefrom(), complete_confno(), complete_dialplan_add_extension(), complete_dialplan_add_ignorepat(), complete_dialplan_add_include(), complete_dialplan_remove_context(), complete_dialplan_remove_extension(), complete_dialplan_remove_ignorepat(), complete_dialplan_remove_include(), complete_meetmecmd_list(), complete_meetmecmd_mute_kick(), complete_peer_helper(), complete_userno(), conf_get_pin(), conf_play(), config_jitterbuffer(), cops_getmsg(), copy(), create_video_frame(), dahdi_cc_callback(), dahdi_chan_conf_default(), dahdi_sendtext(), dahdi_setoption(), dbl_list_expect_reverse(), dbm_open(), dcbias_(), devstate_write(), dialgroup_refreshdb(), dictate_exec(), do_pktccops(), do_tone(), dtmf_store_framehook(), dump_addr(), dump_ipaddr(), dump_prefs(), dump_raw(), dump_string(), dump_versioned_codec(), dundi_encrypt(), dundi_parse_ies(), dundi_send(), enc_ie_facility(), energy_(), eval_exten_read(), expand_gosub_args(), expr2_token_subst(), ext_cmp_exten_strlen(), fax_generator_generate(), fbuf_append(), fetch_response_reader(), ffmpeg_decode(), flip_buf_bits(), frame_set_var(), fsk_serial(), func_read_header(), g722_decode(), g722_encode(), PathSegment::get_child(), get_content_line(), get_name_from_resource(), get_sdp(), get_sdp_iterate(), gsm_write(), gsmtolin_framein(), h261_encap(), h263_encap(), h263_read(), h263_write(), h263p_encap(), h264_read(), h264_write(), handle_cli_devstate_change(), handle_cli_mobile_search(), handle_cli_moh_unregister_class(), handle_cli_presencestate_change(), handle_commandmatchesarray(), handle_incoming(), handle_keypad_button_message(), handle_output(), handle_response(), handle_show_sysinfo(), handle_soft_key_event_message(), Model::has_properties(), Model::has_subtypes(), header_identify_match_check(), help1(), hepv3_create_capture_info(), hpInput(), hpOutput(), http_request_headers_get(), httpd_process_request(), iax_parse_ies(), iax_str2flags(), inner_product_single(), interpolate_product_single(), ip_identify_apply(), ivfilt_(), jb_debug_output(), json_utf8_check_full(), listener(), lpc10_decode(), lpc10tolin_framein(), lpfilt_(), lws2sws(), make_ari_stubs::main(), main(), refcounter::main(), spandspflow2pcap::main(), manager_login(), memcpy_decrypt(), memcpy_encrypt(), message_template_parse_emailbody(), method_match(), mgcp_postrequest(), mgcp_ss(), mgcpsock_read(), milliwatt_generate(), misdn_jb_empty(), misdn_jb_fill(), misdn_lib_tx2misdn_frm(), misdn_read(), misdn_tx_jitter(), monmp3thread(), mpeg4_encap(), my_dahdi_write(), newpvt(), PathSegment::num_children(), openssl_error_string(), parse_bookmark(), parse_ie(), refcounter::parse_line(), get_documentation::parse_manager_event_instance(), pbx_substitute_variables_helper_full(), phone_write_buf(), pjsip_acf_channel_read(), playtones_generator(), plc_fillin(), plc_rx(), pp_each_extension_helper(), presence_write(), reflocks::process_file(), refstats::process_file(), process_sdp(), read_credentials(), receive_message(), refer_blind_callback(), remove_header(), res_sdp_srtp_get_attr(), reschedule_precache(), resource_name_baselen(), rtp_instance_parse_extmap_extensions(), run_agi(), save_history(), scan_thread(), schedule_delivery(), sco_accept(), send_string(), set(), set_bridge_peer_vars_multiparty(), shared_write(), sip_addheader(), sip_route_process_header(), sip_show_channel(), sip_show_history(), sip_tcptls_write(), sms_messagetx(), socket_process_meta(), start_automixmonitor(), start_automonitor(), StateConstructW(), StateSearchW(), static_callback(), strnncpy(), syntFilter(), tdd_feed(), term_filter_escapes(), threadstorage_init(), tonepair_generator(), transfer_exec(), transmit_response_bysession(), try_firmware(), unistim_sp(), unquote(), OrderedDict::update(), uri_parse_and_default(), vm_allocate_dh(), wav_write(), ws_safe_read(), ws_send_msg(), xmldoc_get_syntax_fun(), xmldoc_setpostbr(), xmpp_client_authenticate_sasl(), xmpp_client_receive(), xmpp_client_send_raw_message(), and xmpp_io_recv().
1349 length = strlen(data);
1351 snprintf(
buf, buflen,
"%d", length);
static int replace |
( |
struct ast_channel * |
chan, |
|
|
const char * |
cmd, |
|
|
char * |
data, |
|
|
struct ast_str ** |
buf, |
|
|
ssize_t |
len |
|
) |
| |
|
static |
Definition at line 790 of file func_strings.c.
References args, ast_alloca, AST_APP_ARG, ast_debug, AST_DECLARE_APP_ARGS, ast_free, ast_get_encoded_char(), ast_get_encoded_str(), ast_log, AST_STANDARD_APP_ARGS, ast_str_buffer(), ast_str_create, ast_str_set(), ast_str_strlen(), ast_str_substitute_variables(), ast_strlen_zero, LOG_ERROR, RAII_VAR, and str.
Referenced by FaxPcap::add(), app_get_replace_channel_app(), app_set_replace_channel_app(), app_set_replace_channel_snapshot(), get_replace_channel_snapshot(), ResourceApi::load(), ApiDeclaration::load_file(), manager_dialplan_extension_add(), spandspflow2pcap::n2b(), get_documentation::parse_manager_event_instance(), pj_thread_register_check(), process_text_line(), replace_channel_destroy(), and astconfigparser::try_section().
797 char *strptr, *varsubst;
810 ast_log(
LOG_ERROR,
"Usage: %s(<varname>,<search-chars>[,<replace-char>])\n", cmd);
819 ast_log(
LOG_ERROR,
"The characters to search for and the variable name must not be empty.\n");
824 sprintf(varsubst,
"${%s}",
args.varname);
833 ast_debug(3,
"Characters to find: (%s)\n", find);
834 ast_debug(3,
"Character to replace with: (%s)\n", replace);
839 if (strchr(find, *strptr)) {
841 memmove(strptr, strptr + 1, strlen(strptr + 1) + 1);
char * ast_get_encoded_str(const char *stream, char *result, size_t result_len)
Decode a stream of encoded control or extended ASCII characters.
#define AST_STANDARD_APP_ARGS(args, parse)
Performs the 'standard' argument separation process for an application.
char * ast_str_buffer(const struct ast_str *buf)
Returns the string buffer within the ast_str buf.
void ast_str_substitute_variables(struct ast_str **buf, ssize_t maxlen, struct ast_channel *chan, const char *templ)
#define ast_strlen_zero(foo)
int ast_str_set(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Set a dynamic string using variable arguments.
#define ast_debug(level,...)
Log a DEBUG message.
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
int ast_get_encoded_char(const char *stream, char *result, size_t *consumed)
Decode an encoded control or extended ASCII character.
#define ast_alloca(size)
call __builtin_alloca to ensure we get gcc builtin semantics
The descriptor of a dynamic string XXX storage will be optimized later if needed We use the ts field ...
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
static int replace(struct ast_channel *chan, const char *cmd, char *data, struct ast_str **buf, ssize_t len)
size_t ast_str_strlen(const struct ast_str *buf)
Returns the current length of the string stored within buf.
#define AST_DECLARE_APP_ARGS(name, arglist)
Declare a structure to hold an application's arguments.
#define ast_str_create(init_len)
Create a malloc'ed dynamic length string.
#define AST_APP_ARG(name)
Define an application argument.