Hi Ying,
Mystery is solved.
The problem with the enum.json regex expression to remove part of a telephone
prefix is that “+” is a regular expression special character. Any other
digits may be removed just like shown in the ENUM documentation. In order to
remove the +1 from a number like +16505551234, the expression must be entered
into the enum.json file as :
{ "name" : "Clearwater internal numbers dialed with +1 prefix",
"prefix" : "+1650555",
"regex" : "!^\\+1(.*$)!sip:\\[email protected]!"
}
The TWO backslashes prior to the + make it interpreted not as a special
character, but as part of the telephone prefix.
When Sprout loads the file he displays just one backslash in the result:
09-11-2017 22:11:31.887 UTC Status enumservice.cpp:200: Adding number prefix
+1650555, regex=!^\+1(.*$)!sip:\[email protected]!
Thanks for helping me on to the correct troubleshooting path for this problem.
Best regards,
Roger Case
GCI Alaska
From: Roger Case
Sent: Wednesday, November 08, 2017 3:58 PM
To: [email protected]
Subject: RE: enum.json for +1 numbers
Hi Ying,
Thanks very much for answering.
With the extra \ in the expression the whole load of the enum.json file fails:
08-11-2017 23:38:07.350 UTC Error enumservice.cpp:167: Failed to read ENUM
configuration data: {
"number_blocks" : [
{ "name" : "+1907-644 internal",
"prefix" : "+1907644",
"regex" : "!^\+1(.*$)!sip:\\[email protected]!"
} ]
}
Error: Invalid escape character in string.
--------------------------------------------------------------------------------------------------------
Without the \, as written in the enum.json docs, the entry is not matched at
all, as Clearwater declares the expression “badly formed”.
09-11-2017 00:40:50.419 UTC Debug enumservice.cpp:192: Found valid number
prefix block +1907644
09-11-2017 00:40:50.419 UTC Debug enumservice.cpp:99: Split regex into
match=^+1(.*$), replace=sip:\[email protected]
09-11-2017 00:40:50.419 UTC Warning enumservice.cpp:205: Badly formed regular
expression in ENUM number block !^+1(.*$)!sip:\[email protected]!
This is for:
{ "name" : "+1907-644 internal",
"prefix" : "+1907644",
"regex" : "!^+1(.*$)!sip:\\[email protected]!"
} ]
I’m confused!
Thanks,
Roger
From: Clearwater [mailto:[email protected]] On
Behalf Of Ying Huang
Sent: Wednesday, November 08, 2017 1:03 PM
To:
[email protected]<mailto:[email protected]>
Subject: Re: [Project Clearwater] enum.json for +1 numbers
[External Email]
Hi Roger,
Both regex should work fine, while the second expression with extra \ is more
correct and I suggest you use that. To turn on debug logging for Sprout, writie
log_level=5 to /etc/clearwater/user_settings (creating it if it doesn’t exist
already), then restart Sprout (by running sudo service sprout stop - it will be
restarted by monit). Then you can check /var/log/sprout/sprout_current.txt
while performing the operations. For more suggestions, see
http://clearwater.readthedocs.io/en/stable/Troubleshooting_and_Recovery.html?highlight=debug
The regex is doing what you expect – it matches on the entire number but takes
out the bit in (.*$) to put it in the \\1<file:///\\1> part. So +1333666 will
be replaced by sip:[email protected], where the +1 has been stripped off. You can
modify the second part of the regex to be how you want the number to be sent to
the internal domain.
If anything unclear you can come back to this thread.
Thanks,
Ying
From: Clearwater [mailto:[email protected]] On
Behalf Of Roger Case
Sent: 07 November 2017 01:53
To:
[email protected]<mailto:[email protected]>
Subject: [Project Clearwater] enum.json for +1 numbers
Dear Clearwater,
The ENUM DOCS show an entry in enum.json for +1 dialed internal numbers of:
{ "name" : "Clearwater internal numbers dialled with +1 prefix",
"prefix" : "+1650555",
"regex" : "!^+1(.*$)!sip:\\[email protected]!"
}
This underlined piece of the expression is shown later in the document, inside
a NAPTR record, as:
naptr-record=5.5.5.0.5.6.1.e164.arpa,1,1,U,E2U+SIP,!^\+1(.*$)!sip:\[email protected]!
The second expression contains an extra \ before the +1.
Which is correct, or are both correct?
I ask because neither seem to work in my enum.json file.
Also, is there a way in the enum.json file expressions to remove the + or 1+,
before sending the Invite to the internal or IBCF domain?
Thanks very much,
Roger Case
GCI, Alaska
(old telephone guy trying to understand new telephone technology)
_______________________________________________
Clearwater mailing list
[email protected]
http://lists.projectclearwater.org/mailman/listinfo/clearwater_lists.projectclearwater.org