Skip to end of metadata
Go to start of metadata

Table of parameters

HHTP is a protocol which requires no introduction. After all, HTTP is the very reason this webpage is available on your computer.

The following guide has been created to help you receive information about calls, create calls and manage user settings.

(warning) Library for PHP: api.onlinepbx.ru/lib/onpbx_http_api.php_v1.1.zip . Examples in PHP.

(warning) Library for JavaScript: api.onlinepbx.ru/lib/onpbx_http_api.js . Examples in JavaScript.

(warning) Mail for your questions: support@onlinepbx.ru.


 


 

General concepts

OnlinePBX HTTP API authentication is very similar to the Amazon Rest API. Your API key found in the control panel is used to receive a secret access key and identifier. You will need this key to carry out all further requests. Before completing a request, you will need to calculate the HMAC (Hash Message Authentication Code) in a string of elements using your access key. You will also need a special HTTP header and request. Our server will calculate the HMAC and compare it to the one you have sent. This guarantees thе the integrity and safety of your data, and offers protection from forged requests during processing. For a more detailed study of our API, you may refer to any of the libraries included below. The message body should be in the format “application/x-www-form-urlencoded”.

(warning) We use secure connections with the HTTPS protocol. Enter the URL as: https://api.onlinepbx.ru/.


 

Authorization

Receiving a key

Table of parameters:

ParameterNoteDescription
auth_keymandatoryAPI Key
new Parameter indicated when Key needs to be updated. Mandatory value of “true”
key Key for further requests
key_id Key identifier

 

Parameter
Request

URL: api.onlinepbx.ru/example.onpbx.ru/auth.json

POST /example.onpbx.ru/auth.json HTTP/1.1

Host: api.onlinepbx.ru
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:42.0) Gecko/20100101 Firefox/42.0
Accept: application/json
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Content-Type: application/x-www-form-urlencoded; charset=UTF-8;
Content-Length: 46
Connection: keep-alive
Pragma: no-cache
Cache-Control: no-cache

auth_key=cHd3PJoTc8HzLVfDP3KnkCY3fWStONDxEsES8

Response
HTTP/1.1 200 OK
Date: Thu, 28 Apr 2016 08:55:26 GMT
Server: Apache
X-Powered-By: PHP/5.5.18-pl0-gentoo
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: POST, GET, OPTIONS
Access-Control-Allow-Headers: Content-Type,Content-MD5,x-pbx-authentication,x-pbx-date
Content-Length: 165
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Content-Type: text/json

{"status":1,"comment":"","data":{"key":"Bs5gGDsr1nOhVKB5baadoHm741NF6SYUWlKu0pXL52CyhvEz2pERiokysvrbunMY8JJjWg","key_id":"9acd73e82cbd9af4efbcf444fe04b9ff","new":0}}

(warning) You do not need a new key for each request. Only request a new key if you receive the response: {“status”:0,”comment”:”not authenticated”,”data”:””}.

(warning) Example.onpbx.ru is just an example of a domain. Each of our clients has a unique domain.

(warning) In the event of multiple authorization requests (4-5 in a second), some sessions will be processed incorrectly since every new authorization produces a new key.

(warning) The secret key has a lifespan of 3 days from the moment of the last address


 

Calls

Moments

Table of parameters:

ParameterNoteDescription
frommandatorySending party (subscriber, or internal number)
tomandatoryReceiving party (any number)
gate_from Trunk number of sending party
gate_to Trunk number of receiving party
to_domain Indicate the domain to which the call is being placed (for direct calls)
from_orig_number Displayed number of sending party
from_orig_name Displayed name of sending party
Request

URL: api.onlinepbx.ru/example.onpbx.ru/call/now.json

POST /example.onpbx.ru/call/now.json HTTP/1.1

Host: api.onlinepbx.ru
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:42.0) Gecko/20100101 Firefox/42.0
Accept: application/json
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
x-pbx-date: Thu, 28 Apr 2016 08:59:23 GMT
Content-Type: application/x-www-form-urlencoded; charset=UTF-8;
Content-MD5: 3b0b33c93599477dee717f94d8ecde53
x-pbx-authentication: 9acd73e82cbd9af4efbcf444fe04b9ff:ZjEyOTZmMWI1N2EzOWJjZWE5ZDUzNWE2NGQ0YzNmMTUzNTJiMGMyZQ==
Content-Length: 16
Connection: keep-alive
Pragma: no-cache
Cache-Control: no-cache

from=100&to=9197

Response

HTTP/1.1 200 OK
Date: Thu, 28 Apr 2016 08:59:23 GMT
Server: Apache
X-Powered-By: PHP/5.5.18-pl0-gentoo
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: POST, GET, OPTIONS
Access-Control-Allow-Headers: Content-Type,Content-MD5,x-pbx-authentication,x-pbx-date
Content-Length: 82
Keep-Alive: timeout=15, max=99
Connection: Keep-Alive
Content-Type: text/json

