Create a Working PBX

To create a working domain, several steps must be done to replicate what the PBX Portal is doing.

Getting Started

Check this to learn how to retrieve authentication token - https://pbx.readme.io/reference/getting-started

Check if the PBX Domain does not exist yet

REQUEST

curl --location 'https://12345-hpbx.dashmanager.com/ns-api/?object=domain&action=read&domain=1domaintemplate.20681.service&format=json'

RESPONSE

This is the response if domain is existing.

[
    {
        "domain": "1domaintemplate.20681.service",
        "territory": 20681,
        "dial_match": "",
        "description": "Coreys Domain Template",
        "moh": "yes",
        "mor": "no",
        "mot": "no",
        "rmoh": "no",
        "rating": "no",
        "resi": "no",
        "mksdir": "yes",
        "call_limit": 0,
        "call_limit_ext": 0,
        "sub_limit": 0,
        "max_call_queue": 0,
        "max_aa": 0,
        "max_conference": 0,
        "max_department": 0,
        "max_user": 0,
        "max_device": 0,
        "time_zone": "US/Eastern",
        "dial_plan": "1domaintemplate.20681.service",
        "dial_policy": "Permit All",
        "policies": "active",
        "email_sender": "",
        "smtp_host": "",
        "smtp_port": "",
        "smtp_uid": "",
        "smtp_pwd": "",
        "from_user": "[*]",
        "from_host": "[*]",
        "active_call": 0,
        "countForLimit": 0,
        "countExternal": 0,
        "sub_count": 1,
        "max_site": 0,
        "max_fax": -1,
        "address_id": "",
        "sso": "",
        "vmail_provisioned": "yes",
        "callid_nmbr": 7477774604,
        "callid_name": "Domain Template",
        "callid_emgr": 7477774604,
        "area_code": 747,
        "vmail_transcribe": "no",
        "language": "en_us"
    }
]

It is safe to proceed to create a domain if the response is empty.

[]

Endpoint Reference - https://pbx.readme.io/reference/read-domain

Create the PBX Domain

REQUEST

curl --location 'https://12345-hpbx.dashmanager.com/ns-api/' \
--header 'Authorization: Bearer redacted' \
--form 'object="domain"' \
--form 'action="create"' \
--form 'domain="2domaintemplate.20681.service"' \
--form 'territory="20681"' \
--form 'description="Template Domain"' \
--form 'email_sender="[email protected]"'

RESPONSE

202 Accepted

Endpoint Reference - https://pbx.readme.io/reference/create-a-domain

Create a Dialplan (Dial Translation Table)

Change the following in the example request below

domain

dialplan - should be same as domain

plan_description - Don’t use special characters

REQUEST

curl --location 'https://12345-hpbx.dashmanager.com/ns-api/' \
--header 'Authorization: Bearer redacted' \
--form 'object="dialplan"' \
--form 'action="create"' \
--form 'domain="2domaintemplate.20681.service"' \
--form 'dialplan="2domaintemplate.20681.service"' \
--form 'plan_description="dial plan for 2domaintemplate.20681.service"'

RESPONSE

202 Accepted

Create Domain Dial Translation

Important to NOT change anything except

domain

dialplan - should be the same as the domain value

responderneeds to be <0000.resellerid.service>. See below example request.

REQUEST

curl --location 'https://12345-hpbx.dashmanager.com/ns-api/' \
--header 'Authorization: Bearer redacted' \
--form 'object="dialrule"' \
--form 'action="create"' \
--form 'enable="yes"' \
--form 'domain="2domaintemplate.20681.service"' \
--form 'dialplan="2domaintemplate.20681.service"' \
--form 'matchrule="*"' \
--form 'to_user="[*]"' \
--form 'match_from="*"' \
--form 'dow="*"' \
--form 'tod_from="*"' \
--form 'tod_to="*"' \
--form 'valid_from="*"' \
--form 'valid_to="*"' \
--form 'responder="<0000.20681.service>"' \
--form 'to_scheme="[*]"' \
--form 'to_user="[*]"' \
--form 'to_host="[*]"' \
--form 'from_name="[*]"' \
--form 'from_scheme="[*]"' \
--form 'from_user="[*]"' \
--form 'from_host="[*]"' \
--form 'plan_description="chain to default"'

RESPONSE

202 Accepted

Create Domain User for Domain Defaults

New Users use these as defaults when created.

  1. Change the following required
    domain
    subscriber_login (cannot be a duplicate of existing login)
    email
    dial_plan - needs to match dial plan created above
    callid_number
    callid_name
    callid_emgr
  2. Change the following (optional)
    no_answer_timeout
    subscriber_pin (security, use strong number combination)
    language (en_us…)
    data-limit (25000…)
    call_limit
    time_zone
    vmail_enabled
    vmail_annc_time
    vmail_sort_lifo
    ntfy_missed_call
    dial_policy (set strictly)
    dir_list
    account_status should be pwd reset unless you set a password, if setting a password, use a very strong random password.

REQUEST

