Difference between revisions of "MOR API callback init"

From Kolmisoft Wiki
Jump to navigationJump to search
 
(34 intermediate revisions by 7 users not shown)
Line 1: Line 1:
[[MOR API]]
=Description=
[[Callback|Callback Addon]] is needed in order to use [[MOR API]] callback.


=Request=
This API method is often used to implement Click2Call functionality from webpage. Also it can be used in CRM systems like SugarCRM, Salesforce and others.
<br><br>
=Usage=


http://<YOUR_SERVER_IP>/mor/api/callback?u=<USERNAME>&p=<PASSWORD>device=<DEVICE_ID>&src=<SOURCE>&dst=<DESTINATION>
* From '''MOR X4''' call: '''/api/callback_init'''
* For Backwards-compatibility old name 'callback' is also usable. Call: '''/api/callback'''
* Methods: POST, GET(if allowed, not recomended)
<br><br>
===Parameters===


* USERNAME/PASSWORD - for user, not device!
Parameters which are '''included''' into hash:
* DEVICE_ID - which device should be used to initiate callback and which CALLERID will be set on the call
* SOURCE - which number to dial first
* DESTINATION - will be dialed when SOURCE will answer


You can omit <DESTINATION>. SOURCE will be asked to enter it if you do so.
* '''device''' – device_id, which device should be used to initiate callback and which Caller ID will be set on the call (Device ID = Device ACC, or accountcode). You can find ACC in /billing/devices/devices_all). USER should be the owner of the device in MOR.
* '''dst''' – destination, which will be dialed when SOURCE answers.
* '''src''' – source, which number to dial first.


'''Note that parameters are shown in the same order as they have to be when generating the hash. Last parameter in a row is API_Secret_Key'''
<br><br>
Parameters which are '''not included''' into hash:


==Response==
* [[MOR API hash construction | hash]] - SHA1 hash constructed using parameters above and API_Secret_Key ([[MOR API hash construction | More described in Constructing hash]]). '''Required'''.
* '''u''' – users username, not from the device! (user should be the owner of the device)
<!---from x5--->
* '''cli_lega''' - callerID on legA. Optional. Takes higher priority than GUI settings.
* '''cli_legb''' - callerID on legB. Optional. Takes higher priority than GUI settings.
* '''card_pin''' - Card PIN. Optional.
* '''lega_tariff_id''' - which Tariff to use for User when calling to legA. Optional.
* '''lega_reseller_tariff_id''' - which Tariff to use for Reseller when calling to legA. Optional.
* '''lega_lcr_id''' - which LCR to use for User when calling to legA. Optional.
* '''server_id''' - ID of Server which has to be used. Optional.
* '''callback_uniqueid''' - if set to 1, MOR will return callback_uniqueid which links both Callback Calls (this callback_uniqueid is the same for legA and legB CDRs). Note that API response format will change if you use this parameter. Also, '''use_callback_uniqueid''' setting must be enabled in [[Mor.conf|mor.conf]]. Optional.


<Status>Ok</Status>
You can omit <DESTINATION>. If you do so, SOURCE will be asked to enter it.
<br><br>


* Means callback is initiated
===Request===


<br>
HTML POST: http://<YOUR_SERVER_IP>/billing/api/callback?u=username&device=device_id&src=source&dst=destination
<br><br>
===Returns===


=Errors=
'''Success'''– Means callback is initiated.


==Not authenticated==
<?xml version="1.0" encoding="UTF-8"?>
<status>Ok</status>


  <Status>Not authenticated</Status>
If parameter callback_uniqueid=1 was used, reponse will change to:
   
<?xml version="1.0" encoding="UTF-8"?>
<page>
    <status>ok</status>
    <callback_uniqueid>14811237541247270</callback_uniqueid>
</page>


* User is not present with provided username
Here <callback_uniqueid> will contain uniqueid that links both Callback legs (legA and legB).
* User's password is wrong


==Bad device==
<br><br>
----


<Status>Bad device</Status>
'''Errors'''


* Device does not exist
Not authenticated – User is not present with provided username.
* Device should belong to user if user does not have 'admin' rights.


==No source==
<?xml version="1.0" encoding="UTF-8"?>
<status>Not authenticated</status>


