Description: This patch introduces a new channel variable SIPURIOPTION which contains the uri options from Refer-To URI during call transfer. It enables passing of important uri options like "transport=tcp" which enable VCC and in turn VoxSBC to transfer the call on tcp. Author: Nitesh Bansal --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -17800,6 +17800,7 @@ struct sip_request *req = NULL; const char *transfer_context = NULL; struct sip_refer *refer; + char *urioption = NULL; req = outgoing_req; refer = transferer->refer; @@ -17910,7 +17911,7 @@ } if ((ptr = strchr(refer_to, '@'))) { /* Separate domain */ - char *urioption = NULL, *domain; + char *domain; int bracket = 0; *ptr++ = '\0'; @@ -17933,15 +17934,25 @@ } SIP_PEDANTIC_DECODE(domain); - SIP_PEDANTIC_DECODE(urioption); /* Save the domain for the dial plan */ ast_string_field_set(refer, refer_to_domain, domain); - if (urioption) { - ast_string_field_set(refer, refer_to_urioption, urioption); + } + else + { + /* No domain, but still there could be some URI options */ + if ((urioption = strchr(ptr, ';'))) + { + *urioption++ = '\0'; } } + SIP_PEDANTIC_DECODE(urioption); + + if (urioption) { + ast_string_field_set(refer, refer_to_urioption, urioption); + } + if ((ptr = strchr(refer_to, ';'))) /* Remove options */ *ptr = '\0'; @@ -26195,6 +26206,7 @@ struct ast_channel *chans[2] = { 0, }; char *refer_to = NULL; char *refer_to_domain = NULL; + char *refer_to_urioption= NULL; char *refer_to_context = NULL; char *referred_by = NULL; char *callid = NULL; @@ -26391,6 +26403,7 @@ /* Copy data we can not safely access after letting the pvt lock go. */ refer_to = ast_strdupa(p->refer->refer_to); refer_to_domain = ast_strdupa(p->refer->refer_to_domain); + refer_to_urioption = ast_strdupa(p->refer->refer_to_urioption); refer_to_context = ast_strdupa(p->refer->refer_to_context); referred_by = ast_strdupa(p->refer->referred_by); callid = ast_strdupa(p->callid); @@ -26453,6 +26466,7 @@ if (current.chan2) { pbx_builtin_setvar_helper(current.chan2, "BLINDTRANSFER", ast_channel_name(current.chan1)); pbx_builtin_setvar_helper(current.chan2, "SIPDOMAIN", refer_to_domain); + pbx_builtin_setvar_helper(current.chan2, "SIPURIOPTION", refer_to_urioption); pbx_builtin_setvar_helper(current.chan2, "SIPTRANSFER", "yes"); /* One for the new channel */ pbx_builtin_setvar_helper(current.chan2, "_SIPTRANSFER", "yes");