Difference between revisions of "MOR API location rule create"

From Kolmisoft Wiki
Jump to navigationJump to search
 
Line 27: Line 27:
* u - username  for authentication. Either admin or reseller username. '''Required'''.  
* u - username  for authentication. Either admin or reseller username. '''Required'''.  
* name - name of localization rule. '''Required'''.
* name - name of localization rule. '''Required'''.
* cut - cut pattern for destination. Used in '''Destination and CallerID''' Rules.
* cut - cut pattern. Used in Destination rules to cut destination pattern, CallerID rules to cut source pattern, Combined rules to cut destination pattern.
* add - add pattern for destination. Used in '''Destination and CallerID''' Rules.
* add - add pattern. Used in Destination rules to add destination pattern, CallerID rules to add source pattern, Combined rules to add destination pattern.
* minlen - minimal length for destination pattern (default 1).
* minlen - minimal length for destination pattern (default 1).
* maxlen - maximum length for destination pattern (default 99).
* maxlen - maximum length for destination pattern (default 99).

Latest revision as of 13:15, 4 August 2022

Description

Create localization rule

Admin - can create localization rules for locations under Admin account.

Reseller - can create localization rules for his own locations.



Usage

  • From MOR X14 call: /api/location_rule_create
  • Methods: POST, GET(if allowed, not recommended)



Parameters

Parameters which are included into hash:

  • location_id - id of location where rule will be created. Required.

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. Either admin or reseller username. Required.
  • name - name of localization rule. Required.
  • cut - cut pattern. Used in Destination rules to cut destination pattern, CallerID rules to cut source pattern, Combined rules to cut destination pattern.
  • add - add pattern. Used in Destination rules to add destination pattern, CallerID rules to add source pattern, Combined rules to add destination pattern.
  • minlen - minimal length for destination pattern (default 1).
  • maxlen - maximum length for destination pattern (default 99).
  • src_cut - cut pattern for source. Used in Combined rules only.
  • src_add - add pattern for source. Used in Combined rules only.
  • src_minlen - minimal length for source pattern (default 1).
  • src_maxlen - minimal length for destination pattern(default 99).
  • tariff_id - id of tariff to change to.
  • lcr_id - id of lcr to change to.
  • did_id - id of did to route call to.
  • device_id - id of device to change call owner to.
  • change_callerid_name - change callerid name option (0 - disabled, 1 - enabled, default 0).
  • location_group_id - id of location group (available only for combined rules).
  • dst_locationgroup_id - id of location group (available only for combined rules).
  • lr_type - location rule type. Available options are: src, dst, combined. Default is dst.

Request

Example:

HTML POST: http://<SERVER_IP>/billing/api/location_rule_create?u=admin&location_id=4&name=name&cut=86&add=3706&minlen=1&maxlen=25&hash=baf07459ddbee3e88d759ec8245a019c1fda1cb6



Returns

<?xml version="1.0" encoding="UTF-8"?>
<page>
  <status>
    <success>Rule added</success>
    <rule_id>23</rule_id>
  </status>
</page>

Errors

Possible Error return values are:

  • Rule must be unique - exact same rule already exists.
  • Rule must have name - name parameter is empty.
  • Cannot assign device - device id is not suitable (for example, device id is internal Provider device).
  • Cut and Add cannot be empty - both cut and add parameters are empty.
  • Device not found - device id does not exist.
  • Location error - location does not belong for Admin/Reseller.
  • Location not found - location with location_id does not exist.
  • LCR was not found - LCR with lcr_id does not exist.
  • Cannot assign lcr - lcr_id was used in Reseller account.
  • Cannot assign did - did_id was used in Reseller account.
  • DID was not found - DID with did_id does not exist.
  • Tariff was not found - tariff does not exist or is not accessible.
  • Location Group was not found - location group with id location_group_id does not exist.
  • Access Denied - incorrect authentication username.
  • Incorrect hash – Hash was not correct. Check API_Secret_Key and order or params while concatenating hash_string.

Example:

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

See also