Table of Contents

API : PBX : Time router item list

Introduction

A Time router is a dialplan call router that routes calls based on date and time.

Request

This request returns a list of all of the customers time router items.

URL https://api.telecomx.dk/pbx/timerouter
Method GET
Access level VIEWER, MANAGE, OWNER if time 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.
customer [optional] Id of customer to show time 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/timerouter
https://api.telecomx.dk/pbx/timerouter?customer=123458789012457890ABCD
https://api.telecomx.dk/pbx/timerouter?customer=123458789012457890ABCD&limit=20&offset=100
https://api.telecomx.dk/pbx/timerouter?filter=donald
https://api.telecomx.dk/pbx/timerouter?customer=12345678901234567890ABCD&full=true
https://api.telecomx.dk/pbx/timerouter?customer=12345678901234567890ABCD&expandGoto=true

Response

JSON object
offset Index of the first time router item returned.
limit Number of time router item to return. Note that the actual number of returned items may be lower.
total Number of time router items that can be returned when offset and limit is not considered. This is to be used for paging through the data.
timeRouters Array of time router items, see definition below.
Time router object (normal)
_id Id Unique id of the time router item.
name String Name/description of the time router item.
number String The phone number to dial to reach this time router item, null if it is not dial-able.
redirect String Number to redirect to when execution starts. Used to quickly circumvent the time router item.
notes String Notes about the time router item.
rules Number Number of rules in the time router.
Time router object (full=true)
_id Id Unique id of the time router item.
type String Always 'TIME_ROUTER'.
name String Name/description of the time router item.
number String The phone number to dial to reach this time router item locally, null if it is not dial-able.
startAudio Id A sound item to playback when the time router item is entered, null if not used.
redirect String Number to redirect to when execution starts. Used to quickly circumvent the time router item.
notes String Notes about the time router item.
onNoMatchGoto Id Id of a dialplan item to goto if no rules was matched.
onMatchGoto Id Id of a dialplan item to goto if a rule is matched. Can be overruled by overrideGoto on a specific rule.
Rules Array List of rules to check. Checking ends when a rules matches the current date & time.
rules[].type String Type of rule:
WEEK - a 7 days open/closed/other plan.
PERIOD - a from/to period.
RECURRING - a recurring rule.
rules[].description String Short description of why the rule exists.
rules[].overrideGoto Id Optional dialplan item to goto when the rule is matched. Overrides the global onMatchGoto.
Rules for type=WEEK
rules[].week Array List of weekdays and periods.
rules[].week[].days Array Days of the week this rule is in effect, 0-6, sunday=0.
rules[].week[].from String Time when the period starts, e.g. 02:00.
rules[].week[].to String Time when the period ends, e.g. 03:00.
Rule for type=PERIOD
rules[].fromDate Date Date/time from which the rule matches.
rules[].toDate Date Date/time until which the rule matches.
Rule for type=RECURRING
rules[].occurrence String When does it occur:
EVERY - every week
FIRST - the first week of the month
SECOND - the second week of the month
THIRD - the third week of the month
FOURTH - the fourth week of the month
LAST - the last week of the month
ODD_WEEK - odd weeks
EVEN_WEEK - even weeks
NEWYEAR_DAY - New years day
PALM_SUNDAY - Palm sunday
HOLY_THURSDAY - Holy thursday
LONG_FRIDAY - Long friday
EASTER_DAY - Easter day
SECOND_EASTER_DAY - Second easter day
NO_CONSTITUTION_DAY - Constitution day (Norway)
FIRST_OF_MAY - First of may (Denmark)
DK_CONSTITUTION_DAY - Constitution day (Denmark)
SE_CONSTITUTION_DAY - Constitution day (Sweden)
ASCENSION_DAY - Ascension day
DAY_AFTER_ASCENSION_DAY - Day after ascension day
WHIT_SUNDAY - Whit sunday
SECOND_WHIT_SUNDAY - Day after whit sunday
CHRISTMAS_EVE - Christmas eve
CHRISTMAS_DAY - Christmas day
SECOND_CHRISTMAS_DAY - Second christmas day
NEWYEAR_EVE - New years eve
SE_ALL_SAINTS_DAY - All saints day (Sweden)
SE_MIDSUMMER - Midsummer (Sweden)
SPECIFIC_DATE - Specific date
rules[].day Number Which day of the recurring week(s), 0-6, monday=0.
rules[].from String Time when the period starts, e.g. 02:00.
rules[].to String Time when the period ends, e.g. 03:00.
rules[].specificDate Object Contains date and month of specific date
rules[].specificDate.date Number Number representing date in a month. Min 1, max 31
rules[].specificDate.month Number Number representing a month. Min 1, max 12

Example - normal

{
  offset: 0,
  limit: 50,
  total: 25,
  timeRouters: [
    {
      _id: '12345678901234567890ABCD',
      name: 'Opening hours',
      number: '550',
      redirect: null,
      notes: 'Our regular opening hours',
      rules: 12
    },
    {
      ...
    }
  ]

Example - full=true

{
  offset: 0,
  limit: 50,
  total: 25,
  timeRouters: [
    {
      _id: '12345678901234567890ABCD',
      name: 'Opening hours',
      number: '550',
      startAudio: null,
      redirect: null,
      notes: 'Our regular opening hours',
      onNoMatchGoto: '12345678901234567890ABCD',
      onMatchGoto: '12345678901234567890AAAA',
      rules: [
        {
          type: 'PERIOD',
          description: 'Christmas holidays',
          fromDate: ISODate('2018-12-23T00:00:00.000Z'),
          toDate: ISODate('2018-12-27T00:00:00.000Z')
        },
        {
          type: 'RECURRING',
          description: 'Gaming night',
          occurrence: 'FIRST',
          day: 0,
          from: '16:00',
          to: '23:00'
        },
        {
          type: 'WEEK',
          description: 'Lunch break',
          overrideGoto: '12345678901234567890BBBB',
          week: [
            {
              days: [0,1,2,3,4,5],
              from: '12:00',
              to: '12:30'
            }
          ]
        },
        {
          type: 'WEEK',
          description: 'Regular weekplan',
          overrideGoto: null,
          week: [
            {
              days: [0,1,2,3,4],
              from: '08:00',
              to: '16:00'
            },
            {
              days: [5],
              from: '09:30',
              to: '14:00'
            }
          ]
        }
      ]
    },
    {
      ...
    }
  ]
}

Errors

Error code Message Description
403 access_denied Insufficient access level
500 internal_error <Unspecified>