Author: mmichelson
Date: Wed Jan  7 11:35:27 2015
New Revision: 430313

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=430313
Log:
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


Modified:
    branches/13/res/res_pjsip_refer.c

Modified: branches/13/res/res_pjsip_refer.c
URL: 
http://svnview.digium.com/svn/asterisk/branches/13/res/res_pjsip_refer.c?view=diff&rev=430313&r1=430312&r2=430313
==============================================================================
--- branches/13/res/res_pjsip_refer.c (original)
+++ branches/13/res/res_pjsip_refer.c Wed Jan  7 11:35:27 2015
@@ -599,9 +599,16 @@
 
        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 @@
                }
 
                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;
                }
 


-- 
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

svn-commits mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/svn-commits

Reply via email to