MOR API device callflow update
From Kolmisoft Wiki
Jump to navigationJump to search
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.
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.
- src_callerid - sets caller id the same as it comes.
- 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.