New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
KAZOO-4009: optionally re-format caller id number based on regex and … #1284
Conversation
case re:run(whapps_call:caller_id_number(Call), UseFmts, [{capture, all_but_first, binary}]) of | ||
{match, UseCid} -> | ||
lager:debug("match ~p found! re-formatting to ~p~n", [UseCid, hd(UseCid)]), | ||
whapps_call:set_caller_id_number(hd(UseCid), Call); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mark2600 what happened to prefix and suffix options? I would also like to see the caller-id normalized prior to formatting so we would have a consistent number format to create the regex for.
Something like:
CallerId = wnm_util:to_e164(whapps_call:caller_id_number(Call)),
Classification = wnm_util:classify_number(CallerId),
....
case re:run(CallerId, Formatters, [{'capture', 'all_but_first', 'binary'}]) of
...
Minor formating:
- tickies
- spell out formats
…ns to be under caller_id_options key. add "all" key to match any classifier
This needs to also happen in trunkstore for ts_from_offnet. I believe the server options already has a caller_id_options object. If we move this to a more common place we could reuse the logic. |
maybe_regex_caller_id(CallerId, Regex, Format) -> | ||
Normalized = wnm_util:normalize_number(CallerId), | ||
case re:run(Normalized, Regex, [{'capture', 'all_but_first', 'binary'}]) of | ||
{'match', UseCid} -> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not match the head here, rather than calling hd/1
below?
KAZOO-4009: optionally re-format caller id number based on regex and …
…classifier