Index: channels/chan_sip.c =================================================================== --- channels/chan_sip.c (revision 89084) +++ channels/chan_sip.c (working copy) @@ -3888,6 +3888,16 @@ 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 @@ -4014,9 +4024,8 @@ 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 */ tmp->cid.cid_ani = ast_strdup(i->cid_num); @@ -8714,6 +8723,19 @@ 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; + } } }