添加呼入路由

添加并配置呼入路由。

请求 URL

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

请求参数

参数 是否必填 类型 说明
name String 呼入路由名称。
alert_info String 呼入路由特色响铃。
did_option String DID 号码匹配模式。

取值范围

  • patterns:匹配 DID 号码规则
  • pattern_to_ext:DID 号码规则匹配到分机
  • range_to_ext:DID 号码范围匹配到分机范围
did_pattern_list Array<DID_Pattern_List> DID 号码匹配规则列表。
注: 此参数在 did_optionpatterns 时必填。
did_pattern_to_ext String 匹配到分机的 DID 号码匹配规则。
注: 此参数在 did_optionpattern_to_ext 时必填。
did_to_ext_start String 匹配到分机范围的 DID 号码匹配规则起始号码。
注: 此参数在 did_optionrange_to_ext 时必填。
did_to_ext_end String 匹配到分机范围的 DID 号码匹配规则结束号码。
注: 此参数在 did_optionrange_to_ext 时必填。
did_pattern_to_ext_list Array<DID_Pattern_Ext_List> DID 号码和对应分机列表。
注: 此参数在 did_optionpattern_to_ext_list 时必填。
cid_option String 主叫号码匹配规则。

取值范围

  • patterns:来电匹配主叫号码规则
  • phonebook:来电匹配特定企业联系人群组
cid_pattern_list Array<CID_Pattern_List> 主叫号码匹配规则列表。
注: 此参数在 cid_optionpatterns 时必填。
cid_to_phonebook Array<Integer> 来电匹配的企业联系人群组的唯一 ID。
注:
  • 此参数在 cid_optionphonebook 时必填。
  • 可使用 搜索特定企业联系人群组 接口查询企业联系人群组 ID。
  • 使用半角逗号 , 分隔多个 ID。
trunk_list Array<Trunk_List> 呼入路由中选择的中继列表。
def_dest String 呼入路由的默认目的地。
  • disabled
  • end_call:挂断
  • extension:分机
  • pattern_to_ext:匹配分机
  • range_to_ext:分机范围
  • pattern_to_ext_list:DID 号码匹配到指定分机。
  • ext_vm:分机语音信箱
  • ivr:IVR
  • call_flow:通话流程
  • ring_group:响铃组
  • ai_receptionist:AI 接待员
  • queue:队列
  • group_vm:群语音信箱
  • conference:会议室
  • external_num:外部号码
  • outroute:呼出路由
  • play_greeting:播放问候语后挂断
  • fax_to_email:发送传真到邮箱
def_dest_prefix String

此参数的设置取决于 def_dest 的设置值。

  • def_destexternal_num,此参数用于设置外部号码的前缀。
  • def_destplay_greeting,此参数用于设置问候语的播放次数。
def_dest_value String 此参数的设置取决于 def_dest 的设置值。
  • def_destexternal_num,此参数用于输入外部号码。
  • def_destplay_greeting,此参数用于输入要播放的自定义提示音文件名。

    例如:Test.wav

  • def_destrange_to_ext,此参数用于定义分机范围。

    例如:2001-2010

  • def_dest 为其他目的地,此参数输入目的地的唯一 ID。

    例如,目的地为分机 2002 或分机 2002 的邮箱,则此参数输入分机 2002 的唯一 ID。

    注: 可使用 获取菜单选项 接口查询需要的 ID。
def_dest_ext_list Array<Ext_List> 选择的分机或分机组列表。
注: 此参数在 def_destpattern_to_ext 时必填。
ringback_tone String 自定义提示音的文件名 (如 demo.wav)。在分机用户接听来电之前,系统会向呼叫者播放该提示音。
注:
  • 此参数仅在 def_dest 取值为 extension 时生效。
  • 可使用 获取菜单选项 接口查询自定义提示音的文件名 ("menu":"custom_prompt")。
enb_time_condition Integer 是否启用时间条件。
取值范围
  • 0:禁用。
  • 1:启用。
注: 当设置为 1 时,timezone_idtime_condition 必填。
timezone_id Integer 时区 ID。
注: 可通过 查询时区列表 接口查询时区 ID。
time_condition String 时间类型。

