*/
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
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();
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:
}
}
+ 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];
}
} 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);
}
}
}
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 {
} 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];
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;