123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154 |
- package asterisk
- import (
- "net/http"
- "pbx-api-gin/api/model"
- "pbx-api-gin/internal/app/ami/action"
- "github.com/gin-gonic/gin"
- )
- /*
- // @tags Asterisk-Conference
- // @Summary 查看所有会议室
- // @Description 会议室列表
- // @Security ApiKeyAuth
- // @Accept json
- // @Produce json
- // @Success 200 {object} model.APIOK "请求成功"
- // @Router /ginapi/plugin-asterisk/conference/listroom [get]
- */
- func listRoom(ctx *gin.Context) {
- res, err := action.ListRoom(make(map[string]string))
- if err != nil {
- ctx.JSON(http.StatusInternalServerError, model.APIError{ErrorMessage: err.Error()})
- return
- }
- ctx.JSON(http.StatusOK, model.APIOK{Message: "ok", Data: res})
- }
- /*
- // @tags Asterisk-Conference
- // @Summary 查看指定会议室
- // @Description 会议室信息
- // @Security ApiKeyAuth
- // @Accept json
- // @Produce json
- // @Param data body model.ConferenceInfo true "信息"
- // @Success 200 {object} model.APIOK "请求成功"
- // @Router /ginapi/plugin-asterisk/conference/list [post]
- */
- func list(ctx *gin.Context) {
- var data model.ConferenceInfo
- if err := ctx.ShouldBindJSON(&data); err != nil {
- ctx.JSON(http.StatusBadRequest, model.APIError{ErrorMessage: err.Error()})
- return
- }
- action.List(data.ConfNum)
- ctx.JSON(http.StatusOK, model.APIOK{Message: "ok", Data: data})
- }
- /*
- // @tags Asterisk-Conference
- // @Summary 踢人
- // @Description 移除指定通道
- // @Security ApiKeyAuth
- // @Accept json
- // @Produce json
- // @Param data body model.ConferenceInfo true "参数"
- // @Success 200 {object} model.APIOK "请求成功"
- // @Router /ginapi/plugin-asterisk/conference/kick [post]
- */
- func kick(ctx *gin.Context) {
- var data model.ConferenceInfo
- if err := ctx.ShouldBindJSON(&data); err != nil {
- ctx.JSON(http.StatusBadRequest, model.APIError{ErrorMessage: err.Error()})
- return
- }
- action.Kick(data.ConfNum, data.Channel)
- ctx.JSON(http.StatusOK, model.APIOK{Message: "ok", Data: data})
- }
- /*
- // @tags Asterisk-Conference
- // @Summary 禁言
- // @Description 禁言
- // @Security ApiKeyAuth
- // @Accept json
- // @Produce json
- // @Param data body model.ConferenceInfo true "参数"
- // @Success 200 {object} model.APIOK "请求成功"
- // @Router /ginapi/plugin-asterisk/conference/mute [post]
- */
- func mute(ctx *gin.Context) {
- var data model.ConferenceInfo
- if err := ctx.ShouldBindJSON(&data); err != nil {
- ctx.JSON(http.StatusBadRequest, model.APIError{ErrorMessage: err.Error()})
- return
- }
- action.Mute(data.ConfNum, data.Channel)
- ctx.JSON(http.StatusOK, model.APIOK{Message: "ok", Data: data})
- }
- /*
- // @tags Asterisk-Conference
- // @Summary 取消禁言
- // @Description 取消禁言
- // @Security ApiKeyAuth
- // @Accept json
- // @Produce json
- // @Param data body model.ConferenceInfo true "参数"
- // @Success 200 {object} model.APIOK "请求成功"
- // @Router /ginapi/plugin-asterisk/conference/unmute [post]
- */
- func unMute(ctx *gin.Context) {
- var data model.ConferenceInfo
- if err := ctx.ShouldBindJSON(&data); err != nil {
- ctx.JSON(http.StatusBadRequest, model.APIError{ErrorMessage: err.Error()})
- return
- }
- action.UnMute(data.ConfNum, data.Channel)
- ctx.JSON(http.StatusOK, model.APIOK{Message: "ok", Data: data})
- }
- /*
- // @tags Asterisk-Conference
- // @Summary 开启锁定
- // @Description 开启锁定
- // @Security ApiKeyAuth
- // @Accept json
- // @Produce json
- // @Param data body model.ConferenceInfo true "参数"
- // @Success 200 {object} model.APIOK "请求成功"
- // @Router /ginapi/plugin-asterisk/conference/lock [post]
- */
- func lock(ctx *gin.Context) {
- var data model.ConferenceInfo
- if err := ctx.ShouldBindJSON(&data); err != nil {
- ctx.JSON(http.StatusBadRequest, model.APIError{ErrorMessage: err.Error()})
- return
- }
- action.Lock(data.ConfNum)
- ctx.JSON(http.StatusOK, model.APIOK{Message: "ok", Data: data})
- }
- /*
- // @tags Asterisk-Conference
- // @Summary 关闭锁定
- // @Description 关闭锁定
- // @Security ApiKeyAuth
- // @Accept json
- // @Produce json
- // @Param data body model.ConferenceInfo true "参数"
- // @Success 200 {object} model.APIOK "请求成功"
- // @Router /ginapi/plugin-asterisk/conference/unlock [post]
- */
- func unLock(ctx *gin.Context) {
- var data model.ConferenceInfo
- if err := ctx.ShouldBindJSON(&data); err != nil {
- ctx.JSON(http.StatusBadRequest, model.APIError{ErrorMessage: err.Error()})
- return
- }
- action.UnLock(data.ConfNum)
- ctx.JSON(http.StatusOK, model.APIOK{Message: "ok", Data: data})
- }
|