constify switch_channel_set_variable and remove some incorrect casts in it's consumers.
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4306 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
654dc6e616
commit
3f72839a65
|
@ -208,7 +208,7 @@ SWITCH_DECLARE(char *) switch_channel_get_uuid(switch_channel_t *channel);
|
||||||
\param value the vaule of the variable
|
\param value the vaule of the variable
|
||||||
\returns SWITCH_STATUS_SUCCESS if successful
|
\returns SWITCH_STATUS_SUCCESS if successful
|
||||||
*/
|
*/
|
||||||
SWITCH_DECLARE(switch_status_t) switch_channel_set_variable(switch_channel_t *channel, char *varname, char *value);
|
SWITCH_DECLARE(switch_status_t) switch_channel_set_variable(switch_channel_t *channel, const char *varname, const char *value);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Retrieve a variable from a given channel
|
\brief Retrieve a variable from a given channel
|
||||||
|
|
|
@ -259,7 +259,7 @@ static void unset_function(switch_core_session_t *session, char *data)
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No variable name specified.\n");
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No variable name specified.\n");
|
||||||
} else {
|
} else {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "UNSET [%s]\n", (char *) data);
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "UNSET [%s]\n", (char *) data);
|
||||||
switch_channel_set_variable(channel, (char *) data, NULL);
|
switch_channel_set_variable(channel, data, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2785,8 +2785,8 @@ static void sip_i_state(int status,
|
||||||
|
|
||||||
if (r_sdp) {
|
if (r_sdp) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Remote SDP:\n%s\n", r_sdp);
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Remote SDP:\n%s\n", r_sdp);
|
||||||
tech_pvt->remote_sdp_str = switch_core_session_strdup(session, (char *)r_sdp);
|
tech_pvt->remote_sdp_str = switch_core_session_strdup(session, r_sdp);
|
||||||
switch_channel_set_variable(channel, SWITCH_R_SDP_VARIABLE, (char *)r_sdp);
|
switch_channel_set_variable(channel, SWITCH_R_SDP_VARIABLE, r_sdp);
|
||||||
pass_sdp(tech_pvt, (char *)r_sdp);
|
pass_sdp(tech_pvt, (char *)r_sdp);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2831,7 +2831,7 @@ static void sip_i_state(int status,
|
||||||
(uuid = switch_channel_get_variable(channel, SWITCH_BRIDGE_VARIABLE)) && (other_session = switch_core_session_locate(uuid))) {
|
(uuid = switch_channel_get_variable(channel, SWITCH_BRIDGE_VARIABLE)) && (other_session = switch_core_session_locate(uuid))) {
|
||||||
other_channel = switch_core_session_get_channel(other_session);
|
other_channel = switch_core_session_get_channel(other_session);
|
||||||
if (!switch_channel_get_variable(other_channel, SWITCH_B_SDP_VARIABLE)) {
|
if (!switch_channel_get_variable(other_channel, SWITCH_B_SDP_VARIABLE)) {
|
||||||
switch_channel_set_variable(other_channel, SWITCH_B_SDP_VARIABLE, (char *)r_sdp);
|
switch_channel_set_variable(other_channel, SWITCH_B_SDP_VARIABLE, r_sdp);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch_channel_pre_answer(other_channel);
|
switch_channel_pre_answer(other_channel);
|
||||||
|
@ -2997,7 +2997,7 @@ static void sip_i_state(int status,
|
||||||
if ((uuid = switch_channel_get_variable(channel, SWITCH_BRIDGE_VARIABLE)) && (other_session = switch_core_session_locate(uuid))) {
|
if ((uuid = switch_channel_get_variable(channel, SWITCH_BRIDGE_VARIABLE)) && (other_session = switch_core_session_locate(uuid))) {
|
||||||
other_channel = switch_core_session_get_channel(other_session);
|
other_channel = switch_core_session_get_channel(other_session);
|
||||||
if (!switch_channel_get_variable(other_channel, SWITCH_B_SDP_VARIABLE)) {
|
if (!switch_channel_get_variable(other_channel, SWITCH_B_SDP_VARIABLE)) {
|
||||||
switch_channel_set_variable(other_channel, SWITCH_B_SDP_VARIABLE, (char *)r_sdp);
|
switch_channel_set_variable(other_channel, SWITCH_B_SDP_VARIABLE, r_sdp);
|
||||||
}
|
}
|
||||||
switch_channel_answer(other_channel);
|
switch_channel_answer(other_channel);
|
||||||
switch_core_session_rwunlock(other_session);
|
switch_core_session_rwunlock(other_session);
|
||||||
|
@ -4011,7 +4011,7 @@ static void sip_i_refer(nua_t *nua,
|
||||||
switch_core_session_t *b_session;
|
switch_core_session_t *b_session;
|
||||||
|
|
||||||
if ((b_session = switch_core_session_locate(br))) {
|
if ((b_session = switch_core_session_locate(br))) {
|
||||||
switch_channel_set_variable(channel, "TRANSFER_FALLBACK", (char *) from->a_user);
|
switch_channel_set_variable(channel, "TRANSFER_FALLBACK", from->a_user);
|
||||||
switch_ivr_session_transfer(b_session, exten, profile->dialplan, profile->context);
|
switch_ivr_session_transfer(b_session, exten, profile->dialplan, profile->context);
|
||||||
switch_core_session_rwunlock(b_session);
|
switch_core_session_rwunlock(b_session);
|
||||||
}
|
}
|
||||||
|
@ -4333,13 +4333,13 @@ static void sip_i_invite(nua_t *nua,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
switch_channel_set_variable(channel, "sip_from_user", (char *) from->a_url->url_user);
|
switch_channel_set_variable(channel, "sip_from_user", from->a_url->url_user);
|
||||||
if (from->a_url->url_user && *from->a_url->url_user == '+') {
|
if (from->a_url->url_user && *from->a_url->url_user == '+') {
|
||||||
switch_channel_set_variable(channel, "sip_from_user_stripped", (char *)(from->a_url->url_user+1));
|
switch_channel_set_variable(channel, "sip_from_user_stripped", (char *)(from->a_url->url_user+1));
|
||||||
} else {
|
} else {
|
||||||
switch_channel_set_variable(channel, "sip_from_user_stripped", (char *)from->a_url->url_user);
|
switch_channel_set_variable(channel, "sip_from_user_stripped", from->a_url->url_user);
|
||||||
}
|
}
|
||||||
switch_channel_set_variable(channel, "sip_from_host", (char *) from->a_url->url_host);
|
switch_channel_set_variable(channel, "sip_from_host", from->a_url->url_host);
|
||||||
|
|
||||||
|
|
||||||
if (!(from_port = (char *) from->a_url->url_port)) {
|
if (!(from_port = (char *) from->a_url->url_port)) {
|
||||||
|
@ -4349,7 +4349,7 @@ static void sip_i_invite(nua_t *nua,
|
||||||
switch_channel_set_variable(channel, "sip_from_port", from_port);
|
switch_channel_set_variable(channel, "sip_from_port", from_port);
|
||||||
|
|
||||||
|
|
||||||
snprintf(uri, sizeof(uri), "%s@%s:%s", (char *) from->a_url->url_user, (char *) from->a_url->url_host, from_port);
|
snprintf(uri, sizeof(uri), "%s@%s:%s", from->a_url->url_user, from->a_url->url_host, from_port);
|
||||||
switch_channel_set_variable(channel, "sip_from_uri", uri);
|
switch_channel_set_variable(channel, "sip_from_uri", uri);
|
||||||
|
|
||||||
|
|
||||||
|
@ -4373,13 +4373,13 @@ static void sip_i_invite(nua_t *nua,
|
||||||
|
|
||||||
if (profile->pflags & PFLAG_FULL_ID) {
|
if (profile->pflags & PFLAG_FULL_ID) {
|
||||||
if (req_user) {
|
if (req_user) {
|
||||||
if (!(req_username = switch_mprintf("%s@%s:%s", (char *) req_user, (char *) req_host, req_port))) {
|
if (!(req_username = switch_mprintf("%s@%s:%s", req_user, req_host, req_port))) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
|
||||||
switch_safe_free(username);
|
switch_safe_free(username);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!(req_username = switch_mprintf("%s:%s", (char *) req_host, req_port))) {
|
if (!(req_username = switch_mprintf("%s:%s", req_host, req_port))) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
|
||||||
switch_safe_free(username);
|
switch_safe_free(username);
|
||||||
return;
|
return;
|
||||||
|
@ -4398,7 +4398,7 @@ static void sip_i_invite(nua_t *nua,
|
||||||
switch_channel_set_variable(channel, "sip_contact_port", contact_port);
|
switch_channel_set_variable(channel, "sip_contact_port", contact_port);
|
||||||
|
|
||||||
if (!tech_pvt->call_id && sip && sip->sip_call_id && sip->sip_call_id->i_id) {
|
if (!tech_pvt->call_id && sip && sip->sip_call_id && sip->sip_call_id->i_id) {
|
||||||
tech_pvt->call_id = switch_core_session_strdup(session, (char *)sip->sip_call_id->i_id);
|
tech_pvt->call_id = switch_core_session_strdup(session, sip->sip_call_id->i_id);
|
||||||
switch_channel_set_variable(channel, "sip_call_id", tech_pvt->call_id);
|
switch_channel_set_variable(channel, "sip_call_id", tech_pvt->call_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4491,8 +4491,8 @@ static void sip_i_invite(nua_t *nua,
|
||||||
} else if (!strncasecmp(un->un_name, "X-", 2)) {
|
} else if (!strncasecmp(un->un_name, "X-", 2)) {
|
||||||
if (!switch_strlen_zero(un->un_value)) {
|
if (!switch_strlen_zero(un->un_value)) {
|
||||||
char *new_name;
|
char *new_name;
|
||||||
if ((new_name = switch_mprintf("%s%s", SOFIA_SIP_HEADER_PREFIX, (char *)un->un_name))) {
|
if ((new_name = switch_mprintf("%s%s", SOFIA_SIP_HEADER_PREFIX, un->un_name))) {
|
||||||
switch_channel_set_variable(channel, new_name, (char *)un->un_value);
|
switch_channel_set_variable(channel, new_name, un->un_value);
|
||||||
free(new_name);
|
free(new_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -356,7 +356,7 @@ SWITCH_DECLARE(char *) switch_channel_get_name(switch_channel_t *channel)
|
||||||
return channel->name ? channel->name : "N/A";
|
return channel->name ? channel->name : "N/A";
|
||||||
}
|
}
|
||||||
|
|
||||||
SWITCH_DECLARE(switch_status_t) switch_channel_set_variable(switch_channel_t *channel, char *varname, char *value)
|
SWITCH_DECLARE(switch_status_t) switch_channel_set_variable(switch_channel_t *channel, const char *varname, const char *value)
|
||||||
{
|
{
|
||||||
assert(channel != NULL);
|
assert(channel != NULL);
|
||||||
|
|
||||||
|
|
|
@ -1167,33 +1167,33 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess
|
||||||
}
|
}
|
||||||
|
|
||||||
if (switch_core_file_get_string(fh, SWITCH_AUDIO_COL_STR_TITLE, &p) == SWITCH_STATUS_SUCCESS) {
|
if (switch_core_file_get_string(fh, SWITCH_AUDIO_COL_STR_TITLE, &p) == SWITCH_STATUS_SUCCESS) {
|
||||||
title = (char *) switch_core_session_strdup(session, (char *)p);
|
title = switch_core_session_strdup(session, p);
|
||||||
switch_channel_set_variable(channel, "RECORD_TITLE", (char *)p);
|
switch_channel_set_variable(channel, "RECORD_TITLE", p);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (switch_core_file_get_string(fh, SWITCH_AUDIO_COL_STR_COPYRIGHT, &p) == SWITCH_STATUS_SUCCESS) {
|
if (switch_core_file_get_string(fh, SWITCH_AUDIO_COL_STR_COPYRIGHT, &p) == SWITCH_STATUS_SUCCESS) {
|
||||||
copyright = (char *) switch_core_session_strdup(session, (char *)p);
|
copyright = switch_core_session_strdup(session, p);
|
||||||
switch_channel_set_variable(channel, "RECORD_COPYRIGHT", (char *)p);
|
switch_channel_set_variable(channel, "RECORD_COPYRIGHT", p);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (switch_core_file_get_string(fh, SWITCH_AUDIO_COL_STR_SOFTWARE, &p) == SWITCH_STATUS_SUCCESS) {
|
if (switch_core_file_get_string(fh, SWITCH_AUDIO_COL_STR_SOFTWARE, &p) == SWITCH_STATUS_SUCCESS) {
|
||||||
software = (char *) switch_core_session_strdup(session, (char *)p);
|
software = switch_core_session_strdup(session, p);
|
||||||
switch_channel_set_variable(channel, "RECORD_SOFTWARE", (char *)p);
|
switch_channel_set_variable(channel, "RECORD_SOFTWARE", p);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (switch_core_file_get_string(fh, SWITCH_AUDIO_COL_STR_ARTIST, &p) == SWITCH_STATUS_SUCCESS) {
|
if (switch_core_file_get_string(fh, SWITCH_AUDIO_COL_STR_ARTIST, &p) == SWITCH_STATUS_SUCCESS) {
|
||||||
artist = (char *) switch_core_session_strdup(session, (char *)p);
|
artist = switch_core_session_strdup(session, p);
|
||||||
switch_channel_set_variable(channel, "RECORD_ARTIST", (char *)p);
|
switch_channel_set_variable(channel, "RECORD_ARTIST", p);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (switch_core_file_get_string(fh, SWITCH_AUDIO_COL_STR_COMMENT, &p) == SWITCH_STATUS_SUCCESS) {
|
if (switch_core_file_get_string(fh, SWITCH_AUDIO_COL_STR_COMMENT, &p) == SWITCH_STATUS_SUCCESS) {
|
||||||
comment = (char *) switch_core_session_strdup(session, (char *)p);
|
comment = switch_core_session_strdup(session, p);
|
||||||
switch_channel_set_variable(channel, "RECORD_COMMENT", (char *)p);
|
switch_channel_set_variable(channel, "RECORD_COMMENT", p);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (switch_core_file_get_string(fh, SWITCH_AUDIO_COL_STR_DATE, &p) == SWITCH_STATUS_SUCCESS) {
|
if (switch_core_file_get_string(fh, SWITCH_AUDIO_COL_STR_DATE, &p) == SWITCH_STATUS_SUCCESS) {
|
||||||
date = (char *) switch_core_session_strdup(session, (char *)p);
|
date = switch_core_session_strdup(session, p);
|
||||||
switch_channel_set_variable(channel, "RECORD_DATE", (char *)p);
|
switch_channel_set_variable(channel, "RECORD_DATE", p);
|
||||||
}
|
}
|
||||||
#if 0
|
#if 0
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
|
||||||
|
|
Loading…
Reference in New Issue