lord of the rings

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4230 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2007-02-13 15:47:15 +00:00
parent 9a870c5fb6
commit a62d9fd951
8 changed files with 40 additions and 17 deletions

View File

@ -514,6 +514,14 @@ SWITCH_DECLARE (switch_status_t) switch_core_session_message_send(char *uuid_str
*/
SWITCH_DECLARE(switch_status_t) switch_core_session_queue_message(switch_core_session_t *session, switch_core_session_message_t *message);
/*!
\brief Queue an indication message on a session
\param session the session to queue the message to
\param indication the indication message to queue
\return SWITCH_STATUS_SUCCESS if the message was queued
*/
SWITCH_DECLARE(switch_status_t) switch_core_session_queue_indication(switch_core_session_t *session, switch_core_session_message_types_t indication);
/*!
\brief DE-Queue an message on a given session
\param session the session to de-queue the message on

View File

@ -950,6 +950,10 @@ static switch_status_t negotiate_media(switch_core_session_t *session)
started = switch_time_now();
/* jingle has no ringing indication so we will just pretend that we got one */
switch_core_session_queue_indication(session, SWITCH_MESSAGE_INDICATE_RINGING);
switch_channel_mark_ring_ready(channel);
if (switch_test_flag(tech_pvt, TFLAG_OUTBOUND)) {
tech_pvt->next_cand = switch_time_now() + DL_CAND_WAIT;
tech_pvt->next_desc = switch_time_now();

View File

@ -1043,6 +1043,10 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_runtime(void)
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Call accepted.\n");
break;
case IAX_EVENT_RINGA:
if (channel) {
switch_core_session_queue_indication(tech_pvt->session, SWITCH_MESSAGE_INDICATE_RINGING);
switch_channel_mark_ring_ready(channel);
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Ringing heard.\n");
break;
case IAX_EVENT_PONG:

View File

@ -240,6 +240,9 @@ static switch_status_t channel_on_init(switch_core_session_t *session)
}
}
switch_core_session_queue_indication(session, SWITCH_MESSAGE_INDICATE_RINGING);
switch_channel_mark_ring_ready(channel);
while (switch_channel_get_state(channel) == CS_INIT && !switch_test_flag(tech_pvt, TFLAG_ANSWER)) {
if (switch_time_now() - last >= waitsec) {
char buf[512];

View File

@ -2823,14 +2823,7 @@ static void sip_i_state(int status,
}
} else {
switch_core_session_message_t *msg;
if ((msg = malloc(sizeof(*msg)))) {
memset(msg, 0, sizeof(*msg));
msg->message_id = SWITCH_MESSAGE_INDICATE_RINGING;
msg->from = __FILE__;
switch_core_session_queue_message(session, msg);
switch_set_flag(msg, SCSMF_DYNAMIC);
}
switch_core_session_queue_indication(session, SWITCH_MESSAGE_INDICATE_RINGING);
}
}
}

View File

@ -1160,15 +1160,8 @@ static int on_ringing(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_RINGING;
msg->from = __FILE__;
switch_core_session_queue_message(session, msg);
switch_set_flag(msg, SCSMF_DYNAMIC);
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
}
switch_core_session_queue_indication(tech_pvt->session, SWITCH_MESSAGE_INDICATE_RINGING);
switch_channel_mark_ring_ready(channel);
switch_core_session_rwunlock(session);
} else {

View File

@ -1063,6 +1063,8 @@ static void *woomera_channel_thread_run(switch_thread_t *thread, void *obj)
} else if (!strcasecmp(wmsg.command, "PROCEED")) {
/* This packet has lots of info so well keep it */
tech_pvt->call_info = wmsg;
switch_core_session_queue_indication(tech_pvt->session, SWITCH_MESSAGE_INDICATE_RINGING);
switch_channel_mark_ring_ready(channel);
} else if (switch_test_flag(tech_pvt, TFLAG_PARSE_INCOMING) && !strcasecmp(wmsg.command, "INCOMING")) {
char *exten;
char cid_name[512];

View File

@ -1732,6 +1732,22 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_receive_message(switch_core_
return status;
}
SWITCH_DECLARE(switch_status_t) switch_core_session_queue_indication(switch_core_session_t *session, switch_core_session_message_types_t indication)
{
switch_core_session_message_t *msg;
if ((msg = malloc(sizeof(*msg)))) {
memset(msg, 0, sizeof(*msg));
msg->message_id = indication;
msg->from = __FILE__;
switch_core_session_queue_message(session, msg);
switch_set_flag(msg, SCSMF_DYNAMIC);
return SWITCH_STATUS_SUCCESS;
}
return SWITCH_STATUS_FALSE;
}
SWITCH_DECLARE(switch_status_t) switch_core_session_queue_message(switch_core_session_t *session, switch_core_session_message_t *message)
{
switch_status_t status = SWITCH_STATUS_FALSE;