const char *val = NULL;
val = switch_channel_get_variable(tech_pvt->channel, "disable_q850_reason");
- if (!val || switch_true(val)) {
- if (cause > 0 && cause < 128) {
- switch_snprintf(reason, sizeof(reason), "Q.850;cause=%d;text=\"%s\"", cause, switch_channel_cause2str(cause));
- } else if (cause == SWITCH_CAUSE_PICKED_OFF || cause == SWITCH_CAUSE_LOSE_RACE) {
+
+ if (switch_false(val)) {
+ if (switch_channel_test_flag(channel, CF_INTERCEPT) || cause == SWITCH_CAUSE_PICKED_OFF || cause == SWITCH_CAUSE_LOSE_RACE) {
switch_snprintf(reason, sizeof(reason), "SIP;cause=200;text=\"Call completed elsewhere\"");
+ } else if (cause > 0 && cause < 128) {
+ switch_snprintf(reason, sizeof(reason), "Q.850;cause=%d;text=\"%s\"", cause, switch_channel_cause2str(cause));
} else {
switch_snprintf(reason, sizeof(reason), "%s;cause=%d;text=\"%s\"", tech_pvt->profile->username, cause, switch_channel_cause2str(cause));
}
if (bchannel) {
switch_channel_set_state_flag(bchannel, CF_TRANSFER);
+ switch_channel_set_flag(bchannel, CF_INTERCEPT);
switch_channel_set_state(bchannel, CS_PARK);
}