User Tools

Site Tools


api:pbx:valuerouter:list

API : PBX : Value Router list

Introduction

A Value Router is a dialplan object that holds one or more rule sets to evaluate. Each ruleset may contain one or more rules of which one or all must be matched. On match a list of actions may be performed and then the caller will be routed to the specified dialplan item.

Request

This request returns a list of all of the customers value routers.

URL https://api.telecomx.dk/pbx/valuerouter
Method GET
Access level VIEWER, MANAGE, OWNER if URL router items belongs to the customer, RESELLER if customer belongs to the reseller or ADMIN.
Query offset [optional] Index of the first item to return, default 0.
limit [optional] The number of items to return, default 50, min 1, max 1000.
filter [optional] Search query that will match against searchable fields.
full [optional] True to include all settings.
expandGoto [optional] True to expand goto id's into _id/type/number/name objects. Also sets full=true.
expandRulesets [optional] True to expand music on hold, extensions, employees, queues and redirects in the rulesets. Also sets full=true.
customer [optional] Id of customer to show value router items for. Defaults to the users own customer if not specified.
sort [optional] Which property to sort result by: number (default), name, redirect.

Query examples

https://api.telecomx.dk/pbx/valuerouter
https://api.telecomx.dk/pbx/valuerouter?customer=123458789012457890ABCD
https://api.telecomx.dk/pbx/valuerouter?customer=123458789012457890ABCD&limit=20&offset=100
https://api.telecomx.dk/pbx/valuerouter?filter=donald
https://api.telecomx.dk/pbx/valuerouter?customer=12345678901234567890ABCD&full=true
https://api.telecomx.dk/pbx/valuerouter?customer=12345678901234567890ABCD&expandGoto=true&expandRulesets=true

Response

JSON object
Property Type Description
offset Number Index of the first value router item returned.
limit Number Number of value router items to return. Note that the actual number of returned items may be lower.
total Number Number of value router items that can be returned when offset and limit is not considered. This is to be used for paging through the data.
valueRouters Array List of value router items, see definition below.
Value router object (normal)
Property Type Description
_id Id Unique id of the value router.
name String Name/description of the value router.
number String The phone number to dial to reach this value router, null if it is not dial-able.
redirect String Number to redirect to when execution starts. Used to quickly circumvent the value router.
notes String Notes about the value router.
rulesets Number Number of rulesets this value router contains.
Value router object (full=true)
Property Type Description
_id Id Unique id of the value router.
type String Always 'VALUE_ROUTER'.
customer Id Id of the customer the value router belongs to.
name String Name/description of the value router.
number String The phone number to dial to reach this value router locally, null if it is not dial-able.
startAudio Id A sound item to playback when the value router is entered, null if not used.
redirect String Number to redirect to when execution starts. Used to quickly circumvent the value router item.
notes String Notes about the value router item.
onNoMatchGoto Id Id of diaplan item to goto if no rules are matched.
rulesets Array List of rulesets to evaluate one by one.
rulesets[].index Number Index of the ruleset - order of evaluation.
rulesets[].name String Friendly name of the ruleset.
rulesets[].matchAll Boolean True if all rules must be matched, otherwise one 1 rule is required to match.
rulesets[].onMatchGoto Id Dialplan item to go to on match.
rulesets[].actions Array List of actions to perform on match before goto, see below.
rulesets[].actions[].type String Type of item to perform action on.
rulesets[].actions[].target String Target for types that requires it.
rulesets[].actions[].how String How to affect the target of the action.
rulesets[].actions[].value String Value to use.
rulesets[].rules Array List of rules to evaluate, if one matches (or all if matchAll is true), then actions and/or matchGoto is performed.
rulesets[].rules[].type String Type of item to evaluate.
rulesets[].rules[].target String Target of evaluation for types that requires it.
rulesets[].rules[].comparison String How to compare.
rulesets[].rules[].value String Value to compare against.
Rule object
Type Description Target Comparison Value
CALL_VARIABLE A variable that only exists with the call Name of the variable
a-z A-Z 0-9 _ and -
EQUALS Must match this text or number.
NOT_EQUALS Must not match this text or number.
GREATER_THAN Must be greater than this (nummeric comparison).
LESS_THAN Must be less than this (nummeric comparison).
STARTS_WITH Must start with this string.
ENDS_WITH Must end with this string.
CONTAINS Must contain this string.
LENGTH_EQUALS Must have this number of chars.
LENGTH_LESS_THAN Must have less than this number of chars.
LENGTH_GREATER_THAN Must have more that this number of chars.
RX Regular expression to match.
CALL_DURATION The number of seconds the call has lasted so far EQUALS Number of seconds to match.
NOT_EQUALS Must not match this number of seconds.
GREATER_THAN Must be greater than this number of seconds.
LESS_THAN Must be less than this number of seconds.
CALL_ORIGIN Where the call started from EQUALS EXTERNAL, SIP, MOBILE or DIALPLAN.
NOT_EQUALS EXTERNAL, SIP, MOBILE or DIALPLAN.
CALL_DIRECTION Call direction EQUALS INBOUND or OUTBOUND.
NOT_EQUALS INBOUND or OUTBOUND.
VARIABLE A persistent system variable Name of the variable
a-z A-Z 0-9 _ and -
EQUALS Must match this text or number.
NOT_EQUALS Must not match this text or number.
GREATER_THAN Must be greater than this (nummeric comparison).
LESS_THAN Must be less than this (nummeric comparison).
STARTS_WITH Must start with this string.
ENDS_WITH Must end with this string.
CONTAINS Must contain this string.
LENGTH_EQUALS Must have this number of chars.
LENGTH_LESS_THAN Must have less than this number of chars.
LENGTH_GREATER_THAN Must have more that this number of chars.
RX Regular expression to match.
SWITCH A persistent switch that can be on or off Name of the switch
a-z A-Z 0-9 _ and -
EQUALS true, false, 1, 0, yes, no.
A_NUMBER The callers phone number EQUALS Must match this phone number.
NOT_EQUALS Must not match this phone number.
STARTS_WITH Must start with this number.
ENDS_WITH Must end with this number.
CONTAINS Must contain this number.
LENGTH_EQUALS Must have this number of digits.
LENGTH_LESS_THAN Must have less than this number of digits.
LENGTH_GREATER_THAN Must have more that this number of digits.
RX Regular expression to match.
A_NAME The callers name EQUALS Must match this string.
NOT_EQUALS Must not match this text or number.
GREATER_THAN Must be greater than this (nummeric comparison).
LESS_THAN Must be less than this (nummeric comparison).
STARTS_WITH Must start with this string.
ENDS_WITH Must end with this string.
CONTAINS Must contain this string.
LENGTH_EQUALS Must have this number of chars.
LENGTH_LESS_THAN Must have less than this number of chars.
LENGTH_GREATER_THAN Must have more that this number of chars.
RX Regular expression to match.
A_NUMBER_SECRET Is callers number marked as secret EQUALS true or false.
B_NUMBER The called phone number EQUALS Must match this phone number.
NOT_EQUALS Must not match this phone number.
STARTS_WITH Must start with this number.
ENDS_WITH Must end with this number.
CONTAINS Must contain this number.
LENGTH_EQUALS Must have this number of digits.
LENGTH_LESS_THAN Must have less than this number of digits.
LENGTH_GREATER_THAN Must have more that this number of digits.
RX Regular expression to match.
DIVERSION_NUMBER The phone number of the one who
diverted the call (if diverted)
EQUALS Must match this phone number.
NOT_EQUALS Must not match this phone number.
STARTS_WITH Must start with this number.
ENDS_WITH Must end with this number.
CONTAINS Must contain this number.
LENGTH_EQUALS Must have this number of digits.
LENGTH_LESS_THAN Must have less than this number of digits.
LENGTH_GREATER_THAN Must have more that this number of digits.
RX Regular expression to match.
CDR_NOTE A note stored with the CDR for the call EQUALS Must match this string.
NOT_EQUALS Must not match this text or number.
GREATER_THAN Must be greater than this (nummeric comparison).
LESS_THAN Must be less than this (nummeric comparison).
STARTS_WITH Must start with this string.
ENDS_WITH Must end with this string.
CONTAINS Must contain this string.
LENGTH_EQUALS Must have this number of chars.
LENGTH_LESS_THAN Must have less than this number of chars.
LENGTH_GREATER_THAN Must have more that this number of chars.
RX Regular expression to match.
SIP_PHONE_ONLINE Is a SIP phone online or offline Id of SIP phone EQUALS true or false.
IP_PING Does a given IP address respond
to ping within 2 seconds
IP address or
name of call variable
EQUALS true or false.
EXTENSION_ONLINE Is an extension online
(at least one of the extensions SIP phones)
Id of extension EQUALS true or false.
EXTENSION_STATUS Is an extension in a given state Id of extension EQUALS AVAILABLE, RINGING or BUSY (includes RINGING state).
NOT_EQUALS AVAILABLE, RINGING or BUSY (includes RINGING state).
QUEUE_MEMBERS_COUNT Current number of members in a queue Id of queue EQUALS Must match this number.
NOT_EQUALS Must not match this number.
GREATER_THAN Must be greater than this number.
LESS_THAN Must be less than this number.
QUEUE_MEMBERS_AVAILABLE Current number of members in a queue
that are not busy
Id of queue EQUALS Must match this number.
NOT_EQUALS Must not match this number.
GREATER_THAN Must be greater than this number.
LESS_THAN Must be less than this number.
QUEUE_CALLERS_COUNT Current number of callers in a queue Id of queue EQUALS Must match this number.
NOT_EQUALS Must not match this number.
GREATER_THAN Must be greater than this number.
LESS_THAN Must be less than this number.
QUEUE_CALLERS_MAX_WAIT The number of seconds the #1
caller in the queue has been waiting
Id of queue EQUALS Must match this number.
NOT_EQUALS Must not match this number.
GREATER_THAN Must be greater than this number.
LESS_THAN Must be less than this number.
IS_QUEUE_MEMBER Check if an extension is member of a queue Id of extension EQUALS Id of queue.
NOT_EQUALS Id of queue.
PRESENCE_STATE Presence state of employee Id of employee EQUALS AVAILABLE, BUSY, OUT_OF_OFFICE, OFF_WORK or HOLIDAY.
NOT_EQUALS AVAILABLE, BUSY, OUT_OF_OFFICE, OFF_WORK or HOLIDAY.
PRESENCE_LOCATION Presence location of employee Id of employee EQUALS Must match this string.
NOT_EQUALS Must not match this string.
STARTS_WITH Must start with this string.
ENDS_WITH Must end with this string.
CONTAINS Must contain this string.
LENGTH_EQUALS Must have this number of chars.
LENGTH_LESS_THAN Must have less than this number of chars.
LENGTH_GREATER_THAN Must have more that this number of chars.
RX Regular expression to match.
PRESENCE_MESSAGE Presence message of employee Id of employee EQUALS Must match this string.
NOT_EQUALS Must not match this string.
STARTS_WITH Must start with this string.
ENDS_WITH Must end with this string.
CONTAINS Must contain this string.
LENGTH_EQUALS Must have this number of chars.
LENGTH_LESS_THAN Must have less than this number of chars.
LENGTH_GREATER_THAN Must have more that this number of chars.
RX Regular expression to match.
REDIRECT Current redirect on a dialplan item Id of dialplan item EQUALS Must match this phone number.
NOT_EQUALS Must not match this phone number.
STARTS_WITH Must start with this number.
ENDS_WITH Must end with this number.
CONTAINS Must contain this number.
LENGTH_EQUALS Must have this number of digits.
LENGTH_LESS_THAN Must have less than this number of digits.
LENGTH_GREATER_THAN Must have more that this number of digits.
RX Regular expression to match.
RECORD Current call recording state EQUALS true (on), false (off).
DATE_NOW The date today EQUALS Must match this date.
NOT_EQUALS Must not match this date.
GREATER_THAN Must be after this date.
LESS_THAN Must be before this date.
TIME_NOW The time right now EQUALS Must match this time, e.g. 12:30.
NOT_EQUALS Must not match this time.
GREATER_THAN Must be after this time.
LESS_THAN Must be before this time.
DAY_OF_WEEK The current day of the week 0 (sunday) to 6 (saturday) EQUALS Must match this time, e.g. 1 for monday.
NOT_EQUALS Must not match this day.
GREATER_THAN Must be after this day.
LESS_THAN Must be before this day.
Action object
Type Description Target How Value
CALL_VARIABLE A variable that only exists with the call Name of the variable
a-z A-Z 0-9 _ and -
EQUALS Text or number to set variable to.
EQUALS_INPUT n/a - sets to caller entered digits.
PREFIX String to prefix variable with.
POSTFIX String to postfix variable with.
ADD Number to add to variable.
SUBTRACT Number to subtract from variable.
DELETE n/a - variable is deleted.
CUT_PRE Number of characters to remove from the beginning of the variable.
CUT_POST Number of characters to remove from the end of the variable.
VARIABLE A persistent system variable Name of the variable
a-z A-Z 0-9 _ and -
EQUALS Text or number to set variable to.
EQUALS_INPUT n/a - sets to caller entered digits.
PREFIX String to prefix variable with.
POSTFIX String to postfix variable with.
ADD Number to add to variable.
SUBTRACT Number to subtract from variable.
DELETE n/a - variable is deleted.
CUT_PRE Number of characters to remove from the beginning of the variable.
CUT_POST Number of characters to remove from the end of the variable.
SWITCH A persistent switch that can be on or off Name of the switch
a-z A-Z 0-9 _ and -
EQUALS true, false, 1, 0, yes, no.
EQUALS_INPUT n/a - set to caller entered digits 1 or 0.
A_NUMBER The callers phone number EQUALS Phone number to set.
EQUALS_INPUT n/a - sets to caller entered number.
PREFIX Number to prefix with.
POSTFIX Number to postfix with.
DELETE n/a - Number is deleted/made secret.
CUT_PRE Number of digits to remove from the beginning of the phone number.
CUT_POST Number of digits to remove from the end of the phone number.
A_NAME The callers name EQUALS String to set name to.
PREFIX String to prefix the name with.
POSTFIX String to postfix the name with.
DELETE n/a - name is deleted.
CUT_PRE Number of characters to remove from the beginning of the name.
CUT_POST Number of characters to remove from the end of the name.
B_NUMBER The called phone number EQUALS Phone number to set.
EQUALS_INPUT n/a - sets to caller entered number.
PREFIX Number to prefix with.
POSTFIX Number to postfix with.
DELETE n/a - Number is deleted/made secret.
CUT_PRE Number of digits to remove from the beginning of the phone number.
CUT_POST Number of digits to remove from the end of the phone number.
CDR_NOTE A note stored with the CDR for the call EQUALS Text or number to set the note to.
EQUALS_INPUT n/a - sets to caller entered digits.
PREFIX String to prefix the note with.
POSTFIX String to postfix the note with.
ADD Number to add to the note.
SUBTRACT Number to subtract from the note.
DELETE n/a - note is deleted.
CUT_PRE Number of characters to remove from the beginning of the note.
CUT_POST Number of characters to remove from the end of the note.
LANGUAGE The language to use on the call EQUALS Langauge to use: da or en.
MUSIC_ON_HOLD Set the music on hold class to use EQUALS Id of the music on hold class to use.
PRESENCE_STATE Set the presence state of an employee Id of employee EQUALS The state to set: AVAILABLE, BUSY, OUT_OF_OFFICE, OFF_WORK, HOLIDAY.
PRESENCE_LOCATION The presence location for an employee Id of employee EQUALS Text to set.
PREFIX String to prefix location with.
POSTFIX String to postfix location with.
DELETE n/a - location is deleted.
CUT_PRE Number of characters to remove from the beginning of the location.
CUT_POST Number of characters to remove from the end of the location.
PRESENCE_MESSAGE The presence message for an employee Id of employee EQUALS Text to set.
PREFIX String to prefix message with.
POSTFIX String to postfix message with.
DELETE n/a - message is deleted.
CUT_PRE Number of characters to remove from the beginning of the message.
CUT_POST Number of characters to remove from the end of the message.
PRESENCE_EXPIRES Set or remove expiration on an employee's presence Id of employee EQUALS When the presence shall expire:
IN_5 - in 5 minutes
IN_10 - in 10 minutes
IN_15 - in 15 minutes
IN_30 - in 30 minutes
IN_60 - in 1 hour
IN_90 - in 1.5 hour
IN_120 - in 2 hours
IN_180 - in 3 hours
IN_240 - in 4 hours
ON_THE_HOUR - at the next whole hour
END_OF_DAY - at midnight
TOMORROW_AT_8 - tomorrow at 08:00
END_OF_WEEK - at the end of the week
END_OF_MONTH - at the end of the month.
DELETE n/a - removes the expiration.
REDIRECT Control redirection of dialplan items Id of dialplan item EQUALS Number to redirect to.
DELETE n/a - removes the redirect.
RECORD Control if call is recorded EQUALS true or false.
EMAIL Send an e-mail Recipient e-mail address EQUALS Body of e-mail, max. 256 chars.
SMS Send an SMS Recipient phone number EQUALS SMS message, max. 256 chars.
RINGTONE Set alternative ringtone to use on supported SIP phones EQUALS Ringtone 0-9.
DELETE n/a - removes alternative ringtone.

