From 2350b6d2a97c5b64dfd63ca3ad5f60425b641ff8 Mon Sep 17 00:00:00 2001 From: Wenpeng Song <wenpeng.song@iopsys.eu> Date: Thu, 10 Apr 2025 12:19:20 +0000 Subject: [PATCH] Some changes for external call transfer, REF 16135 - Add Require=replaces, user=phone into Refer-To header field - Remove to-tag, from-tag, from Refer-To:replaces Note that the changes only make the test move forward a bit. But external transfer as a feature still does NOT work after this commit. The reason to accept this partial change is that it has been pushed into the customer's git repo and we have to keep the code synchronised. --- channels/chan_pjsip.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/channels/chan_pjsip.c b/channels/chan_pjsip.c index c10369635b..92772e60b6 100644 --- a/channels/chan_pjsip.c +++ b/channels/chan_pjsip.c @@ -2173,9 +2173,10 @@ static void sip_build_replaces_param(const struct ast_channel *ast, const char * // Create URI encoded Replaces parameter // ?Replaces=<callid>;to-tag=<totag>;from-tag=<fromtag> - snprintf(replaces, len - 1, "%s;to-tag=%s;from-tag=%s", callid, totag, fromtag); + // snprintf(replaces, len - 1, "%s;to-tag=%s;from-tag=%s", callid, totag, fromtag); + snprintf(replaces, len - 1, "%s", callid); ast_uri_encode(replaces, tmp, sizeof(tmp), ast_uri_http); - snprintf(replaces, len - 1, "?Replaces=%s", tmp); + snprintf(replaces, len - 1, "?Require=replaces&Replaces=%s", tmp); } else { ast_log(LOG_NOTICE, "Asked to replace a call on channel type %s\n", type); @@ -2247,7 +2248,8 @@ static void transfer_refer(struct ast_sip_session *session, const char *target) goto failure; } - snprintf(referto, sizeof(referto), "<%s:%s@%s%s>", method, target, session->endpoint->fromdomain, replaces); + //snprintf(referto, sizeof(referto), "<%s:%s@%s%s>", method, target, session->endpoint->fromdomain, replaces); + snprintf(referto, sizeof(referto), "<%s:%s@%s;user=phone%s>", method, target, session->endpoint->fromdomain, replaces); ast_debug(1, "Refer-To: %s\n", referto); if (pjsip_xfer_initiate(sub, pj_cstr(&tmp, referto), &packet) != PJ_SUCCESS) { -- GitLab