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