FreeSWITCH中文网,电话机器人开发网 ,微信订阅号:

FreeSWITCH及VOIP,Openser,电话机器人等产品中文技术资讯、交流、沟通、培训、咨询、服务一体化网络。QQ群:293697898

FSGUI_cloud1.1.6-beta版本发布了


tags:FSGUI cloud FreeSWITCH Cloud GUI 创建时间:2023-11-18 12:13:06

更新日志:

新增:

增加原fsgui中的若干restful http接口

增加每个节点可以多个不同的restful认证用户

其它

下载地址 :

 链接:https://pan.baidu.com/s/15UQEufiehTejRUHSOI8rCA?pwd=1234

 提取码:1234

调用http接口

版本:V1.1.6-beta time: 2023-10-28 log: 一、常量定义

const ( 
RESULT  = "result" 
SUCCESS = "success" 
FAILED  = "failed" 
INFO    
= "info" 
)

二、说明 1. 系统异常 ``` { "Error": "Resource not found" }

``` 2. 请求token说明

由于这个token的相关的认证需求,请求的token必须以: Authorization:Nway 打头,空格后跟

"Authorization:Nway eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2OTg0NTcyOTEsImlkIjoiYWRtaW4iLCJvcmlnX2lhdC WtznCXvAPz6wCtDQkjT7s"

"Authorization:Nway eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2OTg0NTcyOTEsImlkIjoiYWRtaW4iLCJvcmlnX2lhdCWtznCXvAPz6wCtDQkjT7s"

在后续文档中,为了让请求命令看得更容易,以上字符串采用以下替代

"Authorization:Nway token"

三、接口

  1. login

调用方向服务器通过认证方式来获取token

请求值

 curl -d '{"username": "admin", "password": "admin"}' -H "Content-Type:application/json" http://ip:port/api/login

返回值

错误值: { "Error": "Not Authorized" }

正确值:

{ 
"token": 
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2OTg0NTcxMTksImlkIjoiYWRtaW4iLCJvcmlnX2l
 4EC5ap8yQfcnskZoDN-IHjUa-wKiRYs" 
}

2.get_uuid

用于从服务器获取一个uuid,如果是外呼等,建议使用此接口获取uuid 请求值

curl  -H "Authorization:Nway token" http://127.0.0.1:8085/api/get_uuid

返回值 { "result": "success", "uuid": "e0209523-fe05-4dc5-ae78-9d834d39d0cf" }

异常返回值

3.heartbeat

定时向服务器发送请求,用来探测服务器和调用方的心跳 请求值

curl  -H "Authorization:Nway token" http://127.0.0.1:8085/api/heartbeat

返回值

{ 
  "result": "success" 
}

4.get_phone_uuid

用于从服务端获取一个正在通话中的电话的通话中的uuid,切记,如不在通话中则不会存在

请求值

curl  -H "Authorization:Nway token" http://127.0.0.1:8085/api/get_phone_uuid

返回值

 { 
  "result": "success", 
  "uuid": "e0209523-fe05-4dc5-ae78-9d834d39d0cf" 
}

如无通话,那么返回值为:

{ 
  "result": "failed", 
  "uuid": "" 
}

4.hangup

用于将一个正在通话中的电话给强行挂断

请求值

curl -H "Authorization:Nway token" http://127.0.0.1:8085/api/hangup/10086

返回值

{ 
  "result": "success" 
  }

异常情况

{ "result": "failed", "info": "not found phone call" }

当然,文档的更新应是较慢的。大概接口如下: ``` rest.Post("/login", jwt_middleware.LoginHandler),

rest.Get("/get_uuid", nway_rest_get_uuid),
rest.Get("/heartbeat", nway_heartbeat),
rest.Get("/get_phone_uuid/:phone", nway_rest_get_phone_uuid),

rest.Post("/hangup/:phone", nway_rest_hangup),
rest.Post("/hold/:phone", nway_rest_hold),
rest.Post("/phone_answer/:phone", nway_rest_phone_answer), //uuid_phone_event [uuid] talk
rest.Post("/unhold/:phone", nway_rest_unhold),

rest.Post("/originate", nway_rest_originate),

rest.Post("/originate_playback", nway_rest_originate_playback),
rest.Post("/originate_to_nwayacd", nway_originate_to_nwayacd),
rest.Post("/originate_ext", nway_rest_originate_ext),

rest.Post("/bridge", nway_rest_bridge),
rest.Post("/bridge_phone", nway_rest_bridge_by_phone),
rest.Get("/park/:phone", nway_rest_park),
rest.Get("/intercept/:phone", nway_rest_intercept),
rest.Get("/answer/:phone", nway_rest_answer),
rest.Post("/eavesdrop", nway_rest_eavesdrop),
rest.Post("/threeway", nway_rest_threeway),
rest.Post("/whisper", nway_rest_whisper),
rest.Post("/transfer", nway_rest_transfer),
rest.Get("/preanswer/:phone", nway_rest_preanswer),
rest.Post("/playback", nway_rest_playback),

rest.Post("/uuid_break/:uuid", nway_rest_uuid_break),
rest.Post("/uuid_hangup/:uuid", nway_rest_uuid_hangup),
rest.Post("/uuid_park/:uuid", nway_rest_uuid_park),
rest.Post("/uuid_hold/:uuid", nway_rest_uuid_hold),
rest.Post("/uuid_unpark/:uuid", nway_rest_uuid_unpark),
rest.Post("/uuid_unhold/:uuid", nway_rest_uuid_unhold),
rest.Post("/uuid_answer/:uuid", nway_rest_uuid_answer),

rest.Get("/break/:phone", nway_rest_break),
rest.Get("/refresh_token", jwt_middleware.RefreshHandler),

rest.Post("/nwayacd_login", nwayacd_login),
rest.Post("/nwayacd_logout/:user", nwayacd_logout),
rest.Post("/nwayacd_busy/:user", nwayacd_busy),
rest.Post("/nwayacd_ready/:user", nwayacd_ready),
rest.Post("/nwayacd_call_out/:user", nwayacd_call_out),
rest.Post("/nwayacd_call_ready/:user", nwayacd_call_ready),
rest.Post("/nwayacd_version", nwayacd_version),
rest.Post("/nwayacd_add_ext", nwayacd_add_ext),
rest.Post("/nwayacd_set_ext_jobnumber", nwayacd_set_ext_jobnumber),
rest.Post("/nwayacd_rm_ext/:user", nwayacd_rm_ext),
rest.Post("/nwayacd_set_reged_ext/:user", nwayacd_set_reged_ext),
rest.Post("/nwayacd_set_unreg_ext/:user", nwayacd_set_unreg_ext),
rest.Post("/nwayacd_add_group", nwayacd_add_group),
rest.Post("/nwayacd_rm_group/:group", nwayacd_rm_group),
rest.Post("/nwayacd_set_group_ring", nwayacd_set_group_ring),
rest.Post("/nwayacd_list_exts", nwayacd_list_exts),
rest.Post("/nwayacd_list_groups", nwayacd_list_groups),

```

安装方式

https://mp.weixin.qq.com/s/kajTvldiPU4_sRtJPaV7Qw



上海老李,QQ:1354608370,FreeSWITCH QQ群: