Hi Kingsley,
You could try with a single rule, like optional matching the param (like
"(;user=phone)?") and in subst + repl part do not include the param
inside the \1 parenthesis, having it added all the time in the repl part.
Still you need a more complex matching if you have multiple params, not
only the "user" one.
Regards,
Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
https://www.opensips-solutions.com
OpenSIPS Bootcamp 2021 online
https://opensips.org/training/OpenSIPS_eBootcamp_2021/
On 4/20/21 8:16 PM, Kingsley Tart wrote:
Hi,
I want a DP ruleset to ensure that ";user=phone" is in the SIP URI, ie
if it is not there, add it, but if it is already there, do nothing.
I've managed to do this with two lines, but is there a more efficient
way?
This is what I have in the dialplan table in this ruleset?
+----+----------+-------------+-------------+-----------+---------------+
| pr | match_op | match_exp | match_flags | subst_exp | repl_exp |
+----+----------+-------------+-------------+-----------+---------------+
| 1 | 1 | ;user=phone | 1 | (.+) | \1 |
| 2 | 1 | . | 1 | (.+) | \1;user=phone |
+----+----------+-------------+-------------+-----------+---------------+
_______________________________________________
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users