switch_core_session_get_partner(session, &orig_session);
- if (orig_session) {
+ if (orig_session && !switch_channel_test_flag(session->channel, CF_ANSWERED)) {
switch_core_media_set_smode(smh->session, SWITCH_MEDIA_TYPE_AUDIO,
switch_core_session_remote_media_flow(orig_session, SWITCH_MEDIA_TYPE_AUDIO), sdp_type);
switch_core_media_set_smode(smh->session, SWITCH_MEDIA_TYPE_VIDEO,
}
+SWITCH_DECLARE(void) switch_ivr_check_hold(switch_core_session_t *session)
+{
+ switch_channel_t *channel = switch_core_session_get_channel(session);
+ switch_media_flow_t flow;
+
+ if (switch_channel_test_flag(channel, CF_ANSWERED) &&
+ (flow = switch_core_session_media_flow(session, SWITCH_MEDIA_TYPE_AUDIO)) != SWITCH_MEDIA_FLOW_SENDRECV) {
+ switch_core_session_message_t msg = { 0 };
+
+ msg.message_id = SWITCH_MESSAGE_INDICATE_MEDIA_RENEG;
+ msg.from = __FILE__;
+
+ switch_core_media_set_smode(session, SWITCH_MEDIA_TYPE_AUDIO, SWITCH_MEDIA_FLOW_SENDRECV, SDP_TYPE_REQUEST);
+ switch_core_session_receive_message(session, &msg);
+ }
+
+ if (switch_channel_test_flag(channel, CF_HOLD)) {
+ switch_ivr_unhold(session);
+ }
+}
SWITCH_DECLARE(switch_status_t) switch_ivr_session_transfer(switch_core_session_t *session, const char *extension, const char *dialplan,
const char *context)
const char *forwardvar = switch_channel_get_variable(channel, forwardvar_name);
int forwardval = 70;
const char *use_dialplan = dialplan, *use_context = context;
- switch_media_flow_t flow;
if (zstr(forwardvar)) {
forwardvar_name = SWITCH_MAX_FORWARDS_VARIABLE; /* fall back to max_forwards variable for setting maximum */
return SWITCH_STATUS_FALSE;
}
- if (switch_channel_test_flag(channel, CF_ANSWERED) &&
- (flow = switch_core_session_media_flow(session, SWITCH_MEDIA_TYPE_AUDIO)) != SWITCH_MEDIA_FLOW_SENDRECV) {
- switch_core_session_message_t msg = { 0 };
-
- msg.message_id = SWITCH_MESSAGE_INDICATE_MEDIA_RENEG;
- msg.from = __FILE__;
-
- switch_core_media_set_smode(session, SWITCH_MEDIA_TYPE_AUDIO, SWITCH_MEDIA_FLOW_SENDRECV, SDP_TYPE_REQUEST);
- switch_core_session_receive_message(session, &msg);
- }
+ switch_ivr_check_hold(session);
+
max_forwards = switch_core_session_sprintf(session, "%d", forwardval);
switch_channel_set_variable(channel, forwardvar_name, max_forwards);
originator_channel = switch_core_session_get_channel(originator_session);
originatee_channel = switch_core_session_get_channel(originatee_session);
+ switch_ivr_check_hold(originator_session);
+ switch_ivr_check_hold(originatee_session);
+
if (switch_channel_test_flag(originator_channel, CF_LEG_HOLDING)) {
switch_channel_set_flag(originator_channel, CF_HOLD_ON_BRIDGE);