}
sofia_set_flag_locked(tech_pvt, TFLAG_SENT_UPDATE);
- switch_channel_set_flag(channel, CF_REQ_MEDIA);
+
+ if (!switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
+ switch_channel_set_flag(channel, CF_REQ_MEDIA);
+ }
sofia_glue_do_invite(session);
}
break;
sofia_glue_set_image_sdp(tech_pvt, t38_options, msg->numeric_arg);
- switch_channel_set_flag(channel, CF_REQ_MEDIA);
+ if (!switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
+ switch_channel_set_flag(channel, CF_REQ_MEDIA);
+ }
sofia_set_flag_locked(tech_pvt, TFLAG_SENT_UPDATE);
sofia_glue_do_invite(session);
}
sofia_glue_set_local_sdp(tech_pvt, NULL, 0, NULL, 1);
if (send_invite) {
- switch_channel_set_flag(channel, CF_REQ_MEDIA);
+ if (!switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
+ switch_channel_set_flag(channel, CF_REQ_MEDIA);
+ }
sofia_glue_do_invite(session);
} else {
status = SWITCH_STATUS_FALSE;
{
sofia_dispatch_event_t *de;
- if (event == nua_r_invite && status >= 900) {
- return;
- }
-
switch_mutex_lock(profile->flag_mutex);
profile->queued_events++;
switch_caller_profile_t *caller_profile = NULL;
int has_t38 = 0;
+ switch_channel_clear_flag(channel, CF_REQ_MEDIA);
+
+ if (status >= 900) {
+ switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "%s status %d received.\n",
+ switch_channel_get_name(channel), status);
+ return;
+ }
+
sofia_glue_get_addr(de->data->e_msg, network_ip, sizeof(network_ip), &network_port);
switch_channel_set_variable_printf(channel, "sip_local_network_addr", "%s", profile->extsipip ? profile->extsipip : profile->sipip);
caller_profile->network_addr = switch_core_strdup(caller_profile->pool, network_ip);
}
- switch_channel_clear_flag(channel, CF_REQ_MEDIA);
-
tech_pvt->last_sdp_str = NULL;
if (!sofia_use_soa(tech_pvt) && sip->sip_payload && sip->sip_payload->pl_data) {
tech_pvt->last_sdp_str = switch_core_session_strdup(session, sip->sip_payload->pl_data);
if (switch_channel_test_flag(channel, CF_INTERCEPT)) {
switch_channel_hangup(channel, SWITCH_CAUSE_PICKED_OFF);
} else {
- switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
+ if (!switch_channel_test_flag(channel, CF_ANSWERED)) {
+ switch_channel_hangup(channel, SWITCH_CAUSE_ORIGINATOR_CANCEL);
+ } else {
+ switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
+ }
}
}
}
switch_channel_test_flag(peer_channel, CF_RING_READY)) {
const char *app, *data;
+ if (switch_channel_get_state(peer_channel) == CS_CONSUME_MEDIA) {
+ switch_channel_set_state(peer_channel, CS_RESET);
+ switch_channel_wait_for_state(peer_channel, caller_channel, CS_RESET);
+ }
+
+ if (!switch_channel_ready(caller_channel)) {
+ switch_call_cause_t cause = switch_channel_get_cause(caller_channel);
+
+ if (cause) {
+ switch_channel_hangup(peer_channel, cause);
+ goto done;
+ }
+ }
+
+
switch_channel_set_state(peer_channel, CS_CONSUME_MEDIA);
switch_channel_set_variable(peer_channel, "call_uuid", switch_core_session_get_uuid(session));
-
+
if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_BRIDGE) == SWITCH_STATUS_SUCCESS) {
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Bridge-A-Unique-ID", switch_core_session_get_uuid(session));
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Bridge-B-Unique-ID", switch_core_session_get_uuid(peer_session));
if (*bleg) {
switch_channel_t *bchan = switch_core_session_get_channel(*bleg);
+ if (switch_channel_get_state(bchan) == CS_CONSUME_MEDIA) {
+ switch_channel_set_state(bchan, CS_RESET);
+ switch_channel_wait_for_state(bchan, caller_channel, CS_RESET);
+ }
+
if (session && caller_channel) {
switch_caller_profile_t *cloned_profile, *peer_profile = switch_channel_get_caller_profile(switch_core_session_get_channel(*bleg));