取值范围

  • global:基于全局办公时间路由来电
  • route_scope:基于自定义办公时间路由来电
  • custom:基于自定义时间段路由来电
time_condition_value Array<Custom_Time> 自定义办公时间或时间段。
business_hours_destination String

办公时间内外线来电的目的地。

取值范围

  • end_call:挂断
  • extension:分机
  • ext_vm:分机语音信箱
  • group_vm:群语音信箱
  • outroute:呼出路由
  • ai_receptionist:AI 接待员
  • ring_group:响铃组
  • queue:队列
  • conference:会议室
  • ivr:IVR
  • call_flow:通话流程
  • external_num:外部号码
  • play_greeting:播放问候语后挂断
business_hours_destination_value String 办公时间外线来电的详细目的地。
  • 如果 business_hours_destination 取值为 play_greeting,此参数定义自定义提示音的文件名 (如 demo.wav)。

    可使用 获取菜单选项 接口查询自定义提示音的文件名 ("menu":"custom_prompt")。

  • 如果 business_hours_destination 取值为 extensionext_vmgroup_vmivrcall_flowring_groupconferenceai_receptionistoutroutequeue,此参数定义目的地的 ID。

    例如,目的地是分机 2002,则此参数应设置为分机的 ID 2

  • 如果 business_hours_destination 取值为 external_num,此参数定义外部号码。
outside_business_hours_destination String

非办公时间外线来电的目的地类型。

取值范围

  • end_call:挂断
  • extension:分机
  • ext_vm:分机语音信箱
  • group_vm:群语音信箱
  • outroute:呼出路由
  • ai_receptionist:AI 接待员
  • ring_group:响铃组
  • queue:队列
  • conference:会议室
  • ivr:IVR
  • call_flow:通话流程
  • external_num:外部号码
  • play_greeting:播放问候语后挂断
outside_business_hours_destination_value String 非办公时间外线来电的具体目的地。
  • 如果 outside_business_hours_destination 取值为 play_greeting,此参数定义自定义提示音的文件名 (如 demo.wav)。

    可使用 获取菜单选项 接口查询自定义提示音的文件名 ("menu":"custom_prompt")。

  • 如果 outside_business_hours_destination 取值为 extensionext_vmgroup_vmivrcall_flowring_groupconferenceai_receptionistoutroutequeue,此参数定义目的地的 ID。

    例如,目的地是分机 2002,则此参数应设置为分机的 ID 2

  • 如果 outside_business_hours_destination 取值为 external_num,此参数定义外部号码。
holidays_hours_destination String

假期期间外线来电的目的地类型。

取值范围

  • end_call:挂断
  • extension:分机
  • ext_vm:分机语音信箱
  • group_vm:群语音信箱
  • outroute:呼出路由
  • ai_receptionist:AI 接待员
  • ring_group:响铃组
  • queue:队列
  • conference:会议室
  • ivr:IVR
  • call_flow:通话流程
  • external_num:外部号码
  • play_greeting:播放问候语后挂断
holidays_hours_destination_value String 假期期间收到的外线来电的具体目的地。
  • 如果 holidays_hours_destination 取值为 play_greeting,此参数定义自定义提示音的文件名 (如 demo.wav)。

    可使用 获取菜单选项 接口查询自定义提示音的文件名 ("menu":"custom_prompt")。

  • 如果 holidays_hours_destination 取值为 extensionext_vmgroup_vmivrcall_flowring_groupconferenceai_receptionistoutroutequeue,此参数定义目的地的 ID。

    例如,目的地是分机 2002,则此参数应设置为分机的 ID 2

  • 如果 holidays_hours_destination 取值为 external_num,此参数定义外部号码。
enb_holiday_dest_ignore Integer 是否将假期期间的外线来电按照办公时间目的地进行路由。

取值范围

  • 0:禁用。
  • 1:启用。
注: ignore_holiday_destenb_play_holiday_prompt_global 不能同时启用。
enb_play_holiday_prompt_global Integer 是否在将假期期间的外线来电路由至假期目的地之前播放假期提示音。

