diff --git a/libs/iax/src/iax-client.h b/libs/iax/src/iax-client.h index 3057eacaf6..d72df16d2f 100644 --- a/libs/iax/src/iax-client.h +++ b/libs/iax/src/iax-client.h @@ -161,14 +161,14 @@ extern int iax_send_url(struct iax_session *session, char *url, int link); extern int iax_send_text(struct iax_session *session, char *text); extern int iax_send_ping(struct iax_session *session); extern int iax_load_complete(struct iax_session *session); -extern int iax_reject(struct iax_session *session, char *reason); +extern int iax_reject(struct iax_session *session, const char *reason); int iax_reject_registration(struct iax_session *session, char *reason); int iax_ack_registration(struct iax_session *session); int iax_auth_registration(struct iax_session *session); extern int iax_busy(struct iax_session *session); extern int iax_congestion(struct iax_session *session); extern int iax_hangup(struct iax_session *session, char *byemsg); -extern int iax_call(struct iax_session *session, char *cidnum, char *cidname, char *ich, char *lang, int wait, int format, int capability); +extern int iax_call(struct iax_session *session, const char *cidnum, const char *cidname, char *ich, char *lang, int wait, int format, int capability); extern int iax_accept(struct iax_session *session, int format); extern int iax_answer(struct iax_session *session); extern int iax_sendurl(struct iax_session *session, char *url); diff --git a/libs/iax/src/iax.c b/libs/iax/src/iax.c index c60aa2bad8..984f3e8f9c 100644 --- a/libs/iax/src/iax.c +++ b/libs/iax/src/iax.c @@ -1691,7 +1691,7 @@ int iax_auth_registration(struct iax_session *session) return send_command_final(session, AST_FRAME_IAX, IAX_COMMAND_REGAUTH, 0, NULL, 0, -1); } -int iax_reject(struct iax_session *session, char *reason) +int iax_reject(struct iax_session *session, const char *reason) { struct iax_ie_data ied; memset(&ied, 0, sizeof(ied)); @@ -1986,7 +1986,7 @@ void iax_set_samplerate(struct iax_session *session, unsigned short samplemask) } -int iax_call(struct iax_session *session, char *cidnum, char *cidname, char *ich, char *lang, int wait, int formats, int capabilities) +int iax_call(struct iax_session *session, const char *cidnum, const char *cidname, char *ich, char *lang, int wait, int formats, int capabilities) { char tmp[256]=""; char *part1, *part2; diff --git a/libs/iax/src/iax2-parser.c b/libs/iax/src/iax2-parser.c index ab50abae0c..67beefbae8 100644 --- a/libs/iax/src/iax2-parser.c +++ b/libs/iax/src/iax2-parser.c @@ -432,7 +432,7 @@ snprintf(tmp, (int)sizeof(tmp), dump_ies(fh->iedata, datalen); } -int iax_ie_append_raw(struct iax_ie_data *ied, unsigned char ie, void *data, int datalen) +int iax_ie_append_raw(struct iax_ie_data *ied, unsigned char ie, const void *data, int datalen) { char tmp[256]; if (datalen > ((int)sizeof(ied->buf) - ied->pos)) { @@ -466,7 +466,7 @@ int iax_ie_append_short(struct iax_ie_data *ied, unsigned char ie, unsigned shor return iax_ie_append_raw(ied, ie, &newval, (int)sizeof(newval)); } -int iax_ie_append_str(struct iax_ie_data *ied, unsigned char ie, unsigned char *str) +int iax_ie_append_str(struct iax_ie_data *ied, unsigned char ie, const unsigned char *str) { return iax_ie_append_raw(ied, ie, str, (int)strlen((char *) str)); } diff --git a/libs/iax/src/iax2-parser.h b/libs/iax/src/iax2-parser.h index 2384d2de3c..25b863de00 100644 --- a/libs/iax/src/iax2-parser.h +++ b/libs/iax/src/iax2-parser.h @@ -127,11 +127,11 @@ extern void iax_showframe(struct iax_frame *f, struct ast_iax2_full_hdr *fhi, in extern const char *iax_ie2str(int ie); -extern int iax_ie_append_raw(struct iax_ie_data *ied, unsigned char ie, void *data, int datalen); +extern int iax_ie_append_raw(struct iax_ie_data *ied, unsigned char ie, const void *data, int datalen); extern int iax_ie_append_addr(struct iax_ie_data *ied, unsigned char ie, struct sockaddr_in *sin); extern int iax_ie_append_int(struct iax_ie_data *ied, unsigned char ie, unsigned int value); extern int iax_ie_append_short(struct iax_ie_data *ied, unsigned char ie, unsigned short value); -extern int iax_ie_append_str(struct iax_ie_data *ied, unsigned char ie, unsigned char *str); +extern int iax_ie_append_str(struct iax_ie_data *ied, unsigned char ie, const unsigned char *str); extern int iax_ie_append_byte(struct iax_ie_data *ied, unsigned char ie, unsigned char dat); extern int iax_ie_append(struct iax_ie_data *ied, unsigned char ie); extern int iax_parse_ies(struct iax_ies *ies, unsigned char *data, int datalen); diff --git a/libs/libdingaling/src/libdingaling.c b/libs/libdingaling/src/libdingaling.c index d14d93fc44..e937bc8ff9 100644 --- a/libs/libdingaling/src/libdingaling.c +++ b/libs/libdingaling/src/libdingaling.c @@ -257,7 +257,7 @@ char *ldl_session_get_value(ldl_session_t *session, char *key) return apr_hash_get(session->variables, key, APR_HASH_KEY_STRING); } -void ldl_session_set_value(ldl_session_t *session, char *key, char *val) +void ldl_session_set_value(ldl_session_t *session, const char *key, const char *val) { apr_hash_set(session->variables, apr_pstrdup(session->pool, key), APR_HASH_KEY_STRING, apr_pstrdup(session->pool, val)); } @@ -1789,18 +1789,19 @@ void ldl_handle_send_vcard(ldl_handle_t *handle, char *from, char *to, char *id, } -void ldl_handle_send_msg(ldl_handle_t *handle, char *from, char *to, char *subject, char *body) +void ldl_handle_send_msg(ldl_handle_t *handle, char *from, char *to, const char *subject, const char *body) { iks *msg; char *t, *e; char *bdup = NULL; int on = 0; int len = 0; + char *my_body = strdup(body); assert(handle != NULL); assert(body != NULL); - if (strchr(body, '<')) { - len = (int) strlen(body); + if (strchr(my_body, '<')) { + len = (int) strlen(my_body); if (!(bdup = malloc(len))) { return; } @@ -1808,7 +1809,7 @@ void ldl_handle_send_msg(ldl_handle_t *handle, char *from, char *to, char *subje memset(bdup, 0, len); e = bdup; - for(t = body; *t; t++) { + for(t = my_body; *t; t++) { if (*t == '<') { on = 1; } else if (*t == '>') { @@ -1820,10 +1821,10 @@ void ldl_handle_send_msg(ldl_handle_t *handle, char *from, char *to, char *subje *e++ = *t; } } - body = bdup; + my_body = bdup; } - msg = iks_make_msg(IKS_TYPE_NONE, to, body); + msg = iks_make_msg(IKS_TYPE_NONE, to, my_body); iks_insert_attrib(msg, "type", "chat"); if (!from) { @@ -1840,6 +1841,8 @@ void ldl_handle_send_msg(ldl_handle_t *handle, char *from, char *to, char *subje free(bdup); } + free(my_body); + apr_queue_push(handle->queue, msg); msg = NULL; diff --git a/libs/libdingaling/src/libdingaling.h b/libs/libdingaling/src/libdingaling.h index cf513cac1e..cdbd7ac2d8 100644 --- a/libs/libdingaling/src/libdingaling.h +++ b/libs/libdingaling/src/libdingaling.h @@ -309,7 +309,7 @@ char *ldl_session_get_value(ldl_session_t *session, char *key); \param key the key to set \param val the value of the key */ -void ldl_session_set_value(ldl_session_t *session, char *key, char *val); +void ldl_session_set_value(ldl_session_t *session, const char *key, const char *val); /*! \brief Create a Jingle Session @@ -473,7 +473,7 @@ void ldl_handle_send_vcard(ldl_handle_t *handle, char *from, char *to, char *id, \param subject optional subject \param body body of the message */ -void ldl_handle_send_msg(ldl_handle_t *handle, char *from, char *to, char *subject, char *body); +void ldl_handle_send_msg(ldl_handle_t *handle, char *from, char *to, const char *subject, const char *body); /*! \brief Offer candidates to a potential session diff --git a/libs/libteletone/src/libteletone_generate.c b/libs/libteletone/src/libteletone_generate.c index bb904b2d68..b578c45d38 100644 --- a/libs/libteletone/src/libteletone_generate.c +++ b/libs/libteletone/src/libteletone_generate.c @@ -314,7 +314,7 @@ static char *my_strdup (const char *s) return (char *) memcpy (new, s, len); } -int teletone_run(teletone_generation_session_t *ts, char *cmd) +int teletone_run(teletone_generation_session_t *ts, const char *cmd) { char *data = NULL, *cur = NULL, *end = NULL; int var = 0, LOOPING = 0; diff --git a/libs/libteletone/src/libteletone_generate.h b/libs/libteletone/src/libteletone_generate.h index 8e9cf4abbd..fc56405a13 100644 --- a/libs/libteletone/src/libteletone_generate.h +++ b/libs/libteletone/src/libteletone_generate.h @@ -276,7 +276,7 @@ int teletone_mux_tones(teletone_generation_session_t *ts, teletone_tone_map_t *m \param cmd the script to execute \return 0 */ -int teletone_run(teletone_generation_session_t *ts, char *cmd); +int teletone_run(teletone_generation_session_t *ts, const char *cmd); #ifdef __cplusplus } diff --git a/src/include/switch_caller.h b/src/include/switch_caller.h index 70e175d2c8..37498c7e6c 100644 --- a/src/include/switch_caller.h +++ b/src/include/switch_caller.h @@ -60,25 +60,25 @@ SWITCH_BEGIN_EXTERN_C */ struct switch_caller_profile { /*! The Call's User Name */ - char *username; + const char *username; /*! The name of the dialplan */ - char *dialplan; + const char *dialplan; /*! Caller ID Name */ - char *caller_id_name; + const char *caller_id_name; /*! Caller ID Number */ - char *caller_id_number; + const char *caller_id_number; uint8_t caller_ton; uint8_t caller_numplan; /*! Caller Network Address (when applicable) */ - char *network_addr; + const char *network_addr; /*! ANI (when applicable) */ - char *ani; + const char *ani; uint8_t ani_ton; uint8_t ani_numplan; /*! ANI II (when applicable) */ - char *aniii; + const char *aniii; /*! RDNIS */ - char *rdnis; + const char *rdnis; uint8_t rdnis_ton; uint8_t rdnis_numplan; /*! Destination Number */ @@ -86,13 +86,13 @@ SWITCH_BEGIN_EXTERN_C uint8_t destination_number_ton; uint8_t destination_number_numplan; /*! channel type */ - char *source; + const char *source; /*! channel name */ char *chan_name; /*! unique id */ char *uuid; /*! context */ - char *context; + const char *context; /*! flags */ switch_caller_profile_flag_t flags; struct switch_caller_profile *originator_caller_profile; @@ -156,7 +156,7 @@ SWITCH_DECLARE(void) switch_caller_extension_add_application(switch_core_session \param name the name \note this function is meant for situations where the name paramater is the contents of the variable */ -SWITCH_DECLARE(char *) switch_caller_get_field_by_name(switch_caller_profile_t *caller_profile, const char *name); +SWITCH_DECLARE(const char *) switch_caller_get_field_by_name(switch_caller_profile_t *caller_profile, const char *name); /*! \brief Create a new caller profile object diff --git a/src/include/switch_channel.h b/src/include/switch_channel.h index f9e0e23d60..1846d81901 100644 --- a/src/include/switch_channel.h +++ b/src/include/switch_channel.h @@ -209,7 +209,7 @@ SWITCH_DECLARE(switch_status_t) switch_channel_set_variable(switch_channel_t *ch \param varname the name of the variable \return the value of the requested variable */ -SWITCH_DECLARE(char *) switch_channel_get_variable(switch_channel_t *channel, const char *varname); +SWITCH_DECLARE(const char *) switch_channel_get_variable(switch_channel_t *channel, const char *varname); /*! * Start iterating over the entries in the channel variable list. diff --git a/src/include/switch_core.h b/src/include/switch_core.h index 47a4210d28..93bac7cdef 100644 --- a/src/include/switch_core.h +++ b/src/include/switch_core.h @@ -69,7 +69,7 @@ struct switch_core_session_message { /*! optional numeric arg */ int numeric_arg; /*! optional string arg */ - char *string_arg; + const char *string_arg; /*! optional string arg */ switch_size_t string_arg_size; /*! optional arbitrary pointer arg */ @@ -607,7 +607,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_event_send(char *uuid_str, s SWITCH_DECLARE(switch_app_log_t *) switch_core_session_get_app_log(switch_core_session_t *session); SWITCH_DECLARE(switch_status_t) switch_core_session_exec(switch_core_session_t *session, - const switch_application_interface_t *application_interface, char *arg); + const switch_application_interface_t *application_interface, const char *arg); SWITCH_DECLARE(switch_status_t) switch_core_session_execute_exten(switch_core_session_t *session, char *exten, char *dialplan, char *context); /*! @@ -918,7 +918,7 @@ SWITCH_DECLARE(void) switch_hash_this(switch_hash_index_t *hi, const void **key, \param pool the memory pool to use for allocation \return */ -SWITCH_DECLARE(switch_status_t) switch_core_timer_init(switch_timer_t *timer, char *timer_name, int interval, int samples, switch_memory_pool_t *pool); +SWITCH_DECLARE(switch_status_t) switch_core_timer_init(switch_timer_t *timer, const char *timer_name, int interval, int samples, switch_memory_pool_t *pool); /*! \brief Wait for one cycle on an existing timer @@ -1105,7 +1105,7 @@ SWITCH_DECLARE(void) switch_core_db_test_reactive(switch_core_db_t *db, char *te \note the loadable module used is chosen based on the file extension */ SWITCH_DECLARE(switch_status_t) switch_core_file_open(switch_file_handle_t *fh, - char *file_path, uint8_t channels, uint32_t rate, unsigned int flags, switch_memory_pool_t *pool); + const char *file_path, uint8_t channels, uint32_t rate, unsigned int flags, switch_memory_pool_t *pool); /*! \brief Read media from a file handle \param fh the file handle to read from (must be initilized by you memset all 0 for read, fill in channels and rate for write) @@ -1176,8 +1176,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_file_close(switch_file_handle_t *fh) \return SWITCH_STATUS_SUCCESS if the handle is opened */ SWITCH_DECLARE(switch_status_t) switch_core_speech_open(switch_speech_handle_t *sh, - char *module_name, - char *voice_name, + const char *module_name, + const char *voice_name, unsigned int rate, unsigned int interval, switch_speech_flag_t *flags, switch_memory_pool_t *pool); @@ -1202,7 +1202,7 @@ SWITCH_DECLARE(void) switch_core_speech_flush_tts(switch_speech_handle_t *sh); \param param the parameter \param val the value */ -SWITCH_DECLARE(void) switch_core_speech_text_param_tts(switch_speech_handle_t *sh, char *param, char *val); +SWITCH_DECLARE(void) switch_core_speech_text_param_tts(switch_speech_handle_t *sh, char *param, const char *val); /*! \brief Set a numeric parameter on a TTS handle diff --git a/src/include/switch_cpp.h b/src/include/switch_cpp.h index c720617ded..bdf2a35cef 100644 --- a/src/include/switch_cpp.h +++ b/src/include/switch_cpp.h @@ -121,7 +121,7 @@ class CoreSession { int preAnswer(); virtual void hangup(char *cause); void setVariable(char *var, char *val); - char *getVariable(char *var); + const char *getVariable(char *var); /** \brief Record to a file diff --git a/src/include/switch_ivr.h b/src/include/switch_ivr.h index 22613ba13e..54188285e1 100644 --- a/src/include/switch_ivr.h +++ b/src/include/switch_ivr.h @@ -203,7 +203,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech_unload_grammar(switch_c SWITCH_DECLARE(switch_status_t) switch_ivr_record_session(switch_core_session_t *session, char *file, uint32_t limit, switch_file_handle_t *fh); SWITCH_DECLARE(switch_status_t) switch_ivr_displace_session(switch_core_session_t *session, char *file, uint32_t limit, const char *flags); -SWITCH_DECLARE(switch_status_t) switch_ivr_stop_displace_session(switch_core_session_t *session, char *file); +SWITCH_DECLARE(switch_status_t) switch_ivr_stop_displace_session(switch_core_session_t *session, const char *file); /*! \brief Stop Recording a session @@ -211,7 +211,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_stop_displace_session(switch_core_ses \param file the path to the file \return SWITCH_STATUS_SUCCESS if all is well */ -SWITCH_DECLARE(switch_status_t) switch_ivr_stop_record_session(switch_core_session_t *session, char *file); +SWITCH_DECLARE(switch_status_t) switch_ivr_stop_record_session(switch_core_session_t *session, const char *file); /*! \brief Start looking for DTMF inband @@ -282,7 +282,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_tone_detect_session(switch_core_sessi \param args arguements to pass for callbacks etc \return SWITCH_STATUS_SUCCESS if all is well */ -SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *session, switch_file_handle_t *fh, char *file, switch_input_args_t *args); +SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *session, switch_file_handle_t *fh, const char *file, switch_input_args_t *args); SWITCH_DECLARE(switch_status_t) switch_ivr_gentones(switch_core_session_t *session, char *script, int32_t loops, switch_input_args_t *args); @@ -339,7 +339,7 @@ SWITCH_DECLARE(void) switch_ivr_clear_speech_cache(switch_core_session_t *sessio \return SWITCH_STATUS_SUCCESS if all is well */ SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text(switch_core_session_t *session, - char *tts_name, char *voice_name, char *text, switch_input_args_t *args); + const char *tts_name, const char *voice_name, char *text, switch_input_args_t *args); /*! \brief Make an outgoing call @@ -358,10 +358,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text(switch_core_session_t *ses SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *session, switch_core_session_t **bleg, switch_call_cause_t *cause, - char *bridgeto, + const char *bridgeto, uint32_t timelimit_sec, const switch_state_handler_table_t *table, - char *cid_name_override, char *cid_num_override, switch_caller_profile_t *caller_profile_override); + const char *cid_name_override, const char *cid_num_override, switch_caller_profile_t *caller_profile_override); /*! \brief Bridge Audio from one session to another @@ -392,7 +392,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_signal_bridge(switch_core_session_t * \param dialplan the new dialplan (OPTIONAL, may be NULL) \param context the new context (OPTIONAL, may be NULL) */ -SWITCH_DECLARE(switch_status_t) switch_ivr_session_transfer(switch_core_session_t *session, char *extension, char *dialplan, char *context); +SWITCH_DECLARE(switch_status_t) switch_ivr_session_transfer(switch_core_session_t *session, const char *extension, char *dialplan, char *context); /*! \brief Transfer an existing session to another location in the future @@ -403,7 +403,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_session_transfer(switch_core_session_ \param context the new context (OPTIONAL, may be NULL) \return the id of the task */ -SWITCH_DECLARE(uint32_t) switch_ivr_schedule_transfer(time_t runtime, char *uuid, char *extension, char *dialplan, char *context); +SWITCH_DECLARE(uint32_t) switch_ivr_schedule_transfer(time_t runtime, const char *uuid, char *extension, char *dialplan, char *context); /*! @@ -414,7 +414,7 @@ SWITCH_DECLARE(uint32_t) switch_ivr_schedule_transfer(time_t runtime, char *uuid \param bleg hangup up the B-Leg if possible \return the id of the task */ -SWITCH_DECLARE(uint32_t) switch_ivr_schedule_hangup(time_t runtime, char *uuid, switch_call_cause_t cause, switch_bool_t bleg); +SWITCH_DECLARE(uint32_t) switch_ivr_schedule_hangup(time_t runtime, const char *uuid, switch_call_cause_t cause, switch_bool_t bleg); /*! \brief Bridge two existing sessions @@ -422,7 +422,7 @@ SWITCH_DECLARE(uint32_t) switch_ivr_schedule_hangup(time_t runtime, char *uuid, \param originatee_uuid the uuid of the originator \return SWITCH_STATUS_SUCCESS if all is well */ -SWITCH_DECLARE(switch_status_t) switch_ivr_uuid_bridge(char *originator_uuid, char *originatee_uuid); +SWITCH_DECLARE(switch_status_t) switch_ivr_uuid_bridge(const char *originator_uuid, const char *originatee_uuid); /*! \brief Signal a session to request direct media access to it's remote end @@ -430,7 +430,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_uuid_bridge(char *originator_uuid, ch \param flags flags to influence behaviour (SMF_REBRIDGE to rebridge the call in media mode) \return SWITCH_STATUS_SUCCESS if all is well */ -SWITCH_DECLARE(switch_status_t) switch_ivr_media(char *uuid, switch_media_flag_t flags); +SWITCH_DECLARE(switch_status_t) switch_ivr_media(const char *uuid, switch_media_flag_t flags); /*! \brief Signal a session to request indirect media allowing it to exchange media directly with another device @@ -438,21 +438,21 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_media(char *uuid, switch_media_flag_t \param flags flags to influence behaviour (SMF_REBRIDGE to rebridge the call in no_media mode) \return SWITCH_STATUS_SUCCESS if all is well */ -SWITCH_DECLARE(switch_status_t) switch_ivr_nomedia(char *uuid, switch_media_flag_t flags); +SWITCH_DECLARE(switch_status_t) switch_ivr_nomedia(const char *uuid, switch_media_flag_t flags); /*! \brief Signal the session with a protocol specific hold message. \param uuid the uuid of the session to hold \return SWITCH_STATUS_SUCCESS if all is well */ -SWITCH_DECLARE(switch_status_t) switch_ivr_hold_uuid(char *uuid); +SWITCH_DECLARE(switch_status_t) switch_ivr_hold_uuid(const char *uuid); /*! \brief Signal the session with a protocol specific unhold message. \param uuid the uuid of the session to hold \return SWITCH_STATUS_SUCCESS if all is well */ -SWITCH_DECLARE(switch_status_t) switch_ivr_unhold_uuid(char *uuid); +SWITCH_DECLARE(switch_status_t) switch_ivr_unhold_uuid(const char *uuid); /*! \brief Signal the session with a protocol specific hold message. @@ -485,7 +485,7 @@ SWITCH_DECLARE(uint32_t) switch_ivr_schedule_broadcast(time_t runtime, char *uui \param flags flags to send to the request (SMF_ECHO_BRIDGED to send the broadcast to both sides of the call) \return SWITCH_STATUS_SUCCESS if all is well */ -SWITCH_DECLARE(switch_status_t) switch_ivr_broadcast(char *uuid, char *path, switch_media_flag_t flags); +SWITCH_DECLARE(switch_status_t) switch_ivr_broadcast(const char *uuid, const char *path, switch_media_flag_t flags); /*! \brief Transfer variables from one session to another @@ -712,7 +712,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_stack_xml_add_custom(switch_ivr_ */ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_stack_xml_init(switch_ivr_menu_xml_ctx_t ** xml_menu_ctx, switch_memory_pool_t *pool); -SWITCH_DECLARE(switch_status_t) switch_ivr_phrase_macro(switch_core_session_t *session, char *macro_name, char *data, char *lang, +SWITCH_DECLARE(switch_status_t) switch_ivr_phrase_macro(switch_core_session_t *session, const char *macro_name, const char *data, const char *lang, switch_input_args_t *args); SWITCH_DECLARE(void) switch_ivr_delay_echo(switch_core_session_t *session, uint32_t delay_ms); /** @} */ diff --git a/src/include/switch_module_interfaces.h b/src/include/switch_module_interfaces.h index a4c1fbf696..a6be73c393 100644 --- a/src/include/switch_module_interfaces.h +++ b/src/include/switch_module_interfaces.h @@ -231,7 +231,7 @@ struct switch_file_interface { /*! the name of the interface */ const char *interface_name; /*! function to open the file */ - switch_status_t (*file_open) (switch_file_handle_t *, char *file_path); + switch_status_t (*file_open) (switch_file_handle_t *, const char *file_path); /*! function to close the file */ switch_status_t (*file_close) (switch_file_handle_t *); /*! function to read from the file */ @@ -340,7 +340,7 @@ struct switch_speech_interface { /*! the name of the interface */ const char *interface_name; /*! function to open the speech interface */ - switch_status_t (*speech_open) (switch_speech_handle_t *sh, char *voice_name, int rate, switch_speech_flag_t *flags); + switch_status_t (*speech_open) (switch_speech_handle_t *sh, const char *voice_name, int rate, switch_speech_flag_t *flags); /*! function to close the speech interface */ switch_status_t (*speech_close) (switch_speech_handle_t *, switch_speech_flag_t *flags); /*! function to feed audio to the ASR */ @@ -348,7 +348,7 @@ struct switch_speech_interface { /*! function to read audio from the TTS */ switch_status_t (*speech_read_tts) (switch_speech_handle_t *sh, void *data, switch_size_t *datalen, uint32_t * rate, switch_speech_flag_t *flags); void (*speech_flush_tts) (switch_speech_handle_t *sh); - void (*speech_text_param_tts) (switch_speech_handle_t *sh, char *param, char *val); + void (*speech_text_param_tts) (switch_speech_handle_t *sh, char *param, const char *val); void (*speech_numeric_param_tts) (switch_speech_handle_t *sh, char *param, int val); void (*speech_float_param_tts) (switch_speech_handle_t *sh, char *param, double val); diff --git a/src/include/switch_types.h b/src/include/switch_types.h index 768c438e03..93840c666c 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -1070,8 +1070,8 @@ typedef struct switch_core_port_allocator switch_core_port_allocator_t; typedef struct switch_media_bug switch_media_bug_t; typedef switch_bool_t (*switch_media_bug_callback_t) (switch_media_bug_t *, void *, switch_abc_type_t); -typedef void (*switch_application_function_t) (switch_core_session_t *, char *); -#define SWITCH_STANDARD_APP(name) static void name (switch_core_session_t *session, char *data) +typedef void (*switch_application_function_t) (switch_core_session_t *, const char *); +#define SWITCH_STANDARD_APP(name) static void name (switch_core_session_t *session, const char *data) typedef void (*switch_event_callback_t) (switch_event_t *); typedef switch_caller_extension_t *(*switch_dialplan_hunt_function_t) (switch_core_session_t *, void *, switch_caller_profile_t *); diff --git a/src/include/switch_utils.h b/src/include/switch_utils.h index d7015fef30..e1e4201435 100644 --- a/src/include/switch_utils.h +++ b/src/include/switch_utils.h @@ -328,7 +328,7 @@ SWITCH_DECLARE(char *) switch_string_replace(const char *string, const char *sea SWITCH_DECLARE(switch_status_t) switch_string_match(const char *string, size_t string_len, const char *search, size_t search_len); #define SWITCH_READ_ACCEPTABLE(status) (status == SWITCH_STATUS_SUCCESS || status == SWITCH_STATUS_BREAK) -SWITCH_DECLARE(size_t) switch_url_encode(char *url, char *buf, size_t len); +SWITCH_DECLARE(size_t) switch_url_encode(const char *url, char *buf, size_t len); SWITCH_DECLARE(char *) switch_url_decode(char *s); SWITCH_DECLARE(switch_bool_t) switch_simple_email(char *to, char *from, char *headers, char *body, char *file); diff --git a/src/include/switch_xml.h b/src/include/switch_xml.h index 74d0523b59..842006cb42 100644 --- a/src/include/switch_xml.h +++ b/src/include/switch_xml.h @@ -318,13 +318,13 @@ SWITCH_DECLARE(switch_status_t) switch_xml_locate(const char *section, const char *key_name, const char *key_value, switch_xml_t * root, switch_xml_t * node, const char *params); -SWITCH_DECLARE(switch_status_t) switch_xml_locate_domain(char *domain_name, char *params, switch_xml_t *root, switch_xml_t *domain); -SWITCH_DECLARE(switch_status_t) switch_xml_locate_user(char *user_name, char *domain_name, - char *ip, +SWITCH_DECLARE(switch_status_t) switch_xml_locate_domain(const char *domain_name, char *params, switch_xml_t *root, switch_xml_t *domain); +SWITCH_DECLARE(switch_status_t) switch_xml_locate_user(const char *user_name, const char *domain_name, + const char *ip, switch_xml_t *root, switch_xml_t *domain, switch_xml_t *user, - char *xtra_params); + const char *xtra_params); ///\brief open a config in the core registry ///\param file_path the name of the config section e.g. modules.conf diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c index dfe27b9a4a..1df0efbd50 100644 --- a/src/mod/applications/mod_commands/mod_commands.c +++ b/src/mod/applications/mod_commands/mod_commands.c @@ -286,7 +286,7 @@ SWITCH_STANDARD_API(transfer_function) switch_channel_t *channel = switch_core_session_get_channel(tsession); arg++; if (!strcasecmp(arg, "bleg")) { - char *uuid = switch_channel_get_variable(channel, SWITCH_BRIDGE_VARIABLE); + const char *uuid = switch_channel_get_variable(channel, SWITCH_BRIDGE_VARIABLE); if (uuid && (other_session = switch_core_session_locate(uuid))) { switch_core_session_t *tmp = tsession; tsession = other_session; @@ -294,7 +294,7 @@ SWITCH_STANDARD_API(transfer_function) switch_core_session_rwunlock(tmp); } } else if (!strcasecmp(arg, "both")) { - char *uuid = switch_channel_get_variable(channel, SWITCH_BRIDGE_VARIABLE); + const char *uuid = switch_channel_get_variable(channel, SWITCH_BRIDGE_VARIABLE); switch_core_session_t *other_session; if (uuid && (other_session = switch_core_session_locate(uuid))) { switch_ivr_session_transfer(other_session, dest, dp, context); diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index 5dfa511a78..b7120515ef 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -312,7 +312,7 @@ static switch_status_t conference_outcall(conference_obj_t * conference, char *bridgeto, uint32_t timeout, char *flags, char *cid_name, char *cid_num, switch_call_cause_t *cause); static switch_status_t conference_outcall_bg(conference_obj_t * conference, char *conference_name, - switch_core_session_t *session, char *bridgeto, uint32_t timeout, char *flags, char *cid_name, char *cid_num); + switch_core_session_t *session, char *bridgeto, uint32_t timeout, const char *flags, const char *cid_name, const char *cid_num); SWITCH_STANDARD_APP(conference_function); static void launch_conference_thread(conference_obj_t * conference); static void *SWITCH_THREAD_FUNC conference_loop_input(switch_thread_t * thread, void *obj); @@ -1531,11 +1531,11 @@ static void conference_loop_output(conference_member_t * member) if ((call_list = switch_channel_get_private(channel, "_conference_autocall_list_"))) { - char *cid_name = switch_channel_get_variable(channel, "conference_auto_outcall_caller_id_name"); - char *cid_num = switch_channel_get_variable(channel, "conference_auto_outcall_caller_id_number"); - char *toval = switch_channel_get_variable(channel, "conference_auto_outcall_timeout"); - char *flags = switch_channel_get_variable(channel, "conference_auto_outcall_flags"); - char *ann = switch_channel_get_variable(channel, "conference_auto_outcall_announce"); + const char *cid_name = switch_channel_get_variable(channel, "conference_auto_outcall_caller_id_name"); + const char *cid_num = switch_channel_get_variable(channel, "conference_auto_outcall_caller_id_number"); + const char *toval = switch_channel_get_variable(channel, "conference_auto_outcall_timeout"); + const char *flags = switch_channel_get_variable(channel, "conference_auto_outcall_flags"); + const char *ann = switch_channel_get_variable(channel, "conference_auto_outcall_announce"); int to = 60; if (ann) { @@ -3730,7 +3730,7 @@ static void *SWITCH_THREAD_FUNC conference_outcall_run(switch_thread_t * thread, static switch_status_t conference_outcall_bg(conference_obj_t * conference, char *conference_name, - switch_core_session_t *session, char *bridgeto, uint32_t timeout, char *flags, char *cid_name, char *cid_num) + switch_core_session_t *session, char *bridgeto, uint32_t timeout, const char *flags, const char *cid_name, const char *cid_num) { struct bg_call *call = NULL; diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index 1a73d697b7..bd6e5ca3ba 100644 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -259,7 +259,7 @@ SWITCH_STANDARD_APP(phrase_function) assert(channel != NULL); if ((mydata = switch_core_session_strdup(session, data))) { - char *lang; + const char *lang; char *macro = mydata; char *mdata = NULL; @@ -445,7 +445,8 @@ SWITCH_STANDARD_APP(set_profile_var_function) SWITCH_STANDARD_APP(export_function) { switch_channel_t *channel; - char *exports, *new_exports = NULL, *new_exports_d = NULL, *var, *val = NULL, *var_name = NULL; + const char *exports; + char *new_exports = NULL, *new_exports_d = NULL, *var, *val = NULL, *var_name = NULL; int local = 1; channel = switch_core_session_get_channel(session); @@ -923,9 +924,9 @@ static switch_status_t on_dtmf(switch_core_session_t *session, void *input, swit case SWITCH_INPUT_TYPE_DTMF: { char *dtmf = (char *) input; - char *terminators; + const char *terminators; switch_channel_t *channel = switch_core_session_get_channel(session); - char *p; + const char *p; assert(channel); @@ -965,8 +966,8 @@ SWITCH_STANDARD_APP(speak_function) char buf[10]; char *argv[4] = { 0 }; int argc; - char *engine = NULL; - char *voice = NULL; + const char *engine = NULL; + const char *voice = NULL; char *text = NULL; char *mydata = NULL; switch_codec_t *codec; @@ -1211,7 +1212,7 @@ SWITCH_STANDARD_APP(audio_bridge_function) switch_channel_t *caller_channel; switch_core_session_t *peer_session = NULL; unsigned int timelimit = 60; - char *var, *continue_on_fail = NULL; + const char *var, *continue_on_fail = NULL; uint8_t no_media_bridge = 0; switch_call_cause_t cause = SWITCH_CAUSE_NORMAL_CLEARING; diff --git a/src/mod/applications/mod_fifo/mod_fifo.c b/src/mod/applications/mod_fifo/mod_fifo.c index e3334e588e..114ea30203 100644 --- a/src/mod/applications/mod_fifo/mod_fifo.c +++ b/src/mod/applications/mod_fifo/mod_fifo.c @@ -107,8 +107,8 @@ SWITCH_STANDARD_APP(fifo_function) fifo_node_t *node; switch_channel_t *channel; int nowait = 0; - char *moh = NULL; - char *announce = NULL; + const char *moh = NULL; + const char *announce = NULL; switch_event_t *event = NULL; char date[80] = ""; switch_time_exp_t tm; @@ -153,7 +153,7 @@ SWITCH_STANDARD_APP(fifo_function) } if (!strcasecmp(argv[1], "in")) { - char *uuid = strdup(switch_core_session_get_uuid(session)); + const char *uuid = strdup(switch_core_session_get_uuid(session)); switch_channel_answer(channel); @@ -178,7 +178,7 @@ SWITCH_STANDARD_APP(fifo_function) switch_mutex_lock(node->mutex); node->caller_count++; switch_core_hash_insert(node->caller_hash, uuid, session); - switch_queue_push(node->fifo, uuid); + switch_queue_push(node->fifo, (void *)uuid); switch_mutex_unlock(node->mutex); ts = switch_timestamp_now(); @@ -418,8 +418,8 @@ static int xml_hash(switch_xml_t xml, switch_hash_t *hash, char *container, char for (hi = switch_hash_first(NULL, hash); hi; hi = switch_hash_next(hi)) { int c_off = 0, d_off = 0; - char *status; - char *ts; + const char *status; + const char *ts; switch_hash_this(hi, &var, NULL, &val); session = (switch_core_session_t *) val; diff --git a/src/mod/applications/mod_voicemail/mod_voicemail.c b/src/mod/applications/mod_voicemail/mod_voicemail.c index ede0fba58d..b7eb02ea75 100644 --- a/src/mod/applications/mod_voicemail/mod_voicemail.c +++ b/src/mod/applications/mod_voicemail/mod_voicemail.c @@ -872,7 +872,7 @@ static int listen_callback(void *pArg, int argc, char **argv, char **columnNames } -static void message_count(vm_profile_t *profile, char *myid, char *domain_name, char *myfolder, +static void message_count(vm_profile_t *profile, const char *myid, const char *domain_name, char *myfolder, int *total_new_messages, int *total_saved_messages, int *total_new_urgent_messages, int *total_saved_urgent_messages) { char msg_count[80] = ""; @@ -1083,7 +1083,7 @@ static switch_status_t listen_file(switch_core_session_t *session, vm_profile_t return status; } -static void voicemail_check_main(switch_core_session_t *session, char *profile_name, char *domain_name, char *id, int auth) +static void voicemail_check_main(switch_core_session_t *session, const char *profile_name, const char *domain_name, const char *id, int auth) { vm_check_state_t vm_check_state = VM_CHECK_START; switch_channel_t *channel; @@ -1091,8 +1091,8 @@ static void voicemail_check_main(switch_core_session_t *session, char *profile_n vm_profile_t *profile; switch_xml_t x_domain, x_domain_root, x_user, x_params, x_param; switch_status_t status; - char pass_buf[80] = "", *mypass = NULL, id_buf[80] = "", *myid = id, *myfolder = NULL; - const char *thepass = NULL; + char pass_buf[80] = "", *mypass = NULL, id_buf[80] = "", *myfolder = NULL; + const char *thepass = NULL, *myid = id; char term = 0; uint32_t timeout, attempts = 0; int failed = 0; @@ -1522,7 +1522,7 @@ static void voicemail_check_main(switch_core_session_t *session, char *profile_n } -static switch_status_t voicemail_leave_main(switch_core_session_t *session, char *profile_name, char *domain_name, char *id) +static switch_status_t voicemail_leave_main(switch_core_session_t *session, const char *profile_name, const char *domain_name, const char *id) { switch_channel_t *channel; char *myfolder = "inbox"; @@ -1544,7 +1544,8 @@ static switch_status_t voicemail_leave_main(switch_core_session_t *session, char int email_attach = 1; int email_delete = 1; char buf[2]; - char *greet_path = NULL, *voicemail_greeting_number = NULL; + char *greet_path = NULL; + const char *voicemail_greeting_number = NULL; memset(&cbt, 0, sizeof(cbt)); if (!(profile = switch_core_hash_find(globals.profile_hash, profile_name))) { @@ -1833,10 +1834,10 @@ SWITCH_STANDARD_APP(voicemail_function) int argc = 0; char *argv[6] = { 0 }; char *mydata = NULL; - char *profile_name = NULL; - char *domain_name = NULL; - char *id = NULL; - char *auth_var = NULL; + const char *profile_name = NULL; + const char *domain_name = NULL; + const char *id = NULL; + const char *auth_var = NULL; int x = 0, check = 0, auth = 0; switch_channel_t *channel; diff --git a/src/mod/asr_tts/mod_openmrcp/mod_openmrcp.c b/src/mod/asr_tts/mod_openmrcp/mod_openmrcp.c index c2315b59ae..c6cabcf2fa 100644 --- a/src/mod/asr_tts/mod_openmrcp/mod_openmrcp.c +++ b/src/mod/asr_tts/mod_openmrcp/mod_openmrcp.c @@ -603,7 +603,7 @@ static mrcp_status_t synth_stop(mrcp_client_context_t *context, openmrcp_session } -static switch_status_t openmrcp_tts_open(switch_speech_handle_t *sh, char *voice_name, int rate, switch_speech_flag_t *flags) +static switch_status_t openmrcp_tts_open(switch_speech_handle_t *sh, const char *voice_name, int rate, switch_speech_flag_t *flags) { openmrcp_session_t *tts_session; mrcp_client_channel_t *tts_channel; @@ -749,7 +749,7 @@ static void openmrcp_flush_tts(switch_speech_handle_t *sh) synth_stop(context, tts_session); // TODO } -static void openmrcp_text_param_tts(switch_speech_handle_t *sh, char *param, char *val) +static void openmrcp_text_param_tts(switch_speech_handle_t *sh, char *param, const char *val) { } diff --git a/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c b/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c index d64222bdbc..0d848e127c 100644 --- a/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c +++ b/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c @@ -59,7 +59,7 @@ static int parse_exten(switch_core_session_t *session, switch_caller_profile_t * char *field = NULL; char *do_break_a = NULL; char *expression = NULL; - char *field_data = NULL; + const char *field_data = NULL; switch_regex_t *re = NULL; int ovector[30]; break_t do_break_i = BREAK_ON_FALSE; @@ -186,8 +186,8 @@ static switch_status_t dialplan_xml_locate(switch_core_session_t *session, switc switch_stream_handle_t stream = { 0 }; switch_size_t encode_len = 1024, new_len = 0; char *encode_buf = NULL; - char *prof[12] = { 0 }, *prof_names[12] = { - 0}, *e = NULL; + const char *prof[12] = { 0 }, *prof_names[12] = {0}; + char *e = NULL; switch_event_header_t *hi; uint32_t x = 0; diff --git a/src/mod/endpoints/mod_dingaling/mod_dingaling.c b/src/mod/endpoints/mod_dingaling/mod_dingaling.c index e563a8f413..52d558af85 100644 --- a/src/mod/endpoints/mod_dingaling/mod_dingaling.c +++ b/src/mod/endpoints/mod_dingaling/mod_dingaling.c @@ -1614,9 +1614,8 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi char sess_id[11] = ""; char *dnis = NULL; char workspace[1024] = ""; - char *p, *u, ubuf[512] = "", *user = NULL; - char *cid_msg = NULL, *f_cid_msg = NULL; - + char *p, *u, ubuf[512] = "", *user = NULL, *f_cid_msg = NULL; + const char *cid_msg = NULL; switch_copy_string(workspace, outbound_profile->destination_number, sizeof(workspace)); profile_name = workspace; @@ -1649,7 +1648,7 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi user = ldl_handle_get_login(mdl_profile->handle); } else { if (!user) { - char *id_num; + const char *id_num; if (!(id_num = outbound_profile->caller_id_number)) { if (!(id_num = outbound_profile->caller_id_name)) { diff --git a/src/mod/endpoints/mod_portaudio/mod_portaudio.c b/src/mod/endpoints/mod_portaudio/mod_portaudio.c index 80db60d5cb..b3d7faff63 100644 --- a/src/mod/endpoints/mod_portaudio/mod_portaudio.c +++ b/src/mod/endpoints/mod_portaudio/mod_portaudio.c @@ -170,7 +170,7 @@ static switch_status_t channel_on_init(switch_core_session_t *session) switch_time_t last; int waitsec = globals.ring_interval * 1000000; switch_file_handle_t fh = { 0 }; - char *val, *ring_file = NULL, *hold_file = NULL; + const char *val, *ring_file = NULL, *hold_file = NULL; int16_t abuf[2048]; tech_pvt = switch_core_session_get_private(session); @@ -767,7 +767,7 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi if (outbound_profile) { char name[128]; - char *id = !switch_strlen_zero(outbound_profile->caller_id_number) ? outbound_profile->caller_id_number : "na"; + const char *id = !switch_strlen_zero(outbound_profile->caller_id_number) ? outbound_profile->caller_id_number : "na"; snprintf(name, sizeof(name), "PortAudio/%s", id); switch_channel_set_name(channel, name); @@ -1522,8 +1522,8 @@ static switch_status_t list_calls(char **argv, int argc, switch_stream_handle_t { private_t *tp; int x = 0; - char *cid_name = "n/a"; - char *cid_num = "n/a"; + const char *cid_name = "n/a"; + const char *cid_num = "n/a"; switch_mutex_lock(globals.pvt_lock); for (tp = globals.call_list; tp; tp = tp->next) { diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index b8401c2b7f..d6c318a423 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -276,7 +276,7 @@ static switch_status_t sofia_answer_channel(switch_core_session_t *session) switch_channel_t *channel = NULL; switch_status_t status; uint32_t session_timeout = 0; - char *val; + const char *val; assert(session != NULL); @@ -289,13 +289,13 @@ static switch_status_t sofia_answer_channel(switch_core_session_t *session) switch_set_flag_locked(tech_pvt, TFLAG_ANS); if (switch_channel_test_flag(channel, CF_BYPASS_MEDIA)) { - char *sdp = NULL; + const char *sdp = NULL; if ((sdp = switch_channel_get_variable(channel, SWITCH_B_SDP_VARIABLE))) { tech_pvt->local_sdp_str = switch_core_session_strdup(session, sdp); } } else { if (switch_test_flag(tech_pvt, TFLAG_LATE_NEGOTIATION)) { - char *r_sdp = switch_channel_get_variable(channel, SWITCH_R_SDP_VARIABLE); + const char *r_sdp = switch_channel_get_variable(channel, SWITCH_R_SDP_VARIABLE); tech_pvt->num_codecs = 0; sofia_glue_tech_prepare_codecs(tech_pvt); if (sofia_glue_tech_media(tech_pvt, r_sdp) != SWITCH_STATUS_SUCCESS) { @@ -694,7 +694,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi switch (msg->message_id) { case SWITCH_MESSAGE_INDICATE_BROADCAST: { - char *ip = NULL, *port = NULL; + const char *ip = NULL, *port = NULL; ip = switch_channel_get_variable(channel, SWITCH_REMOTE_MEDIA_IP_VARIABLE); port = switch_channel_get_variable(channel, SWITCH_REMOTE_MEDIA_PORT_VARIABLE); if (ip && port) { @@ -708,10 +708,10 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi break; case SWITCH_MESSAGE_INDICATE_NOMEDIA: { - char *uuid; + const char *uuid; switch_core_session_t *other_session; switch_channel_t *other_channel; - char *ip = NULL, *port = NULL; + const char *ip = NULL, *port = NULL; if (switch_channel_get_state(channel) >= CS_HANGUP) { return SWITCH_STATUS_FALSE; @@ -894,13 +894,13 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi /* Transmit 183 Progress with SDP */ if (switch_channel_test_flag(channel, CF_BYPASS_MEDIA)) { - char *sdp = NULL; + const char *sdp = NULL; if ((sdp = switch_channel_get_variable(channel, SWITCH_B_SDP_VARIABLE))) { tech_pvt->local_sdp_str = switch_core_session_strdup(session, sdp); } } else { if (switch_test_flag(tech_pvt, TFLAG_LATE_NEGOTIATION)) { - char *r_sdp = switch_channel_get_variable(channel, SWITCH_R_SDP_VARIABLE); + const char *r_sdp = switch_channel_get_variable(channel, SWITCH_R_SDP_VARIABLE); tech_pvt->num_codecs = 0; sofia_glue_tech_prepare_codecs(tech_pvt); if (sofia_glue_tech_media(tech_pvt, r_sdp) != SWITCH_STATUS_SUCCESS) { diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index e46150c666..fab9d22bb7 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -398,7 +398,7 @@ switch_status_t sofia_glue_activate_rtp(private_object_t *tech_pvt, switch_rtp_f void sofia_glue_deactivate_rtp(private_object_t *tech_pvt); -void sofia_glue_set_local_sdp(private_object_t *tech_pvt, char *ip, uint32_t port, char *sr, int force); +void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, uint32_t port, const char *sr, int force); void sofia_glue_tech_prepare_codecs(private_object_t *tech_pvt); @@ -432,7 +432,7 @@ void launch_sofia_profile_thread(sofia_profile_t *profile); switch_status_t sofia_presence_chat_send(char *proto, char *from, char *to, char *subject, char *body, char *hint); void sofia_glue_tech_absorb_sdp(private_object_t *tech_pvt); -switch_status_t sofia_glue_tech_media(private_object_t *tech_pvt, char *r_sdp); +switch_status_t sofia_glue_tech_media(private_object_t *tech_pvt, const char *r_sdp); char *sofia_reg_find_reg_url(sofia_profile_t *profile, const char *user, const char *host, char *val, switch_size_t len); void event_handler(switch_event_t *event); void sofia_presence_event_handler(switch_event_t *event); diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index fe0f4df473..2220052bd3 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -1122,7 +1122,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status, switch_channel_t *channel = NULL; private_object_t *tech_pvt = NULL; const char *replaces_str = NULL; - char *uuid; + const char *uuid; switch_core_session_t *other_session = NULL; switch_channel_t *other_channel = NULL; char st[80] = ""; @@ -1163,7 +1163,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status, if (channel && (status == 180 || status == 183) && switch_channel_test_flag(channel, CF_OUTBOUND)) { - char *val; + const char *val; if ((val = switch_channel_get_variable(channel, "sip_auto_answer")) && switch_true(val)) { nua_notify(nh, NUTAG_NEWSUB(1), NUTAG_SUBSTATE(nua_substate_active), SIPTAG_EVENT_STR("talk"), TAG_END()); } @@ -1276,7 +1276,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status, } if ((b_private = nua_handle_magic(bnh))) { - char *br_b = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE); + const char *br_b = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE); char *br_a = b_private->uuid; if (br_b) { @@ -1544,7 +1544,7 @@ void sofia_handle_sip_i_refer(nua_t *nua, sofia_profile_t *profile, nua_handle_t char *rep; if ((rep = strchr(refer_to->r_url->url_headers, '='))) { - char *br_a = NULL, *br_b = NULL; + const char *br_a = NULL, *br_b = NULL; char *buf; rep++; @@ -1597,7 +1597,7 @@ void sofia_handle_sip_i_refer(nua_t *nua, sofia_profile_t *profile, nua_handle_t } else { switch_core_session_t *t_session; switch_channel_t *hup_channel; - char *ext; + const char *ext; if (br_a && !br_b) { t_session = switch_core_session_locate(br_a); @@ -1691,7 +1691,7 @@ void sofia_handle_sip_i_refer(nua_t *nua, sofia_profile_t *profile, nua_handle_t if (exten) { switch_channel_t *channel = switch_core_session_get_channel(session); - char *br; + const char *br; if ((br = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))) { switch_core_session_t *b_session; @@ -2040,7 +2040,7 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_ } if (sip->sip_to && sip->sip_to->a_url) { - char *val; + const char *val; char *transport = (my_addrinfo->ai_socktype == SOCK_STREAM) ? "tcp" : "udp"; url_set_chanvars(session, sip->sip_to->a_url, sip_to); diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index a575c4648c..0eebffc146 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -38,7 +38,7 @@ switch_status_t sofia_glue_tech_choose_video_port(private_object_t *tech_pvt); switch_status_t sofia_glue_tech_set_video_codec(private_object_t *tech_pvt, int force); -void sofia_glue_set_local_sdp(private_object_t *tech_pvt, char *ip, uint32_t port, char *sr, int force) +void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, uint32_t port, const char *sr, int force) { char buf[2048]; int ptime = 0; @@ -256,8 +256,8 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, char *ip, uint32_t por void sofia_glue_tech_prepare_codecs(private_object_t *tech_pvt) { - char *abs, *codec_string = NULL; - char *ocodec = NULL; + const char *abs, *codec_string = NULL; + const char *ocodec = NULL; if (switch_channel_test_flag(tech_pvt->channel, CF_BYPASS_MEDIA)) { goto end; @@ -466,13 +466,13 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session) char *rpid = NULL; char *alert_info = NULL; char *max_forwards = NULL; - char *alertbuf; - char *forwardbuf; + const char *alertbuf; + const char *forwardbuf; int forwardval; private_object_t *tech_pvt; switch_channel_t *channel = NULL; switch_caller_profile_t *caller_profile; - char *cid_name, *cid_num; + const char *cid_name, *cid_num; char *e_dest = NULL; const char *holdstr = ""; switch_stream_handle_t stream = { 0 }; @@ -480,8 +480,8 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session) char *extra_headers = NULL; switch_status_t status = SWITCH_STATUS_FALSE; uint32_t session_timeout = 0; - char *val; - char *rep; + const char *val; + const char *rep; channel = switch_core_session_get_channel(session); assert(channel != NULL); @@ -495,8 +495,8 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session) caller_profile = switch_channel_get_caller_profile(channel); - cid_name = (char *) caller_profile->caller_id_name; - cid_num = (char *) caller_profile->caller_id_number; + cid_name = caller_profile->caller_id_name; + cid_num = caller_profile->caller_id_number; sofia_glue_tech_prepare_codecs(tech_pvt); if (!tech_pvt->from_str) { @@ -550,7 +550,8 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session) char *d_url = NULL, *url = NULL; sofia_private_t *sofia_private; char *invite_contact = NULL, *to_str, *use_from_str, *from_str, *url_str; - char *transport = "udp", *t_var, *d_contact = NULL; + const char *transport = "udp", *t_var; + char *d_contact = NULL; if (switch_strlen_zero(tech_pvt->dest)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "URL Error! [%s]\n", tech_pvt->dest); @@ -723,7 +724,7 @@ void sofia_glue_do_xfer_invite(switch_core_session_t *session) (char *) caller_profile->caller_id_number, tech_pvt->profile->extsipip ? tech_pvt->profile->extsipip : tech_pvt->profile->sipip))) { - char *rep = switch_channel_get_variable(channel, SOFIA_REPLACES_HEADER); + const char *rep = switch_channel_get_variable(channel, SOFIA_REPLACES_HEADER); tech_pvt->nh2 = nua_handle(tech_pvt->profile->nua, NULL, SIPTAG_TO_STR(tech_pvt->dest), SIPTAG_FROM_STR(tech_pvt->from_str), SIPTAG_CONTACT_STR(tech_pvt->profile->url), @@ -744,8 +745,7 @@ void sofia_glue_do_xfer_invite(switch_core_session_t *session) void sofia_glue_tech_absorb_sdp(private_object_t *tech_pvt) { - char *sdp_str; - + const char *sdp_str; if ((sdp_str = switch_channel_get_variable(tech_pvt->channel, SWITCH_B_SDP_VARIABLE))) { sdp_parser_t *parser; @@ -933,7 +933,7 @@ switch_status_t sofia_glue_activate_rtp(private_object_t *tech_pvt, switch_rtp_f { int bw, ms; const char *err = NULL; - char *val = NULL; + const char *val = NULL; switch_rtp_flag_t flags; switch_status_t status; char tmp[50]; @@ -1129,7 +1129,7 @@ switch_status_t sofia_glue_activate_rtp(private_object_t *tech_pvt, switch_rtp_f return SWITCH_STATUS_SUCCESS; } -switch_status_t sofia_glue_tech_media(private_object_t *tech_pvt, char *r_sdp) +switch_status_t sofia_glue_tech_media(private_object_t *tech_pvt, const char *r_sdp) { sdp_parser_t *parser = NULL; sdp_session_t *sdp; @@ -1182,7 +1182,7 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, sdp_session_t * int sendonly = 0; int greedy = 0, x = 0, skip = 0, mine = 0; switch_channel_t *channel = NULL; - char *val; + const char *val; tech_pvt = switch_core_session_get_private(session); assert(tech_pvt != NULL); @@ -1225,7 +1225,7 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, sdp_session_t * if (sendonly) { if (!switch_test_flag(tech_pvt, TFLAG_SIP_HOLD)) { - char *stream; + const char *stream; switch_set_flag_locked(tech_pvt, TFLAG_SIP_HOLD); if (tech_pvt->max_missed_packets) { switch_rtp_set_max_missed_packets(tech_pvt->rtp_session, tech_pvt->max_missed_packets * 10); @@ -1557,7 +1557,7 @@ switch_call_cause_t sofia_glue_sip_cause_to_freeswitch(int status) void sofia_glue_pass_sdp(private_object_t *tech_pvt, char *sdp) { - char *val; + const char *val; switch_core_session_t *other_session; switch_channel_t *other_channel; diff --git a/src/mod/event_handlers/mod_cdr/basecdr.cpp b/src/mod/event_handlers/mod_cdr/basecdr.cpp index 31a3b3b6ed..f286674879 100644 --- a/src/mod/event_handlers/mod_cdr/basecdr.cpp +++ b/src/mod/event_handlers/mod_cdr/basecdr.cpp @@ -309,7 +309,7 @@ void BaseCDR::process_channel_variables(const std::list& stringlist tempstringvector.push_back('\0'); char* tempstring= &tempstringvector[0]; - char *tempvariable; + const char *tempvariable; tempvariable = switch_channel_get_variable(channel,tempstring); @@ -350,7 +350,7 @@ void BaseCDR::process_channel_variables(const std::list& stringlist tempstringvector.push_back('\0'); char* tempstring= &tempstringvector[0]; - char *tempvariable; + const char *tempvariable; tempvariable = switch_channel_get_variable(channel,tempstring); if (!switch_strlen_zero(tempvariable)) chanvars_supp[*iItr] = tempvariable; diff --git a/src/mod/event_handlers/mod_event_socket/mod_event_socket.c b/src/mod/event_handlers/mod_event_socket/mod_event_socket.c index 7262f18d60..014d8206bb 100644 --- a/src/mod/event_handlers/mod_event_socket/mod_event_socket.c +++ b/src/mod/event_handlers/mod_event_socket/mod_event_socket.c @@ -631,7 +631,7 @@ static switch_status_t parse_command(listener_t * listener, switch_event_t *even goto done; } else if (!strncasecmp(cmd, "getvar", 6)) { char *arg; - char *val = ""; + const char *val = ""; strip_cr(cmd); diff --git a/src/mod/formats/mod_local_stream/mod_local_stream.c b/src/mod/formats/mod_local_stream/mod_local_stream.c index 934f00777a..965e98c485 100644 --- a/src/mod/formats/mod_local_stream/mod_local_stream.c +++ b/src/mod/formats/mod_local_stream/mod_local_stream.c @@ -143,7 +143,7 @@ static void *SWITCH_THREAD_FUNC read_stream_thread(switch_thread_t *thread, void return NULL; } -static switch_status_t local_stream_file_open(switch_file_handle_t *handle, char *path) +static switch_status_t local_stream_file_open(switch_file_handle_t *handle, const char *path) { local_stream_context_t *context; local_stream_source_t *source; diff --git a/src/mod/formats/mod_native_file/mod_native_file.c b/src/mod/formats/mod_native_file/mod_native_file.c index 280c054386..8572a2ce13 100644 --- a/src/mod/formats/mod_native_file/mod_native_file.c +++ b/src/mod/formats/mod_native_file/mod_native_file.c @@ -40,7 +40,7 @@ struct native_file_context { typedef struct native_file_context native_file_context; -static switch_status_t native_file_file_open(switch_file_handle_t *handle, char *path) +static switch_status_t native_file_file_open(switch_file_handle_t *handle, const char *path) { native_file_context *context; char *ext; diff --git a/src/mod/formats/mod_sndfile/mod_sndfile.c b/src/mod/formats/mod_sndfile/mod_sndfile.c index b04764fb7f..686aa2fba4 100644 --- a/src/mod/formats/mod_sndfile/mod_sndfile.c +++ b/src/mod/formats/mod_sndfile/mod_sndfile.c @@ -55,7 +55,7 @@ struct sndfile_context { typedef struct sndfile_context sndfile_context; -static switch_status_t sndfile_file_open(switch_file_handle_t *handle, char *path) +static switch_status_t sndfile_file_open(switch_file_handle_t *handle, const char *path) { sndfile_context *context; int mode = 0; diff --git a/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c b/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c index 58628178de..d8c9b1fc47 100644 --- a/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c +++ b/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c @@ -1524,7 +1524,8 @@ static JSBool session_streamfile(JSContext * cx, JSObject * obj, uintN argc, jsv switch_file_handle_t fh = { 0 }; JSFunction *function; switch_input_args_t args = { 0 }; - char *prebuf, posbuf[35] = ""; + const char *prebuf; + char posbuf[35] = ""; METHOD_SANITY_CHECK(); @@ -1627,7 +1628,7 @@ static JSBool session_get_variable(JSContext * cx, JSObject * obj, uintN argc, j assert(channel != NULL); if (argc > 0) { - char *var, *val; + const char *var, *val; var = JS_GetStringBytes(JS_ValueToString(cx, argv[0])); val = switch_channel_get_variable(channel, var); @@ -2510,16 +2511,16 @@ static JSBool session_originate(JSContext * cx, JSObject * obj, uintN argc, jsva JSObject *session_obj; switch_core_session_t *session = NULL, *peer_session = NULL; switch_caller_profile_t *caller_profile = NULL, *orig_caller_profile = NULL; - char *dest = NULL; - char *dialplan = NULL; - char *cid_name = ""; - char *cid_num = ""; - char *network_addr = ""; - char *ani = ""; - char *aniii = ""; - char *rdnis = ""; - char *context = ""; - char *username = NULL; + const char *dest = NULL; + const char *dialplan = NULL; + const char *cid_name = ""; + const char *cid_num = ""; + const char *network_addr = ""; + const char *ani = ""; + const char *aniii = ""; + const char *rdnis = ""; + const char *context = ""; + const char *username = NULL; char *to = NULL; char *tmp; @@ -3109,10 +3110,11 @@ static int env_init(JSContext * cx, JSObject * javascript_object) return 1; } -static void js_parse_and_execute(switch_core_session_t *session, char *input_code, struct request_obj *ro) +static void js_parse_and_execute(switch_core_session_t *session, const char *input_code, struct request_obj *ro) { JSObject *javascript_global_object = NULL; - char buf[1024], *script, *arg, *argv[512]; + char buf[1024], *arg, *argv[512]; + const char *script; int argc = 0, x = 0, y = 0; unsigned int flags = 0; struct js_session jss; @@ -3172,9 +3174,9 @@ static void js_parse_and_execute(switch_core_session_t *session, char *input_cod } } -static void js_dp_function(switch_core_session_t *session, char *input_code) +SWITCH_STANDARD_APP(js_dp_function) { - js_parse_and_execute(session, input_code, NULL); + js_parse_and_execute(session, data, NULL); } static void *SWITCH_THREAD_FUNC js_thread_run(switch_thread_t * thread, void *obj) diff --git a/src/mod/languages/mod_spidermonkey/mod_spidermonkey.h b/src/mod/languages/mod_spidermonkey/mod_spidermonkey.h index eb2a1cba06..cd2ebf1f0e 100644 --- a/src/mod/languages/mod_spidermonkey/mod_spidermonkey.h +++ b/src/mod/languages/mod_spidermonkey/mod_spidermonkey.h @@ -71,12 +71,12 @@ SWITCH_BEGIN_EXTERN_C #else //not win32 #define SWITCH_SM_DECLARE(type) type #endif -int eval_some_js(char *code, JSContext * cx, JSObject * obj, jsval * rval) +int eval_some_js(const char *code, JSContext * cx, JSObject * obj, jsval * rval) { JSScript *script = NULL; - char *cptr; + const char *cptr; char *path = NULL; - char *script_name = NULL; + const char *script_name = NULL; int result = 0; JS_ClearPendingException(cx); diff --git a/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c b/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c index d0645dadf2..e7e90fb87c 100644 --- a/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c +++ b/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c @@ -65,7 +65,7 @@ static switch_status_t my_on_hangup(switch_core_session_t *session) char *xml_text = NULL; char *path = NULL; char *curl_xml_text = NULL; - char *logdir = NULL; + const char *logdir = NULL; char *xml_text_escaped = NULL; int fd = -1; uint32_t cur_try; diff --git a/src/switch_caller.c b/src/switch_caller.c index a8bdc26ca5..789db97f58 100644 --- a/src/switch_caller.c +++ b/src/switch_caller.c @@ -126,7 +126,7 @@ SWITCH_DECLARE(switch_caller_profile_t *) switch_caller_profile_clone(switch_cor } -SWITCH_DECLARE(char *) switch_caller_get_field_by_name(switch_caller_profile_t *caller_profile, const char *name) +SWITCH_DECLARE(const char *) switch_caller_get_field_by_name(switch_caller_profile_t *caller_profile, const char *name) { if (!strcasecmp(name, "dialplan")) { return caller_profile->dialplan; diff --git a/src/switch_channel.c b/src/switch_channel.c index abd7502f57..8a287c705d 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -289,7 +289,7 @@ SWITCH_DECLARE(switch_status_t) switch_channel_init(switch_channel_t *channel, s SWITCH_DECLARE(void) switch_channel_presence(switch_channel_t *channel, const char *rpid, const char *status) { - char *id = switch_channel_get_variable(channel, "presence_id"); + const char *id = switch_channel_get_variable(channel, "presence_id"); switch_event_t *event; switch_event_types_t type = SWITCH_EVENT_PRESENCE_IN; @@ -319,9 +319,9 @@ SWITCH_DECLARE(void) switch_channel_presence(switch_channel_t *channel, const ch } -SWITCH_DECLARE(char *) switch_channel_get_variable(switch_channel_t *channel, const char *varname) +SWITCH_DECLARE(const char *) switch_channel_get_variable(switch_channel_t *channel, const char *varname) { - char *v = NULL; + const char *v = NULL; assert(channel != NULL); switch_mutex_lock(channel->profile_mutex); @@ -425,7 +425,7 @@ SWITCH_DECLARE(int) switch_channel_test_flag(switch_channel_t *channel, switch_c SWITCH_DECLARE(switch_bool_t) switch_channel_set_flag_partner(switch_channel_t *channel, switch_channel_flag_t flags) { - char *uuid; + const char *uuid; assert(channel != NULL); @@ -443,7 +443,7 @@ SWITCH_DECLARE(switch_bool_t) switch_channel_set_flag_partner(switch_channel_t * SWITCH_DECLARE(switch_bool_t) switch_channel_clear_flag_partner(switch_channel_t *channel, switch_channel_flag_t flags) { - char *uuid; + const char *uuid; assert(channel != NULL); @@ -1096,7 +1096,7 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_pre_answered(switch_ switch_channel_mark_ring_ready(channel); if (!switch_channel_test_flag(channel, CF_EARLY_MEDIA)) { - char *uuid; + const char *uuid; switch_core_session_t *other_session; switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_NOTICE, "Pre-Answer %s!\n", channel->name); @@ -1184,7 +1184,7 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_ring_ready(switch_channel SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_answered(switch_channel_t *channel, const char *file, const char *func, int line) { switch_event_t *event; - char *uuid; + const char *uuid; switch_core_session_t *other_session; assert(channel != NULL); @@ -1268,7 +1268,8 @@ SWITCH_DECLARE(char *) switch_channel_expand_variables(switch_channel_t *channel char *q, *p, *c = NULL; char *data, *indup; size_t sp = 0, len = 0, olen = 0, vtype = 0, br = 0, cpos, block = 128; - char *sub_val = NULL, *func_val = NULL; + const char *sub_val = NULL; + char *func_val = NULL; int nv = 0; q = in; diff --git a/src/switch_core_file.c b/src/switch_core_file.c index 3c5d68492f..3e8b1c9af3 100644 --- a/src/switch_core_file.c +++ b/src/switch_core_file.c @@ -35,7 +35,7 @@ #include "private/switch_core_pvt.h" SWITCH_DECLARE(switch_status_t) switch_core_file_open(switch_file_handle_t *fh, - char *file_path, uint8_t channels, uint32_t rate, unsigned int flags, switch_memory_pool_t *pool) + const char *file_path, uint8_t channels, uint32_t rate, unsigned int flags, switch_memory_pool_t *pool) { char *ext; switch_status_t status; diff --git a/src/switch_core_session.c b/src/switch_core_session.c index 4d125fbdd9..6f1d66ce7d 100644 --- a/src/switch_core_session.c +++ b/src/switch_core_session.c @@ -194,7 +194,7 @@ SWITCH_DECLARE(switch_call_cause_t) switch_core_session_outgoing_channel(switch_ if (session) { channel = switch_core_session_get_channel(session); if (caller_profile) { - char *ecaller_id_name = NULL, *ecaller_id_number = NULL; + const char *ecaller_id_name = NULL, *ecaller_id_number = NULL; ecaller_id_name = switch_channel_get_variable(channel, "effective_caller_id_name"); ecaller_id_number = switch_channel_get_variable(channel, "effective_caller_id_number"); @@ -247,7 +247,7 @@ SWITCH_DECLARE(switch_call_cause_t) switch_core_session_outgoing_channel(switch_ } if (channel && peer_channel) { - char *export_vars, *val; + const char *export_vars, *val; switch_codec_t *read_codec = switch_core_session_get_read_codec(session); if (read_codec) { @@ -270,7 +270,7 @@ SWITCH_DECLARE(switch_call_cause_t) switch_core_session_outgoing_channel(switch_ int x; for (x = 0; x < argc; x++) { - char *val; + const char *val; if ((val = switch_channel_get_variable(channel, argv[x]))) { char *var = argv[x]; if (!strncasecmp(var, "nolocal:", 8)) { @@ -344,7 +344,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_pass_indication(switch_core_ { switch_core_session_message_t msg = {0}; switch_core_session_t *other_session; - char *uuid; + const char *uuid; switch_channel_t *channel; switch_status_t status = SWITCH_STATUS_SUCCESS; @@ -900,7 +900,7 @@ SWITCH_DECLARE(switch_app_log_t *) switch_core_session_get_app_log(switch_core_s } SWITCH_DECLARE(switch_status_t) switch_core_session_exec(switch_core_session_t *session, - const switch_application_interface_t *application_interface, char *arg) { + const switch_application_interface_t *application_interface, const char *arg) { switch_app_log_t *log, *lp; switch_event_t *event; switch_channel_t *channel; diff --git a/src/switch_core_speech.c b/src/switch_core_speech.c index b079d63990..0fc03584c4 100644 --- a/src/switch_core_speech.c +++ b/src/switch_core_speech.c @@ -36,8 +36,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_speech_open(switch_speech_handle_t *sh, - char *module_name, - char *voice_name, + const char *module_name, + const char *voice_name, unsigned int rate, unsigned int interval, switch_speech_flag_t *flags, @@ -101,7 +101,7 @@ SWITCH_DECLARE(void) switch_core_speech_flush_tts(switch_speech_handle_t *sh) } } -SWITCH_DECLARE(void) switch_core_speech_text_param_tts(switch_speech_handle_t *sh, char *param, char *val) +SWITCH_DECLARE(void) switch_core_speech_text_param_tts(switch_speech_handle_t *sh, char *param, const char *val) { assert(sh != NULL); diff --git a/src/switch_core_timer.c b/src/switch_core_timer.c index e28fde59ff..c4f438b79f 100644 --- a/src/switch_core_timer.c +++ b/src/switch_core_timer.c @@ -34,7 +34,7 @@ #include #include "private/switch_core_pvt.h" -SWITCH_DECLARE(switch_status_t) switch_core_timer_init(switch_timer_t *timer, char *timer_name, int interval, int samples, switch_memory_pool_t *pool) +SWITCH_DECLARE(switch_status_t) switch_core_timer_init(switch_timer_t *timer, const char *timer_name, int interval, int samples, switch_memory_pool_t *pool) { switch_timer_interface_t *timer_interface; switch_status_t status; diff --git a/src/switch_cpp.cpp b/src/switch_cpp.cpp index 81deb425c8..d705ab02e2 100644 --- a/src/switch_cpp.cpp +++ b/src/switch_cpp.cpp @@ -45,7 +45,7 @@ CoreSession::CoreSession() { - init_vars(); + do { session = NULL; channel = NULL; uuid = NULL; tts_name = NULL; voice_name = NULL; memset(&args, 0, sizeof(args)); ap = NULL; caller_profile.source = "mod_unknown"; caller_profile.dialplan = ""; caller_profile.context = ""; caller_profile.caller_id_name = ""; caller_profile.caller_id_number = ""; caller_profile.network_addr = ""; caller_profile.ani = ""; caller_profile.aniii = ""; caller_profile.rdnis = ""; caller_profile.username = ""; on_hangup = NULL; cb_state.function = NULL; } while(0); } CoreSession::CoreSession(char *nuuid) @@ -113,7 +113,7 @@ void CoreSession::setVariable(char *var, char *val) switch_channel_set_variable(channel, var, val); } -char *CoreSession::getVariable(char *var) +const char *CoreSession::getVariable(char *var) { sanity_check(NULL); return switch_channel_get_variable(channel, var); @@ -269,7 +269,7 @@ int CoreSession::streamFile(char *file, int starting_sample_count) { switch_status_t status; switch_file_handle_t fh = { 0 }; - char *prebuf; + const char *prebuf; sanity_check(-1); fh.samples = starting_sample_count; diff --git a/src/switch_ivr.c b/src/switch_ivr.c index 7c91866c35..a3710dba73 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -696,7 +696,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_hold(switch_core_session_t *session) return SWITCH_STATUS_SUCCESS; } -SWITCH_DECLARE(switch_status_t) switch_ivr_hold_uuid(char *uuid) +SWITCH_DECLARE(switch_status_t) switch_ivr_hold_uuid(const char *uuid) { switch_core_session_t *session; @@ -727,7 +727,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_unhold(switch_core_session_t *session return SWITCH_STATUS_SUCCESS; } -SWITCH_DECLARE(switch_status_t) switch_ivr_unhold_uuid(char *uuid) +SWITCH_DECLARE(switch_status_t) switch_ivr_unhold_uuid(const char *uuid) { switch_core_session_t *session; @@ -739,9 +739,9 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_unhold_uuid(char *uuid) return SWITCH_STATUS_SUCCESS; } -SWITCH_DECLARE(switch_status_t) switch_ivr_media(char *uuid, switch_media_flag_t flags) +SWITCH_DECLARE(switch_status_t) switch_ivr_media(const char *uuid, switch_media_flag_t flags) { - char *other_uuid = NULL; + const char *other_uuid = NULL; switch_channel_t *channel, *other_channel = NULL; switch_core_session_t *session, *other_session; switch_core_session_message_t msg = { 0 }; @@ -791,9 +791,9 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_media(char *uuid, switch_media_flag_t } -SWITCH_DECLARE(switch_status_t) switch_ivr_nomedia(char *uuid, switch_media_flag_t flags) +SWITCH_DECLARE(switch_status_t) switch_ivr_nomedia(const char *uuid, switch_media_flag_t flags) { - char *other_uuid; + const char *other_uuid; switch_channel_t *channel, *other_channel = NULL; switch_core_session_t *session, *other_session = NULL; switch_core_session_message_t msg = { 0 }; @@ -845,14 +845,14 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_nomedia(char *uuid, switch_media_flag return status; } -SWITCH_DECLARE(switch_status_t) switch_ivr_session_transfer(switch_core_session_t *session, char *extension, char *dialplan, char *context) +SWITCH_DECLARE(switch_status_t) switch_ivr_session_transfer(switch_core_session_t *session, const char *extension, char *dialplan, char *context) { switch_channel_t *channel; switch_caller_profile_t *profile, *new_profile; switch_core_session_message_t msg = { 0 }; switch_core_session_t *other_session; switch_channel_t *other_channel = NULL; - char *uuid = NULL; + const char *uuid = NULL; assert(session != NULL); switch_core_session_reset(session); @@ -941,7 +941,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_transfer_variable(switch_core_session { switch_channel_t *chana = switch_core_session_get_channel(sessa); switch_channel_t *chanb = switch_core_session_get_channel(sessb); - char *val = NULL; + const char *val = NULL; uint8_t prefix = 0; if (var && *var == '~') { diff --git a/src/switch_ivr_async.c b/src/switch_ivr_async.c index 32dddf4998..a323eafda3 100644 --- a/src/switch_ivr_async.c +++ b/src/switch_ivr_async.c @@ -163,7 +163,7 @@ static switch_bool_t displace_callback(switch_media_bug_t *bug, void *user_data, return SWITCH_TRUE; } -SWITCH_DECLARE(switch_status_t) switch_ivr_stop_displace_session(switch_core_session_t *session, char *file) +SWITCH_DECLARE(switch_status_t) switch_ivr_stop_displace_session(switch_core_session_t *session, const char *file) { switch_media_bug_t *bug; switch_channel_t *channel = switch_core_session_get_channel(session); @@ -277,7 +277,7 @@ static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, s return SWITCH_TRUE; } -SWITCH_DECLARE(switch_status_t) switch_ivr_stop_record_session(switch_core_session_t *session, char *file) +SWITCH_DECLARE(switch_status_t) switch_ivr_stop_record_session(switch_core_session_t *session, const char *file) { switch_media_bug_t *bug; switch_channel_t *channel = switch_core_session_get_channel(session); @@ -297,7 +297,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_session(switch_core_session_t { switch_channel_t *channel; switch_codec_t *read_codec; - char *p; + const char *p; const char *vval; switch_media_bug_t *bug; switch_status_t status; @@ -1071,7 +1071,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech(switch_core_session_t * switch_status_t status; switch_asr_flag_t flags = SWITCH_ASR_FLAG_NONE; struct speech_thread_handle *sth; - char *val; + const char *val; if (!ah) { if (!(ah = switch_core_session_alloc(session, sizeof(*ah)))) { @@ -1145,7 +1145,7 @@ SWITCH_STANDARD_SCHED_FUNC(sch_hangup_callback) { struct hangup_helper *helper; switch_core_session_t *session, *other_session; - char *other_uuid; + const char *other_uuid; assert(task); @@ -1170,7 +1170,7 @@ SWITCH_STANDARD_SCHED_FUNC(sch_hangup_callback) } } -SWITCH_DECLARE(uint32_t) switch_ivr_schedule_hangup(time_t runtime, char *uuid, switch_call_cause_t cause, switch_bool_t bleg) +SWITCH_DECLARE(uint32_t) switch_ivr_schedule_hangup(time_t runtime, const char *uuid, switch_call_cause_t cause, switch_bool_t bleg) { struct hangup_helper *helper; size_t len = sizeof(*helper); @@ -1207,7 +1207,7 @@ SWITCH_STANDARD_SCHED_FUNC(sch_transfer_callback) } -SWITCH_DECLARE(uint32_t) switch_ivr_schedule_transfer(time_t runtime, char *uuid, char *extension, char *dialplan, char *context) +SWITCH_DECLARE(uint32_t) switch_ivr_schedule_transfer(time_t runtime, const char *uuid, char *extension, char *dialplan, char *context) { struct transfer_helper *helper; size_t len = sizeof(*helper); @@ -1283,14 +1283,14 @@ SWITCH_DECLARE(uint32_t) switch_ivr_schedule_broadcast(time_t runtime, char *uui return switch_scheduler_add_task(runtime, sch_broadcast_callback, (char *) __SWITCH_FUNC__, uuid, 0, helper, SSHF_FREE_ARG); } -SWITCH_DECLARE(switch_status_t) switch_ivr_broadcast(char *uuid, char *path, switch_media_flag_t flags) +SWITCH_DECLARE(switch_status_t) switch_ivr_broadcast(const char *uuid, const char *path, switch_media_flag_t flags) { switch_channel_t *channel; int nomedia; switch_core_session_t *session, *master; switch_event_t *event; switch_core_session_t *other_session = NULL; - char *other_uuid = NULL; + const char *other_uuid = NULL; char *app = "playback"; assert(path); diff --git a/src/switch_ivr_bridge.c b/src/switch_ivr_bridge.c index 4e4d5b24fd..133369ce12 100644 --- a/src/switch_ivr_bridge.c +++ b/src/switch_ivr_bridge.c @@ -56,7 +56,7 @@ static void *audio_bridge_thread(switch_thread_t * thread, void *obj) switch_frame_t *read_frame; switch_core_session_t *session_a, *session_b; uint32_t loop_count = 0; - char *app_name = NULL, *app_arg = NULL; + const char *app_name = NULL, *app_arg = NULL; session_a = data->session; if (!(session_b = switch_core_session_locate(data->b_uuid))) { @@ -311,7 +311,7 @@ static switch_status_t uuid_bridge_on_transmit(switch_core_session_t *session) { switch_channel_t *channel = NULL; switch_core_session_t *other_session; - char *other_uuid = NULL; + const char *other_uuid = NULL; channel = switch_core_session_get_channel(session); assert(channel != NULL); @@ -430,7 +430,7 @@ static switch_status_t signal_bridge_on_hibernate(switch_core_session_t *session static switch_status_t signal_bridge_on_hangup(switch_core_session_t *session) { - char *uuid; + const char *uuid; switch_channel_t *channel = NULL; switch_core_session_t *other_session; switch_event_t *event; @@ -595,7 +595,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_multi_threaded_bridge(switch_core_ses switch_event_t *event; switch_core_session_message_t msg = { 0 }; const switch_application_interface_t *application_interface; - char *app, *data; + const char *app, *data; switch_channel_set_state(peer_channel, CS_HOLD); @@ -683,7 +683,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_multi_threaded_bridge(switch_core_ses } -SWITCH_DECLARE(switch_status_t) switch_ivr_uuid_bridge(char *originator_uuid, char *originatee_uuid) +SWITCH_DECLARE(switch_status_t) switch_ivr_uuid_bridge(const char *originator_uuid, const char *originatee_uuid) { switch_core_session_t *originator_session, *originatee_session; switch_channel_t *originator_channel, *originatee_channel; diff --git a/src/switch_ivr_originate.c b/src/switch_ivr_originate.c index 24fd591bb8..f52f1862c9 100644 --- a/src/switch_ivr_originate.c +++ b/src/switch_ivr_originate.c @@ -237,10 +237,10 @@ static int teletone_handler(teletone_generation_session_t * ts, teletone_tone_ma SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *session, switch_core_session_t **bleg, switch_call_cause_t *cause, - char *bridgeto, + const char *bridgeto, uint32_t timelimit_sec, const switch_state_handler_table_t *table, - char *cid_name_override, char *cid_num_override, switch_caller_profile_t *caller_profile_override) + const char *cid_name_override, const char *cid_num_override, switch_caller_profile_t *caller_profile_override) { char *pipe_names[MAX_PEERS] = { 0 }; char *data = NULL; @@ -263,7 +263,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess char key[80] = SWITCH_BLANK_STRING, file[512] = SWITCH_BLANK_STRING, *odata, *var; switch_call_cause_t reason = SWITCH_CAUSE_UNALLOCATED; uint8_t to = 0; - char *var_val, *vars = NULL, *ringback_data = NULL; + char *var_val, *vars = NULL; + const char *ringback_data = NULL; switch_codec_t *read_codec = NULL; uint8_t sent_ring = 0, early_ok = 1; switch_core_session_message_t *message = NULL; diff --git a/src/switch_ivr_play_say.c b/src/switch_ivr_play_say.c index ad066f5010..b71711cedc 100644 --- a/src/switch_ivr_play_say.c +++ b/src/switch_ivr_play_say.c @@ -90,14 +90,14 @@ static switch_say_type_t get_say_type_by_name(char *name) } -SWITCH_DECLARE(switch_status_t) switch_ivr_phrase_macro(switch_core_session_t *session, char *macro_name, char *data, char *lang, +SWITCH_DECLARE(switch_status_t) switch_ivr_phrase_macro(switch_core_session_t *session, const char *macro_name, const char *data, const char *lang, switch_input_args_t *args) { switch_xml_t cfg, xml = NULL, language, macros, macro, input, action; char *lname = NULL, *mname = NULL, hint_data[1024] = "", enc_hint[1024] = ""; switch_status_t status = SWITCH_STATUS_GENERR; - char *old_sound_prefix = NULL, *sound_path = NULL, *tts_engine = NULL, *tts_voice = NULL, *chan_lang = NULL; - const char *module_name = NULL; + const char *old_sound_prefix = NULL, *sound_path = NULL, *tts_engine = NULL, *tts_voice = NULL; + const char *module_name = NULL, *chan_lang = NULL; switch_channel_t *channel; uint8_t done = 0; @@ -273,8 +273,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_phrase_macro(switch_core_session_t *s switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid SAY Interface [%s]!\n", module_name); } } else if (!strcasecmp(func, "speak-text")) { - char *my_tts_engine = (char *) switch_xml_attr(action, "tts-engine"); - char *my_tts_voice = (char *) switch_xml_attr(action, "tts-voice"); + const char *my_tts_engine = switch_xml_attr(action, "tts-engine"); + const char *my_tts_voice = switch_xml_attr(action, "tts-voice"); if (!my_tts_engine) { my_tts_engine = tts_engine; @@ -325,7 +325,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *se switch_codec_t codec, *read_codec; char *codec_name; switch_status_t status = SWITCH_STATUS_SUCCESS; - char *p; + const char *p; const char *vval; time_t start = 0; uint32_t org_silence_hits = 0; @@ -357,37 +357,37 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *se switch_channel_answer(channel); if ((p = switch_channel_get_variable(channel, "RECORD_TITLE"))) { - vval = (const char *) switch_core_session_strdup(session, p); + vval = switch_core_session_strdup(session, p); switch_core_file_set_string(fh, SWITCH_AUDIO_COL_STR_TITLE, vval); switch_channel_set_variable(channel, "RECORD_TITLE", NULL); } if ((p = switch_channel_get_variable(channel, "RECORD_COPYRIGHT"))) { - vval = (const char *) switch_core_session_strdup(session, p); + vval = switch_core_session_strdup(session, p); switch_core_file_set_string(fh, SWITCH_AUDIO_COL_STR_COPYRIGHT, vval); switch_channel_set_variable(channel, "RECORD_COPYRIGHT", NULL); } if ((p = switch_channel_get_variable(channel, "RECORD_SOFTWARE"))) { - vval = (const char *) switch_core_session_strdup(session, p); + vval = switch_core_session_strdup(session, p); switch_core_file_set_string(fh, SWITCH_AUDIO_COL_STR_SOFTWARE, vval); switch_channel_set_variable(channel, "RECORD_SOFTWARE", NULL); } if ((p = switch_channel_get_variable(channel, "RECORD_ARTIST"))) { - vval = (const char *) switch_core_session_strdup(session, p); + vval = switch_core_session_strdup(session, p); switch_core_file_set_string(fh, SWITCH_AUDIO_COL_STR_ARTIST, vval); switch_channel_set_variable(channel, "RECORD_ARTIST", NULL); } if ((p = switch_channel_get_variable(channel, "RECORD_COMMENT"))) { - vval = (const char *) switch_core_session_strdup(session, p); + vval = switch_core_session_strdup(session, p); switch_core_file_set_string(fh, SWITCH_AUDIO_COL_STR_COMMENT, vval); switch_channel_set_variable(channel, "RECORD_COMMENT", NULL); } if ((p = switch_channel_get_variable(channel, "RECORD_DATE"))) { - vval = (const char *) switch_core_session_strdup(session, p); + vval = switch_core_session_strdup(session, p); switch_core_file_set_string(fh, SWITCH_AUDIO_COL_STR_DATE, vval); switch_channel_set_variable(channel, "RECORD_DATE", NULL); } @@ -637,7 +637,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_gentones(switch_core_session_t *sessi #define FILE_BLOCKSIZE 1024 * 8 #define FILE_BUFSIZE 1024 * 64 -SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *session, switch_file_handle_t *fh, char *file, switch_input_args_t *args) +SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *session, switch_file_handle_t *fh, const char *file, switch_input_args_t *args) { switch_channel_t *channel; int16_t abuf[FILE_STARTSAMPLES]; @@ -659,9 +659,9 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess char *title = "", *copyright = "", *software = "", *artist = "", *comment = "", *date = ""; uint8_t asis = 0; char *ext; - char *prefix; - char *timer_name; - char *prebuf; + const char *prefix; + const char *timer_name; + const char *prebuf; channel = switch_core_session_get_channel(session); assert(channel != NULL); @@ -1199,7 +1199,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text_handle(switch_core_session uint32_t rate = 0; switch_size_t extra = 0; char *p, *tmp = NULL; - char *star, *pound; + const char *star, *pound; switch_size_t starlen, poundlen; channel = switch_core_session_get_channel(session); @@ -1467,7 +1467,7 @@ SWITCH_DECLARE(void) switch_ivr_clear_speech_cache(switch_core_session_t *sessio SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text(switch_core_session_t *session, - char *tts_name, char *voice_name, char *text, switch_input_args_t *args) + const char *tts_name, const char *voice_name, char *text, switch_input_args_t *args) { switch_channel_t *channel; uint32_t rate = 0; @@ -1483,7 +1483,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text(switch_core_session_t *ses switch_speech_handle_t lsh, *sh; switch_speech_flag_t flags = SWITCH_SPEECH_FLAG_NONE; switch_codec_t *read_codec; - char *timer_name, *var; + const char *timer_name, *var; cached_speech_handle_t *cache_obj = NULL; int need_create = 1, need_alloc = 1; diff --git a/src/switch_utils.c b/src/switch_utils.c index 222b1ca538..0d250828a5 100644 --- a/src/switch_utils.c +++ b/src/switch_utils.c @@ -657,9 +657,9 @@ SWITCH_DECLARE(int) switch_socket_waitfor(switch_pollfd_t * poll, int ms) } -SWITCH_DECLARE(size_t) switch_url_encode(char *url, char *buf, size_t len) +SWITCH_DECLARE(size_t) switch_url_encode(const char *url, char *buf, size_t len) { - char *p; + const char *p; size_t x = 0; const char urlunsafe[] = "\r\n \"#%&+:;<=>?@[\\]^`{|}"; const char hex[] = "0123456789ABCDEF"; diff --git a/src/switch_xml.c b/src/switch_xml.c index 651fba5408..6824b4c1ea 100644 --- a/src/switch_xml.c +++ b/src/switch_xml.c @@ -1229,7 +1229,7 @@ SWITCH_DECLARE(switch_status_t) switch_xml_locate(const char *section, return SWITCH_STATUS_FALSE; } -SWITCH_DECLARE(switch_status_t) switch_xml_locate_domain(char *domain_name, char *params, switch_xml_t *root, switch_xml_t *domain) +SWITCH_DECLARE(switch_status_t) switch_xml_locate_domain(const char *domain_name, char *params, switch_xml_t *root, switch_xml_t *domain) { char my_params[512]; *domain = NULL; @@ -1243,13 +1243,13 @@ SWITCH_DECLARE(switch_status_t) switch_xml_locate_domain(char *domain_name, char } -SWITCH_DECLARE(switch_status_t) switch_xml_locate_user(char *user_name, - char *domain_name, - char *ip, +SWITCH_DECLARE(switch_status_t) switch_xml_locate_user(const char *user_name, + const char *domain_name, + const char *ip, switch_xml_t *root, switch_xml_t *domain, switch_xml_t *user, - char *xtra_params) + const char *xtra_params) { char params[1024] = ""; switch_status_t status;