OCA/connector-telephony

Problem on calling "local" numbers - does not pass validation

Closed this issue · 1 comments

sraps commented

AMI connected normally, all dependencies satisfied
Scenario: calling local (inhouse) number from Customer contact's (res.partner) phone number, clicking on the tel link. Phone number is 6002. The number is perfectly recognized by Asterisk - call can be originated using Asterisk CLI and AMI. The call fails using asterisk_click2dial + base_phone

Fires such exception in Odoo 12 console...
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/odoo/http.py", line 654, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 312, in _handle_exception
raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
File "/usr/lib/python3/dist-packages/odoo/tools/pycompat.py", line 87, in reraise
raise value
File "/usr/lib/python3/dist-packages/odoo/http.py", line 696, in dispatch
result = self._call_function(**self.params)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 344, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/usr/lib/python3/dist-packages/odoo/service/model.py", line 97, in wrapper
return f(dbname, *args, **kwargs)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 337, in checked_call
result = self.endpoint(*a, **kw)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 939, in call
return self.method(*args, **kw)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 517, in response_wrap
response = f(*args, **kw)
File "/mnt/extra-addons/base_phone/controllers/main.py", line 14, in click2dial
click2dial_id=click2dial_id).click2dial(phone_number)
File "/mnt/extra-addons/asterisk_click2dial/models/phone_common.py", line 23, in click2dial
ast_number = self.convert_to_dial_number(erp_number)
File "/mnt/extra-addons/base_phone/models/phone_common.py", line 139, in convert_to_dial_number
parsed_num = phonenumbers.parse(erp_number, None)
File "/usr/local/lib/python3.5/dist-packages/phonenumbers/phonenumberutil.py", line 2812, in parse
"Missing or invalid default region.")
phonenumbers.phonenumberutil.NumberParseException: (0) Missing or invalid default region.

The same problem happens when directly parsing the phone number 6002 using phonenumbers library in python3 console:
a = phonenumbers.parse("6002", None)

File "/usr/local/lib/python3.5/dist-packages/phonenumbers/phonenumberutil.py", line 2812, in parse
"Missing or invalid default region.")
phonenumbers.phonenumberutil.NumberParseException: (0) Missing or invalid default region.

Possible solution: not to parse the phone numbers before dialing at all, as PBX's dialplan eg Asterisk is responsible for interpreting phone numbers.

There hasn't been any activity on this issue in the past 6 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days.
If you want this issue to never become stale, please ask a PSC member to apply the "no stale" label.