Index: channels/chan_sip.c diff -Nau channels/chan_sip.c.orig channels/chan_sip.c --- channels/chan_sip.c.orig 2009-04-24 00:48:57.000000000 +0200 +++ channels/chan_sip.c 2009-04-24 00:49:21.000000000 +0200 @@ -18771,6 +18771,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 host */ static int sip_sipredirect(struct sip_pvt *p, const char *dest) { char *cdest; @@ -18780,7 +18781,7 @@ cdest = ast_strdupa(dest); extension = strsep(&cdest, "@"); - host = strsep(&cdest, ":"); + host = strsep(&cdest, ":"); /* MSvB: Could begin with '@' if SIPS */ port = strsep(&cdest, ":"); if (ast_strlen_zero(extension)) { ast_log(LOG_ERROR, "Missing mandatory argument: extension\n"); @@ -18813,7 +18814,13 @@ } } - ast_string_field_build(p, our_contact, "Transfer ", extension, host, port ? ":" : "", port ? port : ""); + if (host && *host == '@') { + 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, host + 1, port ? ":" : "", port ? port : ""); + } + else + ast_string_field_build(p, our_contact, "Transfer ", extension, host, port ? ":" : "", port ? port : ""); + transmit_response_reliable(p, "302 Moved Temporarily", &p->initreq); sip_scheddestroy(p, SIP_TRANS_TIMEOUT); /* Make sure we stop send this reply. */