If expandRulesets is true, the follow is added:

Property Type Description
rulesets[].actions[].targetName String Name of the target (only for action type PRESENSE_STATE, PRESENCE_LOCATION, PRESENCE_MESSAGE, PRESENCE_EXPIRES).
rulesets[].actions[].valueName String Name of the music on hold class (only for action MUSIC_ON_HOLD and how EQUALS).
rulesets[].actions[].target Object For type REDIRECT, target is overwritten with an object containing _id, name, type, number.
rulesets[].rules[].targetName String Name of the target (only for rule type SIP_PHONE_ONLINE, PRESENCE_STATE, PRESENCE_LOCATION, PRESENCE_MESSAGE.
rulesets[].rules[].target Object For type REDIRECT, EXTENSION_ONLINE, EXTENSION_STATE, QUEUE_MEMBERS_COUNT, QUEUE_MEMBERS_AVAILABLE, QUEUE_CALLERS_COUNT and QUEUE_CALLERS_MAX_WAIT target is overwritten with an object containing _id, name, type, number.

Example - normal

{
  offset: 0,
  limit: 50,
  total: 25,
  valueRouters: [
    {
      _id: '12345678901234567890ABCD',
      name: 'Is caller VIP',
      number: '888',
      redirect: null,
      notes: 'Check if caller is VIP and ensure caller gets the VIP treatment',
      rulesets: 2
    },
    {
      ...
    }
  ]

Example - full=true

{
  offset: 0,
  limit: 50,
  total: 25,
  valueRouters: [
    {
      _id: '12345678901234567890ABCD',
      type: 'VALUE_ROUTER',
      customer: '12345678901234567890BCED',
      name: 'Is caller VIP',
      number: '888',
      startAudio: null,
      redirect: null,
      notes: 'Check if caller is VIP and ensure caller gets the VIP treatment',
      onNoMatchGoto: '124567890123457890AAAA',
      rulesets: [
        {
          index: 0,
          name: 'Gold members',
          matchAll: true,
          onMatchGoto: '12345678901234567890BBBB',
          rules: [
            {
              type: 'CALL_VARIABLE',
              target: 'customer_type',
              comparison: 'EQUALS',
              value: 'GOLD'
            },
            {
              type: 'TIME_NOW',
              comparison: 'GREATER_THAN',
              value: '08:00'
            },
            {
              type: 'TIME_NOW',
              comparison: 'LESS_THAN',
              value: '16:00'
            }
          ],
          actions: [
            {
              type: 'A_NAME',
              how: 'PREFIX',
              value: 'VIP: '
            },
            {
              type: 'MUSIC_ON_HOLD',
              how: 'EQUALS',
              value: '1234567890123457890CCCC'
            }
          ]
        },
        {
          index: 1,
          name: 'Platinum members',
          matchAll: false,
          onMatchGoto: '1234567890123457890DDDD',
          rules: [
            {
              type: 'CALL_VARIABLE',
              target: 'customer_type',
              comparison: 'EQUALS',
              value: 'PLATINUM'
            }
          ],
          actions: [
            {
              type: 'A_NAME',
              how: 'PREFIX',
              value: 'VIP:'
            }
          ]
        }
      ]
    },
    {
      ...
    }
  ]
}

Errors

Error code Message Description
403 access_denied Insufficient access level
500 internal_error <Unspecified>
api/pbx/valuerouter/list.txt · Last modified: 2021/01/30 20:53 by Per Møller

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki