api:pbx:time_router:get
Table of Contents
API : PBX : Time Router Get
Introduction
A Time router is a dialplan call router that routes calls based on date and time.
Request
This request will return a single time router.
| URL | https://api.telecomx.dk/pbx/timerouter/TIME_ROUTER_ID | |
|---|---|---|
| Method | GET | |
| Access level | VIEWER, MANAGER or OWNER if user belongs to the customer. RESELLER if customer belongs to the reseller. ADMIN. |
|
| Param | TIME_ROUTER_ID | Id of the time router (24 hex-char string) |
| Query | expandGoto | [optional] True to expand goto id's into _id/type/number/name objects |
Query examples
https://api.telecomx.dk/pbx/timerouter/1234567890ABCDEF12345678 https://api.telecomx.dk/pbx/timerouter/1234567890ABCDEF12345678?expandGoto=true
Response
| JSON object | ||
|---|---|---|
| _id | Id | Unique id of the time router item. |
| type | String | Always 'TIME_ROUTER'. |
| customer | Id | Id of the customer the time router belongs to. |
| 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
{ _id: '12345678901234567890ABCD', type: 'TIME_ROUTER', customer: '1234567890123457890ADEF', 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 |
|---|---|---|
| 400 | bad_request | Id not found in requestURI |
| 404 | not_found | Time router not found |
| 403 | access_denied | Insufficient access level |
| 500 | internal_error | <Unspecified> |
api/pbx/time_router/get.txt · Last modified: 2025/01/13 11:39 by Thomas Andersen