diff --git a/src/mod/endpoints/mod_rtmp/mod_rtmp.c b/src/mod/endpoints/mod_rtmp/mod_rtmp.c index 5247074762..6b5bc862c9 100644 --- a/src/mod/endpoints/mod_rtmp/mod_rtmp.c +++ b/src/mod/endpoints/mod_rtmp/mod_rtmp.c @@ -625,7 +625,7 @@ switch_call_cause_t rtmp_outgoing_channel(switch_core_session_t *session, switch /*switch_channel_mark_pre_answered(channel);*/ switch_channel_ring_ready(channel); - rtmp_send_incoming_call(*newsession); + rtmp_send_incoming_call(*newsession, var_event); switch_channel_set_state(channel, CS_INIT); switch_set_flag_locked(tech_pvt, TFLAG_IO); diff --git a/src/mod/endpoints/mod_rtmp/mod_rtmp.h b/src/mod/endpoints/mod_rtmp/mod_rtmp.h index 388afeacb5..6109c8544e 100644 --- a/src/mod/endpoints/mod_rtmp/mod_rtmp.h +++ b/src/mod/endpoints/mod_rtmp/mod_rtmp.h @@ -616,7 +616,7 @@ switch_status_t rtmp_send_message(rtmp_session_t *rsession, uint8_t amfnumber, u void rtmp_send_event(rtmp_session_t *rsession, switch_event_t *event); void rtmp_notify_call_state(switch_core_session_t *session); void rtmp_send_display_update(switch_core_session_t *session); -void rtmp_send_incoming_call(switch_core_session_t *session); +void rtmp_send_incoming_call(switch_core_session_t *session, switch_event_t *var_event); void rtmp_send_onhangup(switch_core_session_t *session); void rtmp_add_registration(rtmp_session_t *rsession, const char *auth, const char *nickname); void rtmp_clear_registration(rtmp_session_t *rsession, const char *auth, const char *nickname); diff --git a/src/mod/endpoints/mod_rtmp/rtmp.c b/src/mod/endpoints/mod_rtmp/rtmp.c index f28f518383..a5224719e6 100644 --- a/src/mod/endpoints/mod_rtmp/rtmp.c +++ b/src/mod/endpoints/mod_rtmp/rtmp.c @@ -357,6 +357,25 @@ void rtmp_get_user_variables(switch_event_t **event, switch_core_session_t *sess } } + +void rtmp_get_user_variables_event(switch_event_t **event, switch_event_t *var_event) +{ + switch_event_header_t *he; + + if (!*event && switch_event_create(event, SWITCH_EVENT_CLONE) != SWITCH_STATUS_SUCCESS) { + return; + } + + if ((he = var_event->headers)) { + for (; he; he = he->next) { + if (!strncmp(he->name, RTMP_USER_VARIABLE_PREFIX, strlen(RTMP_USER_VARIABLE_PREFIX))) { + switch_event_add_header_string(*event, SWITCH_STACK_BOTTOM, he->name, he->value); + } + } + } +} + + void rtmp_session_send_onattach(rtmp_session_t *rsession) { const char *uuid = ""; @@ -386,7 +405,7 @@ void rtmp_send_display_update(switch_core_session_t *session) amf0_str(switch_str_nil(tech_pvt->display_callee_id_number)), NULL); } -void rtmp_send_incoming_call(switch_core_session_t *session) +void rtmp_send_incoming_call(switch_core_session_t *session, switch_event_t *var_event) { rtmp_private_t *tech_pvt = switch_core_session_get_private(session); switch_channel_t *channel = switch_core_session_get_channel(session); @@ -394,7 +413,11 @@ void rtmp_send_incoming_call(switch_core_session_t *session) switch_event_t *event = NULL; amf0_data *obj = NULL; - rtmp_get_user_variables(&event, session); + if (var_event) { + rtmp_get_user_variables_event(&event, var_event); + } else { + rtmp_get_user_variables(&event, session); + } if (event) { amf_event_to_object(&obj, event);