Skinny: handle early media

See MODSKINNY-8 (switch_core_io.c:121
SKINNY/internal/SEP002699438FB6:0/1 has no read codec when using early
media)
This commit is contained in:
Mathieu Parent 2010-06-17 07:44:33 +02:00
parent df92a3ca07
commit 5017869399
3 changed files with 40 additions and 24 deletions

View File

@ -972,9 +972,12 @@ switch_status_t channel_answer_channel(switch_core_session_t *session)
switch_status_t channel_receive_message(switch_core_session_t *session, switch_core_session_message_t *msg) switch_status_t channel_receive_message(switch_core_session_t *session, switch_core_session_message_t *msg)
{ {
private_t *tech_pvt = switch_core_session_get_private(session);
switch (msg->message_id) { switch (msg->message_id) {
case SWITCH_MESSAGE_INDICATE_ANSWER: case SWITCH_MESSAGE_INDICATE_ANSWER:
{ {
switch_clear_flag_locked(tech_pvt, TFLAG_EARLY_MEDIA);
channel_answer_channel(session); channel_answer_channel(session);
} }
break; break;
@ -982,6 +985,14 @@ switch_status_t channel_receive_message(switch_core_session_t *session, switch_c
{ {
skinny_session_send_call_info_all(session); skinny_session_send_call_info_all(session);
} }
case SWITCH_MESSAGE_INDICATE_PROGRESS:
{
if (!switch_test_flag(tech_pvt, TFLAG_EARLY_MEDIA)) {
/* early media */
switch_set_flag_locked(tech_pvt, TFLAG_EARLY_MEDIA);
channel_answer_channel(session);
}
}
default: default:
break; break;
} }

View File

@ -146,10 +146,11 @@ typedef switch_status_t (*skinny_listener_callback_func_t) (listener_t *listener
/* CHANNEL TYPES */ /* CHANNEL TYPES */
/*****************************************************************************/ /*****************************************************************************/
typedef enum { typedef enum {
TFLAG_IO = (1 << 0), TFLAG_FORCE_ROUTE = (1 << 0),
TFLAG_READING = (1 << 9), TFLAG_EARLY_MEDIA = (1 << 1),
TFLAG_WRITING = (1 << 10), TFLAG_IO = (1 << 2),
TFLAG_FORCE_ROUTE = (1 << 11) TFLAG_READING = (1 << 3),
TFLAG_WRITING = (1 << 4)
} TFLAGS; } TFLAGS;
typedef enum { typedef enum {

View File

@ -698,6 +698,7 @@ switch_status_t skinny_session_start_media(switch_core_session_t *session, liste
channel = switch_core_session_get_channel(session); channel = switch_core_session_get_channel(session);
tech_pvt = switch_core_session_get_private(session); tech_pvt = switch_core_session_get_private(session);
if (!switch_channel_test_flag(channel, CF_EARLY_MEDIA)) {
send_stop_tone(listener, line_instance, tech_pvt->call_id); send_stop_tone(listener, line_instance, tech_pvt->call_id);
send_open_receive_channel(listener, send_open_receive_channel(listener,
tech_pvt->call_id, /* uint32_t conference_id, */ tech_pvt->call_id, /* uint32_t conference_id, */
@ -709,6 +710,8 @@ switch_status_t skinny_session_start_media(switch_core_session_t *session, liste
0, /* uint32_t conference_id2, */ 0, /* uint32_t conference_id2, */
0 /* uint32_t reserved[10] */ 0 /* uint32_t reserved[10] */
); );
}
if (!switch_test_flag(tech_pvt, TFLAG_EARLY_MEDIA)) {
skinny_line_set_state(listener, line_instance, tech_pvt->call_id, SKINNY_CONNECTED); skinny_line_set_state(listener, line_instance, tech_pvt->call_id, SKINNY_CONNECTED);
send_select_soft_keys(listener, line_instance, tech_pvt->call_id, send_select_soft_keys(listener, line_instance, tech_pvt->call_id,
SKINNY_KEY_SET_CONNECTED, 0xffff); SKINNY_KEY_SET_CONNECTED, 0xffff);
@ -717,6 +720,7 @@ switch_status_t skinny_session_start_media(switch_core_session_t *session, liste
SKINNY_DISP_CONNECTED, SKINNY_DISP_CONNECTED,
line_instance, line_instance,
tech_pvt->call_id); tech_pvt->call_id);
}
skinny_session_send_call_info(session, listener, line_instance); skinny_session_send_call_info(session, listener, line_instance);
return SWITCH_STATUS_SUCCESS; return SWITCH_STATUS_SUCCESS;