diff --git a/src/switch_caller.c b/src/switch_caller.c index 1cb6ec517e..ee730380a0 100644 --- a/src/switch_caller.c +++ b/src/switch_caller.c @@ -207,59 +207,59 @@ SWITCH_DECLARE(void) switch_caller_profile_event_set_data(switch_caller_profile_ if (!switch_strlen_zero(caller_profile->username)) { switch_snprintf(header_name, sizeof(header_name), "%s-Username", prefix); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, header_name, "%s", caller_profile->username); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, header_name, caller_profile->username); } if (!switch_strlen_zero(caller_profile->dialplan)) { switch_snprintf(header_name, sizeof(header_name), "%s-Dialplan", prefix); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, header_name, "%s", caller_profile->dialplan); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, header_name, caller_profile->dialplan); } if (!switch_strlen_zero(caller_profile->caller_id_name)) { switch_snprintf(header_name, sizeof(header_name), "%s-Caller-ID-Name", prefix); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, header_name, "%s", caller_profile->caller_id_name); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, header_name, caller_profile->caller_id_name); } if (!switch_strlen_zero(caller_profile->caller_id_number)) { switch_snprintf(header_name, sizeof(header_name), "%s-Caller-ID-Number", prefix); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, header_name, "%s", caller_profile->caller_id_number); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, header_name, caller_profile->caller_id_number); } if (!switch_strlen_zero(caller_profile->network_addr)) { switch_snprintf(header_name, sizeof(header_name), "%s-Network-Addr", prefix); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, header_name, "%s", caller_profile->network_addr); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, header_name, caller_profile->network_addr); } if (!switch_strlen_zero(caller_profile->ani)) { switch_snprintf(header_name, sizeof(header_name), "%s-ANI", prefix); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, header_name, "%s", caller_profile->ani); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, header_name, caller_profile->ani); } if (!switch_strlen_zero(caller_profile->aniii)) { switch_snprintf(header_name, sizeof(header_name), "%s-ANI-II", prefix); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, header_name, "%s", caller_profile->aniii); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, header_name, caller_profile->aniii); } if (!switch_strlen_zero(caller_profile->destination_number)) { switch_snprintf(header_name, sizeof(header_name), "%s-Destination-Number", prefix); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, header_name, "%s", caller_profile->destination_number); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, header_name, caller_profile->destination_number); } if (!switch_strlen_zero(caller_profile->uuid)) { switch_snprintf(header_name, sizeof(header_name), "%s-Unique-ID", prefix); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, header_name, "%s", caller_profile->uuid); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, header_name, caller_profile->uuid); } if (!switch_strlen_zero(caller_profile->source)) { switch_snprintf(header_name, sizeof(header_name), "%s-Source", prefix); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, header_name, "%s", caller_profile->source); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, header_name, caller_profile->source); } if (!switch_strlen_zero(caller_profile->context)) { switch_snprintf(header_name, sizeof(header_name), "%s-Context", prefix); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, header_name, "%s", caller_profile->context); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, header_name, caller_profile->context); } if (!switch_strlen_zero(caller_profile->rdnis)) { switch_snprintf(header_name, sizeof(header_name), "%s-RDNIS", prefix); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, header_name, "%s", caller_profile->rdnis); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, header_name, caller_profile->rdnis); } if (!switch_strlen_zero(caller_profile->chan_name)) { switch_snprintf(header_name, sizeof(header_name), "%s-Channel-Name", prefix); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, header_name, "%s", caller_profile->chan_name); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, header_name, caller_profile->chan_name); } if (!switch_strlen_zero(caller_profile->profile_index)) { switch_snprintf(header_name, sizeof(header_name), "%s-Profile-Index", prefix); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, header_name, "%s", caller_profile->profile_index); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, header_name, caller_profile->profile_index); } if (caller_profile->times) { switch_snprintf(header_name, sizeof(header_name), "%s-Channel-Created-Time", prefix); @@ -273,13 +273,13 @@ SWITCH_DECLARE(void) switch_caller_profile_event_set_data(switch_caller_profile_ } switch_snprintf(header_name, sizeof(header_name), "%s-Screen-Bit", prefix); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, header_name, switch_test_flag(caller_profile, SWITCH_CPF_SCREEN) ? "yes" : "no"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, header_name, switch_test_flag(caller_profile, SWITCH_CPF_SCREEN) ? "yes" : "no"); switch_snprintf(header_name, sizeof(header_name), "%s-Privacy-Hide-Name", prefix); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, header_name, switch_test_flag(caller_profile, SWITCH_CPF_HIDE_NAME) ? "yes" : "no"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, header_name, switch_test_flag(caller_profile, SWITCH_CPF_HIDE_NAME) ? "yes" : "no"); switch_snprintf(header_name, sizeof(header_name), "%s-Privacy-Hide-Number", prefix); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, header_name, switch_test_flag(caller_profile, SWITCH_CPF_HIDE_NUMBER) ? "yes" : "no"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, header_name, switch_test_flag(caller_profile, SWITCH_CPF_HIDE_NUMBER) ? "yes" : "no"); } SWITCH_DECLARE(switch_status_t) switch_caller_extension_clone(switch_caller_extension_t **new_ext, switch_caller_extension_t *orig, diff --git a/src/switch_channel.c b/src/switch_channel.c index 1f6998f58a..4384bb83f1 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -405,18 +405,18 @@ SWITCH_DECLARE(void) switch_channel_presence(switch_channel_t *channel, const ch if (switch_event_create(&event, type) == SWITCH_STATUS_SUCCESS) { switch_channel_event_set_data(channel, event); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "proto", "%s", __FILE__); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "login", "%s", __FILE__); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s", id); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", __FILE__); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "login", __FILE__); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from", id); if (type == SWITCH_EVENT_PRESENCE_IN) { if (!rpid) { rpid = "unknown"; } - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "rpid", "%s", rpid); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "status", "%s", status); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "rpid", rpid); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "status", status); } - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "event_type", "presence"); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "alt_event_type", "dialog"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "event_type", "presence"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "alt_event_type", "dialog"); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "event_count", "%d", channel->event_count++); switch_event_fire(&event); } @@ -552,7 +552,7 @@ SWITCH_DECLARE(switch_status_t) switch_channel_set_variable(switch_channel_t *ch switch_mutex_lock(channel->profile_mutex); switch_event_del_header(channel->variables, varname); if (!switch_strlen_zero(value)) { - switch_event_add_header(channel->variables, SWITCH_STACK_BOTTOM, varname, "%s", value); + switch_event_add_header_string(channel->variables, SWITCH_STACK_BOTTOM, varname, value); } switch_mutex_unlock(channel->profile_mutex); return SWITCH_STATUS_SUCCESS; @@ -576,7 +576,7 @@ SWITCH_DECLARE(switch_status_t) switch_channel_set_variable_partner(switch_chann switch_mutex_lock(tchannel->profile_mutex); switch_event_del_header(tchannel->variables, varname); if (value) { - switch_event_add_header(tchannel->variables, SWITCH_STACK_BOTTOM, varname, "%s", value); + switch_event_add_header_string(tchannel->variables, SWITCH_STACK_BOTTOM, varname, value); } switch_mutex_unlock(tchannel->profile_mutex); switch_core_session_rwunlock(session); @@ -794,18 +794,18 @@ SWITCH_DECLARE(switch_channel_state_t) switch_channel_perform_set_running_state( } else { char state_num[25]; switch_snprintf(state_num, sizeof(state_num), "%d", state); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-State", "%s", (char *) switch_channel_state_name(state)); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-State-Number", "%s", (char *) state_num); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-Name", "%s", channel->name); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Unique-ID", "%s", switch_core_session_get_uuid(channel->session)); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Call-Direction", "%s", + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Channel-State", (char *) switch_channel_state_name(state)); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Channel-State-Number", (char *) state_num); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Channel-Name", channel->name); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Unique-ID", switch_core_session_get_uuid(channel->session)); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Call-Direction", switch_channel_test_flag(channel, CF_OUTBOUND) ? "outbound" : "inbound"); if (switch_channel_test_flag(channel, CF_ANSWERED)) { - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Answer-State", "answered"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Answer-State", "answered"); } else if (switch_channel_test_flag(channel, CF_EARLY_MEDIA)) { - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Answer-State", "early"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Answer-State", "early"); } else { - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Answer-State", "ringing"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Answer-State", "ringing"); } } switch_event_fire(&event); @@ -1043,28 +1043,28 @@ SWITCH_DECLARE(void) switch_channel_event_set_data(switch_channel_t *channel, sw originatee_caller_profile = caller_profile->originatee_caller_profile; } - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-State", "%s", switch_channel_state_name(channel->state)); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Channel-State", switch_channel_state_name(channel->state)); switch_snprintf(state_num, sizeof(state_num), "%d", channel->state); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-State-Number", "%s", state_num); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-Name", "%s", switch_channel_get_name(channel)); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Unique-ID", "%s", switch_core_session_get_uuid(channel->session)); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Channel-State-Number", state_num); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Channel-Name", switch_channel_get_name(channel)); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Unique-ID", switch_core_session_get_uuid(channel->session)); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Call-Direction", "%s", switch_channel_test_flag(channel, CF_OUTBOUND) ? "outbound" : "inbound"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Call-Direction", switch_channel_test_flag(channel, CF_OUTBOUND) ? "outbound" : "inbound"); if (switch_channel_test_flag(channel, CF_ANSWERED)) { - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Answer-State", "answered"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Answer-State", "answered"); } else if (switch_channel_test_flag(channel, CF_EARLY_MEDIA)) { - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Answer-State", "early"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Answer-State", "early"); } else { - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Answer-State", "ringing"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Answer-State", "ringing"); } if ((codec = switch_core_session_get_read_codec(channel->session)) && codec->implementation) { - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-Read-Codec-Name", "%s", switch_str_nil(codec->implementation->iananame)); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Channel-Read-Codec-Name", switch_str_nil(codec->implementation->iananame)); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-Read-Codec-Rate", "%u", codec->implementation->actual_samples_per_second); } if ((codec = switch_core_session_get_write_codec(channel->session)) && codec->implementation) { - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-Write-Codec-Name", "%s", switch_str_nil(codec->implementation->iananame)); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Channel-Write-Codec-Name", switch_str_nil(codec->implementation->iananame)); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-Write-Codec-Rate", "%u", codec->implementation->actual_samples_per_second); } @@ -1100,7 +1100,7 @@ SWITCH_DECLARE(void) switch_channel_event_set_data(switch_channel_t *channel, sw switch_assert(vvar && vval); switch_snprintf(buf, sizeof(buf), "variable_%s", vvar); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, buf, "%s", vval); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, buf, vval); } } switch_mutex_unlock(channel->profile_mutex); @@ -1354,7 +1354,7 @@ SWITCH_DECLARE(switch_channel_state_t) switch_channel_perform_hangup(switch_chan switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_NOTICE, "Hangup %s [%s] [%s]\n", channel->name, state_names[last_state], switch_channel_cause2str(channel->hangup_cause)); if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_HANGUP) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Hangup-Cause", "%s", switch_channel_cause2str(channel->hangup_cause)); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Hangup-Cause", switch_channel_cause2str(channel->hangup_cause)); switch_channel_event_set_data(channel, event); switch_event_fire(&event); } diff --git a/src/switch_console.c b/src/switch_console.c index 259488fd2a..879e834b41 100644 --- a/src/switch_console.c +++ b/src/switch_console.c @@ -291,9 +291,9 @@ SWITCH_DECLARE(void) switch_console_printf(switch_text_channel_t channel, const if (channel == SWITCH_CHANNEL_ID_EVENT && switch_event_running() == SWITCH_STATUS_SUCCESS && switch_event_create(&event, SWITCH_EVENT_LOG) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Log-Data", "%s", data); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Log-File", "%s", filep); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Log-Function", "%s", func); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Log-Data", data); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Log-File", filep); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Log-Function", func); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Log-Line", "%d", line); switch_event_fire(&event); } diff --git a/src/switch_core.c b/src/switch_core.c index ee6ed580e4..b9985db828 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -111,10 +111,10 @@ static void check_ip(void) { if (switch_event_create(&event, SWITCH_EVENT_TRAP) == SWITCH_STATUS_SUCCESS) { switch_event_add_header(event, SWITCH_STACK_BOTTOM, "condition", "network-address-change"); if (!ok4) { - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "network-address-change-v4", "%s", main_ip4); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "network-address-change-v4", main_ip4); } if (!ok6) { - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "network-address-change-v6", "%s", main_ip6); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "network-address-change-v6", main_ip6); } switch_event_fire(&event); } diff --git a/src/switch_core_codec.c b/src/switch_core_codec.c index 1cf1813337..5ce0cca410 100644 --- a/src/switch_core_codec.c +++ b/src/switch_core_codec.c @@ -81,7 +81,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_set_read_codec(switch_core_s if (session->read_codec && session->read_codec->implementation) { if (switch_event_create(&event, SWITCH_EVENT_CODEC) == SWITCH_STATUS_SUCCESS) { switch_channel_event_set_data(session->channel, event); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-read-codec-name", "%s", session->read_codec->implementation->iananame); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "channel-read-codec-name", session->read_codec->implementation->iananame); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-read-codec-rate", "%d", session->read_codec->implementation->actual_samples_per_second); if (session->read_codec->implementation->actual_samples_per_second != session->read_codec->implementation->samples_per_second) { switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-reported-read-codec-rate", "%d", session->read_codec->implementation->samples_per_second); @@ -148,7 +148,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_set_write_codec(switch_core_ if (switch_event_create(&event, SWITCH_EVENT_CODEC) == SWITCH_STATUS_SUCCESS) { switch_channel_event_set_data(session->channel, event); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-write-codec-name", "%s", session->write_codec->implementation->iananame); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "channel-write-codec-name", session->write_codec->implementation->iananame); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-write-codec-rate", "%d", session->write_codec->implementation->actual_samples_per_second); if (session->write_codec->implementation->actual_samples_per_second != session->write_codec->implementation->samples_per_second) { switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-reported-write-codec-rate", "%d", @@ -185,7 +185,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_set_video_read_codec(switch_ if (switch_event_create(&event, SWITCH_EVENT_CODEC) == SWITCH_STATUS_SUCCESS) { switch_channel_event_set_data(session->channel, event); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-video-read-codec-name", "%s", codec->implementation->iananame); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "channel-video-read-codec-name", codec->implementation->iananame); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-video-read-codec-rate", "%d", codec->implementation->actual_samples_per_second); switch_event_fire(&event); } @@ -212,7 +212,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_set_video_write_codec(switch if (switch_event_create(&event, SWITCH_EVENT_CODEC) == SWITCH_STATUS_SUCCESS) { switch_channel_event_set_data(session->channel, event); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-video-write-codec-name", "%s", codec->implementation->iananame); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "channel-video-write-codec-name", codec->implementation->iananame); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-video-write-codec-rate", "%d", codec->implementation->actual_samples_per_second); switch_event_fire(&event); } diff --git a/src/switch_core_session.c b/src/switch_core_session.c index 155c089281..ec99cb02c4 100644 --- a/src/switch_core_session.c +++ b/src/switch_core_session.c @@ -1110,8 +1110,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_exec(switch_core_session_t * if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_EXECUTE) == SWITCH_STATUS_SUCCESS) { switch_channel_event_set_data(session->channel, event); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Application", "%s", application_interface->interface_name); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Application-Data", "%s", arg); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Application", application_interface->interface_name); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Application-Data", arg); switch_event_fire(&event); } @@ -1127,8 +1127,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_exec(switch_core_session_t * if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_EXECUTE_COMPLETE) == SWITCH_STATUS_SUCCESS) { switch_channel_event_set_data(session->channel, event); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Application", "%s", application_interface->interface_name); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Application-Data", "%s", arg); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Application", application_interface->interface_name); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Application-Data", arg); switch_event_fire(&event); } diff --git a/src/switch_event.c b/src/switch_event.c index ce8c4da866..600f34be61 100644 --- a/src/switch_event.c +++ b/src/switch_event.c @@ -554,7 +554,7 @@ SWITCH_DECLARE(switch_status_t) switch_event_create_subclass(switch_event_t **ev SWITCH_DECLARE(switch_status_t) switch_event_set_priority(switch_event_t *event, switch_priority_t priority) { event->priority = priority; - switch_event_add_header(event, SWITCH_STACK_TOP, "priority", "%s", switch_priority_name(priority)); + switch_event_add_header_string(event, SWITCH_STACK_TOP, "priority", switch_priority_name(priority)); return SWITCH_STATUS_SUCCESS; } diff --git a/src/switch_ivr_async.c b/src/switch_ivr_async.c index e2309f4a58..c98a8e88df 100644 --- a/src/switch_ivr_async.c +++ b/src/switch_ivr_async.c @@ -1178,9 +1178,9 @@ static switch_bool_t tone_detect_callback(switch_media_bug_t *bug, void *user_da if (cont->list[i].app) { if (switch_event_create(&event, SWITCH_EVENT_MESSAGE) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "call-command", "execute"); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "execute-app-name", "%s", cont->list[i].app); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "execute-app-arg", "%s", cont->list[i].data); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "call-command", "execute"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "execute-app-name", cont->list[i].app); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "execute-app-arg", cont->list[i].data); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "lead-frames", "%d", 5); switch_core_session_queue_private_event(cont->session, &event); } @@ -1188,7 +1188,7 @@ static switch_bool_t tone_detect_callback(switch_media_bug_t *bug, void *user_da if (switch_event_create(&event, SWITCH_EVENT_DETECTED_TONE) == SWITCH_STATUS_SUCCESS) { switch_event_t *dup; - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Detected-Tone", "%s", cont->list[i].key); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Detected-Tone", cont->list[i].key); if (switch_event_dup(&dup, event) == SWITCH_STATUS_SUCCESS) { switch_event_fire(&dup); @@ -1196,7 +1196,7 @@ static switch_bool_t tone_detect_callback(switch_media_bug_t *bug, void *user_da if (switch_core_session_queue_event(cont->session, &event) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Event queue failed!\n"); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "delivery-failure", "true"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "delivery-failure", "true"); switch_event_fire(&event); } } @@ -1579,10 +1579,10 @@ static void *SWITCH_THREAD_FUNC speech_thread(switch_thread_t *thread, void *obj if (switch_event_create(&event, SWITCH_EVENT_DETECTED_SPEECH) == SWITCH_STATUS_SUCCESS) { if (status == SWITCH_STATUS_SUCCESS) { - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Speech-Type", "detected-speech"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Speech-Type", "detected-speech"); switch_event_add_body(event, "%s", xmlstr); } else { - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Speech-Type", "begin-speaking"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Speech-Type", "begin-speaking"); } if (switch_test_flag(sth->ah, SWITCH_ASR_FLAG_FIRE_EVENTS)) { @@ -1596,7 +1596,7 @@ static void *SWITCH_THREAD_FUNC speech_thread(switch_thread_t *thread, void *obj if (switch_core_session_queue_event(sth->session, &event) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Event queue failed!\n"); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "delivery-failure", "true"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "delivery-failure", "true"); switch_event_fire(&event); } } @@ -2014,16 +2014,16 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_broadcast(const char *uuid, const cha if ((flags & SMF_ECHO_BLEG) && (other_uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE)) && (other_session = switch_core_session_locate(other_uuid))) { if (switch_event_create(&event, SWITCH_EVENT_MESSAGE) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "call-command", "execute"); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "execute-app-name", "%s", app); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "execute-app-arg", "%s", path); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "call-command", "execute"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "execute-app-name", app); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "execute-app-arg", path); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "lead-frames", "%d", 5); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "event-lock", "%s", "true"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "event-lock", "true"); if ((flags & SMF_LOOP)) { switch_event_add_header(event, SWITCH_STACK_BOTTOM, "loops", "%d", -1); } if ((flags & SMF_HOLD_BLEG)) { - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "hold-bleg", "%s", "true"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "hold-bleg", "true"); } switch_core_session_queue_private_event(other_session, &event); @@ -2036,16 +2036,16 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_broadcast(const char *uuid, const cha if ((flags & SMF_ECHO_ALEG)) { if (switch_event_create(&event, SWITCH_EVENT_MESSAGE) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "call-command", "execute"); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "execute-app-name", "%s", app); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "execute-app-arg", "%s", path); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "call-command", "execute"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "execute-app-name", app); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "execute-app-arg", path); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "lead-frames", "%d", 5); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "event-lock", "%s", "true"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "event-lock", "true"); if ((flags & SMF_LOOP)) { switch_event_add_header(event, SWITCH_STACK_BOTTOM, "loops", "%d", -1); } if ((flags & SMF_HOLD_BLEG)) { - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "hold-bleg", "%s", "true"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "hold-bleg", "true"); } switch_core_session_queue_private_event(session, &event); @@ -2055,19 +2055,19 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_broadcast(const char *uuid, const cha if (nomedia) { if (switch_event_create(&event, SWITCH_EVENT_MESSAGE) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "call-command", "nomedia"); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "nomedia-uuid", "%s", uuid); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "event-lock", "%s", "true"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "call-command", "nomedia"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "nomedia-uuid", uuid); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "event-lock", "true"); switch_core_session_queue_private_event(master, &event); } } if (cause) { if (switch_event_create(&event, SWITCH_EVENT_MESSAGE) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "call-command", "execute"); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "execute-app-name", "hangup"); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "execute-app-arg", "%s", cause); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "event-lock", "%s", "true"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "call-command", "execute"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "execute-app-name", "hangup"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "execute-app-arg", cause); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "event-lock", "true"); switch_core_session_queue_private_event(session, &event); } } diff --git a/src/switch_ivr_bridge.c b/src/switch_ivr_bridge.c index 40cd74cf89..92b9009d00 100644 --- a/src/switch_ivr_bridge.c +++ b/src/switch_ivr_bridge.c @@ -511,15 +511,15 @@ static switch_status_t uuid_bridge_on_soft_execute(switch_core_session_t *sessio /* fire events that will change the data table from "show channels" */ if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_EXECUTE) == SWITCH_STATUS_SUCCESS) { switch_channel_event_set_data(channel, event); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Application", "uuid_bridge"); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Application-Data", "%s", switch_core_session_get_uuid(other_session)); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Application", "uuid_bridge"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Application-Data", switch_core_session_get_uuid(other_session)); switch_event_fire(&event); } if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_EXECUTE) == SWITCH_STATUS_SUCCESS) { switch_channel_event_set_data(other_channel, event); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Application", "uuid_bridge"); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Application-Data", "%s", switch_core_session_get_uuid(session)); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Application", "uuid_bridge"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Application-Data", switch_core_session_get_uuid(session)); switch_event_fire(&event); } @@ -638,15 +638,15 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_signal_bridge(switch_core_session_t * /* fire events that will change the data table from "show channels" */ if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_EXECUTE) == SWITCH_STATUS_SUCCESS) { switch_channel_event_set_data(caller_channel, event); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Application", "signal_bridge"); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Application-Data", "%s", switch_core_session_get_uuid(peer_session)); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Application", "signal_bridge"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Application-Data", switch_core_session_get_uuid(peer_session)); switch_event_fire(&event); } if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_EXECUTE) == SWITCH_STATUS_SUCCESS) { switch_channel_event_set_data(peer_channel, event); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Application", "signal_bridge"); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Application-Data", "%s", switch_core_session_get_uuid(session)); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Application", "signal_bridge"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Application-Data", switch_core_session_get_uuid(session)); switch_event_fire(&event); } diff --git a/src/switch_ivr_originate.c b/src/switch_ivr_originate.c index da70856851..20a62d3c34 100644 --- a/src/switch_ivr_originate.c +++ b/src/switch_ivr_originate.c @@ -628,7 +628,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess } if (ok) { - switch_event_add_header(var_event, SWITCH_STACK_BOTTOM, (char *) hi->name, "%s", (char *) hi->value); + switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, (char *) hi->name, (char *) hi->value); } } switch_channel_variable_last(caller_channel); @@ -638,7 +638,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess for (; hi; hi = switch_hash_next(hi)) { switch_hash_this(hi, &vvar, NULL, &vval); if (vvar && vval) { - switch_event_add_header(var_event, SWITCH_STACK_BOTTOM, (void *) vvar, "%s", (char *) vval); + switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, (void *) vvar, (char *) vval); } } switch_channel_variable_last(caller_channel); @@ -658,7 +658,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess if ((inner_var_count = switch_separate_string(var_array[x], '=', inner_var_array, (sizeof(inner_var_array) / sizeof(inner_var_array[0])))) == 2) { - switch_event_add_header(var_event, SWITCH_STACK_BOTTOM, inner_var_array[0], "%s", inner_var_array[1]); + switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, inner_var_array[0], inner_var_array[1]); } } } diff --git a/src/switch_loadable_module.c b/src/switch_loadable_module.c index 43a810bedb..bf33c3de81 100644 --- a/src/switch_loadable_module.c +++ b/src/switch_loadable_module.c @@ -139,8 +139,8 @@ static switch_status_t switch_loadable_module_process(char *key, switch_loadable switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Adding Endpoint '%s'\n", ptr->interface_name); switch_core_hash_insert(loadable_modules.endpoint_hash, ptr->interface_name, (const void *) ptr); if (switch_event_create(&event, SWITCH_EVENT_MODULE_LOAD) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "type", "%s", "endpoint"); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "name", "%s", ptr->interface_name); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "type", "endpoint"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "name", ptr->interface_name); switch_event_fire(&event); } } @@ -182,8 +182,8 @@ static switch_status_t switch_loadable_module_process(char *key, switch_loadable } } if (switch_event_create(&event, SWITCH_EVENT_MODULE_LOAD) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "type", "%s", "codec"); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "name", "%s", ptr->interface_name); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "type", "codec"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "name", ptr->interface_name); switch_event_fire(&event); } } @@ -200,8 +200,8 @@ static switch_status_t switch_loadable_module_process(char *key, switch_loadable } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Adding Dialplan '%s'\n", ptr->interface_name); if (switch_event_create(&event, SWITCH_EVENT_MODULE_LOAD) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "type", "%s", "dialplan"); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "name", "%s", ptr->interface_name); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "type", "dialplan"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "name", ptr->interface_name); switch_event_fire(&event); } switch_core_hash_insert(loadable_modules.dialplan_hash, ptr->interface_name, (const void *) ptr); @@ -218,8 +218,8 @@ static switch_status_t switch_loadable_module_process(char *key, switch_loadable } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Adding Timer '%s'\n", ptr->interface_name); if (switch_event_create(&event, SWITCH_EVENT_MODULE_LOAD) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "type", "%s", "timer"); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "name", "%s", ptr->interface_name); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "type", "timer"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "name", ptr->interface_name); switch_event_fire(&event); } switch_core_hash_insert(loadable_modules.timer_hash, ptr->interface_name, (const void *) ptr); @@ -236,10 +236,10 @@ static switch_status_t switch_loadable_module_process(char *key, switch_loadable } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Adding Application '%s'\n", ptr->interface_name); if (switch_event_create(&event, SWITCH_EVENT_MODULE_LOAD) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "type", "%s", "application"); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "name", "%s", ptr->interface_name); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "description", "%s", switch_str_nil(ptr->short_desc)); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "syntax", "%s", switch_str_nil(ptr->syntax)); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "type", "application"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "name", ptr->interface_name); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "description", switch_str_nil(ptr->short_desc)); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "syntax", switch_str_nil(ptr->syntax)); switch_event_fire(&event); } switch_core_hash_insert(loadable_modules.application_hash, ptr->interface_name, (const void *) ptr); @@ -256,10 +256,10 @@ static switch_status_t switch_loadable_module_process(char *key, switch_loadable } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Adding API Function '%s'\n", ptr->interface_name); if (switch_event_create(&event, SWITCH_EVENT_MODULE_LOAD) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "type", "%s", "api"); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "name", "%s", ptr->interface_name); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "description", "%s", switch_str_nil(ptr->desc)); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "syntax", "%s", switch_str_nil(ptr->syntax)); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "type", "api"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "name", ptr->interface_name); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "description", switch_str_nil(ptr->desc)); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "syntax", switch_str_nil(ptr->syntax)); switch_event_fire(&event); } switch_core_hash_insert(loadable_modules.api_hash, ptr->interface_name, (const void *) ptr); @@ -278,8 +278,8 @@ static switch_status_t switch_loadable_module_process(char *key, switch_loadable for (i = 0; ptr->extens[i]; i++) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Adding File Format '%s'\n", ptr->extens[i]); if (switch_event_create(&event, SWITCH_EVENT_MODULE_LOAD) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "type", "%s", "file"); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "name", "%s", ptr->extens[i]); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "type", "file"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "name", ptr->extens[i]); switch_event_fire(&event); } switch_core_hash_insert(loadable_modules.file_hash, ptr->extens[i], (const void *) ptr); @@ -297,8 +297,8 @@ static switch_status_t switch_loadable_module_process(char *key, switch_loadable } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Adding Speech interface '%s'\n", ptr->interface_name); if (switch_event_create(&event, SWITCH_EVENT_MODULE_LOAD) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "type", "%s", "speech"); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "name", "%s", ptr->interface_name); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "type", "speech"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "name", ptr->interface_name); switch_event_fire(&event); } switch_core_hash_insert(loadable_modules.speech_hash, ptr->interface_name, (const void *) ptr); @@ -315,8 +315,8 @@ static switch_status_t switch_loadable_module_process(char *key, switch_loadable } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Adding ASR interface '%s'\n", ptr->interface_name); if (switch_event_create(&event, SWITCH_EVENT_MODULE_LOAD) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "type", "%s", "asr"); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "name", "%s", ptr->interface_name); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "type", "asr"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "name", ptr->interface_name); switch_event_fire(&event); } switch_core_hash_insert(loadable_modules.asr_hash, ptr->interface_name, (const void *) ptr); @@ -333,8 +333,8 @@ static switch_status_t switch_loadable_module_process(char *key, switch_loadable } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Adding Directory interface '%s'\n", ptr->interface_name); if (switch_event_create(&event, SWITCH_EVENT_MODULE_LOAD) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "type", "%s", "directory"); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "name", "%s", ptr->interface_name); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "type", "directory"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "name", ptr->interface_name); switch_event_fire(&event); } switch_core_hash_insert(loadable_modules.directory_hash, ptr->interface_name, (const void *) ptr); @@ -351,8 +351,8 @@ static switch_status_t switch_loadable_module_process(char *key, switch_loadable } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Adding Chat interface '%s'\n", ptr->interface_name); if (switch_event_create(&event, SWITCH_EVENT_MODULE_LOAD) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "type", "%s", "chat"); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "name", "%s", ptr->interface_name); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "type", "chat"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "name", ptr->interface_name); switch_event_fire(&event); } switch_core_hash_insert(loadable_modules.chat_hash, ptr->interface_name, (const void *) ptr); @@ -369,8 +369,8 @@ static switch_status_t switch_loadable_module_process(char *key, switch_loadable } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Adding Say interface '%s'\n", ptr->interface_name); if (switch_event_create(&event, SWITCH_EVENT_MODULE_LOAD) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "type", "%s", "say"); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "name", "%s", ptr->interface_name); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "type", "say"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "name", ptr->interface_name); switch_event_fire(&event); } switch_core_hash_insert(loadable_modules.say_hash, ptr->interface_name, (const void *) ptr); @@ -393,8 +393,8 @@ static switch_status_t switch_loadable_module_process(char *key, switch_loadable "Adding Management interface '%s' OID[%s.%s]\n", key, FREESWITCH_OID_PREFIX, ptr->relative_oid); switch_core_hash_insert(loadable_modules.management_hash, ptr->relative_oid, (const void *) ptr); if (switch_event_create(&event, SWITCH_EVENT_MODULE_LOAD) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "type", "%s", "management"); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "name", "%s", ptr->relative_oid); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "type", "management"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "name", ptr->relative_oid); switch_event_fire(&event); } } @@ -456,8 +456,8 @@ static switch_status_t switch_loadable_module_unprocess(switch_loadable_module_t } } if (switch_event_create(&event, SWITCH_EVENT_MODULE_UNLOAD) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "type", "%s", "codec"); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "name", "%s", ptr->interface_name); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "type", "codec"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "name", ptr->interface_name); switch_event_fire(&event); } } @@ -472,8 +472,8 @@ static switch_status_t switch_loadable_module_unprocess(switch_loadable_module_t if (ptr->interface_name) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Deleting Dialplan '%s'\n", ptr->interface_name); if (switch_event_create(&event, SWITCH_EVENT_MODULE_UNLOAD) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "type", "%s", "dialplan"); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "name", "%s", ptr->interface_name); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "type", "dialplan"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "name", ptr->interface_name); switch_event_fire(&event); } switch_core_hash_delete(loadable_modules.dialplan_hash, ptr->interface_name); @@ -488,8 +488,8 @@ static switch_status_t switch_loadable_module_unprocess(switch_loadable_module_t if (ptr->interface_name) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Deleting Timer '%s'\n", ptr->interface_name); if (switch_event_create(&event, SWITCH_EVENT_MODULE_UNLOAD) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "type", "%s", "timer"); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "name", "%s", ptr->interface_name); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "type", "timer"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "name", ptr->interface_name); switch_event_fire(&event); } switch_core_hash_delete(loadable_modules.timer_hash, ptr->interface_name); @@ -508,10 +508,10 @@ static switch_status_t switch_loadable_module_unprocess(switch_loadable_module_t switch_thread_rwlock_unlock(ptr->rwlock); if (switch_event_create(&event, SWITCH_EVENT_MODULE_UNLOAD) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "type", "%s", "application"); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "name", "%s", ptr->interface_name); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "description", "%s", switch_str_nil(ptr->short_desc)); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "syntax", "%s", switch_str_nil(ptr->syntax)); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "type", "application"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "name", ptr->interface_name); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "description", switch_str_nil(ptr->short_desc)); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "syntax", switch_str_nil(ptr->syntax)); switch_event_fire(&event); } switch_core_hash_delete(loadable_modules.application_hash, ptr->interface_name); @@ -531,10 +531,10 @@ static switch_status_t switch_loadable_module_unprocess(switch_loadable_module_t switch_thread_rwlock_unlock(ptr->rwlock); if (switch_event_create(&event, SWITCH_EVENT_MODULE_UNLOAD) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "type", "%s", "api"); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "name", "%s", ptr->interface_name); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "description", "%s", switch_str_nil(ptr->desc)); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "syntax", "%s", switch_str_nil(ptr->syntax)); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "type", "api"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "name", ptr->interface_name); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "description", switch_str_nil(ptr->desc)); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "syntax", switch_str_nil(ptr->syntax)); switch_event_fire(&event); } switch_core_hash_delete(loadable_modules.api_hash, ptr->interface_name); @@ -551,8 +551,8 @@ static switch_status_t switch_loadable_module_unprocess(switch_loadable_module_t for (i = 0; ptr->extens[i]; i++) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Deleting File Format '%s'\n", ptr->extens[i]); if (switch_event_create(&event, SWITCH_EVENT_MODULE_UNLOAD) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "type", "%s", "file"); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "name", "%s", ptr->extens[i]); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "type", "file"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "name", ptr->extens[i]); switch_event_fire(&event); } switch_core_hash_delete(loadable_modules.file_hash, ptr->extens[i]); @@ -568,8 +568,8 @@ static switch_status_t switch_loadable_module_unprocess(switch_loadable_module_t if (ptr->interface_name) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Deleting Speech interface '%s'\n", ptr->interface_name); if (switch_event_create(&event, SWITCH_EVENT_MODULE_UNLOAD) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "type", "%s", "speech"); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "name", "%s", ptr->interface_name); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "type", "speech"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "name", ptr->interface_name); switch_event_fire(&event); } switch_core_hash_delete(loadable_modules.speech_hash, ptr->interface_name); @@ -584,8 +584,8 @@ static switch_status_t switch_loadable_module_unprocess(switch_loadable_module_t if (ptr->interface_name) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Deleting Asr interface '%s'\n", ptr->interface_name); if (switch_event_create(&event, SWITCH_EVENT_MODULE_UNLOAD) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "type", "%s", "asr"); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "name", "%s", ptr->interface_name); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "type", "asr"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "name", ptr->interface_name); switch_event_fire(&event); } switch_core_hash_delete(loadable_modules.asr_hash, ptr->interface_name); @@ -600,8 +600,8 @@ static switch_status_t switch_loadable_module_unprocess(switch_loadable_module_t if (ptr->interface_name) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Deleting Directory interface '%s'\n", ptr->interface_name); if (switch_event_create(&event, SWITCH_EVENT_MODULE_UNLOAD) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "type", "%s", "directory"); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "name", "%s", ptr->interface_name); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "type", "directory"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "name", ptr->interface_name); switch_event_fire(&event); } switch_core_hash_delete(loadable_modules.directory_hash, ptr->interface_name); @@ -617,8 +617,8 @@ static switch_status_t switch_loadable_module_unprocess(switch_loadable_module_t if (ptr->interface_name) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Deleting Chat interface '%s'\n", ptr->interface_name); if (switch_event_create(&event, SWITCH_EVENT_MODULE_UNLOAD) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "type", "%s", "chat"); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "name", "%s", ptr->interface_name); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "type", "chat"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "name", ptr->interface_name); switch_event_fire(&event); } switch_core_hash_delete(loadable_modules.chat_hash, ptr->interface_name); @@ -633,8 +633,8 @@ static switch_status_t switch_loadable_module_unprocess(switch_loadable_module_t if (ptr->interface_name) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Deleting Say interface '%s'\n", ptr->interface_name); if (switch_event_create(&event, SWITCH_EVENT_MODULE_UNLOAD) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "type", "%s", "say"); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "name", "%s", ptr->interface_name); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "type", "say"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "name", ptr->interface_name); switch_event_fire(&event); } switch_core_hash_delete(loadable_modules.say_hash, ptr->interface_name); @@ -651,8 +651,8 @@ static switch_status_t switch_loadable_module_unprocess(switch_loadable_module_t "Deleting Management interface '%s' OID[%s.%s]\n", old_module->key, FREESWITCH_OID_PREFIX, ptr->relative_oid); switch_core_hash_delete(loadable_modules.management_hash, ptr->relative_oid); if (switch_event_create(&event, SWITCH_EVENT_MODULE_UNLOAD) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "type", "%s", "management"); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "name", "%s", ptr->relative_oid); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "type", "management"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "name", ptr->relative_oid); switch_event_fire(&event); } } @@ -1389,10 +1389,10 @@ SWITCH_DECLARE(switch_status_t) switch_api_execute(const char *cmd, const char * if (stream->param_event) { if (cmd) { - switch_event_add_header(stream->param_event, SWITCH_STACK_BOTTOM, "API-Command", "%s", cmd); + switch_event_add_header_string(stream->param_event, SWITCH_STACK_BOTTOM, "API-Command", cmd); } if (arg) { - switch_event_add_header(stream->param_event, SWITCH_STACK_BOTTOM, "API-Command-Argument", "%s", arg); + switch_event_add_header_string(stream->param_event, SWITCH_STACK_BOTTOM, "API-Command-Argument", arg); } } diff --git a/src/switch_log.c b/src/switch_log.c index 94095ce749..084c7c8eac 100644 --- a/src/switch_log.c +++ b/src/switch_log.c @@ -293,9 +293,9 @@ SWITCH_DECLARE(void) switch_log_printf(switch_text_channel_t channel, const char if (channel == SWITCH_CHANNEL_ID_EVENT) { switch_event_t *event; if (switch_event_running() == SWITCH_STATUS_SUCCESS && switch_event_create(&event, SWITCH_EVENT_LOG) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Log-Data", "%s", data); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Log-File", "%s", filep); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Log-Function", "%s", funcp); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Log-Data", data); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Log-File", filep); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Log-Function", funcp); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Log-Line", "%d", line); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Log-Level", "%d", (int) level); switch_event_fire(&event); diff --git a/src/switch_scheduler.c b/src/switch_scheduler.c index 1c7537544a..23b4c96d1b 100644 --- a/src/switch_scheduler.c +++ b/src/switch_scheduler.c @@ -64,16 +64,16 @@ static void switch_scheduler_execute(switch_scheduler_task_container_t *tp) tp->executed = 0; if (switch_event_create(&event, SWITCH_EVENT_RE_SCHEDULE) == SWITCH_STATUS_SUCCESS) { switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Task-ID", "%u", tp->task.task_id); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Task-Desc", "%s", tp->desc); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Task-Group", "%s", switch_str_nil(tp->task.group)); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Task-Desc", tp->desc); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Task-Group", switch_str_nil(tp->task.group)); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Task-Runtime", "%" SWITCH_INT64_T_FMT, tp->task.runtime); switch_event_fire(&event); } } else { if (switch_event_create(&event, SWITCH_EVENT_DEL_SCHEDULE) == SWITCH_STATUS_SUCCESS) { switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Task-ID", "%u", tp->task.task_id); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Task-Desc", "%s", tp->desc); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Task-Group", "%s", switch_str_nil(tp->task.group)); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Task-Desc", tp->desc); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Task-Group", switch_str_nil(tp->task.group)); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Task-Runtime", "%" SWITCH_INT64_T_FMT, tp->task.runtime); switch_event_fire(&event); } @@ -216,8 +216,8 @@ SWITCH_DECLARE(uint32_t) switch_scheduler_add_task(time_t task_runtime, if (switch_event_create(&event, SWITCH_EVENT_ADD_SCHEDULE) == SWITCH_STATUS_SUCCESS) { switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Task-ID", "%u", tp->task.task_id); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Task-Desc", "%s", tp->desc); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Task-Group", "%s", switch_str_nil(tp->task.group)); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Task-Desc", tp->desc); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Task-Group", switch_str_nil(tp->task.group)); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Task-Runtime", "%" SWITCH_INT64_T_FMT, tp->task.runtime); switch_event_fire(&event); } @@ -241,8 +241,8 @@ SWITCH_DECLARE(uint32_t) switch_scheduler_del_task_id(uint32_t task_id) tp->destroyed++; if (switch_event_create(&event, SWITCH_EVENT_DEL_SCHEDULE) == SWITCH_STATUS_SUCCESS) { switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Task-ID", "%u", tp->task.task_id); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Task-Desc", "%s", tp->desc); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Task-Group", "%s", switch_str_nil(tp->task.group)); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Task-Desc", tp->desc); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Task-Group", switch_str_nil(tp->task.group)); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Task-Runtime", "%" SWITCH_INT64_T_FMT, tp->task.runtime); switch_event_fire(&event); } @@ -271,8 +271,8 @@ SWITCH_DECLARE(uint32_t) switch_scheduler_del_task_group(const char *group) } if (switch_event_create(&event, SWITCH_EVENT_DEL_SCHEDULE) == SWITCH_STATUS_SUCCESS) { switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Task-ID", "%u", tp->task.task_id); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Task-Desc", "%s", tp->desc); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Task-Group", "%s", switch_str_nil(tp->task.group)); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Task-Desc", tp->desc); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Task-Group", switch_str_nil(tp->task.group)); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Task-Runtime", "%" SWITCH_INT64_T_FMT, tp->task.runtime); switch_event_fire(&event); }