Skinny: correct early media and answer
- SWITCH_MESSAGE_INDICATE_DISPLAY was missing a "break" statement - handle not responding device (cancels early media or answer) - don't send messages when listener is not ready (fix rare crashes)
This commit is contained in:
parent
4e82098307
commit
20194286a4
|
@ -957,10 +957,16 @@ switch_status_t channel_answer_channel(switch_core_session_t *session)
|
||||||
switch_channel_get_variable(channel, "skinny_device_name"),
|
switch_channel_get_variable(channel, "skinny_device_name"),
|
||||||
atoi(switch_channel_get_variable(channel, "skinny_device_instance")), &listener);
|
atoi(switch_channel_get_variable(channel, "skinny_device_instance")), &listener);
|
||||||
if (listener) {
|
if (listener) {
|
||||||
|
int x = 0;
|
||||||
skinny_session_start_media(session, listener, atoi(switch_channel_get_variable(channel, "skinny_line_instance")));
|
skinny_session_start_media(session, listener, atoi(switch_channel_get_variable(channel, "skinny_line_instance")));
|
||||||
/* Wait for media */
|
/* Wait for media */
|
||||||
while(!switch_test_flag(tech_pvt, TFLAG_IO)) {
|
while(!switch_test_flag(tech_pvt, TFLAG_IO)) {
|
||||||
switch_cond_next();
|
switch_cond_next();
|
||||||
|
if (++x > 1000) {
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Wait tooo long to answer %s:%s\n",
|
||||||
|
switch_channel_get_variable(channel, "skinny_device_name"), switch_channel_get_variable(channel, "skinny_device_instance"));
|
||||||
|
return SWITCH_STATUS_FALSE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Unable to find listener to answer %s:%s\n",
|
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Unable to find listener to answer %s:%s\n",
|
||||||
|
@ -976,28 +982,26 @@ switch_status_t channel_receive_message(switch_core_session_t *session, switch_c
|
||||||
|
|
||||||
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);
|
||||||
switch_clear_flag_locked(tech_pvt, TFLAG_EARLY_MEDIA);
|
return channel_answer_channel(session);
|
||||||
channel_answer_channel(session);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case SWITCH_MESSAGE_INDICATE_DISPLAY:
|
case SWITCH_MESSAGE_INDICATE_DISPLAY:
|
||||||
{
|
skinny_session_send_call_info_all(session);
|
||||||
skinny_session_send_call_info_all(session);
|
return SWITCH_STATUS_SUCCESS;
|
||||||
}
|
|
||||||
case SWITCH_MESSAGE_INDICATE_PROGRESS:
|
case SWITCH_MESSAGE_INDICATE_PROGRESS:
|
||||||
{
|
if (!switch_test_flag(tech_pvt, TFLAG_EARLY_MEDIA)) {
|
||||||
if (!switch_test_flag(tech_pvt, TFLAG_EARLY_MEDIA)) {
|
/* early media */
|
||||||
/* early media */
|
switch_set_flag_locked(tech_pvt, TFLAG_EARLY_MEDIA);
|
||||||
switch_set_flag_locked(tech_pvt, TFLAG_EARLY_MEDIA);
|
return channel_answer_channel(session);
|
||||||
channel_answer_channel(session);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
return SWITCH_STATUS_SUCCESS;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return SWITCH_STATUS_SUCCESS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Make sure when you have 2 sessions in the same scope that you pass the appropriate one to the routines
|
/* Make sure when you have 2 sessions in the same scope that you pass the appropriate one to the routines
|
||||||
|
|
|
@ -914,13 +914,19 @@ switch_status_t skinny_perform_send_reply(listener_t *listener, const char *file
|
||||||
len = reply->length+8;
|
len = reply->length+8;
|
||||||
ptr = (char *) reply;
|
ptr = (char *) reply;
|
||||||
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_DEBUG,
|
if (listener_is_ready(listener)) {
|
||||||
"Sending %s (type=%x,length=%d) to %s:%d.\n",
|
switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_DEBUG,
|
||||||
skinny_message_type2str(reply->type), reply->type, reply->length,
|
"Sending %s (type=%x,length=%d) to %s:%d.\n",
|
||||||
listener->device_name, listener->device_instance);
|
skinny_message_type2str(reply->type), reply->type, reply->length,
|
||||||
switch_socket_send(listener->sock, ptr, &len);
|
listener->device_name, listener->device_instance);
|
||||||
|
return switch_socket_send(listener->sock, ptr, &len);
|
||||||
return SWITCH_STATUS_SUCCESS;
|
} else {
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_WARNING,
|
||||||
|
"Not sending %s (type=%x,length=%d) to %s:%d while not ready.\n",
|
||||||
|
skinny_message_type2str(reply->type), reply->type, reply->length,
|
||||||
|
listener->device_name, listener->device_instance);
|
||||||
|
return SWITCH_STATUS_FALSE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* For Emacs:
|
/* For Emacs:
|
||||||
|
|
Loading…
Reference in New Issue