Add an Inbound Route

Add and configure an inbound route.

Request URL

POST {base_url}/{api_path}/inbound_route/create?access_token={access_token}

Request parameters

Parameter Required Type Description
name Yes String The name of the inbound route.
alert_info No String Inbound alert info.
did_option No String DID matching mode.

Valid value:

  • patterns: Match DID patterns. (Default)
  • pattern_to_ext: Match DID pattern to extensions.
  • range_to_ext: Match DID range to extension range.
  • pattern_to_ext_list: Match DID number(s) to extension(s) in one-to-one correspondence.
did_pattern_list No Array<DID_Pattern_List> The DID matching pattern list.
Note: This parameter is required when the did_option is patterns.
did_pattern_to_ext No String The DID pattern matching to extensions.
Note: This parameter is required when the did_option is pattern_to_ext.
did_to_ext_start No String The start number of the DID matching pattern range.
Note: This parameter is required when the did_option is range_to_ext.
did_to_ext_end No String The end number of the DID matching pattern range.
Note: This parameter is required when the did_option is range_to_ext.
did_pattern_to_ext_list No Array<DID_Pattern_Ext_List> The list of DID numbers and the corresponding extensions.
Note: This parameter is required when the did_option is pattern_to_ext_list.
cid_option No String The Caller ID matching pattern.

Valid value:

  • patterns: Match Caller ID patterns.
  • phonebook: Match contacts' caller ID in specific phonebooks.
cid_pattern_list No Array<CID_Pattern_List> The Caller ID matching pattern list.
Note: This parameter is required when the cid_option is patterns.
cid_to_phonebook No Array<Integer> The ID(s) of the selected phonebook(s).
Note:
  • This parameter is required when the cid_option is phonebook.
  • You can query the phonebook's ID using Search Specific Phonebooks.
  • Use a comma to separate multiple IDs.
trunk_list Yes Array<Trunk_List> The list of the selected trunk in the inbound route.
def_dest Yes String Default destination.
  • disabled
  • end_call: Hang up
  • extension: Extension
  • pattern_to_ext: Match DID pattern to extensions
  • range_to_ext: Match DID range to extension range
  • pattern_to_ext_list: Match DID number(s) to extension(s) in one-to-one correspondence.
  • ext_vm: Extension voicemail
  • ivr: IVR
  • call_flow: Call Flow
  • ai_receptionist: AI receptionist
  • ring_group: Ring group
  • queue: Queue
  • group_vm: Group voicemail
  • conference: Conference
  • external_num: External number
  • outroute: Outbound route
  • play_greeting: Play greeting then hang up
  • fax_to_email: Fax to email
def_dest_prefix No String

This parameter defines different settings depending on the value of def_dest.

  • When def_dest is external_num, this parameter defines the prefix of the external number.
  • When def_dest is play_greeting, this parameter defines the play count of the greeting.
def_dest_value No String This parameter defines different settings depending on the value of def_dest.
  • When def_dest is external_num, this parameter defines the external number.
  • When def_dest is play_greeting, this parameter defines the custom prompt file name.

    E.g. Test.wav.

  • When def_dest is range_to_ext, this parameter defines the extension range.

    E.g. 2001-2010.

  • When def_dest is other destinations, this parameter should be the unique ID of the destination.

    For example, if the destination is the extension 2002 or the extension voicemail of 2002, then you need to enter the ID of the extension 2002.

    Note: You can query the ID of desired options using Get Menu Options.
def_dest_ext_list No Array<Ext_List> The list of selected extensions/extension groups.
Note: This parameter is required when the def_dest is set to pattern_to_ext.
ringback_tone No String The filename of custom prompt (e.g. demo.wav) played for the caller before the extension user answers the call.
Note:
  • This parameter is available only when the def_dest is set to extension.
  • You can query the filename of custom prompts using Get Menu Options ("menu":"custom_prompt").
enb_time_condition No Integer Whether to enable time condition.

Valid value:

  • 0: Disabled.
  • 1: Enabled.
Note: When set to 1, timezone_id and time_condition are required.
timezone_id No Integer Time zone ID.
Note: You can query time zone ID using Query Time Zone List.
time_condition No String Time-based routing mode.

Valid value:

  • global: Inbound calls are routed based on global business hours.
  • route_scope: Inbound calls are routed based on custom business hours.
  • custom: Inbound calls are routed based on custom time periods.
time_condition_value No Array<Custom_Time> Custom business hours or time periods.
business_hours_destination No String

The destination for inbound calls received during business hours.

Valid value:

  • end_call: Hang Up.
  • extension: Extension.
  • ext_vm: Extension Voicemail.
  • group_vm: Group Voicemail.
  • outroute: Outbound Route.
  • ai_receptionist: AI Receptionist.
  • ring_group: Ring Group.
  • queue: Queue.
  • conference: Conference.
  • ivr: IVR.
  • call_flow: Call Flow.
  • external_num: External Number.
  • play_greeting: Play Prompt and Exit.
business_hours_destination_value No String The detailed destination for inbound calls received during business hours.
  • If business_hours_destination is play_greeting, this parameter defines the filename of custom prompt(e.g. demo.wav).

    You can query the filename of custom prompts using Get Menu Options ("menu":"custom_prompt").

  • If business_hours_destination is extension, ext_vm, group_vm, ivr, call_flow, ring_group, conference, ai_receptionist, outroute, or queue, this parameter should be the unique ID of the destination.

    For example, the destination is the extension 2002, then this parameter should be set to the extension's ID 2.

  • If business_hours_destination is external_num, this parameter defines the external number.
outside_business_hours_destination No String

The destination for inbound calls received outside business hours.

Valid value:

  • end_call: Hang Up.
  • extension: Extension.
  • ext_vm: Extension Voicemail.
  • group_vm: Group Voicemail.
  • outroute: Outbound Route.
  • ai_receptionist: AI Receptionist.
  • ring_group: Ring Group.
  • queue: Queue.
  • conference: Conference.
  • ivr: IVR.
  • call_flow: Call Flow.
  • external_num: External Number.
  • play_greeting: Play Prompt and Exit.
outside_business_hours_destination_value No String The detailed destination for inbound calls received outside business hours.
  • If outside_business_hours_destination is play_greeting, this parameter defines the filename of custom prompt(e.g. demo.wav).

    You can query the filename of custom prompts using Get Menu Options ("menu":"custom_prompt").

  • If outside_business_hours_destination is extension, ext_vm, group_vm, ivr, call_flow, ring_group, conference, ai_receptionist, outroute, or queue, this parameter should be the unique ID of the destination.

    For example, the destination is the extension 2002, then this parameter should be set to the extension's ID 2.

  • If outside_business_hours_destination is external_num, this parameter defines the external number.
holidays_hours_destination No String

The destination for inbound calls received during holidays.

Valid value:

  • end_call: Hang Up.
  • extension: Extension.
  • ext_vm: Extension Voicemail.
  • group_vm: Group Voicemail.
  • outroute: Outbound Route.
  • ai_receptionist: AI Receptionist.
  • ring_group: Ring Group.
  • queue: Queue.
  • conference: Conference.
  • ivr: IVR.
  • call_flow: Call Flow.
  • external_num: External Number.
  • play_greeting: Play Prompt and Exit.
holidays_hours_destination_value No String The detailed destination for inbound calls received during holidays.
  • If holidays_hours_destination is play_greeting, this parameter define the filename of custom prompt(e.g. demo.wav).

    You can query the filename of custom prompts using Get Menu Options ("menu":"custom_prompt").

  • If holidays_hours_destination is extension, ext_vm, group_vm, ivr, call_flow, ring_group, conference, ai_receptionist, outroute, or queue, this parameter should be the unique ID of the destination.

    For example, the destination is the extension 2002, then this parameter should be set to the extension's ID 2.

  • If holidays_hours_destination is external_num, this parameter defines the external number.
enb_holiday_dest_ignore No Integer Whether to route inbound calls received during holidays according to the business hours destination.

Valid value:

  • 0: Disabled.
  • 1: Enabled.
Note: ignore_holiday_dest and enb_play_holiday_prompt_global can not both be enabled.
enb_play_holiday_prompt_global No Integer Whether to play holiday prompt before routing inbound calls received during holidays to the holiday destination.

Valid value:

  • 0: Disabled.
  • 1: Enabled.
Note: ignore_holiday_dest and enb_play_holiday_prompt_global can not both be enabled.
DID_Pattern_List
Parameter Required Type Description
did_pattern Yes String DID matching patten rule.
DID_Pattern_Ext_List
Parameter Required Type Description
did_pattern Yes String The specific DID number.
did_pattern_to_ext Yes String The unique ID of the extension that corresponds to the DID number.
Note: You can query the extension's ID using Search Specific Extensions.
CID_Pattern_List
Parameter Required Type Description
cid_pattern Yes String Caller ID matching pattern rule.
Trunk_List
Parameter Required Type Description
id Yes Integer The unique ID of the selected trunk.
Note: You can query the trunk's ID using Search Specific Trunks.
name No String Trunk name.
type No String Trunk type.
Ext_List
Parameter Required Type Description
value Yes String The unique ID of the extension/extension group.
Note:
name No String The name of the extension/extension group.
number No String Extension number.
type No String The type of the selected item.

Valid value:

  • extension
  • ext_group
Custom_Time
Parameter Required Type Description
days_of_week No Integer The days of the week to which the time period applies.

Valid value:

  • sun: Sunday
  • mon: Monday
  • tue: Tuesday
  • wed: Wednesday
  • thu: Thursday
  • fri: Friday
  • sat: Saturday
Note: For multiple values, use space to separate.
times No Array<String> The time range of the time period.
months No String The months to which the time period applies.

Valid value:

  • jan: January
  • feb: February
  • mar: March
  • apr: April
  • may: May
  • jun: June
  • jul: July
  • aug: August
  • sep: September
  • oct: October
  • nov: November
  • dec: December
Note: For multiple values, use space to separate.
days No String The days of the month to which the time period applies.

Valid value: 1 - 31

Note: For multiple values, use space to separate.
dest No String

The destination for inbound calls received during the time period.

Valid value:

  • end_call: Hang Up.
  • extension: Extension.
  • ext_vm: Extension Voicemail.
  • group_vm: Group Voicemail.
  • outroute: Outbound Route.
  • ai_receptionist: AI Receptionist.
  • ring_group: Ring Group.
  • queue: Queue.
  • conference: Conference.
  • ivr: IVR.
  • call_flow: Call Flow.
  • external_num: External Number.
  • play_greeting: Play Prompt and Exit.
dest_prefix No String The destination prefix for inbound calls during the time period.
Note: Configure this parameter only when time_condition is set to custom or route_scope and dest is set to external_num or play_greeting.
  • If dest is set to external_num, this parameter defines the dial-out prefix of the external number.
  • If dest is set to play_greeting, this parameter defines the play count of the prompt, and only integers from 1 to 5 is supported.
dest_value No String The detailed destination for inbound calls received during the time period.
  • If dest is play_greeting, this parameter defines the filename of custom prompt (e.g. demo.wav).

    You can query the filename of custom prompts using Get Menu Options ("menu":"custom_prompt").

  • If dest is extension, ext_vm, group_vm, ivr, call_flow, ring_group, conference, ai_receptionist, outroute, or queue, this parameter should be the unique ID of the destination.

    For example, the destination is the extension 2002, then this parameter should be set to the extension's ID 2.

  • If dest is external_num, this parameter defines the external number.
time_condition_switch No Integer Whether to enable advanced time settings for flexible scheduling based on a combination of week, month, and date.

Valid value:

  • 0: Disabled.
  • 1: Enabled.

Response parameters

Parameter Type Description
errcode Integer Returned error code.
  • 0: Succeed.
  • Non-zero value: Failed.
Note: You can check the error code and error message in Error Code and Error Message.
errmsg String Returned message.
  • SUCCESS: Succeed.
  • FAILURE: Failed.
id Integer The unique ID of the inbound route.

Examples

Request example

POST /openapi/v1.0/inbound_route/create?access_token=Rka0iV0BJUVTXj1EYpwbg2YUkODdw22N HTTP/1.1
Host: 192.168.5.150:8088
Content-Type: application/json
{
    "name": "demo",
    "trunk_list": [
        {
            "id": 14
        }
    ],
    "def_dest":"end_call",
    "enb_time_condition": 1,
    "time_condition": "route_scope",
    "timezone_id": 1,
    "business_hours_destination": "extension",
    "business_hours_destination_value": "1000-Leo Ball",
    "outside_business_hours_destination": "group_vm",
    "outside_business_hours_destination_value": "6100-6100",
    "holidays_hours_destination": "ivr",
    "holidays_hours_destination_value": "6200-测试",
    "time_condition_value": [
        {
        "days_of_week": "mon tue wed thu fri",
        "times": [
            "08:45-11:45",
            "13:15-18:00"
                 ],
        "months": "jan feb mar",
        "days": "1 2 3",
        "dest": "end_call",
        "dest_prefix": "",
        "dest_value": "",
        "time_condition_switch": 1
        },
                {
                    "days_of_week": "mon tue wed thu fri",
                    "times": [
                        "11:45-13:15"
                    ],
                    "months": "",
                    "days": "",
                    "dest": "",
                    "dest_prefix": "",
                    "dest_value": "",
                    "time_condition_switch": 0
                }
            ]
}

Response example

HTTP/1.1 200 OK
{
    "errcode": 0,
    "errmsg": "SUCCESS",
    "id": 15
}