MOR API user calls get

From Kolmisoft Wiki
Jump to navigationJump to search


Retrieves list of 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.


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


Parameters which are included into hash:

  • period_start - Unix timestamp of calls period starting date. (Default: Today at 00:00).
  • period_end - Unix timestamp of calls period end date. (Default: Today at 23:59).
  • s_user - User's ID in MOR database. Required, if s_reseller is not used.
  • s_call_type - Call type. Possible values [all, answered, no answer, failed, busy]. (Default: all)
  • s_device - Device ID in MOR database. Possible values [all, numeric value of device_id]. (Default: all).
  • s_provider - Provider ID in MOR database. Possible values [all, numeric value of provider_id]. (Default: all).Only for Admin and Reseller PRO.
  • s_hgc - Hangup cause code ID in MOR database. Possible values [all, numeric value of hangup_cause_code_id]. (Default: all). Only for Admin and Reseller if Show HGC for Resellers is ON.
  • s_did - show calls made through specific DID. Possible values [all, calls.did_id]. (Default: all). Only for Admin.
  • s_destination - prefix.
  • order_desc - Possible values [0,1]. (Default: 0).
  • only_did - show calls that only went through did. Possible values [0,1]. (Default: 0).
  • s_uniqueid - returns specific Call by uniqueid. Date parameters are ignored in this case.
  • s_callback_uniqueid - returns Call(s) by callback uniqueid. Date parameters are ignored in this case. Only works when use_callback_uniqueid setting is enabled in mor.conf.
  • originator_codec_name - originator codec.
  • terminator_codec_name - terminator codec.

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.
  • order_by - Possible values [time, src, dst, prefix, nice_billsec, hgc, server, p_name, p_rate, p_price, reseller, r_rate, r_price, user, u_rate, u_price, number, d_provider, d_inc, d_owner]. (Default: time).
  • s_reseller - Reseller type User ID in MOR database. (Default: all).


If you want find s_call_type=all calls for s_user = 5, through s_device=7 in period from 2011-11-01 23:59:59 till 2011-11-30 23:59:59, and your API Secret Key = 456789

You send:

HTML POST: http://<SERVER_IP>/billing/api/user_calls_get?u=username&s_user=5&period_start=1320191999&period_end=1322697599&s_device=7&s_call_type=all&hash=df2983700ffecb52e6649f0cb3981b66537083a4 

* Note that username is not included in hash


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

<?xml version="1.0" encoding="UTF-8"?>
     <period_start>2008-03-07 11:48:18</period_start>
     <period_end>2012-03-07 11:46:01</period_end>
       <calldate2>2009-01-02 00:00:01</calldate2>
       <destination>Lithuania MOB Lithuania mobile</destination>
       <nice_reseller> </nice_reseller>
       <provider_name>Test Provider</provider_name>

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


  • <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.


   <error>API Requests are disabled</error>

See also