[SR-Users] Dialplan: using $avp("key") on subst rule with regexp capturing group

João Vitor Arruda joao.arruda at gmail.com
Wed Jul 22 00:31:55 CEST 2020


Hello,

I'm trying to use the dialplan  with $avp("key") on match_exp and
subst_exp but i'm getting an error message when there is a regex
capturing group on subst_exp to be used on repl_exp

This is the config used:

modparam("dialplan", "match_dynamic", 1)
$avp(s:PSTNAC)  =       "0";

Dialplan entry:
dpid = 1
match_op = 1
match_exp = ^$avp(s:PSTNAC)
match_len = 0
subst_exp = ^$avp(s:PSTNAC)(.*)
repl_exp = 9\1

After executing dp_translate while the dialplan is properly matched
the following error message occurs and the repl_exp didn't work as
expected:
ERROR: dialplan [dp_repl.c:422]: rule_translate(): illegal access to
1-th subexpr of subst expr (max 0)

I've tried some other dialplan entries like:

dpid = 1
match_op = 1
match_exp = ^$(avp(s:PSTNAC)[*])
match_len = 0
subst_exp = ^$(avp(s:PSTNAC)[*])(.*)
repl_exp = 9\1

But that resulted in the same error message and no replacement either.

Any suggestion on what I'm doing wrong here?

Thanks,

Joao Arruda



More information about the sr-users mailing list