Vodia PBX API

Examples of how the API's will work for CRUD (Create, Read, Update, Delete) for any of the attributes on the Vodia PBX. These can be used by the developers to create numerous functionalities with help of the APIs like, creating your own web interface completely from the scratch, remote controlling a system from a server, craeting classroom extension, trunks etc. Also, this can be done using any language of your choice. You can also make this as a part of the CRM software you support for e.g. creating an extension on-the-go for a hotel management system from the details of the customer provided.

Extensions

GET extensions's configurations

GET

/rest/domain/{domain_name}/user_settings/{extension_number}

Parameters

Field Type Description
domain_name String Name of the existing domain.
extension_number Int Number (id) of the existing extension

Success Response (200 OK)

Example:

curl -u admin: GET -D - http://127.0.0.1:8080/rest/domain/localhost/user_settings/440
{ access_level: "0", active_calls: "", actsync_address: "", actsync_calendar: "", actsync_cert: "", actsync_room: "", actsync_timer: "", actsync_username: "", admin: "", adrbook_pref: "", anonymous: "", auth_adr: "", avail: "", barge: "", block_cid: "false", bob: "false", call_redial: "<sip:443@localhost>", call_return: ""GXP 1628" <sip:443@localhost>", callback: "", carddav_email: "", cell_acd: "", cell_always: "", cell_c2d: "", cell_callback: "", cell_callback_dest: "", cell_conn: "", cell_dis: "", cell_hunt: "", cell_in: "", cell_mwi: "false", cell_never: "", cell_night: "", cell_pause: "", cell_retries: "", cell_time: "", cfa: "", cfa_times: "", cfb: "", cfb_times: "", cfd: "", cfn: "", cfn_timeout: "", cfn_times: "", cfr: "", checked_in: "false", cleanup: "", codecs: "", crm_address: "", crm_type: "", crm_username: "", cw: "true", dial_plan: "", display_name: "", disturb: "", dnd: "false", dnd_cust_reason: "", dnd_reason: "", door_url: "", eani: "", edest: "", email_address: "", email_all: "", email_black_call: "", email_mb_full: "", email_missed: "", email_recadr: "", email_status: "", email_vmail: "", euse: "", extcall: "", extts: "", fax: "", first_name: "Snom 820", hours_fri: "", hours_holiday: "", hours_mon: "", hours_sat: "", hours_sun: "", hours_thu: "", hours_tue: "", hours_wed: "", hunt: "", include_local: "true", lang_audio: "", lang_web: "", lastcall: "1498595251.742", lines: "", listen: "", log_register: "9", lync_authname: "", lync_username: "", lync_uuid: "", mac: "", mailbox_access: "", mailbox_escape: "", mailbox_escape9: "", mailbox_group: "", max_regs: "", mb_enable: "true", mb_offer_cell: "", mb_play_env: "", mb_size: "", mb_timeout: "", melody: "", moh: "", mwi: "true", name_use: "false", no_vpa: "", num_acds: "", orbits: "", pcall: "", pcap: "false", pcc: "", personal: "", personal_greetings: "1 446 8", pickups: "", picom: "", picture: "", playrec: "", pnp_open: "873af39063340100", position: "", predir: "", presence: "", profile: "1", profilename: "Akuvox SP-R63G", rec_911: "", rec_extension: "", rec_external: "", rec_internal: "", showacd: "", sip_hist: "03ac674216f3e15c761ee1a5e255f067953623c8b388b4459e13f978d7c846f4 88334fb045e40ad77bb51a1c0e4801f77d54e55132b7a951d95473b57b1912e0", siptrans: "", super_mwi: "false", super_number: "", super_pause: "60", super_retries: "3", tagline: "", teach: "", total_reg: "343361", tz: "", ua_type: "", use_acd_dp: "false", vm_indicator: "7/0 (0/0)", vmail_option: "", wakeup: "", wakeup_fail_email: "", web_hist: "03ac674216f3e15c761ee1a5e255f067953623c8b388b4459e13f978d7c846f4 7a5cef8ececde7adead3ec9df9646f5ec04b7cd19d7269e720b4d7870386cf0b", wrtc_register: "", acdani: "", ani: "", cdr_time: "", credit: "", dialog_state: "", dialog_subscribe: "", dialog_version: "", disabled: "", email_cdr: "", epid: "5827991637", location: "", max_call_duration: "", max_cdrs: "", need_license: "", param1: "", param2: "", param3: "", rb: "", rf: "", view_settings: "", visible: "", alias: [ "446" ] }