{"status":"1","comment":"","data":{"uuid":"8090e90f-5b17-4454-a724-30ee245b2af3"}}


 

Return of a UUID immediately after a request

A UUID automatically generates when calling a method.

Table of parameters:

ParameterNoteDescription
frommandatorySending party (subscriber, or internal number)
tomandatoryReceiving party (any number)
gate_from Trunk number of sending party
gate_to Trunk number of receiving party
to_domain Indicate the domain to which the call is being placed (for direct calls)
from_orig_number Displayed number of sending party
from_orig_name Displayed name of sending party
Request

The request is lost in instant calls.

Response

The response is lost in instant calls.

(warning) If there are no errors within 0.5 seconds of a request, a UUID is returned. Otherwise, information about the error is returned, for example (USER_NOT_REGISTERED or USER_BUSY).

 


 

Call Delay

Call delay is processed once every 5 minutes. If a call is assigned in 2 minutes, it could contain a lag of 2 to 5 minutes. If the call is delayed more than 5 minutes, it will be synchronized (the difference will not be more than several seconds).

Table of parameters:

ParameterNoteDescription
frommandatorySending party (subscriber or internal number)
tomandatoryReceiving party (any number)
gate_from Trunk number of sending party
gate_to Trunk number of receiving party
to_domain Indicate domain to which call must be placed
date Date in the format (RFC-2822)
Request

URL: api.onlinepbx.ru/example.onpbx.ru/call/later.json

POST /example.onpbx.ru/call/later.json HTTP/1.1

Host: api.onlinepbx.ru
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:42.0) Gecko/20100101 Firefox/42.0
Accept: application/json
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
x-pbx-date: Thu, 28 Apr 2016 09:03:03 GMT
Content-Type: application/x-www-form-urlencoded; charset=UTF-8;
Content-MD5: e5c0516a76d124bbec45274c0e435ce6
x-pbx-authentication: 9acd73e82cbd9af4efbcf444fe04b9ff:MzVlYWQ5ODBjYzI3ZTIyNWNkZGUwN2M5OGI1NDhhNzc3MWE1YTQ4Yw==
Content-Length: 65
Connection: keep-alive
Pragma: no-cache
Cache-Control: no-cache

from=100&to=9197&date=28%20Apr%202016%2012%3A05%3A00%20GMT%2B0300

Response

HTTP/1.1 200 OK
Date: Thu, 28 Apr 2016 09:03:03 GMT
Server: Apache
X-Powered-By: PHP/5.5.18-pl0-gentoo
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: POST, GET, OPTIONS
Access-Control-Allow-Headers: Content-Type,Content-MD5,x-pbx-authentication,x-pbx-date
Content-Length: 35
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Content-Type: text/json

{"status":1,"comment":"","data":[]}

 

 

 

 

To contents


 

Call History

(warning) To deal with the large volume of requests, calls are saved using a separate database. Otherwise, we collect data in this base. Therefore the list will be more complete and might differ from the history listed in the control panel. The list of calls is available using the API at: https://panel2.onlinepbx.ru/calls.php.

Table of parameters for requests:

ParameterNoteDescription
duration_from Length (of entire call) from (second)
duration_to Length (of entire call)  to (second)
billsec_from Length of conversation from (second)
billsec_to Length of conversation to (second)
date_from Call started (date) from (RFC-2882)
date_to Call ended (date)  to (RFC-2882)
start_date_from Call started (date) from (RFC-2822)
start_date_to Call started (date) to (RFC-2822)
end_date_from Call ended (date) from (RFC-2822)
end_date_to Call ended (date) to (RFC-2822)
number Exact number
out_number Part of number (given by any number containing these digits)
type inbound/outbound/local
uuid Unique call identifier
uuid_array List ID of several calls
download If this parameter is indicated, a URL for downloading call recordings will be returned in place of a data array. If a call is found, the link will last for 200 seconds. Otherwise, it will last for one hour

(warning) A request must include at least one of these parameters.

Table of parameters for responses:

ParameterNoteDescription
uuid Unique identifier of session
caller  
from_domain Caller domain
to Recipient of call
to_domain  
gateway Trunk
date Date in UNIX timestamp format: https://www.unixtimestamp.com/index.php
duration Total length of call
billsec Length of conversation
hangup_cause Reason for ending call: https://api.onlinepbx.ru/lib/hangup_cause.js
type inbound/outbound/local

(warning) There might be a delay of up to a minute between completing the call and receiving access to it in the API.


 

Request

URL: api.onlinepbx.ru/example.onpbx.ru/history/search.json

POST /example.onpbx.ru/history/search.json HTTP/1.1

