summaryrefslogtreecommitdiff
path: root/res
diff options
context:
space:
mode:
authorMark Michelson <mmichelson@digium.com>2015-01-07 17:35:27 +0000
committerMark Michelson <mmichelson@digium.com>2015-01-07 17:35:27 +0000
commit9ea8dd036fa79f7884e71b0d1769d9416a3d958a (patch)
tree09e2dbf0d12d9a51ba479ac15551b057a0c69dab /res
parent75cd302b0af6a14d8a7b53330049b34e33aece75 (diff)
Fix ability to perform a remote attended transfer with PJSIP.
This fix has two parts: * Corrected an error message to properly state that external_replaces is an extension. The error message also prints what dialplan context the external_replaces extension was being looked for in. * Corrected the printing of the Replaces: header in an INVITE request. We were duplicating "Replaces: " in the header. ASTERISK-24376 #close Reported by Matt Jordan Review: https://reviewboard.asterisk.org/r/4296 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@430313 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res')
-rw-r--r--res/res_pjsip_refer.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/res/res_pjsip_refer.c b/res/res_pjsip_refer.c
index 1cbbbc0b2..87700ac27 100644
--- a/res/res_pjsip_refer.c
+++ b/res/res_pjsip_refer.c
@@ -599,9 +599,16 @@ static void refer_blind_callback(struct ast_channel *chan, struct transfer_chann
if (refer->replaces) {
char replaces[512];
-
- pjsip_hdr_print_on(refer->replaces, replaces, sizeof(replaces));
- pbx_builtin_setvar_helper(chan, "__SIPREPLACESHDR", S_OR(replaces, NULL));
+ char *replaces_val = NULL;
+ int len;
+
+ len = pjsip_hdr_print_on(refer->replaces, replaces, sizeof(replaces) - 1);
+ if (len != -1) {
+ /* pjsip_hdr_print_on does not NULL terminate the buffer */
+ replaces[len] = '\0';
+ replaces_val = replaces + sizeof("Replaces:");
+ }
+ pbx_builtin_setvar_helper(chan, "__SIPREPLACESHDR", replaces_val);
} else {
pbx_builtin_setvar_helper(chan, "SIPREPLACESHDR", NULL);
}
@@ -674,8 +681,8 @@ static int refer_incoming_attended_request(struct ast_sip_session *session, pjsi
}
if (!ast_exists_extension(NULL, context, "external_replaces", 1, NULL)) {
- ast_log(LOG_ERROR, "Received REFER for remote session on channel '%s' from endpoint '%s' but 'external_replaces' context does not exist for handling\n",
- ast_channel_name(session->channel), ast_sorcery_object_get_id(session->endpoint));
+ ast_log(LOG_ERROR, "Received REFER for remote session on channel '%s' from endpoint '%s' but 'external_replaces' extension not found in context %s\n",
+ ast_channel_name(session->channel), ast_sorcery_object_get_id(session->endpoint), context);
return 404;
}