conference.go 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. package asterisk
  2. import (
  3. "net/http"
  4. "pbx-api-gin/api/model"
  5. "pbx-api-gin/internal/app/ami/action"
  6. "github.com/gin-gonic/gin"
  7. )
  8. /*
  9. // @tags Asterisk-Conference
  10. // @Summary 查看所有会议室
  11. // @Description 会议室列表
  12. // @Security ApiKeyAuth
  13. // @Accept json
  14. // @Produce json
  15. // @Success 200 {object} model.APIOK "请求成功"
  16. // @Router /ginapi/plugin-asterisk/conference/listroom [get]
  17. */
  18. func listRoom(ctx *gin.Context) {
  19. res, err := action.ListRoom(make(map[string]string))
  20. if err != nil {
  21. ctx.JSON(http.StatusInternalServerError, model.APIError{ErrorMessage: err.Error()})
  22. return
  23. }
  24. ctx.JSON(http.StatusOK, model.APIOK{Message: "ok", Data: res})
  25. }
  26. /*
  27. // @tags Asterisk-Conference
  28. // @Summary 查看指定会议室
  29. // @Description 会议室信息
  30. // @Security ApiKeyAuth
  31. // @Accept json
  32. // @Produce json
  33. // @Param data body model.ConferenceInfo true "信息"
  34. // @Success 200 {object} model.APIOK "请求成功"
  35. // @Router /ginapi/plugin-asterisk/conference/list [post]
  36. */
  37. func list(ctx *gin.Context) {
  38. var data model.ConferenceInfo
  39. if err := ctx.ShouldBindJSON(&data); err != nil {
  40. ctx.JSON(http.StatusBadRequest, model.APIError{ErrorMessage: err.Error()})
  41. return
  42. }
  43. action.List(data.ConfNum)
  44. ctx.JSON(http.StatusOK, model.APIOK{Message: "ok", Data: data})
  45. }
  46. /*
  47. // @tags Asterisk-Conference
  48. // @Summary 踢人
  49. // @Description 移除指定通道
  50. // @Security ApiKeyAuth
  51. // @Accept json
  52. // @Produce json
  53. // @Param data body model.ConferenceInfo true "参数"
  54. // @Success 200 {object} model.APIOK "请求成功"
  55. // @Router /ginapi/plugin-asterisk/conference/kick [post]
  56. */
  57. func kick(ctx *gin.Context) {
  58. var data model.ConferenceInfo
  59. if err := ctx.ShouldBindJSON(&data); err != nil {
  60. ctx.JSON(http.StatusBadRequest, model.APIError{ErrorMessage: err.Error()})
  61. return
  62. }
  63. action.Kick(data.ConfNum, data.Channel)
  64. ctx.JSON(http.StatusOK, model.APIOK{Message: "ok", Data: data})
  65. }
  66. /*
  67. // @tags Asterisk-Conference
  68. // @Summary 禁言
  69. // @Description 禁言
  70. // @Security ApiKeyAuth
  71. // @Accept json
  72. // @Produce json
  73. // @Param data body model.ConferenceInfo true "参数"
  74. // @Success 200 {object} model.APIOK "请求成功"
  75. // @Router /ginapi/plugin-asterisk/conference/mute [post]
  76. */
  77. func mute(ctx *gin.Context) {
  78. var data model.ConferenceInfo
  79. if err := ctx.ShouldBindJSON(&data); err != nil {
  80. ctx.JSON(http.StatusBadRequest, model.APIError{ErrorMessage: err.Error()})
  81. return
  82. }
  83. action.Mute(data.ConfNum, data.Channel)
  84. ctx.JSON(http.StatusOK, model.APIOK{Message: "ok", Data: data})
  85. }
  86. /*
  87. // @tags Asterisk-Conference
  88. // @Summary 取消禁言
  89. // @Description 取消禁言
  90. // @Security ApiKeyAuth
  91. // @Accept json
  92. // @Produce json
  93. // @Param data body model.ConferenceInfo true "参数"
  94. // @Success 200 {object} model.APIOK "请求成功"
  95. // @Router /ginapi/plugin-asterisk/conference/unmute [post]
  96. */
  97. func unMute(ctx *gin.Context) {
  98. var data model.ConferenceInfo
  99. if err := ctx.ShouldBindJSON(&data); err != nil {
  100. ctx.JSON(http.StatusBadRequest, model.APIError{ErrorMessage: err.Error()})
  101. return
  102. }
  103. action.UnMute(data.ConfNum, data.Channel)
  104. ctx.JSON(http.StatusOK, model.APIOK{Message: "ok", Data: data})
  105. }
  106. /*
  107. // @tags Asterisk-Conference
  108. // @Summary 开启锁定
  109. // @Description 开启锁定
  110. // @Security ApiKeyAuth
  111. // @Accept json
  112. // @Produce json
  113. // @Param data body model.ConferenceInfo true "参数"
  114. // @Success 200 {object} model.APIOK "请求成功"
  115. // @Router /ginapi/plugin-asterisk/conference/lock [post]
  116. */
  117. func lock(ctx *gin.Context) {
  118. var data model.ConferenceInfo
  119. if err := ctx.ShouldBindJSON(&data); err != nil {
  120. ctx.JSON(http.StatusBadRequest, model.APIError{ErrorMessage: err.Error()})
  121. return
  122. }
  123. action.Lock(data.ConfNum)
  124. ctx.JSON(http.StatusOK, model.APIOK{Message: "ok", Data: data})
  125. }
  126. /*
  127. // @tags Asterisk-Conference
  128. // @Summary 关闭锁定
  129. // @Description 关闭锁定
  130. // @Security ApiKeyAuth
  131. // @Accept json
  132. // @Produce json
  133. // @Param data body model.ConferenceInfo true "参数"
  134. // @Success 200 {object} model.APIOK "请求成功"
  135. // @Router /ginapi/plugin-asterisk/conference/unlock [post]
  136. */
  137. func unLock(ctx *gin.Context) {
  138. var data model.ConferenceInfo
  139. if err := ctx.ShouldBindJSON(&data); err != nil {
  140. ctx.JSON(http.StatusBadRequest, model.APIError{ErrorMessage: err.Error()})
  141. return
  142. }
  143. action.UnLock(data.ConfNum)
  144. ctx.JSON(http.StatusOK, model.APIOK{Message: "ok", Data: data})
  145. }