Source code for wxc_sdk.telephony.location.internal_dialing

from typing import Optional

from ...api_child import ApiChild
from ...base import ApiModel
from ...common import RouteIdentity

__all__ = ['InternalDialing', 'InternalDialingApi']


[docs] class InternalDialing(ApiModel): #: When enabled, calls made by users at the location to an unknown extension (between 2-6 digits) are routed to #: the selected route group/trunk as premises calls. enable_unknown_extension_route_policy: bool #: destination for unknown extensions unknown_extension_route_identity: Optional[RouteIdentity] = None
[docs] class InternalDialingApi(ApiChild, base='telephony/config/locations'): """ Internal dialing settings for location """ def _url(self, location_id: str) -> str: """ :meta private: """ return super().ep(f'{location_id}/internalDialing')
[docs] def read(self, location_id: str, org_id: str = None) -> InternalDialing: """ Read the Internal Dialing configuration for a location Get current configuration for routing unknown extensions to the Premises as internal calls If some users in a location are registered to a PBX, retrieve the setting to route unknown extensions (digits that match the extension length) to the PBX. Retrieving the internal dialing configuration requires a full or read-only administrator or location administrator auth token with a scope of `spark-admin:telephony_config_read`. :param location_id: location for which internal calling configuration is being requested :type location_id: str :param org_id: :type org_id: str :return: settings :rtype: :class:`InternalDialing` """ url = self._url(location_id=location_id) params = org_id and {'orgId': org_id} or None data = self.get(url=url, params=params) return InternalDialing.model_validate(data)
[docs] def update(self, location_id: str, update: InternalDialing, org_id: str = None): """ Modify the Internal Dialing configuration for a location Modify current configuration for routing unknown extensions to the premise as internal calls If some users in a location are registered to a PBX, enable the setting to route unknown extensions (digits that match the extension length) to the PBX. Editing the internal dialing configuration requires a full administrator or location administrator auth token with a scope of `spark-admin:telephony_config_write`. :param location_id: location for which internal calling configuration is being requested :type location_id: str :param update: new settings :type update: :class:`InternalDialing` :param org_id: :type org_id: str """ url = self._url(location_id=location_id) params = org_id and {'orgId': org_id} or None data = update.model_dump_json(exclude_none=False) self.put(url=url, params=params, data=data)