sip.go 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  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 Extension struct {
  24. Extension string `xorm:"exten" json:"exten"`
  25. Type string `xorm:"type" json:"type"`
  26. Priority string `xorm:"priority" json:"priority"`
  27. Special string `xorm:"special" json:"special"`
  28. Status string `xorm:"status" json:"status"`
  29. Remark string `xorm:"remark" json:"remark"`
  30. }
  31. func (*Extension) TableName() string {
  32. return "t_extension"
  33. }
  34. type EndpointList struct {
  35. Event string `json:"Event"`
  36. ObjectType string `json:"ObjectType"`
  37. ObjectName string `json:"ObjectName"`
  38. Transport string `json:"Transport"`
  39. Aor string `json:"Aor"`
  40. Auths string `json:"Auths"`
  41. OutboundAuths string `json:"OutboundAuths"`
  42. Contacts string `json:"Contacts"`
  43. DeviceState string `json:"DeviceState"`
  44. ActiveChannels string `json:"ActiveChannels"`
  45. }
  46. // Event: PeerEntry
  47. // Channeltype: SIP
  48. // ObjectName: 875
  49. // ChanObjectType: peer
  50. // IPaddress: -none-
  51. // IPport: 0
  52. // Dynamic: yes
  53. // AutoForcerport: no
  54. // Forcerport: yes
  55. // AutoComedia: no
  56. // Comedia: yes
  57. // VideoSupport: no
  58. // TextSupport: no
  59. // ACL: no
  60. // Status: UNKNOWN
  61. // RealtimeDevice: no
  62. // Description:
  63. // Accountcode:
  64. type PeerEntry struct {
  65. Event string `json:"Event"`
  66. Channeltype string `json:"Channeltype"`
  67. ObjectName string `json:"ObjectName"`
  68. ChanObjectType string `json:"ChanObjectType"`
  69. IPaddress string `json:"IPaddress"`
  70. IPport string `json:"IPport"`
  71. Dynamic string `json:"Dynamic"`
  72. AutoForcerport string `json:"AutoForcerport"`
  73. Forcerport string `json:"Forcerport"`
  74. AutoComedia string `json:"AutoComedia"`
  75. Status string `json:"Status"`
  76. RealtimeDevice string `json:"RealtimeDevice"`
  77. }
  78. // Event: ContactList
  79. // ObjectType: contact
  80. // ObjectName: 120;@199f77999ab9abe1ec7fbe48e0b51053
  81. // ViaAddr: 192.168.17.183
  82. // QualifyTimeout: 30.000000
  83. // CallId: DBnHD24ea-7MTKkYj9ewfafR0KAmWv4z
  84. // RegServer:
  85. // PruneOnBoot: no
  86. // Path:
  87. // Endpoint: 120
  88. // ViaPort: 60442
  89. // AuthenticateQualify: no
  90. // Uri: sip:120@192.168.17.183:60442;ob
  91. // QualifyFrequency: 300
  92. // UserAgent: Telephone 1.2.6
  93. // ExpirationTime: 1620818122
  94. // OutboundProxy:
  95. // Status: Reachable
  96. // RoundtripUsec: 85040
  97. type ContactList struct {
  98. Event string `json:"Event"`
  99. ObjectName string `json:"ObjectName"`
  100. ViaAddr string `json:"ViaAddr"`
  101. Uri string `json:"Uri"`
  102. RoundtripUsec string `json:"RoundtripUsec"`
  103. }
  104. func (list ContactList) String() string {
  105. data, _ := json.Marshal(list)
  106. return string(data)
  107. }
  108. // 分机状态
  109. // Event: ExtensionStatus
  110. // Exten: 118
  111. // Context: channelhints_exten
  112. // Hint: PJSIP/118,CustomPresence:118
  113. // Status: 4
  114. // StatusText: Unavailable
  115. type ExtensionStatus struct {
  116. Event string `json:"event"`
  117. Exten string `json:"extension"`
  118. Context string `json:"context"`
  119. Hint string `json:"hint"`
  120. Status string `json:"status"`
  121. StatusText string `json:"statusText"`
  122. }