ExtensionManagerRpc
ExtensionManagerRpc exposes RPC methods for managing telephony extensions and for supplying reference values used by form fields in the extension UI. The class delegates extension lifecycle operations to TelephonyConnectorService and provides a limited, field-specific lookup for phone numbers when requested by the outboundCallerIdNumber reference configuration.
Endpoints
POST /api/rpc (Method: ExtensionManagerRpc.getData)
This method lists telephony extensions. It forwards the validated request parameters and request context to TelephonyConnectorService.listExtensions(...).
Description: Lists telephony extensions through TelephonyManager.
Request Body:
{ "method": "ExtensionManagerRpc.getData", "params": { "filter": {}, "sort": {}, "page": 1, "pageSize": 25 } }Parameters:
Name Type Required Description filterObjectNo Optional filter object. The schema allows arbitrary properties via passthrough().sortObjectNo Optional sort object. The schema allows arbitrary properties via passthrough().pageNumberNo Positive integer page number. Defaults to 1when omitted.pageSizeNumberNo Positive integer page size. Defaults to 25when omitted.Response:
{ "success": true, "data": { "..." : "Returned by TelephonyConnectorService.listExtensions(...)" } }Example (cURL):
curl -X POST "${APP_BASE_URL}/api/rpc" \ -H "Content-Type: application/json" \ -d '{ "method": "ExtensionManagerRpc.getData", "params": { "page": 1, "pageSize": 25 } }'
POST /api/rpc (Method: ExtensionManagerRpc.create)
This method creates a telephony extension. It forwards the validated payload and request context to TelephonyConnectorService.createExtension(...).
Description: Creates a telephony extension through TelephonyManager.
Request Body:
{ "method": "ExtensionManagerRpc.create", "params": { "extensionNumber": "1001", "outboundCallerIdNumber": null } }Parameters:
Name Type Required Description extensionNumberStringYes Extension number to create. outboundCallerIdNumberStringNo Optional outbound caller ID number. The schema allows null.Response:
{ "success": true, "data": { "..." : "Returned by TelephonyConnectorService.createExtension(...)" } }Example (cURL):
curl -X POST "${APP_BASE_URL}/api/rpc" \ -H "Content-Type: application/json" \ -d '{ "method": "ExtensionManagerRpc.create", "params": { "extensionNumber": "1001", "outboundCallerIdNumber": null } }'
POST /api/rpc (Method: ExtensionManagerRpc.update)
This method updates a telephony extension. It forwards the validated payload and request context to TelephonyConnectorService.updateExtension(...).
Description: Updates a telephony extension through TelephonyManager.
Request Body:
{ "method": "ExtensionManagerRpc.update", "params": { "_id": "64f0c2a0d1e7a2f4d2e4b111" } }Parameters:
Name Type Required Description _idStringYes Identifier of the extension to update. The schema requires this field and allows additional properties through passthrough().Response:
{ "success": true, "data": { "..." : "Returned by TelephonyConnectorService.updateExtension(...)" } }Example (cURL):
curl -X POST "${APP_BASE_URL}/api/rpc" \ -H "Content-Type: application/json" \ -d '{ "method": "ExtensionManagerRpc.update", "params": { "_id": "64f0c2a0d1e7a2f4d2e4b111" } }'
POST /api/rpc (Method: ExtensionManagerRpc.delete)
This method deletes a telephony extension by identifier. It forwards the _id and request context to TelephonyConnectorService.deleteExtension(...).
Description: Deletes a telephony extension through TelephonyManager.
Request Body:
{ "method": "ExtensionManagerRpc.delete", "params": { "_id": "64f0c2a0d1e7a2f4d2e4b111" } }Parameters:
Name Type Required Description _idStringYes Identifier of the extension to delete. Response:
{ "success": true, "data": { "..." : "Returned by TelephonyConnectorService.deleteExtension(...)" } }Example (cURL):
curl -X POST "${APP_BASE_URL}/api/rpc" \ -H "Content-Type: application/json" \ -d '{ "method": "ExtensionManagerRpc.delete", "params": { "_id": "64f0c2a0d1e7a2f4d2e4b111" } }'
POST /api/rpc (Method: ExtensionManagerRpc.getFieldValues)
This method returns reference values for specific form fields. It only contains implemented logic for outboundCallerIdNumber when the reference collection is telephonyDIDs; in that case, it requests phone numbers from TelephonyConnectorService.listPhoneNumbers(...) and maps them into { value, label } pairs. For any other field, it logs a warning and returns an empty array. If the phone-number lookup fails, it logs an error and returns an empty array.
Description: Gets reference field values for the DataForm, such as a list of available phone numbers.
Request Body:
{ "method": "ExtensionManagerRpc.getFieldValues", "params": { "fieldName": "outboundCallerIdNumber", "reference": { "collection": "telephonyDIDs", "valueField": "_id", "displayField": "phoneNumber" } } }Parameters:
Name Type Required Description fieldNameStringYes Name of the field requesting reference values. referenceObjectYes Reference configuration object. reference.collectionStringYes Referenced collection name. reference.valueFieldStringYes Property name used to produce each returned value.reference.displayFieldStringYes Property name used to produce each returned label.Response:
{ "success": true, "data": [ { "value": "..." , "label": "..." } ] }Example (cURL):
curl -X POST "${APP_BASE_URL}/api/rpc" \ -H "Content-Type: application/json" \ -d '{ "method": "ExtensionManagerRpc.getFieldValues", "params": { "fieldName": "outboundCallerIdNumber", "reference": { "collection": "telephonyDIDs", "valueField": "_id", "displayField": "phoneNumber" } } }'
Behavior Notes
The RPC class initializes a TelephonyConnectorService instance during startup and uses it for all extension-related operations. The only explicitly implemented field-value lookup is for outboundCallerIdNumber with the telephonyDIDs reference collection. Other field requests are not handled and return an empty list.
and collection == telephonyDIDs?} G -->|Yes| H[Call listPhoneNumbers] H --> I[Map to value/label pairs] G -->|No| J[Log warning] H --> K[Return empty array on error] J --> L[Return empty array]