MOR API local calls get

From Kolmisoft Wiki

Jump to: navigation, search

Contents

[edit] Description

Retrieves list of local calls in selected time period for specified User/Device.

Admin - can get any user calls

Reseller - can get his and his users calls.

User - can get his own calls.

[edit] Usage

  • From MOR X13 call: /api/local_calls_get
  • Methods: POST, GET(if allowed, not recomended)



[edit] Parameters

Parameters which are included into hash:

  • from - Unix timestamp of local calls period starting date.
  • till - Unix timestamp of calls period end date.
  • s_user - User's ID in MOR database. Required,.

NOTE that if from and till will not be entered, API would show today`s local calls.

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 (if setting Disable hash checking is not checked).
  • u - username for authentication. Required.

[edit] Request

If you want find local calls for s_user = 5 in period from 2018-01-01 23:59:59 till 2019-01-01 00:00:00, and your API Secret Key = 123456

You send:

HTML POST: http://SERVER_IP/billing/api/local_calls_get?u=admin&s_user=5&from=1514851199&till=1546300800&hash=7c4a8d09ca3762af61e59520943dc26494f8941b



[edit] Returns

Success: Everything is ok. You get the list of local calls if there is any:

<?xml version="1.0" encoding="UTF-8"?>
<page>
 <local_calls>
   <call>
       <calldate>
       <date>2018-10-03 14:08:52</date>
       <timezone>GMT +0000</timezone>
     </calldate>
     <originator_device>2 Device Test</originator_device>
     <originator_caller_id>8888888888</originator_caller_id>
     <orignator_ip></orignator_ip>
     <orignator_channel>Local/1003@mor_local-00000003;2</orignator_channel>
     <terminator_user>Tom Ford</terminator_user>
     <terminator_device>2 Device Test</terminator_device>
     <terminator_ip></terminator_ip>
   </call>
 </local_calls>
</page>

NOTE that calldate is in system(server) Time Zone.

Errors:

  • <error>API Requests are disabled</error> – Allow API globally setting is unchecked.
  • <error>Access Denied</error> – Such username does not exist in the database or it was not specified.
  • <error>Incorrect hash</error> – Hash was not correct. Check API_Secret_Key and order or params while concatenating hash_string.
  • <error>User was not found</error> – User was not found using user_id. Use correct user_id.

Example:

 <status>
   <error>API Requests are disabled</error>
 </status>



[edit] See also

Personal tools

Try MOR

Try M2