sip.go 3.3 KB

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