make it so when you put someone on hold and then they attended transfer you, the resulting bridge will still be playing hold music
This commit is contained in:
parent
6644cefb20
commit
d48e3de7c8
|
@ -1255,6 +1255,7 @@ typedef enum {
|
|||
CF_NO_CDR,
|
||||
CF_EARLY_OK,
|
||||
CF_MEDIA_TRANS,
|
||||
CF_HOLD_ON_BRIDGE,
|
||||
/* WARNING: DO NOT ADD ANY FLAGS BELOW THIS LINE */
|
||||
/* IF YOU ADD NEW ONES CHECK IF THEY SHOULD PERSIST OR ZERO THEM IN switch_core_session.c switch_core_session_request_xml() */
|
||||
CF_FLAG_MAX
|
||||
|
|
|
@ -2456,25 +2456,31 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
|
|||
|
||||
case SWITCH_MESSAGE_INDICATE_HOLD:
|
||||
{
|
||||
sofia_set_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
|
||||
switch_channel_set_flag(channel, CF_LEG_HOLDING);
|
||||
sofia_glue_do_invite(session);
|
||||
if (!zstr(msg->string_arg)) {
|
||||
char message[256] = "";
|
||||
const char *ua = switch_channel_get_variable(tech_pvt->channel, "sip_user_agent");
|
||||
|
||||
if (ua && switch_stristr("snom", ua)) {
|
||||
snprintf(message, sizeof(message), "From:\r\nTo: \"%s\" %s\r\n", msg->string_arg, tech_pvt->caller_profile->destination_number);
|
||||
nua_info(tech_pvt->nh, SIPTAG_CONTENT_TYPE_STR("message/sipfrag"),
|
||||
TAG_IF(!zstr(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)), SIPTAG_PAYLOAD_STR(message), TAG_END());
|
||||
} else if (ua && switch_stristr("polycom", ua)) {
|
||||
snprintf(message, sizeof(message), "P-Asserted-Identity: \"%s\" <%s>", msg->string_arg, tech_pvt->caller_profile->destination_number);
|
||||
nua_update(tech_pvt->nh,
|
||||
NUTAG_SESSION_TIMER(tech_pvt->session_timeout),
|
||||
NUTAG_SESSION_REFRESHER(tech_pvt->session_refresher),
|
||||
TAG_IF(!zstr(tech_pvt->route_uri), NUTAG_PROXY(tech_pvt->route_uri)),
|
||||
TAG_IF(!zstr_buf(message), SIPTAG_HEADER_STR(message)),
|
||||
TAG_IF(!zstr(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)), TAG_END());
|
||||
if (msg->numeric_arg) {
|
||||
sofia_glue_toggle_hold(tech_pvt, 1);
|
||||
} else {
|
||||
|
||||
sofia_set_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
|
||||
switch_channel_set_flag(channel, CF_LEG_HOLDING);
|
||||
sofia_glue_do_invite(session);
|
||||
if (!zstr(msg->string_arg)) {
|
||||
char message[256] = "";
|
||||
const char *ua = switch_channel_get_variable(tech_pvt->channel, "sip_user_agent");
|
||||
|
||||
if (ua && switch_stristr("snom", ua)) {
|
||||
snprintf(message, sizeof(message), "From:\r\nTo: \"%s\" %s\r\n", msg->string_arg, tech_pvt->caller_profile->destination_number);
|
||||
nua_info(tech_pvt->nh, SIPTAG_CONTENT_TYPE_STR("message/sipfrag"),
|
||||
TAG_IF(!zstr(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)), SIPTAG_PAYLOAD_STR(message), TAG_END());
|
||||
} else if (ua && switch_stristr("polycom", ua)) {
|
||||
snprintf(message, sizeof(message), "P-Asserted-Identity: \"%s\" <%s>", msg->string_arg, tech_pvt->caller_profile->destination_number);
|
||||
nua_update(tech_pvt->nh,
|
||||
NUTAG_SESSION_TIMER(tech_pvt->session_timeout),
|
||||
NUTAG_SESSION_REFRESHER(tech_pvt->session_refresher),
|
||||
TAG_IF(!zstr(tech_pvt->route_uri), NUTAG_PROXY(tech_pvt->route_uri)),
|
||||
TAG_IF(!zstr_buf(message), SIPTAG_HEADER_STR(message)),
|
||||
TAG_IF(!zstr(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)), TAG_END());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -316,7 +316,16 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj)
|
|||
if ((b_state = switch_channel_down_nosig(chan_b))) {
|
||||
goto end_of_bridge_loop;
|
||||
}
|
||||
|
||||
|
||||
if (switch_channel_test_flag(chan_a, CF_HOLD_ON_BRIDGE)) {
|
||||
switch_core_session_message_t hmsg = { 0 };
|
||||
switch_channel_clear_flag(chan_a, CF_HOLD_ON_BRIDGE);
|
||||
hmsg.message_id = SWITCH_MESSAGE_INDICATE_HOLD;
|
||||
hmsg.from = __FILE__;
|
||||
hmsg.numeric_arg = 1;
|
||||
switch_core_session_receive_message(session_a, &hmsg);
|
||||
}
|
||||
|
||||
if (read_frame_count > DEFAULT_LEAD_FRAMES && switch_channel_media_ack(chan_a) && switch_core_session_private_event_count(session_a)) {
|
||||
switch_channel_set_flag(chan_b, CF_SUSPEND);
|
||||
msg.numeric_arg = 42;
|
||||
|
@ -1556,6 +1565,16 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_uuid_bridge(const char *originator_uu
|
|||
originatee_channel = switch_core_session_get_channel(originatee_session);
|
||||
|
||||
|
||||
if (switch_channel_test_flag(originator_channel, CF_LEG_HOLDING)) {
|
||||
switch_channel_set_flag(originator_channel, CF_HOLD_ON_BRIDGE);
|
||||
}
|
||||
|
||||
if (switch_channel_test_flag(originatee_channel, CF_LEG_HOLDING)) {
|
||||
switch_channel_set_flag(originatee_channel, CF_HOLD_ON_BRIDGE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (switch_channel_direction(originatee_channel) == SWITCH_CALL_DIRECTION_OUTBOUND && !switch_channel_test_flag(originatee_channel, CF_DIALPLAN)) {
|
||||
switch_channel_flip_cid(originatee_channel);
|
||||
switch_channel_set_flag(originatee_channel, CF_DIALPLAN);
|
||||
|
|
Loading…
Reference in New Issue