As seen, the response code list can be huge depending on the page (For e.g API being fired for an extension, AA, ACD etc.)

Error Codes

Field Code Description
Invalid supplied 400 Only authenticated Admins can access the data
Permission Denied 403 Only authenticated Admins can access the data.
Not Found 404 The id of the User was not found or there are errors in the URL.

POST (Create, Update and Delete the Attributes of the Extensions)

post

Create

/rest/domain/domain_name/addacc/extension_number

Parameters used

Field Type Description
domain_name String Name of the existing domain.
extension_number Int Extension number to be deleted

Example:

Request:

curl -u admin: -D - http://127.0.0.1:8080/rest/domain/localhost/addacc/447 -X POST -d "{ 'type':'extensions', 'account_ext':'447', 'first_name':'Nikola', 'last_name':'Tesla', 'cell':'(777)788-8800', 'email':'telephone@bsnl.com', 'mac':'AABBCCDDEEFF' }"

Response:

Response Code Description
Success 200 OK
Invalid ID supplied 400 Only authenticated a Admins can access the data
Permission Denied 403 Forbidden
Not Found 404 The id of the User was not found or there are errors in the URL.

Update

/rest/domain/domain_name/user_settings/extension_number

Parameters used

Field Type Description
domain_name String Name of the existing domain.
extension_number Int Extension number to be deleted

Example:

Request:

curl -u admin: -D - http://127.0.0.1:8080/rest/domain/localhost/user_settings/447 -X POST -d "{ 'anonymous':'reject', 'cell_acd':'unreg', 'cell_c2d':'true', 'cell_callback':'true', 'cell_dis':'(779)1111-222', 'cell_hunt':'unreg', 'cfa':'54367356', 'no_vpa':'false' 'bob':'true' 'cfr':'545', 'dnd':'false' }"

Response:

Response Code Description
Success 200 OK
Invalid ID supplied 400 Only authenticated a Admins can access the data
Permission Denied 403 Forbidden
Not Found 404 The id of the User was not found or there are errors in the URL.

Delete

There are 2 ways of deleting an entry.

1) Delete, multiple accounts (extension, auto-attendant, agent-groups etc. together) at once.

/rest/domain/domain_name/domain_action

Parameters used

Field Type Description
domain_name String Name of the existing domain.
account_number Int Account number to be deleted

Example:

Request:

curl -u admin: -D - http://127.0.0.1:8080/rest/domain/localhost/domain_action -X POST -d "{ 'type':'accounts', 'action':'delete_selected', 'selected':'446 447' }"

2) Delete, single account at a time.

/rest/domain/domain_name/addacc/account_number

Request:

curl -u admin: -D - http://127.0.0.1:8080/rest/domain/local2/addacc/66 -X DELETE -d "{ 'type':'extensions', 'account':'66' }"

Response (for both cases):

Code Description
200 OK
400 Invalid user supplied
404 User not found

GET (Getting the Trunk's list)

GET

1) (Info of the entire list of trunks and their unique IDs)

rest/domain/domain_name/domain_trunks

Parameters

Field Type Description
domain_name String Name of the existing domain.

Success (200 OK)

Example:

Request:

curl -u admin: GET -D - http://192.168.1.194:8080/rest/domain/localhost/domain_trunks
[ { id: "1", name: "CallCentric", type: "register", disabled: "false", account: "17778648639", proxy: "sip:callcentric.com:5060", registrar: "callcentric.com", direction: "", ani: "sachinpchhajed", global: "true", status1: "200 Ok", status2: "60 s" }, { id: "2", name: "Int Trunk", type: "register", disabled: "false", account: "441", proxy: "nyc.vodia.com", registrar: "nyc.vodia.com", direction: "", ani: "", global: "false", status1: "200 Ok", status2: "180 s" }, { id: "3", name: "WebRTC", type: "wrtc", disabled: "", account: "", proxy: "", registrar: "", direction: "", ani: "", global: "", status1: "", status2: "" }, { id: "28", name: "Action Kumar", type: "register", disabled: "", account: "", proxy: "", registrar: "", direction: "", ani: "", global: "", status1: "", status2: "" } ]

