[OpenSIPS-Users] Strip prefix

Ben Newlin Ben.Newlin at genesys.com
Wed Jun 5 18:25:46 UTC 2024


It looks right to me. The error you get when changing repl_exp to “\1” implies to me that it is causing the dpid to fail to load from the database at all due to some syntax issue. Is you database escaping or converting the “\” maybe?

I’d recommend increasing the logging verbosity of opensips and doing a module reload and the test scenario and see what the logs say about why it isn’t matching.

Ben Newlin

From: Users <users-bounces at lists.opensips.org> on behalf of morris edery <morrisedery at gmail.com>
Date: Wednesday, June 5, 2024 at 1:46 PM
To: OpenSIPS users mailling list <users at lists.opensips.org>
Subject: Re: [OpenSIPS-Users] Strip prefix
 EXTERNAL EMAIL - Please use caution with links and attachments

________________________________
Yes i change it all


dpid = 17

pr = 0

match_op = 1

match_exp = ^770555.+

match_flags = 0

subst_exp = ^770555(.+)

repl_exp = \1

without  \1  im able to complete the call but prefix still there and when i add the \1  on repl_exp i get the error

On Wed, Jun 5, 2024 at 1:13 PM Ben Newlin <Ben.Newlin at genesys.com<mailto:Ben.Newlin at genesys.com>> wrote:
Did you make all the changes I suggested or only changed the repl_exp? I detailed changes needed to the match_exp and subst_exp as well.

Ben Newlin

From: Users <users-bounces at lists.opensips.org<mailto:users-bounces at lists.opensips.org>> on behalf of morris edery <morrisedery at gmail.com<mailto:morrisedery at gmail.com>>
Date: Wednesday, June 5, 2024 at 12:44 PM
To: OpenSIPS users mailling list <users at lists.opensips.org<mailto:users at lists.opensips.org>>
Subject: Re: [OpenSIPS-Users] Strip prefix
 EXTERNAL EMAIL - Please use caution with links and attachments

________________________________
Still no luck.

when i add  repl_exp = \1

i get this

Jun  5 12:13:04 [12250] DBG:dialplan:dp_translate_f: input is 7705557867129454
Jun  5 12:13:04 [12250] DBG:dialplan:dp_translate_f: no information available for dpid 17

DBG:sl:sl_reply_error: error text is Bad URI (475/SL)

On Wed, Jun 5, 2024 at 10:04 AM Ben Newlin <Ben.Newlin at genesys.com<mailto:Ben.Newlin at genesys.com>> wrote:
There’s a few issues.

1. You are missing a “.” in your match_exp. The way you have it written will only match repeating digit 5 after the prefix.
2. Your subst_exp is too greedy. The wildcards in the first grouping will make that grouping match the whole string, and there will be nothing left for the second grouping (or it won’t match at all because of the + in the second grouping, not sure). If you are trying to match a fixed-string prefix you don’t need wildcards for that. You also don’t need to capture that grouping, since you aren’t using it in the replace.

Try this:


dpid = 17

pr = 0

match_op = 1

match_exp = ^770555.+

match_flags = 0

subst_exp = ^770555(.+)

repl_exp = \1

Ben Newlin

From: Users <users-bounces at lists.opensips.org<mailto:users-bounces at lists.opensips.org>> on behalf of morris edery <morrisedery at gmail.com<mailto:morrisedery at gmail.com>>
Date: Wednesday, June 5, 2024 at 12:48 AM
To: OpenSIPS users mailling list <users at lists.opensips.org<mailto:users at lists.opensips.org>>
Subject: [OpenSIPS-Users] Strip prefix
 EXTERNAL EMAIL - Please use caution with links and attachments

________________________________
Hello Team, im trying to strip a prefix with dialplan from a number and from some reason have no success on that , please tell me what im doing wrong ?  below

opensips 2.4.8

dpid = 17

pr = 0

match_op = 1

match_exp = ^770555+

match_flags = 0

subst_exp = ^(*770555*)(.+)

repl_exp = \2



need to remove 770555

on cfg file

    if (dp_translate("17", "$rU/$rU")){ }





Thanks
_______________________________________________
Users mailing list
Users at lists.opensips.org<mailto:Users at lists.opensips.org>
http://lists.opensips.org/cgi-bin/mailman/listinfo/users<http://lists.opensips.org/cgi-bin/mailman/listinfo/users>
_______________________________________________
Users mailing list
Users at lists.opensips.org<mailto:Users at lists.opensips.org>
http://lists.opensips.org/cgi-bin/mailman/listinfo/users<http://lists.opensips.org/cgi-bin/mailman/listinfo/users>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20240605/6dfd7359/attachment-0001.html>


More information about the Users mailing list