MOR API device callflow update
From Kolmisoft Wiki
Description
This API method allows you to change callflow actions, assign numbers, devices or edit Caller ID.
Usage
- From MOR X4 call: /api/device_callflow_update
- Methods: POST, GET(if allowed, not recommended)
Parametres
- device_id - device id which callflow settings you want to change. Required.
- state - callflow state you want to edit. Possible values are: before_call, no_answer, failed, busy. Required.
- action - defines what action needs to be taken at specific state. Possible values are: empty, forward, fax_detect (only for before_call state), voicemail. Required.
NOTE: when using forward action you also need to specify where to forward: foward_to_device=[device_id], external_number=[number] (for example: external_number=37062698746). NOTE: when using fax_detect you need to specify fax device by using fax_device=[device_id].
- forward_to_device - used to specify device to which call needs to be forwarded.
- external_number - used to specify fax device to which call will be forwarded.
- fax_device - used to specify number to which call needs to be forwarded.
- voicemail - when this action is set, call will go straight to voicemail.
- device_callerid - is used to set caller id from device. Possible value: true.
- src_callerid - sets caller id the same as it comes. Possible value: true.
- did_id - assigns caller id as did number.
NOTE: did needs to be assigned for the device otherwise it will not be able to use this did.
- custom - this means that any caller id value will be assigned to the state.
- u - username for authentication. Required.
- hash - SHA1 hash constructed using params and API_Secret_Key ( More described in Constructing hash). Required.
Request examples
HTML POST: http://<SERVER_IP>/billing/api/device_callflow_update?u=admin&device_id=4&state=before_call&callflow_action=forward&external_number=37062699289&custom=caller&hash=ed9d3657ad490fa2ed860ecc93223d58bf471672
HTML POST: http://<SERVER_IP>/billing/api/device_callflow_update?u=admin&device_id=4&state=before_call&callflow_action=fax_detect&fax_device=2&hash=2b76184f5fd39ee4d149d7481c39d57fdc1f7f7a
HTML POST: http://<SERVER_IP>/billing/api/device_callflow_update?u=admin&device_id=4&state=before_call&callflow_action=fax_detect&fax_device=2&hash=71973ad6f8d1f8a52ba17e3a2d3a4e974ac057d2
NOTE that username and password are not included in hash
Returns
Success
<?xml version="1.0" encoding="UTF-8"?> <page> <status>Callflow was successfully updated</status> <user>Test User #1</user> <device>IAX2/1002</device> <callflow> <state>Before call</state> <priority>1</priority> <action>Forward</action> IAX2/101 <callerid_type>From Device</callerid_type> <callerid_data/> </callflow> </page>
Errors
- <error>Bad login</error> - User supplied bad login or password.
- <error>Incorrect hash</error> - Hash was not correct. Check API_Secret_Key and order or params while concatenating hash_string.
- <error>Device was not found</error> - device does not exist or does not belong to user.
- <error>You are not authorised to use this functionality</error> - Reseller needs PBX Addon permission to use this API method. Accountant has no access to callflow API at all.
- <error>Callflow state was not found</error> - no state was specified or it is incorrect.
- <error>Missing forward parameters</error> - forward action was selected without parameters where to forward.
- <error>Local device was not found</error> - forward parameter forward_to_device specified but device selected was not found.
- <error>External number was not found</error> - forward parameter external_number specified but number entered is incorrect.
- <error>Callflow action was not found</error> - no action was specified or it is incorrect.
- <error>DID was not found</error> - incorrect did specified or is it not assigned to the selected device.
- <error>FAX device was not found</error> - device does not exist or does not belong to user.