2) (Info of a SINGLE trunk)

rest/domain/domain_name/edit_trunk/trunk_number

Parameters

Field Type Description
domain_name String Name of the existing domain.
trunk_number Int Unique ID number generated

Success (200 OK)

Example:

Request:

curl -u admin: -D - http://192.168.1.194:8080/rest/domain/localhost/edit_trunk/2
{ aadr: "", analog: "false", bcp: "", behind_nat: "false", cid_update: "", cobusy: "500 Line Unavailable", codec_lock: "true", codecs: "", codest: "", cur: "", dial_extension: "hi", dialplan: "1", dir: "", dis: "false", domain: "1", dtmf: "false", dtmf_mode: "", earlymedia: "true", expires: "3600", failover: "never", fraction: "128", from_source: "ppi", from_user: "", glob: "", global: "false", hcv: "", hd: "", hf: "{from}", hpai: "", hppi: "{trunk}", hpr: "{if clip true}id{fi clip true}", hrpi: "", hru: "{request-uri}", ht: "{to}", icid: "", ignore_18x_sdp: "false", interoffice: "false", minimum: "10", minor: "181 s", name: "Int Trunk", outbound_proxy: "nyc.vodia.com", pcap: "false", prack: "true", prefix: "", redirect: "false", reg_account: "441", reg_display: "Int Trunk", reg_keep: "", reg_pass: "vodia2013@1234!", reg_registrar: "nyc.vodia.com", reg_user: "441", remote_party: "", request_timeout: "", require: "", rfcrtp: "false", ring180: "false", rtcpxr: "false", rtp_begin: "", rtp_end: "", send_email: "", sip_port: "", status: "200 Ok", tel: "true", trusted: "false", type: "register", use_epid: "false", use_history: "false", use_uuid: "false", user_defined_hdr: "", uuid: "urn:uuid:47af6eb5-f535-449f-b955-25964ba0df4e", wrtc_dest_name: "", wrtc_dest_number: "" }
Response Code Description
Success 200 OK
Invalid ID supplied 400 Only authenticated a Admins can access the data
Permission Denied 403 Forbidden
Not Found 404 The id of the User was not found or there are errors in the URL.

POST (Create, Update and Delete the Attributes of the Webpage)

post

Create

/rest/domain/domain_name/domain_trunks
Example:

Request:

curl -u admin: -D - http://127.0.0.1:8080/rest/domain/localhost/domain_trunks -X POST -d "{ 'type':'register', 'name':'Trunk New' }"

Response:

Response Code Description
Success 200 OK
Invalid ID supplied 400 Only authenticated a Admins can access the data
Permission Denied 403 Forbidden
Not Found 404 The id of the User was not found or there are errors in the URL.

Update

/rest/domain/domain_name/edit_trunk/trunk_number
Example:

Request:

curl -u admin: -D - http://127.0.0.1:8080/rest/domain/localhost/edit_trunk/27 -X POST -d "{ 'remote_party':'888888888', 'hru':'new_group', 'remote_party':'456456456456', 'name':'Replaced Trunk' }"

Response:

Response Code Description
Success 200 OK
Invalid ID supplied 400 Only authenticated a Admins can access the data
Permission Denied 403 Forbidden
Not Found 404 The id of the User was not found or there are errors in the URL.

Delete

/rest/domain/domain_name/edit_trunk/trunk_number
Example:

The trunk number in the API call below can be obtained using the GET for entire trunk list

If multiple trunks have to be deleted at once, multiple API calls have to be sent, with varying Trunk IDs.

Request:

curl -u admin: -D - http://192.168.1.194:8080/rest/domain/localhost/domain_trunks?trunk=26 -X DELETE

Response:

Response Code Description
Success 200 OK
Invalid ID supplied 400 Only authenticated a Admins can access the data
Permission Denied 403 Forbidden
Not Found 404 The id of the User was not found or there are errors in the URL.