Update the outgoing channel handler so it passes the "var_event" event down towards rtmp_send_incoming_call since variables passed using originate are not yet in the session before the outgoing channel function returns.

This commit is contained in:
Mathieu Rene 2012-05-22 14:00:39 -04:00
parent fb790bc320
commit a5cd951c53
3 changed files with 27 additions and 4 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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);