curl --location 'https://12345-hpbx.dashmanager.com/ns-api/' \
--header 'Authorization: Bearer redacted' \
--form 'object="subscriber"' \
--form 'action="create"' \
--form 'user="domain"' \
--form 'domain="2domaintemplate.20681.service"' \
--form 'vmail_provisioned="yes"' \
--form 'accept="yes"' \
--form 'reject="yes"' \
--form 'screen="yes"' \
--form 'no_answer_timeout="20"' \
--form 'first_name="domain"' \
--form 'last_name="user"' \
--form 'subscriber_login="[email protected]"' \
--form 'subscriber_pin="2511281"' \
--form 'language="en_us"' \
--form 'data_limit="25000"' \
--form 'call_limit="0"' \
--form 'time_zone="US/Eastern"' \
--form 'dir_anc="yes"' \
--form 'directory_order="1"' \
--form 'vmail_enabled="yes"' \
--form 'rej_anony="no"' \
--form 'vmail_annc_time="yes"' \
--form 'vmail_sort_lifo="no"' \
--form 'email="[email protected]"' \
--form 'ntfy_missed_call="no"' \
--form 'dial_plan="2domaintemplate.20681.service"' \
--form 'dial_policy="US and Canada"' \
--form 'callid_nmbr="7477774604"' \
--form 'callid_name="Domain Template"' \
--form 'callid_emgr="7477774604"' \
--form 'area_code="747"' \
--form 'presence="open"' \
--form 'dir_list="yes"' \
--form 'srv_code="system_user"' \
--form 'scope="Office Manager"' \
--form 'gauSession="0"' \
--form 'vmail_transcribe="no"' \
--form 'account_status="pwd reset"'

RESPONSE

202 Accepted

Endpoint Reference - https://pbx.readme.io/reference/create-subscriber

Create Additional User(s)

  1. Change the following required

domain

subscriber_login (cannot be a duplicate of an existing login)

email

dial_plan - needs to match dial plan created above

callid_number

callid_name

callid_emgr

  1. Change the following (optional)

no_answer_timeout

subscriber_pin (security, use strong number combination)

language (en_us…)

data-limit (25000…)

call_limit

time_zone

vmail_enabled

vmail_annc_time

vmail_sort_lifo

vmail_transcribe

ntfy_missed_call

dial_policy (set strictly)

dir_list

account_status should be pwd reset unless you set a password, if setting a password, use a very strong random password.

REQUEST

curl --location 'https://12345-hpbx.dashmanager.com/ns-api/' \
--header 'Authorization: Bearer redacted' \
--form 'object="subscriber"' \
--form 'action="create"' \
--form 'user="100"' \
--form 'domain="2domaintemplate.20681.service"' \
--form 'vmail_provisioned="yes"' \
--form 'accept="yes"' \
--form 'reject="yes"' \
--form 'screen="yes"' \
--form 'no_answer_timeout="20"' \
--form 'first_name="John"' \
--form 'last_name="Doey"' \
--form 'subscriber_login="[email protected]"' \
--form 'subscriber_pin="2511281"' \
--form 'language="en_us"' \
--form 'data_limit="25000"' \
--form 'call_limit="0"' \
--form 'time_zone="US/Eastern"' \
--form 'dir_anc="yes"' \
--form 'directory_order="1"' \
--form 'vmail_enabled="yes"' \
--form 'rej_anony="no"' \
--form 'vmail_annc_time="yes"' \
--form 'vmail_sort_lifo="no"' \
--form 'email="[email protected]"' \
--form 'ntfy_missed_call="no"' \
--form 'dial_plan="2domaintemplate.20681.service"' \
--form 'dial_policy="US and Canada"' \
--form 'callid_nmbr="7477774604"' \
--form 'callid_name="John Doe"' \
--form 'callid_emgr="7477774604"' \
--form 'area_code="747"' \
--form 'presence="open"' \
--form 'dir_list="yes"' \
--form 'scope="Basic User"' \
--form 'vmail_transcribe="no"' \
--form 'account_status="pwd reset"'

RESPONSE

202 Accepted

Create Device(s)

  1. Change the following

device - should be “sip:” + “{subscriber id}” + “{optional postfix letter, lower case a-z}” + “{domain}”

uid- Needs to match subscriber

aor - needs to be same as device

authentication_key - This is the SIP password, must be a strong random string

subscriber_name

  1. Optionally change the following

callid_emgr - This is a device-level 911 override that overrides the subscriber 911

  1. Do not change the following

expires

REQUEST

curl --location 'https://12345-hpbx.dashmanager.com/ns-api/' \
--header 'Authorization: Bearer redacted' \
--form 'object="device"' \
--form 'action="create"' \
--form 'device="sip:[email protected]"' \
--form 'uid="[email protected]"' \
--form 'aor="sip:[email protected]"' \
--form 'subscriber_name="100"' \
--form 'expires="50"' \
--form 'callid_emgr="[*]"' \
--form 'authentication_key="redacted"'

RESPONSE

202 Accepted

Endpoint Reference - https://pbx.readme.io/reference/create-device