User Tools

Site Tools


api:pbx:time_router:update

API : PBX : Time Router Update

Introduction

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

Request

This request will update a time router. As little as single property can be set. Only exception is for rules, where the whole ruleset must be provided.

URL https://api.telecomx.dk/pbx/timerouter/TIME_ROUTER_ID
Method POST
Access level MANAGER or OWNER if user belongs to the customer.
RESELLER if customer belongs to the reseller.
ADMIN.
Params TIME_ROUTER_ID id Id of time router to update.
Body name String Name/description of the time router.
number String [optional] The phone number to dial to reach this time router locally. Null if not used.
startAudio Id [optional] A sound item to playback when the time router is entered.
redirect String [optional] Number to redirect to when execution starts. Used to quickly circumvent the time router. Null if not used.
notes String Notes about the time router.
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, monday=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 Which week 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 recurring date
rules[].day Number Recurring day of week, 0-6, monday=0. Only applies to occurence types: EVERY, FIRST, SECOND, THIRD, FOURTH, LAST, ODD_WEEK, EVEN_WEEK.
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

Request body example

{
  name: 'Default Opening hours',
  number: '555'
}

Response

JSON object
_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 Which week 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 recurring date
rules[].day Number Recurring day of week, 0-6, monday=0. Only applies to occurence types: EVERY, FIRST, SECOND, THIRD, FOURTH, LAST, ODD_WEEK, EVEN_WEEK.
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

{
  _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: 'RECURRING',
      description: 'Anniversary',
      occurence: 'SPECIFIC_DATE',
      day: 0,
      from: '08:00',
      to: '16:00',
      specificDate: {
          date: 25,
          month: 6
    },
    {
      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
404 customer Customer not found or not active
404 not_found Time router not found
422 name Name must be at least 3 characters
409 number Number is in use by another dialplan item
422 number Number is invalid, only 0-9 is allowed and no public service numbers
422 redirect Redirect number is invalid, only + 0-9, # and * is allowed
404 redirect Redirect number is local but does not point to an existing dialplan item
404 startAudio Start audio file not found
404 onNoMatchGoto Dialplan item not found
404 onMatchGoto Dialplan item not found
422 rules[x].type Invalid type, use WEEK, PERIOD or RECURRING.
422 rules[x].description Too long, max 64 chars.
404 rules[x].week Week is missing
404 rules[x].week[x].days Missing or invalid
422 rules[x].week[x].from Invalid, equal to or later than to
422 rules[x].week[x].to Invalid or before from
422 rules[x].fromDate Invalid, equal to or later than toDate
422 rules[x].toDate Invalid or before fromDate
422 rules[x].day Missing or invalid
422 rules[x].from Invalid, equal to or later than to
422 rules[x].to Invalid or before from
404 rules[x].overrideGoto Dialplan item not found
403 access_denied Insufficient access level
500 internal_error <Unspecified>
api/pbx/time_router/update.txt · Last modified: 2024/11/28 13:41 by Thomas Andersen

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki