Index: chan_sip.c =================================================================== RCS file: /usr/cvsroot/asterisk/channels/chan_sip.c,v retrieving revision 1.422 diff -u -r1.422 chan_sip.c --- chan_sip.c 22 Jun 2004 18:49:00 -0000 1.422 +++ chan_sip.c 25 Jun 2004 12:42:15 -0000 @@ -4446,6 +4446,28 @@ return 0; } +/*--- _percent_escape: Escape %XX codes in headers */ +char *_percent_escape(char *s) { + char c, *aptr, *sptr; + int val; + char *answer = malloc(strlen(s)+1); // answer is always shorter + aptr = answer; + sptr = s; + while ((c = *sptr++) != '\0') { + if (c == '%') { + sscanf(sptr, "%02X", &val); + *aptr++ = (char) val; + sptr += 2; + } + else + *aptr++ = c; + } + *aptr = '\0'; + strcpy(s, answer); + free(answer); + return s; +} + /*--- get_destination: Find out who the call is for --*/ static int get_destination(struct sip_pvt *p, struct sip_request *oreq) { @@ -4493,6 +4515,7 @@ } else strncpy(p->fromdomain, fr, sizeof(p->fromdomain) - 1); } + c = _percent_escape(c); if (sip_debug_test_pvt(p)) ast_verbose("Looking for %s in %s\n", c, p->context); if (ast_exists_extension(NULL, p->context, c, 1, fr) ||