Closed WEBudoGT closed 1 year ago
@WEBudoGT Does translation work after adding double \\
?
Hello Hnimminh
No, it doesn't
On Thu, Nov 10, 2022, 1:42 AM Minh @.***> wrote:
@WEBudoGT https://github.com/WEBudoGT Does translation work after adding double \ ?
— Reply to this email directly, view it on GitHub https://github.com/hnimminh/libresbc/issues/76#issuecomment-1309891943, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMPHOGRJ25OTJBMY5ODPVMTWHSRPXANCNFSM6AAAAAAR4E6YAY . You are receiving this because you were mentioned.Message ID: @.***>
Did you assign that translation profile to the interconnection? and try with % instead of $
"caller_number_replacement": "%{1}"
I'm very sorry @hnimminh Yes it works! No need to change the $ by % So using double backslash works just fine. Thanks!!! :D
@WEBudoGT I'm going to add the list of organization/company who are using LibreSBC into repo, and I really need your help to completed it. Can you tell me if you're using libresbc by commenting here or send email to me hnimminh [at] outlook [dot] com.
Appreciate for your help!
Describe the bug When the number_pattern (caller or destination) includes a + sign (in E.164 format) it never matches.
To Reproduce Create a translation class like the following: { "name": "anyName", "desc": "Localize Caller ID", "caller_number_pattern": "^+?502([0-9]{8})$", "destination_number_pattern": "", "caller_number_replacement": "${1}", "destination_number_replacement": "", "caller_name": "_caller_number" } Make a call using inbound interconnection that has your "anyName" defined in "translation_classes" list with a device that has a caller ID that matches pattern.
Actual behavior The CallerID is not changed on the outcome, and logs show there are no translations for the call like in the following example:
2022-11-10T04:44:48.733597+00:00 ny3sbc program=libresbc, pid=784, module=callng, space=main, action=translate, seshid=f4544848-60fd-437b-b6f4-8050d3ea68ef, direction=inbound, uuid=c3943970-f9ed-450d-95de-ed17585f1dd5, tranrules=[], cidnumber=+50212345678, cidname=Name, dstnumber=50298765432
Expected behavior Translation rule being applied.
Log & Screenshots I guessed that the + sign must be escaped for the PCRE REGEX to match, but if trying to add it using
"^\+?502([0-9]{8})$"
on the API I get:Trying to escape it twice
"^\\+?502([0-9]{8})$"
is accepted on the API request, but also stored as double\\
Also tried to add it directly to redis using redis-cli:
It gets stored with double quotes
Additional context