Remove invalid characters from destination numbers

Status
Not open for further replies.

geomat

New Member
Jul 26, 2019
28
5
3
36
www.linkedin.com
Hello,

I would like to remove invalid characters from destination numbers in order to make successful outbound calls. For example, 0044123456%06 to be converted to 0044123456. For doing this I modified the following variables using a lua script:
  1. destination_number
  2. sip_to_uri
  3. sip_to_user
  4. sip_req_uri
  5. sip_req_user
However, although the above variables have the correct values in CDRs the sip headers have the original values. How can I fix also the sip headers ?

Thank you in advance,
George
 

DigitalDaz

Administrator
Staff member
Sep 29, 2016
3,070
577
113
Why are you trying to do this by the way? Why do you need to accept bad sip requests?
 

geomat

New Member
Jul 26, 2019
28
5
3
36
www.linkedin.com
Well, the idea is to strip invalid characters such as whitespaces, which are not obvious when users copy them into their softphones. In that case, they don't know what is the problem. I am thinking to avoid this issue by creating a dialplan with order=999 that will play a pre-recorded message (e.g., no route).
 

hfoster

Active Member
Jan 28, 2019
684
81
28
34
Don't most of the regex groups for Outbound Routes capture this already? Unless you start using a dot instead of a \d, I'm pretty sure only the digits in the first capture group will be sent to the gateway.
 

geomat

New Member
Jul 26, 2019
28
5
3
36
www.linkedin.com
I am not sure about this. In the most of the cases, if I am not wrong, the \d is used (e.g., ^\+(\d{6,17})$).

Of course I can modify the expression and accept whitespaces at the beginning or end of the string but for this I have to modify hundreds of outbound routes :)
 
Status
Not open for further replies.