--- certified-asterisk-11.6-cert11/channels/chan_sip.c.orig 2016-04-14 18:51:43.000000000 -0400 +++ certified-asterisk-11.6-cert11/channels/chan_sip.c 2016-04-18 23:18:19.000000000 -0400 @@ -17855,9 +17855,20 @@ } if ((ptr = strchr(refer_to, '@'))) { /* Separate domain */ + ast_debug(2, "SIP REFER user with domain sip uri found\n"); + *ptr++ = '\0'; + } else if(!strcasestr(refer_to, "user=phone")) { /* No @ and not user=phone then uri is domain only */ + ast_debug(2, "SIP REFER domain only sip uri found\n"); + ptr = refer_to; + refer_to = ast_malloc(sizeof(char) * 2); + sprintf(refer_to, "s"); + } else { + ast_debug(2, "SIP REFER user only sip uri found\n"); + } + + if(ptr) { char *urioption = NULL, *domain; int bracket = 0; - *ptr++ = '\0'; if ((urioption = strchr(ptr, ';'))) { /* Separate urioptions */ *urioption++ = '\0'; @@ -17885,6 +17896,8 @@ if (urioption) { ast_string_field_set(refer, refer_to_urioption, urioption); } + + ast_verbose("SIP transfer with domain to %s@%s\n", refer_to, domain); } if ((ptr = strchr(refer_to, ';'))) /* Remove options */