channel.go 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. package asterisk
  2. import (
  3. "net/http"
  4. "pbx-api-gin/api/model"
  5. "pbx-api-gin/internal/app/ami"
  6. "pbx-api-gin/internal/app/ami/action"
  7. "github.com/gin-gonic/gin"
  8. )
  9. // @tags Asterisk-Channel
  10. // @Summary 当前通话通道
  11. // @Description 当前通话通道
  12. // @Security ApiKeyAuth
  13. // @Accept json
  14. // @Produce json
  15. // @Success 200 {object} model.APIOK "请求成功"
  16. // @Router /ginapi/plugin-asterisk/channel/show-channels [get]
  17. func showChannels(ctx *gin.Context) {
  18. data, err := action.CoreShowChannels()
  19. if err != nil {
  20. ctx.JSON(http.StatusBadRequest, model.APIError{ErrorMessage: err.Error()})
  21. return
  22. }
  23. ctx.JSON(http.StatusOK, model.APIOK{Message: "ok", Data: data})
  24. }
  25. // @tags Asterisk-Channel
  26. // @Summary 当前 Bridge 通道
  27. // @Description 当前 Bridge 通道
  28. // @Security ApiKeyAuth
  29. // @Accept json
  30. // @Produce json
  31. // @Success 200 {object} model.APIOK "请求成功"
  32. // @Router /ginapi/plugin-asterisk/channel/show-bridge-channels [get]
  33. func showBridgeChannels(ctx *gin.Context) {
  34. ctx.JSON(http.StatusOK, model.APIOK{Message: "ok", Data: ami.GetBridgeMapValue()})
  35. }