Omnix

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
    filter Object No Optional filter object. The schema allows arbitrary properties via passthrough().
    sort Object No Optional sort object. The schema allows arbitrary properties via passthrough().
    page Number No Positive integer page number. Defaults to 1 when omitted.
    pageSize Number No Positive integer page size. Defaults to 25 when 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
    extensionNumber String Yes Extension number to create.
    outboundCallerIdNumber String No 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
    _id String Yes 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
    _id String Yes 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
    fieldName String Yes Name of the field requesting reference values.
    reference Object Yes Reference configuration object.
    reference.collection String Yes Referenced collection name.
    reference.valueField String Yes Property name used to produce each returned value.
    reference.displayField String Yes 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.

graph TD A[RPC request] --> B{Method} B -->|getData| C[Call listExtensions] B -->|create| D[Call createExtension] B -->|update| E[Call updateExtension] B -->|delete| F[Call deleteExtension] B -->|getFieldValues| G{fieldName == outboundCallerIdNumber
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]