<Status>No source</Status>
Bad device – Device does not exist or Device should belong to user if user does not have 'admin' rights.


* No source in request
<?xml version="1.0" encoding="UTF-8"?>
<status>Bad device</status>


No source – No source in request.


==Call is not received==
<?xml version="1.0" encoding="UTF-8"?>
<status>No source</status>


* Check your CDR for FAILED call and reason why it failed
PIN was not found - Entered PIN is not numerical or not found.
* Check Asterisk CLI for error
<?xml version="1.0" encoding="UTF-8"?>
* Use [[Call Tracing]] to locate error and fix it
<status>PIN was not found</status>
 
===Call is not received===
 
* Check your CDR for a FAILED call and reason why it failed.
* Check Asterisk CLI for error.
* Use [[Call Tracing]] to locate the error and fix it.
<br><br>
= See also =
 
* [[MOR API]]
* [[Callback]]

Latest revision as of 08:12, 7 November 2018

Description

Callback Addon is needed in order to use MOR API callback.

This API method is often used to implement Click2Call functionality from webpage. Also it can be used in CRM systems like SugarCRM, Salesforce and others.

Usage

  • From MOR X4 call: /api/callback_init
  • For Backwards-compatibility old name 'callback' is also usable. Call: /api/callback
  • Methods: POST, GET(if allowed, not recomended)



Parameters

Parameters which are included into hash:

  • device – device_id, which device should be used to initiate callback and which Caller ID will be set on the call (Device ID = Device ACC, or accountcode). You can find ACC in /billing/devices/devices_all). USER should be the owner of the device in MOR.
  • dst – destination, which will be dialed when SOURCE answers.
  • src – source, which number to dial first.

Note that parameters are shown in the same order as they have to be when generating the hash. Last parameter in a row is API_Secret_Key

Parameters which are not included into hash:

  • hash - SHA1 hash constructed using parameters above and API_Secret_Key ( More described in Constructing hash). Required.
  • u – users username, not from the device! (user should be the owner of the device)
  • cli_lega - callerID on legA. Optional. Takes higher priority than GUI settings.
  • cli_legb - callerID on legB. Optional. Takes higher priority than GUI settings.
  • card_pin - Card PIN. Optional.
  • lega_tariff_id - which Tariff to use for User when calling to legA. Optional.
  • lega_reseller_tariff_id - which Tariff to use for Reseller when calling to legA. Optional.
  • lega_lcr_id - which LCR to use for User when calling to legA. Optional.
  • server_id - ID of Server which has to be used. Optional.
  • callback_uniqueid - if set to 1, MOR will return callback_uniqueid which links both Callback Calls (this callback_uniqueid is the same for legA and legB CDRs). Note that API response format will change if you use this parameter. Also, use_callback_uniqueid setting must be enabled in mor.conf. Optional.

You can omit <DESTINATION>. If you do so, SOURCE will be asked to enter it.

Request

HTML POST: http://<YOUR_SERVER_IP>/billing/api/callback?u=username&device=device_id&src=source&dst=destination



Returns

Success– Means callback is initiated.

<?xml version="1.0" encoding="UTF-8"?>
<status>Ok</status>

If parameter callback_uniqueid=1 was used, reponse will change to:

<?xml version="1.0" encoding="UTF-8"?>
<page>
    <status>ok</status>
    <callback_uniqueid>14811237541247270</callback_uniqueid>
</page>

Here <callback_uniqueid> will contain uniqueid that links both Callback legs (legA and legB).




Errors

Not authenticated – User is not present with provided username.

<?xml version="1.0" encoding="UTF-8"?>
<status>Not authenticated</status>

Bad device – Device does not exist or Device should belong to user if user does not have 'admin' rights.

<?xml version="1.0" encoding="UTF-8"?>
<status>Bad device</status>

No source – No source in request.

<?xml version="1.0" encoding="UTF-8"?>
<status>No source</status>

PIN was not found - Entered PIN is not numerical or not found.

<?xml version="1.0" encoding="UTF-8"?>
<status>PIN was not found</status>

Call is not received

  • Check your CDR for a FAILED call and reason why it failed.
  • Check Asterisk CLI for error.
  • Use Call Tracing to locate the error and fix it.



See also