取值范围

  • 0:禁用。
  • 1:启用。
注: ignore_holiday_destenb_play_holiday_prompt_global 不能同时启用。
DID_Pattern_List
参数 是否必填 类型 说明
did_pattern String DID 匹配规则。
DID_Pattern_Ext_List
参数 是否必填 类型 说明
did_pattern String DID 号码。
did_pattern_to_ext String DID 号码对应分机的 ID。
注: 可使用 搜索特定分机 接口查询需要的分机 ID。
CID_Pattern_List
参数 是否必填 类型 说明
cid_pattern String 主叫号码匹配规则。
Trunk_List
参数 是否必填 类型 说明
id Integer 中继的唯一 ID。
注: 可使用 搜索特定中继 接口查询中继 ID。
name String 中继名称。
type String 中继类型。
Ext_List
参数 是否必填 类型 说明
value String 分机/分机组的唯一 ID。
注:
name String 分机/分机组名称。
number String 分机号码。
type String 所选项目的类型。

取值范围

  • extension:分机
  • ext_group:分机组
Custom_Time
参数 是否必填 类型 说明
days_of_week Integer 时间段适用的星期。

取值范围

  • sun:星期日
  • mon:星期一
  • tue:星期二
  • wed:星期三
  • thu:星期四
  • fri:星期五
  • sat:星期六
注: 多个值用空格分隔。
times Array<String> 时间段的时间范围。
months String 时间段适用的月份。

取值范围

  • jan:一月
  • feb:二月
  • mar:三月
  • apr:四月
  • may:五月
  • jun:六月
  • jul:七月
  • aug:八月
  • sep:九月
  • oct:十月
  • nov:十一月
  • dec:十二月
注: 多个值用空格分隔。
days String 时间段适用的日期。

取值范围:1 - 31

注: 多个值用空格分隔。
dest String

时间段内收到的外线来电的目的地前缀。

取值范围

  • end_call:挂断
  • extension:分机
  • ext_vm:分机语音信箱
  • group_vm:群语音信箱
  • outroute:呼出路由
  • ai_receptionist:AI 接待员
  • ring_group:响铃组
  • queue:队列
  • conference:会议室
  • ivr:IVR
  • call_flow:通话流程
  • external_num:外部号码
  • play_greeting:播放问候语后挂断
dest_prefix String 时间段内收到的外线来电的目的地前缀。
注: 仅当 time_condition i设置为 customroute_scope,且 dest 设置为 external_numplay_greeting 时,配置此参数。
  • 如果 destexternal_num,此参数定义外部号码的呼出前缀。
  • 如果 destplay_greeting,此参数定义提示音的播放次数,支持 1 - 5 范围内的整数。
dest_value String 时间段内收到的外线来电的详细目的地。
  • 如果 destplay_greeting,此参数定义自定义提示音的文件名 (如 demo.wav)。

    可使用 获取菜单选项 接口查询自定义提示音的文件名 ("menu":"custom_prompt")。

  • 如果 destextensionext_vmgroup_vmivrcall_flowring_groupconferenceai_receptionistoutroutequeue,此参数定义目的地的 ID。

    例如,目的地是分机 2002,则此参数应设置为分机的 ID 2

  • 如果 destexternal_num,此参数定义外部号码。
time_condition_switch Integer 是否启用高级时间设置,以支持按星期、月份和日期的组合方式配置时间条件。

取值范围

  • 0:禁用。
  • 1:启用。

响应参数

参数 类型 说明
errcode Integer 返回错误码。
  • 0:请求成功。
  • 非零值:请求失败。
注: 更多错误码和错误信息说明,请参见 错误码 & 错误信息
errmsg String 返回信息。
  • SUCCESS:请求成功。
  • FAILURE:请求失败。
id Integer 呼入路由的唯一 ID。

示例

请求示例

POST /openapi/v1.0/inbound_route/create?access_token=Rka0iV0BJUVTXj1EYpwbg2YUkODdw22N HTTP/1.1

Host: yeastardocs.example.yeastarcloud.com
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
                }
            ]
}

响应示例

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