Host: api.onlinepbx.ru
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:42.0) Gecko/20100101 Firefox/42.0
Accept: application/json
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
x-pbx-date: Thu, 28 Apr 2016 09:10:29 GMT
Content-Type: application/x-www-form-urlencoded; charset=UTF-8;
Content-MD5: 45090026162443c78e898e554aa88d76
x-pbx-authentication: 9acd73e82cbd9af4efbcf444fe04b9ff:YjBhODUxOThmMDJhZTM1MTEwZGEwYWYwYjViMzg5MzYyZjUwMzFjMg==
Content-Length: 53
Connection: keep-alive
Pragma: no-cache
Cache-Control: no-cache

date_from=25%20Apr%202016%2000%3A00%3A00%20GMT%2B0300

Responce

HTTP/1.1 200 OK
Date: Thu, 28 Apr 2016 09:10:29 GMT
Server: Apache
X-Powered-By: PHP/5.5.18-pl0-gentoo
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: POST, GET, OPTIONS
Access-Control-Allow-Headers: Content-Type,Content-MD5,x-pbx-authentication,x-pbx-date
Content-Length: 2671
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Content-Type: text/json

{"status":1,"comment":"","data":[{"uuid":"54bcc345-6617-4d3f-8d45-ff7aa0a03b2f","caller":"100","caller_name":"100","from_domain":"example.onpbx.ru","to":"9197","to_domain":"example.onpbx.ru","gateway":"","date":"1461741061","duration":"2","billsec":"2","hangup_cause":"NORMAL_CLEARING","type":"local"},{"uuid":"f4161c95-9db0-4f21-a847-981b6ff4bc13","caller":"100","caller_name":"100","from_domain":"example.onpbx.ru","to":"9197","to_domain":"example.onpbx.ru","gateway":"","date":"1461741130","duration":"1","billsec":"1","hangup_cause":"NORMAL_CLEARING","type":"local"},{"uuid":"aa3cc1f7-88c2-49a9-a846-cd578c2c8565","caller":"100","caller_name":"Outbound Call","from_domain":"example.onpbx.ru","to":"9197","to_domain":"example.onpbx.ru","gateway":"","date":"1461741199","duration":"6","billsec":"4","hangup_cause":"NORMAL_CLEARING","type":"local"},{"uuid":"240ac3bd-12aa-42c4-80aa-b9cb7b0e62c3","caller":"100","caller_name":"100","from_domain":"example.onpbx.ru","to":"urnuuid00000000-0000-0000-0000-1ce6c7989857","to_domain":"example.onpbx.ru","gateway":"","date":"1461821189","duration":"0","billsec":"0","hangup_cause":"EXCHANGE_ROUTING_ERROR","type":"local"},{"uuid":"41e091c8-8828-4321-8cd7-2b2b2e327bfe","caller":"100","caller_name":"100","from_domain":"example.onpbx.ru","to":"urnuuid00000000-0000-0000-0000-1ce6c7989857","to_domain":"example.onpbx.ru","gateway":"","date":"1461821241","duration":"0","billsec":"0","hangup_cause":"EXCHANGE_ROUTING_ERROR","type":"local"},{"uuid":"cda5fbd6-f81b-4b18-bcd6-cd4980a1d9e3","caller":"100","caller_name":"100","from_domain":"example.onpbx.ru","to":"urnuuid00000000-0000-0000-0000-1ce6c7989857","to_domain":"example.onpbx.ru","gateway":"","date":"1461821619","duration":"0","billsec":"0","hangup_cause":"EXCHANGE_ROUTING_ERROR","type":"local"},{"uuid":"78d22c44-faf1-43b2-86af-b0ed1cdb3357","caller":"100","caller_name":"100","from_domain":"example.onpbx.ru","to":"urnuuid00000000-0000-0000-0000-1ce6c7989857","to_domain":"example.onpbx.ru","gateway":"","date":"1461821638","duration":"0","billsec":"0","hangup_cause":"EXCHANGE_ROUTING_ERROR","type":"local"},{"uuid":"8090e90f-5b17-4454-a724-30ee245b2af3","caller":"100","caller_name":"Outbound Call","from_domain":"example.onpbx.ru","to":"9197","to_domain":"example.onpbx.ru","gateway":"","date":"1461833963","duration":"28","billsec":"25","hangup_cause":"NORMAL_CLEARING","type":"local"},{"uuid":"1b11e344-afc8-4a50-ae92-de3a42f1a608","caller":"100","caller_name":"Outbound Call","from_domain":"example.onpbx.ru","to":"9197","to_domain":"example.onpbx.ru","gateway":"","date":"1461834303","duration":"6","billsec":"2","hangup_cause":"NORMAL_CLEARING","type":"local"}]}


 

Downloading recordings of specific calls

Request

URL: api.onlinepbx.ru/example.onpbx.ru/history/search.json

POST /example.onpbx.ru/history/search.json HTTP/1.1

Host: api.onlinepbx.ru
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:42.0) Gecko/20100101 Firefox/42.0
Accept: application/json
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
x-pbx-date: Thu, 28 Apr 2016 09:12:58 GMT
Content-Type: application/x-www-form-urlencoded; charset=UTF-8;
Content-MD5: 34f571545b5bc7ce896aaa465bfd4b9a
x-pbx-authentication: 9acd73e82cbd9af4efbcf444fe04b9ff:ZTZkMjEwNGUyOGY2NGI2OWU1MDI4YjlmNzcxOGMzNWMwMDIwNTA2Mw==
Content-Length: 52
Connection: keep-alive
Pragma: no-cache
Cache-Control: no-cache

uuid=8090e90f-5b17-4454-a724-30ee245b2af3&download=1

Responce

HTTP/1.1 200 OK
Date: Thu, 28 Apr 2016 09:12:58 GMT
Server: Apache
X-Powered-By: PHP/5.5.18-pl0-gentoo
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: POST, GET, OPTIONS
Access-Control-Allow-Headers: Content-Type,Content-MD5,x-pbx-authentication,x-pbx-date
Content-Length: 126
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Content-Type: text/json

{"status":1,"comment":"","data":"https:\/\/example.onpbx.ru\/download\/uZBoqSfk0PccajcGUQQhNN9tqum0vyNANgCb1GvFpEXSA\/rec.wav"}

 

 


 

Downloading several recordings using the TAR archive

Request

URL:api.onlinepbx.ru/example.onpbx.ru/history/search.json

POST /example.onpbx.ru/history/search.json HTTP/1.1

Host: api.onlinepbx.ru
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:42.0) Gecko/20100101 Firefox/42.0
Accept: application/json
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
x-pbx-date: Thu, 28 Apr 2016 09:11:55 GMT
Content-Type: application/x-www-form-urlencoded; charset=UTF-8;
Content-MD5: 31449869d0b5b23fc7fffb988da9d183
x-pbx-authentication: 9acd73e82cbd9af4efbcf444fe04b9ff:YzA1YTI4OTU4NjFiMTEzMzg3ZTVjM2M4OTMyY2NhZTU0YWMyMDdlMw==
Content-Length: 64
Connection: keep-alive
Pragma: no-cache
Cache-Control: no-cache

date_from=25%20Apr%202016%2000%3A00%3A00%20GMT%2B0300&download=1

Responce

HTTP/1.1 200 OK
Date: Thu, 28 Apr 2016 09:11:55 GMT
Server: Apache
X-Powered-By: PHP/5.5.18-pl0-gentoo
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: POST, GET, OPTIONS
Access-Control-Allow-Headers: Content-Type,Content-MD5,x-pbx-authentication,x-pbx-date
Content-Length: 133
Keep-Alive: timeout=15, max=99
Connection: Keep-Alive
Content-Type: text/json

{"status":1,"comment":"","data":"https:\/\/example.onpbx.ru\/download_batch\/?key=zsnrQs8Mdsb4TTYzFa3b2uUJ4Jbpbyl3ht20pAS204zJWz3NrR"}

 

To contents


 

ICM (Intelligent Contact Manager)

Contact search

Table of parameters:

ParameterNoteDescription
out_num External number
int_num Internal number of team member
date_from Date of last change from (RFC-2822)
date_to Date of last change to (RFC-2822)
creation_date_from Date of creation from (RFC-2822)
creation_date_to Date of creation to (RFC-2822)

(warning) Request must include at least one of these parameters.

Request

URL: api.onlinepbx.ru/example.onpbx.ru/icm/search.json

POST /example.onpbx.ru/icm/search.json HTTP/1.1

Host: api.onlinepbx.ru
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:42.0) Gecko/20100101 Firefox/42.0
Accept: application/json
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
x-pbx-date: Thu, 28 Apr 2016 09:18:00 GMT
Content-Type: application/x-www-form-urlencoded; charset=UTF-8;
Content-MD5: ef760dd2ac332e4648eb90d51349a7ca
x-pbx-authentication: 9acd73e82cbd9af4efbcf444fe04b9ff:NDY2N2I0MDQzODE4Y2U3MDRmYWMyZDkwMThjYTVkZTc3YmY2MzAzOQ==
Content-Length: 18
Connection: keep-alive
Pragma: no-cache
Cache-Control: no-cache

out_num=0123456789

Responce

HTTP/1.1 200 OK
Date: Thu, 28 Apr 2016 09:18:00 GMT
Server: Apache
X-Powered-By: PHP/5.5.18-pl0-gentoo
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: POST, GET, OPTIONS
Access-Control-Allow-Headers: Content-Type,Content-MD5,x-pbx-authentication,x-pbx-date
Content-Length: 155
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Content-Type: text/json

{"status":1,"comment":"","data":[{"out_num":"0123456789","out_name":"","num":"100","block":"","note":"","date":"1461835032","creation_date":"1461832032"}]}


 

Add contact

Table of parameters:

ParameterNoteDescription
out_nummandatoryExternal number
out_name Contact name
int_nummandatoryInternal number of team member
block Prohibit changes 1/0 (on/off)
note  
Request

URL: api.onlinepbx.ru/example.onpbx.ru/icm/add.json

POST /example.onpbx.ru/icm/add.json HTTP/1.1

Host: api.onlinepbx.ru
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:42.0) Gecko/20100101 Firefox/42.0
Accept: application/json
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
x-pbx-date: Thu, 28 Apr 2016 09:20:13 GMT
Content-Type: application/x-www-form-urlencoded; charset=UTF-8;
Content-MD5: df1dba2e21d11732f37a9328b63e6800
x-pbx-authentication: 9acd73e82cbd9af4efbcf444fe04b9ff:ODM2MDRiZTAxZTJjNTNmZGE5Y2FiN2FmMDk1N2FhY2JmYTFkYWZiNw==
Content-Length: 71
Connection: keep-alive
Pragma: no-cache
Cache-Control: no-cache

out_num=9876543210&out_name=Client&int_num=200&note=icm%20api%20example

Responce

HTTP/1.1 200 OK
Date: Thu, 28 Apr 2016 09:20:13 GMT
Server: Apache
X-Powered-By: PHP/5.5.18-pl0-gentoo
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: POST, GET, OPTIONS
Access-Control-Allow-Headers: Content-Type,Content-MD5,x-pbx-authentication,x-pbx-date
Content-Length: 35
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Content-Type: text/json

{"status":1,"comment":"","data":""}


 

Change contact

Table of parameters:

ParameterNoteDescription
out_nummandatoryExternal number
out_name Contact name
int_nummandatoryInternal number of team member
block Prohibit changes 1/0 (on/off)
note  
Request

URL: api.onlinepbx.ru/example.onpbx.ru/icm/edit.json

POST /example.onpbx.ru/icm/edit.json HTTP/1.1

Host: api.onlinepbx.ru
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:42.0) Gecko/20100101 Firefox/42.0
Accept: application/json
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
x-pbx-date: Thu, 28 Apr 2016 09:22:25 GMT
Content-Type: application/x-www-form-urlencoded; charset=UTF-8;
Content-MD5: 57301486b1fc5818fb0918e7b04e6f09
x-pbx-authentication: 9acd73e82cbd9af4efbcf444fe04b9ff:ODc4Yzg4YmZiMmJmNDJmZGVhNmZkMzRlZjQ4M2FmZWRiOWQ1MjQyNQ==
Content-Length: 53
Connection: keep-alive
Pragma: no-cache
Cache-Control: no-cache

out_num=9876543210&block=1&note=icm%20block%20example

Responce

HTTP/1.1 200 OK
Date: Thu, 28 Apr 2016 09:22:25 GMT
Server: Apache
X-Powered-By: PHP/5.5.18-pl0-gentoo
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: POST, GET, OPTIONS
Access-Control-Allow-Headers: Content-Type,Content-MD5,x-pbx-authentication,x-pbx-date
Content-Length: 35
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Content-Type: text/json

{"status":1,"comment":"","data":""}

 

 

 

To contents


 

Users

Add user

Table of parameters:

ParameterNoteDescription
nummandatoryInternal user number
passmandatoryPassword
name  
delay1  
tr1 Unreachable number 1
delay2  
tr2 Unreachable number 2
delay3  
tr3 Unreachable number 3
Request

URL: api.onlinepbx.ru/example.onpbx.ru/user/add.json

POST /example.onpbx.ru/user/add.json HTTP/1.1

Host: api.onlinepbx.ru
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:42.0) Gecko/20100101 Firefox/42.0
Accept: application/json
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
x-pbx-date: Thu, 28 Apr 2016 09:34:57 GMT
Content-Type: application/x-www-form-urlencoded; charset=UTF-8;
Content-MD5: 70940e43342e9df70ab32c68fb3a0d60
x-pbx-authentication: 9acd73e82cbd9af4efbcf444fe04b9ff:OTk0MTM1OGZlODcyMDZlMGRmMTJjYTZiNDI1MTNjOGMzODM3ODg2OA==
Content-Length: 46
Connection: keep-alive
Pragma: no-cache
Cache-Control: no-cache

num=300&pass=uOnNcdx8YrR8H&name=Example%20User

Responce

HTTP/1.1 200 OK
Date: Thu, 28 Apr 2016 09:34:57 GMT
Server: Apache
X-Powered-By: PHP/5.5.18-pl0-gentoo
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: POST, GET, OPTIONS
Access-Control-Allow-Headers: Content-Type,Content-MD5,x-pbx-authentication,x-pbx-date
Content-Length: 35
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Content-Type: text/json

{"status":1,"comment":"","data":""}


 

Change User

Table of parameters:

ParameterNoteDescription
nummandatoryInternal user number
passmandatoryPassword
name  
delay1  
tr1 Unreachable number 1
delay2  
tr2 Unreachable number 2
delay3  
tr3 Unreachable number 3
Request

URL: api.onlinepbx.ru/example.onpbx.ru/user/edit.json

POST /example.onpbx.ru/user/edit.json HTTP/1.1

Host: api.onlinepbx.ru
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:42.0) Gecko/20100101 Firefox/42.0
Accept: application/json
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
x-pbx-date: Thu, 28 Apr 2016 09:36:36 GMT
Content-Type: application/x-www-form-urlencoded; charset=UTF-8;
Content-MD5: 93e4036aeea6f77edfd627396c8ec060
x-pbx-authentication: 9acd73e82cbd9af4efbcf444fe04b9ff:NGM0NWUwNmM5MjRlNGRlNDM3NmJhYTQ3NDNkYjMyMGMyMWZlYmQ4Zg==
Content-Length: 45
Connection: keep-alive
Pragma: no-cache
Cache-Control: no-cache

num=300&pass=cA7ApxgqJpdE3&delay1=10&tr1=5000

Responce

HTTP/1.1 200 OK
Date: Thu, 28 Apr 2016 09:36:37 GMT
Server: Apache
X-Powered-By: PHP/5.5.18-pl0-gentoo
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: POST, GET, OPTIONS
Access-Control-Allow-Headers: Content-Type,Content-MD5,x-pbx-authentication,x-pbx-date
Content-Length: 35
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Content-Type: text/json

{"status":1,"comment":"","data":""}


 

Receive

Table of parameters:

ParameterNoteDescription
nummandatoryInternal number of user
name  
delay1  
tr1 Unreachable number 1
delay2  
tr2 Unreachable number 2
delay3  
tr3 Unreachable number 3
Request

URL: api.onlinepbx.ru/example.onpbx.ru/user/get.json

POST /example.onpbx.ru/user/get.json HTTP/1.1

Host: api.onlinepbx.ru
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:42.0) Gecko/20100101 Firefox/42.0
Accept: application/json
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
x-pbx-date: Thu, 28 Apr 2016 09:38:10 GMT
Content-Type: application/x-www-form-urlencoded; charset=UTF-8;
Content-MD5: 51163ef87bc2e99cb965b7a17ca85fd2
x-pbx-authentication: 9acd73e82cbd9af4efbcf444fe04b9ff:Njg2YmE4YzM5YWVkYTgzOWEyNzFmMjFlZDIxY2MyMzQ4M2Q3ZDlhNg==
Content-Length: 7
Connection: keep-alive
Pragma: no-cache
Cache-Control: no-cache

num=300

Responce

HTTP/1.1 200 OK
Date: Thu, 28 Apr 2016 09:38:10 GMT
Server: Apache
X-Powered-By: PHP/5.5.18-pl0-gentoo
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: POST, GET, OPTIONS
Access-Control-Allow-Headers: Content-Type,Content-MD5,x-pbx-authentication,x-pbx-date
Content-Length: 127
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Content-Type: text/json

{"status":1,"comment":"","data":{"name":"Example User","tr1":"5000","tr2":"","tr3":"","delay1":"10","delay2":"0","delay3":"0"}}


 

Receive directory of internal numbers

Request

URL: api.onlinepbx.ru/example.onpbx.ru/user/get.json

POST /example.onpbx.ru/user/get.json HTTP/1.1

Host: api.onlinepbx.ru
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:42.0) Gecko/20100101 Firefox/42.0
Accept: application/json
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
x-pbx-date: Thu, 28 Apr 2016 09:39:06 GMT
Content-Type: application/x-www-form-urlencoded; charset=UTF-8;
Content-MD5: d41d8cd98f00b204e9800998ecf8427e
x-pbx-authentication: 9acd73e82cbd9af4efbcf444fe04b9ff:MTFkMzc2NDQxZjNiYjA3ZTk2YTU4YzA0ZTExZmE4ODBkZTE1NWM2Yg==
Content-Length: 0
Connection: keep-alive
Pragma: no-cache
Cache-Control: no-cache

Responce

HTTP/1.1 200 OK
Date: Thu, 28 Apr 2016 09:39:06 GMT
Server: Apache
X-Powered-By: PHP/5.5.18-pl0-gentoo
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: POST, GET, OPTIONS
Access-Control-Allow-Headers: Content-Type,Content-MD5,x-pbx-authentication,x-pbx-date
Content-Length: 64
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Content-Type: text/json

