Table of Contents

API : Voice account Get

Introduction

This request will return a voice account if found. A voice account can be either a SIP account or a MVNO account.

This request is used when you want to lookup the account for a given id or for a given phone number.

Request

URL https://api.telecomx.dk/voiceaccount/ID
Method GET
Access level VIEWER, MANAGER or OWNER if user belongs to the customer.
RESELLER if customer belongs to the reseller or a sub reseller.
RESELLER_ADMIN.
ADMIN.
Param ID Id of the SIP/MVNO account (24 hex-char string) or a phone number that belongs to the account (E.164 format).
Query basics [optional] If true, only _id, customer, name, active, type, deviceType, sipAccount, pbx, extension and numbers are returned.
pbx [optional] If true, only type, pbx and extension is returned (used to check if a phone number is usable for hosted PBX).

Query example

https://api.telecomx.dk/voiceaccount/1234567890ABCDEF12345678
https://api.telecomx.dk/voiceaccount/+4570305050

Response

By default (no query flags) the full voice account document is returned - for the MVNO account shape see API : MVNO account Get. Three fields are exceptions: mitId is never returned, notes is only returned to RESELLER and up, and sipServer is only returned to ADMIN users.

With pbx=true only type, pbx and extension are returned.

With basics=true only the following fields are returned:

Json object (basics=true)
_id Id Unique SIP account id.
customer Id Id of customer the SIP account belongs to.
active Boolean True if the account is active and can handle calls.
name String Human readable name of the SIP account, or the first number of the account.
type String Type of account - 'SIP' or 'MVNO'.
numbers Array Array of numbers that the account handles in E.164 format.
sipAccount Id Id of the SIP account (sip trunk) all calls are routed through (if used) (MVNO only).
pbx Number Id of hosted PBX cluster to use, null or 0 if not part of hosted PBX.
extension Id Id of extension the account belongs to on the hosted PBX (only MVNO and if pbx>0).

Note that properties holding no value may be omitted from the object.

Example (basics=true)

{
  "_id": "650000000000000000000701",
  "customer": "650000000000000000000101",
  "active": true,
  "name": "Primary trunk CPH",
  "type": "SIP",
  "numbers": ["+4570305050", "+4570305051", "+4570305052"],
  "pbx": 1
}

Errors

Error code Message Description
404 id Id is neither a valid account id nor an E.164 number
404 not_found Voice account not found
403 access_denied Insufficient access level
500 internal_error <Unspecified>