Index: channels/chan_sip.c diff -Nau channels/chan_sip.c.orig channels/chan_sip.c --- channels/chan_sip.c.orig 2011-05-23 17:35:28.358543497 +0200 +++ channels/chan_sip.c 2011-05-23 17:57:05.948534524 +0200 @@ -29733,6 +29733,7 @@ \todo Fix this function so that we wait for reply to the REFER and react to errors, denials or other issues the other end might have. */ +/* MSvB: Paramater dest may be SIPS encoded, having '@' before domain */ static int sip_sipredirect(struct sip_pvt *p, const char *dest) { char *cdest; @@ -29741,7 +29742,7 @@ cdest = ast_strdupa(dest); extension = strsep(&cdest, "@"); - domain = cdest; + domain = strsep(&cdest, ":"); /* MSvB: Could begin with '@' if SIPS */ if (ast_strlen_zero(extension)) { ast_log(LOG_ERROR, "Missing mandatory argument: extension\n"); return 0; @@ -29773,7 +29774,14 @@ } } - ast_string_field_build(p, our_contact, "Transfer ", extension, domain); + if (domain && *domain == '@') { + ast_log(LOG_DEBUG, "Decoding TLS incapable Asterisk SIP URI to a standard SIPS URI before redirecting via 302 Moved Temporarily\n"); + ast_string_field_build(p, our_contact, "Transfer ", extension, domain); + + } + else + ast_string_field_build(p, our_contact, "Transfer ", extension, domain); + transmit_response_reliable(p, "302 Moved Temporarily", &p->initreq); sip_scheddestroy(p, SIP_TRANS_TIMEOUT); /* Make sure we stop send this reply. */