| |
1 Index: channels/chan_sip.c |
| |
2 diff -Nau channels/chan_sip.c.orig channels/chan_sip.c |
| |
3 --- channels/chan_sip.c.orig 2009-04-24 00:48:57.000000000 +0200 |
| |
4 +++ channels/chan_sip.c 2009-04-24 00:49:21.000000000 +0200 |
| |
5 @@ -18771,6 +18771,7 @@ |
| |
6 \todo Fix this function so that we wait for reply to the REFER and |
| |
7 react to errors, denials or other issues the other end might have. |
| |
8 */ |
| |
9 +/* MSvB: Paramater dest may be SIPS encoded, having '@@' before host */ |
| |
10 static int sip_sipredirect(struct sip_pvt *p, const char *dest) |
| |
11 { |
| |
12 char *cdest; |
| |
13 @@ -18780,7 +18781,7 @@ |
| |
14 cdest = ast_strdupa(dest); |
| |
15 |
| |
16 extension = strsep(&cdest, "@"); |
| |
17 - host = strsep(&cdest, ":"); |
| |
18 + host = strsep(&cdest, ":"); /* MSvB: Could begin with '@' if SIPS */ |
| |
19 port = strsep(&cdest, ":"); |
| |
20 if (ast_strlen_zero(extension)) { |
| |
21 ast_log(LOG_ERROR, "Missing mandatory argument: extension\n"); |
| |
22 @@ -18813,7 +18814,13 @@ |
| |
23 } |
| |
24 } |
| |
25 |
| |
26 - ast_string_field_build(p, our_contact, "Transfer <sip:%s@%s%s%s>", extension, host, port ? ":" : "", port ? port : ""); |
| |
27 + if (host && *host == '@') { |
| |
28 + ast_log(LOG_DEBUG, "Decoding TLS incapable Asterisk SIP URI to a standard SIPS URI before redirecting via 302 Moved Temporarily\n"); |
| |
29 + ast_string_field_build(p, our_contact, "Transfer <sips:%s@%s%s%s>", extension, host + 1, port ? ":" : "", port ? port : ""); |
| |
30 + } |
| |
31 + else |
| |
32 + ast_string_field_build(p, our_contact, "Transfer <sip:%s@%s%s%s>", extension, host, port ? ":" : "", port ? port : ""); |
| |
33 + |
| |
34 transmit_response_reliable(p, "302 Moved Temporarily", &p->initreq); |
| |
35 |
| |
36 sip_scheddestroy(p, SIP_TRANS_TIMEOUT); /* Make sure we stop send this reply. */ |