diff --git a/pbx.c b/pbx.c index b66effc359..85d692da92 100644 --- a/pbx.c +++ b/pbx.c @@ -1343,10 +1343,12 @@ static void pbx_substitute_variables_helper_full(struct ast_channel *c, struct v needsub = 0; /* Find the end of it */ - while(brackets && *vare) { + while (brackets && *vare) { if ((vare[0] == '$') && (vare[1] == '{')) { needsub++; brackets++; + } else if (vare[0] == '{') { + brackets++; } else if (vare[0] == '}') { brackets--; } else if ((vare[0] == '$') && (vare[1] == '['))