forked from Mirrors/freeswitch
update
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@7779 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
552d9c2d7e
commit
7088c57a25
@ -1507,8 +1507,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_dptools_load)
|
||||
SWITCH_ADD_APP(app_interface, "strftime", NULL, NULL, strftime_function, NULL, SAF_SUPPORT_NOMEDIA);
|
||||
SWITCH_ADD_APP(app_interface, "phrase", "Say a Phrase", "Say a Phrase", phrase_function, "<macro_name>,<data>", SAF_NONE);
|
||||
SWITCH_ADD_APP(app_interface, "eval", "Do Nothing", "Do Nothing", eval_function, "", SAF_SUPPORT_NOMEDIA);
|
||||
SWITCH_ADD_APP(app_interface, "pre_answer", "Pre-Answer the call", "Pre-Answer the call for a channel.", pre_answer_function, "", SAF_SUPPORT_NOMEDIA);
|
||||
SWITCH_ADD_APP(app_interface, "answer", "Answer the call", "Answer the call for a channel.", answer_function, "", SAF_SUPPORT_NOMEDIA);
|
||||
SWITCH_ADD_APP(app_interface, "pre_answer", "Pre-Answer the call", "Pre-Answer the call for a channel.", pre_answer_function, "", SAF_NONE);
|
||||
SWITCH_ADD_APP(app_interface, "answer", "Answer the call", "Answer the call for a channel.", answer_function, "", SAF_NONE);
|
||||
SWITCH_ADD_APP(app_interface, "hangup", "Hangup the call", "Hangup the call for a channel.", hangup_function, "[<cause>]", SAF_SUPPORT_NOMEDIA);
|
||||
SWITCH_ADD_APP(app_interface, "set_name", "Name the channel", "Name the channel", set_name_function, "<name>", SAF_SUPPORT_NOMEDIA);
|
||||
SWITCH_ADD_APP(app_interface, "log", "Logs a channel variable", LOG_LONG_DESC, log_function, "<varname>", SAF_SUPPORT_NOMEDIA);
|
||||
|
@ -712,13 +712,6 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (msg->message_id == SWITCH_MESSAGE_INDICATE_ANSWER || msg->message_id == SWITCH_MESSAGE_INDICATE_PROGRESS) {
|
||||
const char *var;
|
||||
if ((var = switch_channel_get_variable(channel, SOFIA_SECURE_MEDIA_VARIABLE)) && switch_true(var)) {
|
||||
switch_set_flag_locked(tech_pvt, TFLAG_SECURE);
|
||||
}
|
||||
}
|
||||
|
||||
switch (msg->message_id) {
|
||||
case SWITCH_MESSAGE_INDICATE_VIDEO_REFRESH_REQ:
|
||||
{
|
||||
@ -794,10 +787,26 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
|
||||
|
||||
case SWITCH_MESSAGE_INDICATE_MEDIA:
|
||||
{
|
||||
uint32_t count = 0;
|
||||
|
||||
uint32_t count = 0, send_invite = 1;
|
||||
|
||||
switch_channel_clear_flag(channel, CF_PROXY_MODE);
|
||||
tech_pvt->local_sdp_str = NULL;
|
||||
|
||||
if (!switch_channel_media_ready(channel)) {
|
||||
if (!switch_channel_test_flag(tech_pvt->channel, CF_OUTBOUND)) {
|
||||
const char *r_sdp = switch_channel_get_variable(channel, SWITCH_R_SDP_VARIABLE);
|
||||
|
||||
tech_pvt->num_codecs = 0;
|
||||
sofia_glue_tech_prepare_codecs(tech_pvt);
|
||||
if (sofia_glue_tech_media(tech_pvt, r_sdp) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "CODEC NEGOTIATION ERROR");
|
||||
status = SWITCH_STATUS_FALSE;
|
||||
goto end;
|
||||
}
|
||||
send_invite = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (!switch_rtp_ready(tech_pvt->rtp_session)) {
|
||||
sofia_glue_tech_prepare_codecs(tech_pvt);
|
||||
if ((status = sofia_glue_tech_choose_port(tech_pvt, 0)) != SWITCH_STATUS_SUCCESS) {
|
||||
@ -806,20 +815,22 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
|
||||
}
|
||||
}
|
||||
sofia_glue_set_local_sdp(tech_pvt, NULL, 0, NULL, 1);
|
||||
sofia_glue_do_invite(session);
|
||||
|
||||
/* wait for rtp to start and first real frame to arrive */
|
||||
tech_pvt->read_frame.datalen = 0;
|
||||
while (switch_test_flag(tech_pvt, TFLAG_IO) && switch_channel_get_state(channel) < CS_HANGUP && !switch_rtp_ready(tech_pvt->rtp_session)) {
|
||||
if (++count > 1000) {
|
||||
status = SWITCH_STATUS_FALSE;
|
||||
goto end;
|
||||
if (send_invite) {
|
||||
sofia_glue_do_invite(session);
|
||||
/* wait for rtp to start and first real frame to arrive */
|
||||
tech_pvt->read_frame.datalen = 0;
|
||||
while (switch_test_flag(tech_pvt, TFLAG_IO) && switch_channel_get_state(channel) < CS_HANGUP && !switch_rtp_ready(tech_pvt->rtp_session)) {
|
||||
if (++count > 1000) {
|
||||
status = SWITCH_STATUS_FALSE;
|
||||
goto end;
|
||||
}
|
||||
if (!switch_rtp_ready(tech_pvt->rtp_session)) {
|
||||
switch_yield(1000);
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (!switch_rtp_ready(tech_pvt->rtp_session)) {
|
||||
switch_yield(1000);
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -1422,11 +1422,18 @@ switch_status_t sofia_glue_activate_rtp(private_object_t *tech_pvt, switch_rtp_f
|
||||
uint32_t rtp_timeout_sec = tech_pvt->profile->rtp_timeout_sec;
|
||||
uint32_t rtp_hold_timeout_sec = tech_pvt->profile->rtp_hold_timeout_sec;
|
||||
char *timer_name;
|
||||
const char *var;
|
||||
|
||||
switch_assert(tech_pvt != NULL);
|
||||
|
||||
switch_core_session_signal_lock(tech_pvt->session);
|
||||
|
||||
|
||||
if ((var = switch_channel_get_variable(tech_pvt->channel, SOFIA_SECURE_MEDIA_VARIABLE)) && switch_true(var)) {
|
||||
switch_set_flag_locked(tech_pvt, TFLAG_SECURE);
|
||||
}
|
||||
|
||||
|
||||
if (switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MODE)) {
|
||||
status = SWITCH_STATUS_SUCCESS;
|
||||
goto end;
|
||||
|
@ -137,8 +137,7 @@ static void switch_core_standard_on_execute(switch_core_session_t *session)
|
||||
|
||||
while (switch_channel_get_state(session->channel) == CS_EXECUTE && extension->current_application) {
|
||||
char *expanded = NULL;
|
||||
int nomedia = 0;
|
||||
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Execute %s(%s)\n", switch_channel_get_name(session->channel),
|
||||
extension->current_application->application_name, switch_str_nil(extension->current_application->application_data));
|
||||
if ((application_interface = switch_loadable_module_get_application_interface(extension->current_application->application_name)) == 0) {
|
||||
@ -155,7 +154,6 @@ static void switch_core_standard_on_execute(switch_core_session_t *session)
|
||||
|
||||
if (switch_channel_test_flag(session->channel, CF_PROXY_MODE) && !switch_test_flag(application_interface, SAF_SUPPORT_NOMEDIA)) {
|
||||
switch_ivr_media(session->uuid_str, SMF_NONE);
|
||||
nomedia++;
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Application %s Requires media on channel %s!\n",
|
||||
extension->current_application->application_name, switch_channel_get_name(session->channel));
|
||||
} else if (!switch_test_flag(application_interface, SAF_SUPPORT_NOMEDIA) && !switch_channel_media_ready(session->channel)) {
|
||||
@ -189,12 +187,6 @@ static void switch_core_standard_on_execute(switch_core_session_t *session)
|
||||
goto top;
|
||||
}
|
||||
|
||||
if (nomedia) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Application %s Releasing media\n",
|
||||
extension->current_application->application_name);
|
||||
switch_ivr_nomedia(session->uuid_str, SMF_NONE);
|
||||
}
|
||||
|
||||
extension->current_application = extension->current_application->next;
|
||||
}
|
||||
|
||||
|
@ -496,7 +496,7 @@ static switch_status_t signal_bridge_on_hangup(switch_core_session_t *session)
|
||||
switch_core_session_t *other_session;
|
||||
switch_event_t *event;
|
||||
|
||||
if (switch_channel_test_flag(channel, CF_ORIGINATOR)) {
|
||||
if (switch_channel_test_flag(channel, CF_ORIGINATOR)) {
|
||||
switch_channel_clear_flag(channel, CF_ORIGINATOR);
|
||||
if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_UNBRIDGE) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_channel_event_set_data(channel, event);
|
||||
@ -514,17 +514,10 @@ static switch_status_t signal_bridge_on_hangup(switch_core_session_t *session)
|
||||
switch_channel_set_variable(channel, SWITCH_BRIDGE_VARIABLE, NULL);
|
||||
switch_channel_set_variable(other_channel, SWITCH_BRIDGE_VARIABLE, NULL);
|
||||
|
||||
assert (!switch_channel_test_flag(other_channel, CF_TRANSFER));
|
||||
if (switch_channel_get_state(other_channel) < CS_HANGUP) {
|
||||
switch_channel_hangup(other_channel, switch_channel_get_cause(channel));
|
||||
}
|
||||
|
||||
if (!switch_channel_test_flag(other_channel, CF_TRANSFER)) {
|
||||
if (switch_channel_test_flag(other_channel, CF_ANSWERED) &&
|
||||
switch_channel_get_state(other_channel) < CS_HANGUP &&
|
||||
switch_true(switch_channel_get_variable(other_channel, SWITCH_HANGUP_AFTER_BRIDGE_VARIABLE))) {
|
||||
switch_channel_hangup(other_channel, switch_channel_get_cause(channel));
|
||||
} else {
|
||||
switch_channel_set_state(other_channel, CS_EXECUTE);
|
||||
}
|
||||
}
|
||||
switch_core_session_rwunlock(other_session);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user