aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2008-09-23 15:37:00 +0000
committermmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2008-09-23 15:37:00 +0000
commit57b96b0814f65861b36b31fe3bd356dc4337d2e8 (patch)
treeab33ac6814766066dfe7bb5d6cf64ebf5c38a95f
parentf5a6f60d5ed99443d156d47a920f940ac52af6a3 (diff)
When a promiscuous redirect contained both a user and
host portion in the Contact URI and specifies a transport, the parsing done in parse_moved_contact resulted in a malformed URI. This commit fixes the parsing so that a proper Dial string may be formed when the forwarded call is placed. (closes issue #13523) Reported by: mattdarnell Patches: 13523v2.patch uploaded by putnopvut (license 60) Tested by: mattdarnell git-svn-id: http://svn.digium.com/svn/asterisk/trunk@144025 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r--channels/chan_sip.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 7b1f0b13f..e26bdc3fe 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -15095,6 +15095,7 @@ static void parse_moved_contact(struct sip_pvt *p, struct sip_request *req)
p->socket.type = transport;
if (ast_test_flag(&p->flags[0], SIP_PROMISCREDIR)) {
+ char *host = NULL;
if (!strncasecmp(s, "sip:", 4))
s += 4;
else if (!strncasecmp(s, "sips:", 5))
@@ -15102,9 +15103,16 @@ static void parse_moved_contact(struct sip_pvt *p, struct sip_request *req)
e = strchr(s, '/');
if (e)
*e = '\0';
- ast_debug(2, "Found promiscuous redirection to 'SIP/::::%s@%s'\n", get_transport(transport), s);
- if (p->owner)
- ast_string_field_build(p->owner, call_forward, "SIP/::::%s@%s", get_transport(transport), s);
+ if ((host = strchr(s, '@'))) {
+ *host++ = '\0';
+ ast_debug(2, "Found promiscuous redirection to 'SIP/%s::::%s@%s'\n", s, get_transport(transport), host);
+ if (p->owner)
+ ast_string_field_build(p->owner, call_forward, "SIP/%s::::%s@%s", s, get_transport(transport), host);
+ } else {
+ ast_debug(2, "Found promiscuous redirection to 'SIP/::::%s@%s'\n", get_transport(transport), s);
+ if (p->owner)
+ ast_string_field_build(p->owner, call_forward, "SIP/::::%s@%s", get_transport(transport), s);
+ }
} else {
e = strchr(tmp, '@');
if (e) {