mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-07-23 04:31:50 +00:00
<refactor>
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4944 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
@@ -1513,6 +1513,9 @@ static switch_status_t channel_receive_message(switch_core_session_t *session, s
|
||||
assert(tech_pvt != NULL);
|
||||
|
||||
switch (msg->message_id) {
|
||||
case SWITCH_MESSAGE_INDICATE_ANSWER:
|
||||
channel_answer_channel(session);
|
||||
break;
|
||||
case SWITCH_MESSAGE_INDICATE_BRIDGE:
|
||||
if (tech_pvt->rtp_session && switch_test_flag(tech_pvt->profile, TFLAG_TIMER)) {
|
||||
switch_rtp_clear_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_USE_TIMER);
|
||||
@@ -1571,7 +1574,6 @@ static const switch_state_handler_table_t channel_event_handlers = {
|
||||
|
||||
static const switch_io_routines_t channel_io_routines = {
|
||||
/*.outgoing_channel */ channel_outgoing_channel,
|
||||
/*.answer_channel */ channel_answer_channel,
|
||||
/*.read_frame */ channel_read_frame,
|
||||
/*.write_frame */ channel_write_frame,
|
||||
/*.kill_channel */ channel_kill_channel,
|
||||
|
||||
@@ -747,6 +747,29 @@ static switch_status_t channel_answer_channel(switch_core_session_t *session)
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
static switch_status_t channel_receive_message(switch_core_session_t *session, switch_core_session_message_t *msg)
|
||||
{
|
||||
switch_channel_t *channel;
|
||||
private_t *tech_pvt;
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
assert(channel != NULL);
|
||||
|
||||
tech_pvt = (private_t *) switch_core_session_get_private(session);
|
||||
assert(tech_pvt != NULL);
|
||||
|
||||
switch (msg->message_id) {
|
||||
case SWITCH_MESSAGE_INDICATE_ANSWER:
|
||||
channel_answer_channel(session);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static const switch_state_handler_table_t channel_event_handlers = {
|
||||
/*.on_init */ channel_on_init,
|
||||
/*.on_ring */ channel_on_ring,
|
||||
@@ -758,13 +781,13 @@ static const switch_state_handler_table_t channel_event_handlers = {
|
||||
|
||||
static const switch_io_routines_t channel_io_routines = {
|
||||
/*.outgoing_channel */ channel_outgoing_channel,
|
||||
/*.answer_channel */ channel_answer_channel,
|
||||
/*.read_frame */ channel_read_frame,
|
||||
/*.write_frame */ channel_write_frame,
|
||||
/*.kill_channel */ channel_kill_channel,
|
||||
/*.waitfor_read */ channel_waitfor_read,
|
||||
/*.waitfor_write */ channel_waitfor_write,
|
||||
/*.send_dtmf */ channel_send_dtmf
|
||||
/*.send_dtmf */ channel_send_dtmf,
|
||||
/*.receive_message*/ channel_receive_message
|
||||
};
|
||||
|
||||
static const switch_endpoint_interface_t channel_endpoint_interface = {
|
||||
|
||||
@@ -718,6 +718,9 @@ static switch_status_t channel_receive_message(switch_core_session_t *session, s
|
||||
|
||||
|
||||
switch (msg->message_id) {
|
||||
case SWITCH_MESSAGE_INDICATE_ANSWER:
|
||||
channel_answer_channel(session);
|
||||
break;
|
||||
case SWITCH_MESSAGE_INDICATE_PROGRESS:
|
||||
{
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Engage Early Media\n");
|
||||
@@ -788,7 +791,6 @@ static const switch_state_handler_table_t channel_event_handlers = {
|
||||
|
||||
static const switch_io_routines_t channel_io_routines = {
|
||||
/*.outgoing_channel */ channel_outgoing_channel,
|
||||
/*.answer_channel */ channel_answer_channel,
|
||||
/*.read_frame */ channel_read_frame,
|
||||
/*.write_frame */ channel_write_frame,
|
||||
/*.kill_channel */ channel_kill_channel,
|
||||
|
||||
@@ -675,9 +675,14 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
|
||||
break;
|
||||
case SWITCH_MESSAGE_INDICATE_RINGING:
|
||||
nua_respond(tech_pvt->nh, SIP_180_RINGING, SIPTAG_CONTACT_STR(tech_pvt->profile->url), TAG_END());
|
||||
switch_channel_mark_ring_ready(channel);
|
||||
break;
|
||||
case SWITCH_MESSAGE_INDICATE_ANSWER:
|
||||
sofia_answer_channel(session);
|
||||
break;
|
||||
case SWITCH_MESSAGE_INDICATE_PROGRESS:{
|
||||
if (!switch_test_flag(tech_pvt, TFLAG_ANS)) {
|
||||
|
||||
switch_set_flag_locked(tech_pvt, TFLAG_EARLY_MEDIA);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Asked to send early media by %s\n", msg->from);
|
||||
|
||||
@@ -708,7 +713,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Ring SDP:\n%s\n", tech_pvt->local_sdp_str);
|
||||
}
|
||||
}
|
||||
|
||||
switch_channel_mark_pre_answered(channel);
|
||||
nua_respond(tech_pvt->nh,
|
||||
SIP_183_SESSION_PROGRESS,
|
||||
SIPTAG_CONTACT_STR(tech_pvt->profile->url),
|
||||
@@ -754,7 +759,6 @@ static switch_status_t sofia_receive_event(switch_core_session_t *session, switc
|
||||
|
||||
static const switch_io_routines_t sofia_io_routines = {
|
||||
/*.outgoing_channel */ sofia_outgoing_channel,
|
||||
/*.answer_channel */ sofia_answer_channel,
|
||||
/*.read_frame */ sofia_read_frame,
|
||||
/*.write_frame */ sofia_write_frame,
|
||||
/*.kill_channel */ sofia_kill_channel,
|
||||
|
||||
@@ -930,6 +930,9 @@ static switch_status_t wanpipe_receive_message(switch_core_session_t *session, s
|
||||
break;
|
||||
case SWITCH_MESSAGE_INDICATE_REDIRECT:
|
||||
break;
|
||||
case SWITCH_MESSAGE_INDICATE_ANSWER:
|
||||
wanpipe_answer_channel(session);
|
||||
break;
|
||||
case SWITCH_MESSAGE_INDICATE_PROGRESS:
|
||||
break;
|
||||
case SWITCH_MESSAGE_INDICATE_RINGING:
|
||||
@@ -969,7 +972,6 @@ static switch_status_t wanpipe_kill_channel(switch_core_session_t *session, int
|
||||
|
||||
static const switch_io_routines_t wanpipe_io_routines = {
|
||||
/*.outgoing_channel */ wanpipe_outgoing_channel,
|
||||
/*.answer_channel */ wanpipe_answer_channel,
|
||||
/*.read_frame */ wanpipe_read_frame,
|
||||
/*.write_frame */ wanpipe_write_frame,
|
||||
/*.kill_channel */ wanpipe_kill_channel,
|
||||
@@ -1422,16 +1424,8 @@ static int on_proceed(struct sangoma_pri *spri, sangoma_pri_event_t event_type,
|
||||
channel = switch_core_session_get_channel(session);
|
||||
assert(channel != NULL);
|
||||
|
||||
if ((msg = malloc(sizeof(*msg)))) {
|
||||
memset(msg, 0, sizeof(*msg));
|
||||
msg->message_id = SWITCH_MESSAGE_INDICATE_PROGRESS;
|
||||
msg->from = __FILE__;
|
||||
switch_core_session_queue_message(session, msg);
|
||||
switch_set_flag(msg, SCSMF_DYNAMIC);
|
||||
switch_channel_mark_pre_answered(channel);
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
|
||||
}
|
||||
switch_core_session_pass_indication(session, SWITCH_MESSAGE_INDICATE_PROGRESS);
|
||||
switch_channel_mark_pre_answered(channel);
|
||||
|
||||
switch_core_session_rwunlock(session);
|
||||
} else {
|
||||
@@ -1457,7 +1451,7 @@ static int on_ringing(struct sangoma_pri *spri, sangoma_pri_event_t event_type,
|
||||
channel = switch_core_session_get_channel(session);
|
||||
assert(channel != NULL);
|
||||
|
||||
switch_core_session_queue_indication(session, SWITCH_MESSAGE_INDICATE_RINGING);
|
||||
switch_core_session_pass_indication(session, SWITCH_MESSAGE_INDICATE_RINGING);
|
||||
switch_channel_mark_ring_ready(channel);
|
||||
|
||||
switch_core_session_rwunlock(session);
|
||||
|
||||
@@ -447,7 +447,6 @@ static const switch_state_handler_table_t woomera_event_handlers = {
|
||||
|
||||
static const switch_io_routines_t woomera_io_routines = {
|
||||
/*.outgoing_channel */ woomera_outgoing_channel,
|
||||
/*.answer_channel */ NULL,
|
||||
/*.read_frame */ woomera_read_frame,
|
||||
/*.write_frame */ woomera_write_frame,
|
||||
/*.kill_channel */ woomera_kill_channel,
|
||||
|
||||
Reference in New Issue
Block a user