Add an Emergency Number

Add an emergency number.

Request URL

POST {base_url}/{api_path}/emergency_number/create?access_token={access_token}

Request parameters

Parameter Required Type Description
name Yes String The name of the emergency number. Maximum length: 63 characters.
number Yes String The emergency number. Only letters, numbers, and ( ) . - + * # are allowed. Maximum length: 31 characters. The number must be unique globally.
trunks Yes Array<Emergency_Trunk> The trunk configurations of the emergency number, with at least one entry.
member_select No String The extension scope of the emergency number.

Valid value:

  • sel_all_ext: All extensions.
  • sel_specific: Specified extensions.

Default value: sel_all_ext. When sel_specific is set, the exts field of each trunk is required.

outb_cid_option No String The priority of the outbound caller ID.

Valid value:

  • emergency_first: The caller ID of the emergency number takes precedence.
  • ext_first: The caller ID of the extension takes precedence.

Default value: emergency_first.

Emergency_Trunk
Parameter Type Description
trunk_id Integer The unique ID of a trunk.
Note: You can query trunk's ID using the Query Trunk List interface.
outb_cid String The caller ID displayed for calls routed through this trunk. Maximum length: 31 characters.
prepend String The digits prepended to the dialed number.
strip Integer The number of digits to strip from the dialed number. The value 0 means no stripping. Valid values: 0 to 16.
exts Array<Emergency_Ext> The scope entries where this trunk takes effect.
Note: This field is required when member_select is sel_specific.
Emergency_Ext
Parameter Type Description
type String The type of the scope entry.
  • extension: The entry applies to an extension (value is the extension number).
  • ext_group: The entry applies to an extension group (value is the extension group ID).
  • all: The entry applies to all extensions (value is ignored).
value String The identifier of the scope entry: the extension number when type is extension, the extension group ID when type is ext_group, and ignored when type is all.

Response parameters

Parameter Type Description
errcode Integer Returned error code.
  • 0: Succeed.
  • Non-zero value: Failed.
Note: You can check the error code and error message in Error Code and Error Message.
errmsg String Returned message.
  • SUCCESS: Succeed.
  • FAILURE: Failed.
id Integer The unique ID of the newly created emergency number.

Example

Request example

POST /openapi/v1.0/emergency_number/create?access_token=lweYFZuwsgSrhFOKC3Z0XmDRXfbPohi6 HTTP/1.1

Host: yeastardocs.example.yeastarcloud.com
Content-Type: application/json
{
    "name": "API Test Emergency",
    "number": "9110",
    "member_select": "sel_specific",
    "outb_cid_option": "ext_first",
    "trunks": [
        {
            "trunk_id": 14,
            "outb_cid": "5500123",
            "prepend": "9",
            "strip": 0,
            "exts": [
                {
                    "type": "all"
                }
            ]
        }
    ]
}

Response example

HTTP/1.1 200 OK
{
    "errcode": 0,
    "errmsg": "SUCCESS",
    "id": 2
}