MOR API local calls get

From Kolmisoft Wiki
Revision as of 07:38, 4 January 2019 by Dmitrij (talk | contribs) (→‎Request)
Jump to navigationJump to search

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.

Usage

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



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.

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



Returns

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

<?xml version="1.0" encoding="UTF-8"?> <page>

 <local_calls>
   <call>
     <calldate>
       <date>2018-02-22 12:23:08</date>
       <timezone>GMT +0000</timezone>
     </calldate>
     <originator_device>dsadas12</originator_device>
     <originator_caller_id></originator_caller_id>
     <orignator_ip>192.168.0.198</orignator_ip>
     <orignator_channel>SIP/1018-00000008</orignator_channel>
     <terminator_user>Tom Ford</terminator_user>
     <terminator_device>2 Device Test</terminator_device>
     <terminator_ip>192.168.0.167</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>



See also