sip.go 3.3 KB

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