sip.go 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. package model
  2. import "encoding/json"
  3. // Event: EndpointList
  4. // ObjectType: endpoint
  5. // ObjectName: www
  6. // Transport: UDP
  7. // Aor: www
  8. // Auths: www
  9. // OutboundAuths: www
  10. // Contacts:
  11. // DeviceState: Unavailable
  12. // ActiveChannels:
  13. // Event: EndpointList
  14. // ObjectType: endpoint
  15. // ObjectName: 899
  16. // Transport:
  17. // Aor: 899
  18. // Auths: 899
  19. // OutboundAuths:
  20. // Contacts:
  21. // DeviceState: Unavailable
  22. // ActiveChannels:
  23. type EndpointList struct {
  24. Event string `json:"Event"`
  25. ObjectType string `json:"ObjectType"`
  26. ObjectName string `json:"ObjectName"`
  27. Transport string `json:"Transport"`
  28. Aor string `json:"Aor"`
  29. Auths string `json:"Auths"`
  30. OutboundAuths string `json:"OutboundAuths"`
  31. Contacts string `json:"Contacts"`
  32. DeviceState string `json:"DeviceState"`
  33. ActiveChannels string `json:"ActiveChannels"`
  34. }
  35. // Event: PeerEntry
  36. // Channeltype: SIP
  37. // ObjectName: 875
  38. // ChanObjectType: peer
  39. // IPaddress: -none-
  40. // IPport: 0
  41. // Dynamic: yes
  42. // AutoForcerport: no
  43. // Forcerport: yes
  44. // AutoComedia: no
  45. // Comedia: yes
  46. // VideoSupport: no
  47. // TextSupport: no
  48. // ACL: no
  49. // Status: UNKNOWN
  50. // RealtimeDevice: no
  51. // Description:
  52. // Accountcode:
  53. type PeerEntry struct {
  54. Event string `json:"Event"`
  55. Channeltype string `json:"Channeltype"`
  56. ObjectName string `json:"ObjectName"`
  57. ChanObjectType string `json:"ChanObjectType"`
  58. IPaddress string `json:"IPaddress"`
  59. IPport string `json:"IPport"`
  60. Dynamic string `json:"Dynamic"`
  61. AutoForcerport string `json:"AutoForcerport"`
  62. Forcerport string `json:"Forcerport"`
  63. AutoComedia string `json:"AutoComedia"`
  64. Status string `json:"Status"`
  65. RealtimeDevice string `json:"RealtimeDevice"`
  66. }
  67. // Event: ContactList
  68. // ObjectType: contact
  69. // ObjectName: 120;@199f77999ab9abe1ec7fbe48e0b51053
  70. // ViaAddr: 192.168.17.183
  71. // QualifyTimeout: 30.000000
  72. // CallId: DBnHD24ea-7MTKkYj9ewfafR0KAmWv4z
  73. // RegServer:
  74. // PruneOnBoot: no
  75. // Path:
  76. // Endpoint: 120
  77. // ViaPort: 60442
  78. // AuthenticateQualify: no
  79. // Uri: sip:120@192.168.17.183:60442;ob
  80. // QualifyFrequency: 300
  81. // UserAgent: Telephone 1.2.6
  82. // ExpirationTime: 1620818122
  83. // OutboundProxy:
  84. // Status: Reachable
  85. // RoundtripUsec: 85040
  86. type ContactList struct {
  87. Event string `json:"Event"`
  88. ObjectName string `json:"ObjectName"`
  89. ViaAddr string `json:"ViaAddr"`
  90. Uri string `json:"Uri"`
  91. RoundtripUsec string `json:"RoundtripUsec"`
  92. }
  93. func (list ContactList) String() string {
  94. data, _ := json.Marshal(list)
  95. return string(data)
  96. }
  97. // 分机状态
  98. // Event: ExtensionStatus
  99. // Exten: 118
  100. // Context: channelhints_exten
  101. // Hint: PJSIP/118,CustomPresence:118
  102. // Status: 4
  103. // StatusText: Unavailable
  104. type ExtensionStatus struct {
  105. Event string `json:"event"`
  106. Exten string `json:"extension"`
  107. Context string `json:"context"`
  108. Hint string `json:"hint"`
  109. Status string `json:"status"`
  110. StatusText string `json:"statusText"`
  111. }