conference.go 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. package action
  2. import (
  3. "errors"
  4. )
  5. func ListRoom(options map[string]string) (res map[string]string, err error) {
  6. action := map[string]string{
  7. "Action": "ConfbridgeListRooms",
  8. }
  9. for key, value := range options {
  10. action[key] = value
  11. }
  12. res, _, err = AminInstance.Send(action)
  13. if err != nil {
  14. return nil, err
  15. }
  16. if res["Response"] != "Success" {
  17. return nil, errors.New(res["Message"])
  18. }
  19. return res, nil
  20. }
  21. func List(confnum string) (res map[string]string, err error) {
  22. action := map[string]string{
  23. "Action": "ConfbridgeList",
  24. "Conference": confnum,
  25. }
  26. res, _, err = AminInstance.Send(action)
  27. if err != nil {
  28. return nil, err
  29. }
  30. if res["Response"] != "Success" {
  31. return nil, errors.New(res["Message"])
  32. }
  33. return res, nil
  34. }
  35. func Kick(confnum, channel string) (res map[string]string, err error) {
  36. action := map[string]string{
  37. "Action": "ConfbridgeKick",
  38. "Conference": confnum,
  39. "Channel": channel,
  40. }
  41. res, _, err = AminInstance.Send(action)
  42. if err != nil {
  43. return nil, err
  44. }
  45. if res["Response"] != "Success" {
  46. return nil, errors.New(res["Message"])
  47. }
  48. return res, nil
  49. }
  50. func Mute(confnum, channel string) (res map[string]string, err error) {
  51. action := map[string]string{
  52. "Action": "ConfbridgeMute",
  53. "Conference": confnum,
  54. "Channel": channel,
  55. }
  56. res, _, err = AminInstance.Send(action)
  57. if err != nil {
  58. return nil, err
  59. }
  60. if res["Response"] != "Success" {
  61. return nil, errors.New(res["Message"])
  62. }
  63. return res, nil
  64. }
  65. func UnMute(confnum, channel string) (res map[string]string, err error) {
  66. action := map[string]string{
  67. "Action": "ConfbridgeUnmute",
  68. "Conference": confnum,
  69. "Channel": channel,
  70. }
  71. res, _, err = AminInstance.Send(action)
  72. if err != nil {
  73. return nil, err
  74. }
  75. if res["Response"] != "Success" {
  76. return nil, errors.New(res["Message"])
  77. }
  78. return res, nil
  79. }
  80. func Lock(confnum string) (res map[string]string, err error) {
  81. action := map[string]string{
  82. "Action": "ConfbridgeLock",
  83. "Conference": confnum,
  84. }
  85. res, _, err = AminInstance.Send(action)
  86. if err != nil {
  87. return nil, err
  88. }
  89. if res["Response"] != "Success" {
  90. return nil, errors.New(res["Message"])
  91. }
  92. return res, nil
  93. }
  94. func UnLock(confnum string) (res map[string]string, err error) {
  95. action := map[string]string{
  96. "Action": "ConfbridgeUnlock",
  97. "Conference": confnum,
  98. }
  99. res, _, err = AminInstance.Send(action)
  100. if err != nil {
  101. return nil, err
  102. }
  103. if res["Response"] != "Success" {
  104. return nil, errors.New(res["Message"])
  105. }
  106. return res, nil
  107. }