提交 64d4d9ea authored 作者: Anthony Minessale's avatar Anthony Minessale

add pickup endpoint and app to dptools add pickup/keyname to forked dial, then…

add pickup endpoint and app to dptools add pickup/keyname to forked dial, then route a call to call app pickup(keyname) to have your channel return from originate. sub to pickup+keyname or presence map the pickup proto to use on blf
上级 5c66ab47
......@@ -1211,6 +1211,7 @@ typedef enum {
CF_SERVICE_VIDEO,
CF_ZRTP_HASH,
CF_ZRTP_PASS,
CF_CHANNEL_SWAP,
/* 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
......
......@@ -1761,6 +1761,20 @@ static int sofia_dialog_probe_callback(void *pArg, int argc, char **argv, char *
remote_user = to_user;
remote_host = local_host;
}
else if (proto && !strcasecmp(proto, "pickup")) {
local_user = to_user;
local_user_param = switch_mprintf(";proto=%s", proto);
event_status = "hold";
if (skip_proto) {
buf_to_free = switch_mprintf("sip:%s", to_user);
} else {
buf_to_free = switch_mprintf("sip:pickup+%s", to_user);
}
remote_uri = buf_to_free;
strcpy(remote_display_buf, "pickup");
remote_user = to_user;
remote_host = local_host;
}
else if (proto && !strcasecmp(proto, "conf")) {
local_user = to_user;
local_user_param = switch_mprintf(";proto=%s", proto);
......@@ -2626,6 +2640,18 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char *
stream.write_function(&stream, "<target uri=\"sip:park+%s\"/>\n", uuid);
}
stream.write_function(&stream, "</remote>\n");
} else if (!strcasecmp(proto, "pickup")) {
stream.write_function(&stream, "<local>\n<identity display=\"pickup\">sip:%s@%s;proto=pickup</identity>\n",
!zstr(clean_to_user) ? clean_to_user : "unknown", host);
stream.write_function(&stream, "<target uri=\"sip:%s@%s;proto=pickup\">\n", !zstr(clean_to_user) ? clean_to_user : "unknown", host);
stream.write_function(&stream, "<param pname=\"+sip.rendering\" pvalue=\"no\"/>\n</target>\n</local>\n");
stream.write_function(&stream, "<remote>\n<identity display=\"pickup\">sip:%s</identity>\n", uuid);
if (skip_proto) {
stream.write_function(&stream, "<target uri=\"sip:%s\"/>\n", uuid);
} else {
stream.write_function(&stream, "<target uri=\"sip:pickup+%s\"/>\n", uuid);
}
stream.write_function(&stream, "</remote>\n");
} else if (!strcasecmp(proto, "conf")) {
stream.write_function(&stream, "<local>\n<identity display=\"conference\">sip:%s@%s;proto=conference</identity>\n",
!zstr(clean_to_user) ? clean_to_user : "unknown", host);
......
......@@ -3541,6 +3541,25 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
if (*bleg) {
switch_channel_t *bchan = switch_core_session_get_channel(*bleg);
if (switch_channel_test_flag(bchan, CF_CHANNEL_SWAP)) {
const char *key = switch_channel_get_variable(bchan, "channel_swap_uuid");
switch_core_session_t *swap_session, *old_session;
if ((swap_session = switch_core_session_locate(key))) {
switch_channel_clear_flag(bchan, CF_CHANNEL_SWAP);
switch_channel_hangup(bchan, SWITCH_CAUSE_PICKED_OFF);
switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(bchan), SWITCH_LOG_DEBUG, "Swapping %s for %s\n",
switch_core_session_get_name(swap_session), switch_channel_get_name(bchan));
old_session = *bleg;
*bleg = swap_session;
bchan = switch_core_session_get_channel(*bleg);
switch_channel_answer(bchan);
switch_core_session_rwunlock(old_session);
}
}
if (session && caller_channel) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论