#### 外呼渠道-新建 URL: {基本地址}/channel METHOD: POST Headers: | key | value | | :----------- | :------------: | | Content-Type | application/json;charset=utf-8 | | Authorization | 用户TOKEN | RequestBody: ```json { "name":"进峰测试", // 渠道名称 "channelId":"jinfeng-test", // 渠道ID "appSecret":"123456", // 渠道密钥 "clientBaseUrl": "http://hw-gz59.heyqiwu.cn:60012", // 渠道客户端的基本地址 "config":"{\"service\": {\"默认\": {\"field_number_1\": {\"zhFieldName\": \"金额\",\"extraInfoName\": \"cashFlow\"},\"field_number_2\":{\"zhFieldName\": \"年龄\",\"extraInfoName\": \"age\"}}}}" // 渠道配置 } ``` ResponseBody: ```json { "code": 1, "msg": "成功", "data": null } ``` Example: ``` curl --location --request POST 'http://hw-gz26.heyqiwu.cn:60013/channel' \ --header 'Authorization: Basic ZXlKaGJHY2lPaUpJVXpJMU5pSjkuZXlKcFlYUWlPakUyTmpZNE5URTROVE1zSW1WNGNDSTZNVFkyTmpnNU5UQTFNeXdpYVdRaU9qRjkuZ2o3R29xU2hDTGJpVVh3YnpCWVhoNnBUVU1XTldlVjRuaGNQOTgwLV9oYzpzMDBwZXJzM2NyZXQ=' \ --header 'Content-Type: application/json' \ --data-raw '{ "name":"进峰测试", "channelId":"jinfeng-test", "appSecret":"123456", "clientBaseUrl": "http://hw-gz59.heyqiwu.cn:60012", "config":"{\"service\": {\"默认\": {\"field_number_1\": {\"zhFieldName\": \"金额\",\"extraInfoName\": \"cashFlow\"},\"field_number_2\":{\"zhFieldName\": \"年龄\",\"extraInfoName\": \"age\"}}}}" }' ``` #### 外呼渠道-更新 URL: {基本地址}/channel METHOD: PUT Headers: | key | value | | :----------- | :------------: | | Content-Type | application/json;charset=utf-8 | | Authorization | 用户TOKEN | RequestBody: ```json { "id":52, // 主键ID "name":"进峰测试", // 渠道名称 "channelId":"jinfeng-test", // 渠道ID "appSecret":"1234567", // 渠道密钥 "clientBaseUrl": "http://hw-gz59.heyqiwu.cn:60012", // 渠道客户端基本地址 "config":"{\"service\": {\"默认\": {\"field_number_1\": {\"zhFieldName\": \"金额\",\"extraInfoName\": \"cashFlow\"},\"field_number_2\":{\"zhFieldName\": \"年龄\",\"extraInfoName\": \"age\"}}}}" // 配置数据 } ``` ResponseBody: ```json { "code": 1, "msg": "成功", "data": null } ``` Example: ``` curl --location --request PUT 'http://hw-gz26.heyqiwu.cn:60013/channel' \ --header 'Authorization: Basic ZXlKaGJHY2lPaUpJVXpJMU5pSjkuZXlKcFlYUWlPakUyTmpZNE5URTROVE1zSW1WNGNDSTZNVFkyTmpnNU5UQTFNeXdpYVdRaU9qRjkuZ2o3R29xU2hDTGJpVVh3YnpCWVhoNnBUVU1XTldlVjRuaGNQOTgwLV9oYzpzMDBwZXJzM2NyZXQ=' \ --header 'Content-Type: application/json' \ --data-raw '{ "id":52, "name":"进峰测试", "channelId":"jinfeng-test", "appSecret":"1234567", "clientBaseUrl": "http://hw-gz59.heyqiwu.cn:60012", "config":"{\"service\": {\"默认\": {\"field_number_1\": {\"zhFieldName\": \"金额\",\"extraInfoName\": \"cashFlow\"},\"field_number_2\":{\"zhFieldName\": \"年龄\",\"extraInfoName\": \"age\"}}}}" }' ``` #### 外呼渠道-删除 URL: {基本地址}/channel METHOD: DELETE Headers: | key | value | | :----------- | :------------: | | Content-Type | application/json;charset=utf-8 | | Authorization | 用户TOKEN | RequestParams: | Key | Describe | | :----------- | :------------: | | id | 主键id;必填 | ResponseBody: ```json { "code": 1, "msg": "成功", "data": null } ``` Example: ``` curl --location --request DELETE 'http://hw-gz26.heyqiwu.cn:60013/channel?id=52' \ --header 'Authorization: Basic ZXlKaGJHY2lPaUpJVXpJMU5pSjkuZXlKcFlYUWlPakUyTmpZNE5URTROVE1zSW1WNGNDSTZNVFkyTmpnNU5UQTFNeXdpYVdRaU9qRjkuZ2o3R29xU2hDTGJpVVh3YnpCWVhoNnBUVU1XTldlVjRuaGNQOTgwLV9oYzpzMDBwZXJzM2NyZXQ=' ``` #### 外呼渠道-搜索 URL: {基本地址}/channel/search METHOD: GET RequestParams: | Key | Describe | | :----------- | :------------: | | searchText | 搜索的文本(可以针对渠道ID, 渠道名称, 渠道配置);非必填;默认为空 | | pageSize | 页的记录数;非必填;默认为10 | | pageNum | 当前页;非必填;默认为1 | Headers: | key | value | | :----------- | :------------: | | Content-Type | application/json;charset=utf-8 | | Authorization | 用户TOKEN | ResponseBody: ```json { "code": 1, "msg": "成功", "data": { "pages": 1, "pageNum": 1, "pageSize": 10, "total": 1, "records": [ { "id": 49, // 主键ID "name": "司墨渠道", // 渠道名称 "channelId": "simo-test", // 渠道名称 "appSecret": "UzYxlHPXrw", // 渠道密钥 "clientBaseUrl": "http://47.111.189.55:60012", // 渠道客户端基本地址 "config": "{\n \"service\": {\n \"默认\": {\n \"field_number_1\": {\n \"zhFieldName\": \"金额\",\n \"extraInfoName\": \"cashFlow\"\n },\n \"field_number_2\":{\n \"zhFieldName\": \"年龄\",\n \"extraInfoName\": \"age\"\n }\n }\n }\n}", // 渠道配置信息 "creator": "超级管理员", // 创建用户 "createTime": 1664524788000 // 创建时间 毫秒时间戳 } ] } } ``` Example: ``` curl --location --request GET 'http://hw-gz26.heyqiwu.cn:60013/channel/search?searchText=司墨&pageSize=10&pageNum=1' \ --header 'Authorization: Basic ZXlKaGJHY2lPaUpJVXpJMU5pSjkuZXlKcFlYUWlPakUyTmpZNE5URTROVE1zSW1WNGNDSTZNVFkyTmpnNU5UQTFNeXdpYVdRaU9qRjkuZ2o3R29xU2hDTGJpVVh3YnpCWVhoNnBUVU1XTldlVjRuaGNQOTgwLV9oYzpzMDBwZXJzM2NyZXQ=' ``` #### 外呼渠道-获取所有基本信息 URL: {基本地址}/channel/all METHOD: GET Headers: | key | value | | :----------- | :------------: | | Content-Type | application/json;charset=utf-8 | | Authorization | 用户TOKEN | ResponseBody: ```json { "code": 1, "msg": "成功", "data": [ { "name": "测试渠道", // 渠道名称 "channelId": "test" // 渠道ID }, { "name": "司墨渠道", "channelId": "simo-test" } ] } ``` Example: ``` curl --location --request GET 'http://hw-gz26.heyqiwu.cn:60013/channel/all' \ --header 'Authorization: Basic ZXlKaGJHY2lPaUpJVXpJMU5pSjkuZXlKcFlYUWlPakUyTmpZNE5URTROVE1zSW1WNGNDSTZNVFkyTmpnNU5UQTFNeXdpYVdRaU9qRjkuZ2o3R29xU2hDTGJpVVh3YnpCWVhoNnBUVU1XTldlVjRuaGNQOTgwLV9oYzpzMDBwZXJzM2NyZXQ=' ``` #### 外呼渠道-备份远程客户端日志 URL: {基本地址}/channel/log/sync/backup?channelId={渠道ID} METHOD: POST Headers: | key | value | | :----------- | :------------: | | Content-Type | application/json;charset=utf-8 | | Authorization | 用户TOKEN | ResponseBody: ```json { "code": 1, "msg": "成功", "data": null } ``` Example: ``` curl --location --request POST 'http://hw-gz26.heyqiwu.cn:60013/channel/log/sync/backup?channelId=simo-test' \ --header 'Authorization: Basic ZXlKaGJHY2lPaUpJVXpJMU5pSjkuZXlKcFlYUWlPakUyTmpZNE5URTROVE1zSW1WNGNDSTZNVFkyTmpnNU5UQTFNeXdpYVdRaU9qRjkuZ2o3R29xU2hDTGJpVVh3YnpCWVhoNnBUVU1XTldlVjRuaGNQOTgwLV9oYzpzMDBwZXJzM2NyZXQ=' ``` #### 外呼渠道-下载远程客户端日志 URL: {基本地址}/channel/log/download?channelId={渠道ID}&date={日期} METHOD: POST Headers: | key | value | | :----------- | :------------: | | Content-Type | application/json;charset=utf-8 | | Authorization | 用户TOKEN | ResponseBody: ```json { "code": 1, "msg": "成功", "data": { "cmdMsg": "\n\n adding: logs/20221027/ (stored 0%) adding: logs/20221027/freeswitch/ (stored 0%) adding: logs/20221027/freeswitch/freeswitch.xml.fsxml (deflated 85%) adding: logs/20221027/freeswitch/supervisor.log (deflated 94%) adding: logs/20221027/freeswitch/freeswitch.log (deflated 96%) adding: logs/20221027/outboundcall/ (stored 0%) adding: logs/20221027/outboundcall/nohup.log (deflated 97%)\n\n", // 下载的日志 "downlodUrl": "http://47.111.189.55:60012/resource/logs/20221027.zip" // 下载地址 } } ``` Example: ``` curl --location --request POST 'http://hw-gz26.heyqiwu.cn:60013/channel/log/download?channelId=simo-test&date=20221027' \ --header 'Authorization: Basic ZXlKaGJHY2lPaUpJVXpJMU5pSjkuZXlKcFlYUWlPakUyTmpZNE5URTROVE1zSW1WNGNDSTZNVFkyTmpnNU5UQTFNeXdpYVdRaU9qRjkuZ2o3R29xU2hDTGJpVVh3YnpCWVhoNnBUVU1XTldlVjRuaGNQOTgwLV9oYzpzMDBwZXJzM2NyZXQ=' ``` #### 外呼渠道-获取远程网关信息 URL: {基本地址}/channel/client/gateway/info?channelId={渠道ID} METHOD: GET Headers: | key | value | | :----------- | :------------: | | Content-Type | application/json;charset=utf-8 | | Authorization | 用户TOKEN | ResponseBody: ```json { "code": 1, "msg": "成功", "data": " Name\t Type\t Data\tState\n=================================================================================================\n 172.16.10.18\t alias\t internal\tALIASED\n external\tprofile\t sip:mod_sofia@47.111.189.55:60080\tRUNNING (0)\n external::juchen\tgateway\t sip:yx13160014890@101.132.41.160:6060\tNOREG\n external::jishi\tgateway\t sip:327007@119.23.189.225:2459\tNOREG\n internal\tprofile\t sip:mod_sofia@47.111.189.55:60060\tRUNNING (0)\n=================================================================================================\n2 profiles 1 alias" // 远程freeswitch网关信息 } ``` Example: ``` curl --location --request GET 'http://hw-gz26.heyqiwu.cn:60013/channel/client/gateway/info?channelId=simo-test' \ --header 'Authorization: Basic ZXlKaGJHY2lPaUpJVXpJMU5pSjkuZXlKcFlYUWlPakUyTmpZNE5URTROVE1zSW1WNGNDSTZNVFkyTmpnNU5UQTFNeXdpYVdRaU9qRjkuZ2o3R29xU2hDTGJpVVh3YnpCWVhoNnBUVU1XTldlVjRuaGNQOTgwLV9oYzpzMDBwZXJzM2NyZXQ=' ``` #### 外呼渠道-客户端操作指令 URL: {基本地址}/channel/client/operate METHOD: POST Headers: | key | value | | :----------- | :------------: | | Content-Type | application/json;charset=utf-8 | | Authorization | 用户TOKEN | RequestBody: ```json { "channelId":"simo-test", // 渠道ID "requireGatewayInfo":0, // 重新从运营主服务器获取网关配置信息 "rescanSipProfile":0, // freeswitch重新扫描网关配置文件 "restartFreeswitch":1, // 重新启动freeswitch "restartListener":1 // 重新启动外呼端监听进程 } ``` ResponseBody: ```json { "code": 1, "msg": "成功", "data": { "operateLog": "fatal: destination path 'freeswitch' already exists and is not an empty directory.Sending build context to Docker daemon 278.5MBStep 1/34 : FROM debian:buster ---> 61cd0373ceabStep 2/34 : COPY conf/sources.list /etc/apt ---> Using cache ---> c05ebd8fd131Step 3/34 : RUN apt-get update && apt-get install -yq git gnupg2 wget lsb-release ---> Using cache ---> bc5b66210b04Step 4/34 : ENV TOKEN pat_7VzvtZvAkiXnJ56QE37qPfbn ---> Using cache ---> 9f36169f5bb0Step 5/34 : RUN wget --http-user=signalwire --http-password=$TOKEN -O /usr/share/keyrings/signalwire-freeswitch-repo.gpg https://freeswitch.signalwire.com/repo/deb/debian-release/signalwire-freeswitch-repo.gpg ---> Using cache ---> cde6966f285dStep 6/34 : RUN echo \"machine freeswitch.signalwire.com login signalwire password $TOKEN\" > /etc/apt/auth.conf ---> Using cache ---> 071f7f6036cbStep 7/34 : RUN echo \"deb [signed-by=/usr/share/keyrings/signalwire-freeswitch-repo.gpg] https://freeswitch.signalwire.com/repo/deb/debian-release/ `lsb_release -sc` main\" > /etc/apt/sources.list.d/freeswitch.list ---> Using cache ---> 384bb66ceae4Step 8/34 : RUN echo \"deb-src [signed-by=/usr/share/keyrings/signalwire-freeswitch-repo.gpg] https://freeswitch.signalwire.com/repo/deb/debian-release/ `lsb_release -sc` main\" >> /etc/apt/sources.list.d/freeswitch.list ---> Using cache ---> 1ccb89ce1c55Step 9/34 : RUN apt-get update ---> Using cache ---> dcf151635b59Step 10/34 : RUN apt-get -yq build-dep freeswitch ---> Using cache ---> 4be58e30272cStep 11/34 : WORKDIR /usr/local/src ---> Using cache ---> f0888a3682e9Step 12/34 : COPY package/freeswitch /usr/local/src/freeswitch ---> Using cache ---> 5cbe5958bdb7Step 13/34 : COPY src/switch_ivr_async.c /usr/local/src/freeswitch/src/switch_ivr_async.c ---> Using cache ---> 02f61d3865c4Step 14/34 : COPY src/mod_unimrcp.c /usr/local/src/freeswitch/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c ---> Using cache ---> 004f7e0b7ca6Step 15/34 : WORKDIR /usr/local/src/freeswitch ---> Using cache ---> 42b4b3d2c1f1Step 16/34 : COPY conf/modules.conf /usr/local/src/freeswitch ---> Using cache ---> 78dbae87e3e6Step 17/34 : RUN cd /usr/local/src/freeswitch && ./bootstrap.sh -j && ./configure -C && make && make install ---> Using cache ---> 8fda708b9718Step 18/34 : RUN ln -s /usr/local/freeswitch/bin/freeswitch /usr/local/bin/ ---> Using cache ---> 7f024c0fa481Step 19/34 : RUN ln -s /usr/local/freeswitch/bin/fs_cli /usr/local/bin ---> Using cache ---> 7be64d2d977cStep 20/34 : RUN apt-get install -yq vim lsof zip lua5.2 ffmpeg curl supervisor telnet gdb ---> Using cache ---> 02a52c6447c2Step 21/34 : RUN /bin/cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo 'Asia/Shanghai' >/etc/timezone ---> Using cache ---> 07966243afacStep 22/34 : RUN rm -Rf /usr/local/freeswitch/conf/* ---> Using cache ---> 74823371be94Step 23/34 : RUN rm -Rf /usr/local/freeswitch/recordings/* ---> Using cache ---> e0dde69a7c3aStep 24/34 : RUN rm -Rf /usr/local/freeswitch/sounds/* ---> Using cache ---> 9dfd04bac8b6Step 25/34 : RUN rm -Rf /usr/local/freeswitch/log/* ---> Using cache ---> c76de6f30f67Step 26/34 : RUN rm -Rf /usr/local/freeswitch/scripts/* ---> Using cache ---> bb5860436ed2Step 27/34 : RUN rm -Rf /usr/local/freeswitch/grammar/* ---> Using cache ---> e864f82e6cb4Step 28/34 : COPY package/v3.0-rc1.zip /usr/local/src/ ---> Using cache ---> 17a3228979e1Step 29/34 : RUN cd /usr/local/src && unzip v3.0-rc1.zip ---> Using cache ---> 202499854a26Step 30/34 : RUN cd /usr/local/src/luasocket-3.0-rc1/src && perl -p -i.bak1 -e \"s#luaL_openlib\\(L, NULL, func, 0\\)#luaL_register\\(L, NULL, func\\)#\" *.c && perl -p -i.bak2 -e \"s#luaL_openlib\\(L, \\\"socket\\\", func, 0\\)#luaL_register\\(L, \\\"socket\\\", func\\)#\" *.c && perl -p -i.bak3 -e \"s#luaL_openlib\\(L, \\\"mime\\\", func, 0\\)#luaL_register\\(L, \\\"mime\\\", func\\)#\" *.c && cd /usr/local/src/luasocket-3.0-rc1/gem && perl -p -i.bak1 -e \"s#luaL_openlib\\(L, \\\"gem\\\", func, 0\\)#luaL_register\\(L, \\\"gem\\\", func\\)#\" *.c && cd /usr/local/src/luasocket-3.0-rc1 && make PLAT=linux DEBUG=NODEBUG LUAV=5.2 prefix=/usr/local COMPAT=NOCOMPAT LUAINC_linux=/usr/include/lua5.2 && make PLAT=linux DEBUG=NODEBUG LUAV=5.2 prefix=/usr/local COMPAT=NOCOMPAT LUAINC_linux=/usr/include/lua5.2 install ---> Using cache ---> 756bd75b5b53Step 31/34 : COPY lua_lib /usr/local/lib/lua/5.2/lua_lib ---> Using cache ---> b258a3144f22Step 32/34 : RUN cd /usr/local/lib/lua/5.2/ && mv lua_lib/* ./ && rm -rf lua_lib ---> Using cache ---> 170b7122317fStep 33/34 : RUN ln -s /usr/local/freeswitch/scripts /usr/local/lib/lua/5.2/custom ---> Using cache ---> a01bd4594b6cStep 34/34 : COPY conf/supervisor.conf /etc/supervisor/conf.d/freeswitch.conf ---> Using cache ---> 04865bb58f29Successfully built 04865bb58f29Successfully tagged qiwu.ai/freeswitch:latestqwfreeswitchqwfreeswitched38054c9db1a5e555ed2b5c9883608b8053bf1736b1f749930f1c52bf56a4adqwfreeswitch/usr/lib/python2.7/dist-packages/supervisor/options.py:461: UserWarning: Supervisord is running as root and it is searching for its configuration file in default locations (including its current working directory); you probably want to specify a \"-c\" argument specifying an absolute path to a configuration file for improved security. 'Supervisord is running as root and it is searching '[18:00:23]============================结束\n\n请30s之后查询网关信息,查看是否正常,再配置其他任务!" // 操作log信息 } } ``` Example: ``` curl --location --request POST 'http://hw-gz26.heyqiwu.cn:60013/channel/client/operate' \ --header 'Authorization: Basic ZXlKaGJHY2lPaUpJVXpJMU5pSjkuZXlKcFlYUWlPakUyTmpZNE5URTROVE1zSW1WNGNDSTZNVFkyTmpnNU5UQTFNeXdpYVdRaU9qRjkuZ2o3R29xU2hDTGJpVVh3YnpCWVhoNnBUVU1XTldlVjRuaGNQOTgwLV9oYzpzMDBwZXJzM2NyZXQ=' \ --header 'Content-Type: application/json' \ --data-raw '{ "channelId":"simo-test", "requireGatewayInfo":0, "rescanSipProfile":0, "restartFreeswitch":1, "restartListener":1 }' ```