fixes sip native transfer
authorDavid Vossel <dvossel@digium.com>
Wed, 5 May 2010 19:13:57 +0000 (19:13 +0000)
committerDavid Vossel <dvossel@digium.com>
Wed, 5 May 2010 19:13:57 +0000 (19:13 +0000)
The Refer-To header field containing the Replaces header in the URI
was not being decoded properly.  This caused invalid parsing between
the caller id field and the domain resulting in a failed transfer.

(closes issue #17284)
Reported by: dvossel

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@261316 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_sip.c

index 876ca36..3f83425 100644 (file)
@@ -13737,6 +13737,7 @@ static int get_refer_info(struct sip_pvt *transferer, struct sip_request *outgoi
                /* This is an attended transfer */
                referdata->attendedtransfer = 1;
                ast_copy_string(referdata->replaces_callid, ptr+9, sizeof(referdata->replaces_callid));
                /* This is an attended transfer */
                referdata->attendedtransfer = 1;
                ast_copy_string(referdata->replaces_callid, ptr+9, sizeof(referdata->replaces_callid));
+               ast_uri_decode(referdata->replaces_callid);
                if ((ptr = strchr(referdata->replaces_callid, ';')))    /* Find options */ {
                        *ptr++ = '\0';
                }
                if ((ptr = strchr(referdata->replaces_callid, ';')))    /* Find options */ {
                        *ptr++ = '\0';
                }
@@ -13754,7 +13755,6 @@ static int get_refer_info(struct sip_pvt *transferer, struct sip_request *outgoi
                                *to = '\0';
                        if ((to = strchr(ptr, ';')))
                                *to = '\0';
                                *to = '\0';
                        if ((to = strchr(ptr, ';')))
                                *to = '\0';
-                       ast_uri_decode(ptr);
                        ast_copy_string(referdata->replaces_callid_totag, ptr, sizeof(referdata->replaces_callid_totag));
                }
                
                        ast_copy_string(referdata->replaces_callid_totag, ptr, sizeof(referdata->replaces_callid_totag));
                }
                
@@ -13764,7 +13764,6 @@ static int get_refer_info(struct sip_pvt *transferer, struct sip_request *outgoi
                                *to = '\0';
                        if ((to = strchr(ptr, ';')))
                                *to = '\0';
                                *to = '\0';
                        if ((to = strchr(ptr, ';')))
                                *to = '\0';
-                       ast_uri_decode(ptr);
                        ast_copy_string(referdata->replaces_callid_fromtag, ptr, sizeof(referdata->replaces_callid_fromtag));
                }
                
                        ast_copy_string(referdata->replaces_callid_fromtag, ptr, sizeof(referdata->replaces_callid_fromtag));
                }