[sr-dev] dialplan and empty repl_exp

Andreas Granig agranig at sipwise.com
Mon May 7 19:49:59 CEST 2012


Hi all,

We ran into an issue with dialplan in regex mode when we leave the
repl_exp empty. Consider this scenario:

if(dp_translate("1", "$rU/$var(out)") {
  # translation successful
  $rU = $var(out);
}

If the dialplan entry has match_exp="^999" and subst_exp="^999" and
repl_exp="" and my $rU is "999123", I'd expect $var(out) to be "123",
because an empty replacement part is perfectly valid for a regex. The
result however is that $var(out) is untouched, so whatever $var(out) was
before the function call, will end up in $rU in this case. That's not
what I'd expect if dp_translate returns success.

It should be fairly easy to fix and we can provide a patch for that, I'd
just want to get some feedback if you agree on changing dp_translate
behavior in such a case, as it might break existing scripts if you rely
on the current way of working.

Comments?

Andreas

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 900 bytes
Desc: OpenPGP digital signature
URL: <http://lists.sip-router.org/pipermail/sr-dev/attachments/20120507/76aef091/attachment.pgp>


More information about the sr-dev mailing list