From abbe42fcd3e4dcab240b09e48e40e407229e5aec Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 25 May 2010 14:16:32 -0500 Subject: [PATCH] add indications so gateway mode calls show up as bridged -take 2 --- src/mod/applications/mod_fax/mod_fax.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/mod/applications/mod_fax/mod_fax.c b/src/mod/applications/mod_fax/mod_fax.c index 6e67fdfeb6..d907da9d51 100644 --- a/src/mod/applications/mod_fax/mod_fax.c +++ b/src/mod/applications/mod_fax/mod_fax.c @@ -1447,6 +1447,7 @@ static switch_status_t t38_gateway_on_soft_execute(switch_core_session_t *sessio switch_core_session_message_t msg = { 0 }; switch_status_t status; switch_frame_t *read_frame = { 0 }; + switch_event_t *event; if (!(other_session = switch_core_session_locate(peer_uuid))) { switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); @@ -1465,6 +1466,11 @@ static switch_status_t t38_gateway_on_soft_execute(switch_core_session_t *sessio msg.string_arg = peer_uuid; switch_core_session_receive_message(session, &msg); + if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_BRIDGE) == SWITCH_STATUS_SUCCESS) { + switch_channel_event_set_data(channel, event); + switch_event_fire(&event); + } + while (switch_channel_ready(channel) && switch_channel_up(other_channel) && !switch_channel_test_app_flag(channel, CF_APP_T38)) { status = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0); @@ -1543,6 +1549,11 @@ static switch_status_t t38_gateway_on_soft_execute(switch_core_session_t *sessio msg.string_arg = peer_uuid; switch_core_session_receive_message(session, &msg); + if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_UNBRIDGE) == SWITCH_STATUS_SUCCESS) { + switch_channel_event_set_data(channel, event); + switch_event_fire(&event); + } + switch_channel_hangup(other_channel, SWITCH_CAUSE_NORMAL_CLEARING); switch_core_session_rwunlock(other_session); @@ -1573,6 +1584,7 @@ static switch_status_t t38_gateway_on_consume_media(switch_core_session_t *sessi char *trace_read, *trace_write; zap_socket_t read_fd = FAX_INVALID_SOCKET, write_fd = FAX_INVALID_SOCKET; switch_core_session_message_t msg = { 0 }; + switch_event_t *event; switch_core_session_get_read_impl(session, &read_impl); @@ -1590,6 +1602,11 @@ static switch_status_t t38_gateway_on_consume_media(switch_core_session_t *sessi msg.string_arg = peer_uuid; switch_core_session_receive_message(session, &msg); + if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_BRIDGE) == SWITCH_STATUS_SUCCESS) { + switch_channel_event_set_data(channel, event); + switch_event_fire(&event); + } + while (switch_channel_ready(channel) && switch_channel_up(other_channel) && !switch_channel_test_app_flag(channel, CF_APP_T38)) { status = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0); @@ -1729,6 +1746,12 @@ static switch_status_t t38_gateway_on_consume_media(switch_core_session_t *sessi msg.string_arg = peer_uuid; switch_core_session_receive_message(session, &msg); + + if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_UNBRIDGE) == SWITCH_STATUS_SUCCESS) { + switch_channel_event_set_data(channel, event); + switch_event_fire(&event); + } + if (read_fd != FAX_INVALID_SOCKET) { close(read_fd); read_fd = FAX_INVALID_SOCKET;