Remove prefix digits before calling out

Status
Not open for further replies.

gunemalli

New Member
Dec 18, 2018
24
3
3
Hi All,

Need some help with another query. I've been scratching my head for two days on how to do this and my regex capability is abysmal.

My requirement is to remove the 1st 3 digits of the destination number. For example, if i dial 6770412345678, then i want to set the destination number as 0412345678.

I can get the first bit done by doing ^(677\d{10})$, but i'm confused at the stripping part.

Here's the dialplan I'm trying to setup.

1564712899912.png

Any help would be appreciated :)
 

JamesBorne

Active Member
Jan 24, 2019
294
57
28
Australia
Good on you for including the picture, example source string and stripped string.

If you want to only match 677 at the front or reject, you can do:
^677(\d{10})$
and
outbound_caller_id_number=$1

If the three digits can be other things, you could do:
^(677|123|344)?(\d{10})$
and
outbound_caller_id_number=$2
* It's $2 cos we are ignoring the first set of brackets; we don't want that in out outbound_caller_id_number.
* Also note that the ? after that set means it may have those one of those numbers, or none of those numbers.

Up to you.
 

gunemalli

New Member
Dec 18, 2018
24
3
3
Good on you for including the picture, example source string and stripped string.

If you want to only match 677 at the front or reject, you can do:
^677(\d{10})$
and
outbound_caller_id_number=$1

If the three digits can be other things, you could do:
^(677|123|344)?(\d{10})$
and
outbound_caller_id_number=$2
* It's $2 cos we are ignoring the first set of brackets; we don't want that in out outbound_caller_id_number.
* Also note that the ? after that set means it may have those one of those numbers, or none of those numbers.

Up to you.


Hey, Thanks for this.

Gave the information get this sorted. In essence this customer wants to present different outbound caller-IDs on the fly. So had to get this done in two places.

1. Dialplan -> Dialplan Manager -> Dialplan Name ->
1564725461382.png

2. Dialplan -> Outbound Routes -> Route Name (Copy of an existing route to allow the new prefixed routed calls to go out)
1564725635199.png

I hope this helps someone else looking for a solution like this.
 
  • Like
Reactions: valiantiam
Status
Not open for further replies.