aboutsummaryrefslogtreecommitdiffstats
path: root/channels
diff options
context:
space:
mode:
authormmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2007-11-07 22:42:24 +0000
committermmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2007-11-07 22:42:24 +0000
commitfba187de25da4c295b964892f77c55ff47cbb2fc (patch)
treea6846a6043d4beb7e23fd0ea4991b38be350b3c2 /channels
parent6d6b520aba0c25a7c4e097e67d7c4d37ce99f0bb (diff)
Merged revisions 89090 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r89090 | mmichelson | 2007-11-07 16:40:35 -0600 (Wed, 07 Nov 2007) | 6 lines This patch makes it possible for SIP phones to dial extensions defined with '#' characters in extensions.conf AND maintain their escaped characters when forming URI's (closes issue #10681, reported by cahen, patched by me, code review by file) ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@89091 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rw-r--r--channels/chan_sip.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 2e231d35d..a9b81dad8 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -4502,6 +4502,16 @@ static int sip_indicate(struct ast_channel *ast, int condition, const void *data
return res;
}
+static char *translate_escaped_pound(char *exten)
+{
+ char *rest, *marker;
+ while((marker = strstr(exten, "%23"))) {
+ rest = marker + 3;
+ *marker++ = '#';
+ memmove(marker, rest, strlen(rest) + 1);
+ }
+ return exten;
+}
/*! \brief Initiate a call in the SIP channel
@@ -4637,8 +4647,7 @@ static struct ast_channel *sip_new(struct sip_pvt *i, int state, const char *tit
i->owner = tmp;
ast_module_ref(ast_module_info->self);
ast_copy_string(tmp->context, i->context, sizeof(tmp->context));
- ast_copy_string(tmp->exten, i->exten, sizeof(tmp->exten));
-
+ ast_copy_string(tmp->exten, translate_escaped_pound(ast_strdupa(i->exten)), sizeof(tmp->exten));
/* Don't use ast_set_callerid() here because it will
* generate an unnecessary NewCallerID event */
@@ -9585,6 +9594,19 @@ static int get_destination(struct sip_pvt *p, struct sip_request *oreq)
if (!oreq)
ast_string_field_set(p, exten, uri);
return 0;
+ } else { /*Could be trying to match a literal '#'. Try replacing and see if that works.*/
+ char *tmpuri = ast_strdupa(uri);
+ char *rest, *marker;
+ while((marker = strstr(tmpuri, "%23"))) {
+ rest = marker + 3;
+ *marker++ = '#';
+ memmove(marker, rest, strlen(rest) + 1);
+ }
+ if(ast_exists_extension(NULL, p->context, tmpuri, 1, from) || !strcmp(uri, ast_pickup_ext())) {
+ if(!oreq)
+ ast_string_field_set(p, exten, uri);
+ return 0;
+ }
}
}