{"status":1,"comment":"","data":["103","101","100","102","300"]}

 

 

To contents


 

Balance

Account balance information.

URL: api.onlinepbx.ru/example.onpbx.ru/balance/get.json

Table of parameters:

ParameterNoteDiscription
data 

OnlinePBX account balance

Response
{"status":1,"comment":"","data":"100"}

To contents


 

Getting number status

URL: api.onlinepbx.ru/example.onpbx.ru/trunks/get.json

Table of parameters:

 

ParameterNoteDiscription
number 

Phone number

name 

Name of phone number in field

display name  
description 

Name of external number module in onlinePBX

destination 

Number of call recipient

use_for_call_forwarding 

Use number for call forwarding

gateway 

ID of external number module onlinePBX

status Registration status of number
Response

{"status":1,"comment":"","data":

[{"number":"1101","name":"88001006729","description":"88001006729","destination":"6100","use_for_call_forwarding":"0","gateway":"0b2ffb284748173c2134174c03b35843","status":"REGED"},

{"number":"74999385724","name":"74999385724","description":"test number

OnlinePBX","destination":"","use_for_call_forwarding":"0","gateway":"d094581e3ad02fdc493e15fae7996594","status":"REGED"}]}

To contents


 

Fax

Load PDFs to the server

Table of parameters:

ParameterNoteDescription
linemandatoryFax number
filemandatory

Our library refers to the file on your server and encodes it to base64 before it is sent to our server

Request

URL: api.onlinepbx.ru/example.onpbx.ru/fax/upload.json

POST /example.onpbx.ru/fax/upload.json HTTP/1.1

Host: api.onlinepbx.ru
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:42.0) Gecko/20100101 Firefox/42.0
Accept: application/json
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
x-pbx-date: Thu, 12 May 2016 15:44:24 GMT
Content-Type: application/x-www-form-urlencoded; charset=UTF-8;
Content-MD5: 235540fefe40fda840309c5a4edecd6a
x-pbx-authentication: 9acd73e82cbd9af4efbcf444fe04b9ff:ZmE5MDk2MTk0MDYzZWUwZTU3ZjljNzFkZjJlMDZjMjVjNDBkODUyYQ==
Content-Length: 10935
Connection: keep-alive
Pragma: no-cache
Cache-Control: no-cache

line=32&file%5Bname%5D=pdf-sample.pdf&file%5Bdata%5D=JVBERi0xLjMNJeLjz9MNCjcgMCBvYmoNPDwvTGluZWFyaXplZCAxL0wgNzk0NS9PIDkvRSAzNTI0L04gMS9UIDc2NTYvSCBbIDQ1MSAxMzddPj4NZW5kb2JqDSAgICAgICAgICAgICAgICAgICAgICAgDQoxMyAwIG9iag08PC9EZWNvZGVQYXJtczw8L0NvbHVtbnMgNC9QcmVkaWN0b3IgMTI%2BPi9GaWx0ZXIvRmxhdGVEZWNvZGUvSURbPDREQzkxQTE4NzVBNkQ3MDdBRUMyMDNCQjAyMUM5M0EwPjxGNkM5MkIzNjhBOEExMzQwODQ1N0ExRDM5NUEzN0VCOT5dL0luZGV4WzcgMjFdL0luZm8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sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iPgogICAgICAgICA8eG1wTU06RG9jdW1lbnRJRD51dWlkOjA4MDVlMjIxLTgwYTgtNDU5ZS1hNTIyLTYzNWVkNWMxZTJlNjwveG1wTU06RG9jdW1lbnRJRD4KICAgICAgICAgPHhtcE1NOkluc3RhbmNlSUQ%2BdXVpZDo2MmQ2YWU2ZC00M2M0LTQ3MmQtOWIyOC03YzRhZGQ4ZjllNDY8L3htcE1NOkluc3RhbmNlSUQ%2BCiAgICAgIDwvcmRmOkRlc2NyaXB0aW9uPgogICA8L3JkZjpSREY%2BCjwveDp4bXBtZXRhPgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgCjw%2FeHBhY2tldCBlbmQ9InciPz4NCmVuZHN0cmVhbQ1lbmRvYmoNMiAwIG9iag08PC9GaWx0ZXIvRmxhdGVEZWNvZGUvRmlyc3QgNC9MZW5ndGggNDgvTiAxL1R5cGUvT2JqU3RtPj5zdHJlYW0NCmjeMlUwULCx0XfOL80rUTDU985MKY62BIoFxeqHVBak6gckpqcW29kBBBgA1ncLgA0KZW5kc3RyZWFtDWVuZG9iag0zIDAgb2JqDTw8L0ZpbHRlci9GbGF0ZURlY29kZS9GaXJzdCA0L0xlbmd0aCAxNjcvTiAxL1R5cGUvT2JqU3RtPj5zdHJlYW0NCmjePMvBCsIwEEXRX5mdDaKdxCpVSqFY3AkuBNexSelA6EAyRfx7A4qPu3znAAhNU3aLTByLwVkKb1Weo7dCPPdWfNGfDOYdzFGj0VivtV4hrn6vrK40RE48Cjw4Oqi3qMoruz%2FWuwxrvTeV3m2w%2BuJbZLcMPhZdxk8r0FMSCsFHqLYII0d40Oz4lVR5Jwm%2BuE%2BUIGdBfBK49RcYKXjVth8BBgBnZztkDQplbmRzdHJlYW0NZW5kb2JqDTQgMCBvYmoNPDwvRGVjb2RlUGFybXM8PC9Db2x1bW5zIDMvUHJlZGljdG9yIDEyPj4vRmlsdGVyL0ZsYXRlRGVjb2RlL0lEWzw0REM5MUExODc1QTZENzA3QUVDMjAzQkIwMjFDOTNBMD48RjZDOTJCMzY4QThBMTM0MDg0NTdBMUQzOTVBMzdFQjk%2BXS9JbmZvIDYgMCBSL0xlbmd0aCAzNy9Sb290IDggMCBSL1NpemUgNy9UeXBlL1hSZWYvV1sxIDIgMF0%2BPnN0cmVhbQ0KaN5iYmBgYGLkPcLEwD%2BViYGhh4mBkYWJ8bEkkM0IEGAAKlkDFA0KZW5kc3RyZWFtDWVuZG9iag1zdGFydHhyZWYNCjExNg0KJSVFT0YNCg%3D%3D

Responce

HTTP/1.1 200 OK
Date: Thu, 12 May 2016 15:44:24 GMT
Server: Apache
X-Powered-By: PHP/5.5.18-pl0-gentoo
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: POST, GET, OPTIONS
Access-Control-Allow-Headers: Content-Type,Content-MD5,x-pbx-authentication,x-pbx-date
Content-Length: 35
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Content-Type: text/json

{"status":1,"comment":"","data":""}

 

 

 

To contents


 

Examples in use

Examples in PHP

Table of parameters:

ParameterNoteDescription
domain Your SIP domain
apikey API key found in the control pane
new New key
data_key_array Ready PHP array with keys
secret_key Secret key received in last request
key_id Open key (key identifier)
url URL of request
post  
data_array Ready array with response

(warning) A request must include at least one of these parameters.

Request

Library api.onlinepbx.ru/lib/onpbx_http_api.php_v1.1.zip

// Connecting library
require_once './onpbx_http_api.php';


// Receiving secret key
$domain = 'demo.onpbx.ru';
$apikey = '56ofsz1scn3r790324l4fw2843597822';
$new = false;
$data_key_array = onpbx_get_secret_key($domain, $apikey, $new);


// Completing requests
$secret_key = $data_key_array['data']['key'];
$key_id = $data_key_array['data']['key_id'];
$url = 'api.onlinepbx.ru/'.$domain.'/call/now.json';
$post = array('from' => '202', 'to'=>'203');
$data_array = onpbx_api_query($secret_key, $key_id, $url, $post);

 

getting the secret key

 

Examples in JavaScript

Table of parameters:

ParameterNoteDescription
var domain Your SIP domain
var apikey API key available in control panel
var new_key Generate new key
var secret_key Secret Key
var key_id  
var url URL request
var post POST request data

(warning) A request must include at least one of these parameters.

Request

Library api.onlinepbx.ru/lib/onpbx_http_api.js

// Connecting library
<script type="text/javascript" src="https://api.onlinepbx.ru/lib/onpbx_http_api.js">>
<script type="text/javascript" >

// Determining variables
var domain = 'demo.onpbx.ru';
var apikey = '56ofsz1scn3r790324l4fw2843597822';
var new_key = false;
var secret_key = "";
var key_id = "";

// Receiving secret key and identifier

onpbx_get_secret_key(domain, apikey, new_key, function(json){
if(!json['status']){
return alert(json['status'] + ':' + json['comment']); //error obtaining secret key
}

var secret_key = json['data']['key'];
var key_id = json['data']['key_id'];

// Determining request data
var url = 'api.onlinepbx.ru/' + domain + '/call/now.json';
var post = {'from':'202', 'to':'203'};

// Callback notification sent after receiving response from server
function query_callback(json){ alert(json['status'] + ':' + json['comment']); }

// Сompleting request
onpbx_api_query(secret_key, key_id, url, post, query_callback ); // receiving ready object with response

});
</script>

Write a comment…