michael@202: Index: channels/chan_sip.c michael@202: diff -Nau channels/chan_sip.c.orig channels/chan_sip.c michael@202: --- channels/chan_sip.c.orig 2009-04-24 00:48:57.000000000 +0200 michael@202: +++ channels/chan_sip.c 2009-04-24 00:49:21.000000000 +0200 michael@202: @@ -18771,6 +18771,7 @@ michael@202: \todo Fix this function so that we wait for reply to the REFER and michael@202: react to errors, denials or other issues the other end might have. michael@202: */ michael@202: +/* MSvB: Paramater dest may be SIPS encoded, having '@@' before host */ michael@202: static int sip_sipredirect(struct sip_pvt *p, const char *dest) michael@202: { michael@202: char *cdest; michael@202: @@ -18780,7 +18781,7 @@ michael@202: cdest = ast_strdupa(dest); michael@202: michael@202: extension = strsep(&cdest, "@"); michael@202: - host = strsep(&cdest, ":"); michael@202: + host = strsep(&cdest, ":"); /* MSvB: Could begin with '@' if SIPS */ michael@202: port = strsep(&cdest, ":"); michael@202: if (ast_strlen_zero(extension)) { michael@202: ast_log(LOG_ERROR, "Missing mandatory argument: extension\n"); michael@202: @@ -18813,7 +18814,13 @@ michael@202: } michael@202: } michael@202: michael@202: - ast_string_field_build(p, our_contact, "Transfer ", extension, host, port ? ":" : "", port ? port : ""); michael@202: + if (host && *host == '@') { michael@202: + ast_log(LOG_DEBUG, "Decoding TLS incapable Asterisk SIP URI to a standard SIPS URI before redirecting via 302 Moved Temporarily\n"); michael@202: + ast_string_field_build(p, our_contact, "Transfer ", extension, host + 1, port ? ":" : "", port ? port : ""); michael@202: + } michael@202: + else michael@202: + ast_string_field_build(p, our_contact, "Transfer ", extension, host, port ? ":" : "", port ? port : ""); michael@202: + michael@202: transmit_response_reliable(p, "302 Moved Temporarily", &p->initreq); michael@202: michael@202: sip_scheddestroy(p, SIP_TRANS_TIMEOUT); /* Make sure we stop send this reply. */