coopaging_db.sql 43 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205
  1. --
  2. -- Host: localhost Database: coopaging_db
  3. -- ------------------------------------------------------
  4. --
  5. /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
  6. /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
  7. /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
  8. /*!40101 SET NAMES utf8 */;
  9. /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
  10. /*!40103 SET TIME_ZONE='+00:00' */;
  11. /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
  12. /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
  13. /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
  14. /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
  15. --
  16. -- Table structure for table `t_exinfo`
  17. --
  18. DROP TABLE IF EXISTS `t_exinfo`;
  19. /*!40101 SET @saved_cs_client = @@character_set_client */;
  20. /*!40101 SET character_set_client = utf8 */;
  21. CREATE TABLE `t_exinfo` (
  22. `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  23. `hostname` varchar(20) NOT NULL,
  24. `macaddr` varchar(20) NOT NULL,
  25. `mode` varchar(20) NOT NULL,
  26. `ip` varchar(20) NOT NULL,
  27. `netmask` varchar(20) NOT NULL,
  28. `gateway` varchar(20) NOT NULL,
  29. `publicip` varchar(20) NOT NULL DEFAULT '',
  30. `port` varchar(20) NOT NULL DEFAULT '9999',
  31. `fxssendkey` varchar(6) NOT NULL DEFAULT '#',
  32. `onlinestatus` int(6) unsigned NOT NULL DEFAULT '0',
  33. `username` varchar(20) NOT NULL DEFAULT '',
  34. `password` varchar(20) NOT NULL DEFAULT '',
  35. `configstatus` int(10) unsigned NOT NULL DEFAULT '0',
  36. `everconfigstatus` varchar(6) NOT NULL DEFAULT 'no',
  37. `portifavailable` varchar(80) NOT NULL DEFAULT '',
  38. `_F1` varchar(128) NOT NULL DEFAULT 'no',
  39. `_F2` varchar(128) NOT NULL DEFAULT '',
  40. `_F3` varchar(128) NOT NULL DEFAULT '',
  41. `_F4` varchar(128) NOT NULL DEFAULT '',
  42. PRIMARY KEY (`id`),
  43. UNIQUE KEY `ip` (`ip`),
  44. UNIQUE KEY `macaddr` (`macaddr`)
  45. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  46. /*!40101 SET character_set_client = @saved_cs_client */;
  47. --
  48. -- Dumping data for table `t_exinfo`
  49. --
  50. LOCK TABLES `t_exinfo` WRITE;
  51. /*!40000 ALTER TABLE `t_exinfo` DISABLE KEYS */;
  52. /*!40000 ALTER TABLE `t_exinfo` ENABLE KEYS */;
  53. UNLOCK TABLES;
  54. --
  55. -- Table structure for table `t_pbx_inbound_did`
  56. --
  57. DROP TABLE IF EXISTS `t_pbx_inbound_did`;
  58. /*!40101 SET @saved_cs_client = @@character_set_client */;
  59. /*!40101 SET character_set_client = utf8 */;
  60. CREATE TABLE `t_pbx_inbound_did` (
  61. `_id` int(16) NOT NULL AUTO_INCREMENT,
  62. `_didnumber` varchar(32) NOT NULL,
  63. `_destexten` varchar(128) NOT NULL,
  64. PRIMARY KEY (`_id`),
  65. UNIQUE KEY `_didnumber` (`_didnumber`)
  66. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  67. /*!40101 SET character_set_client = @saved_cs_client */;
  68. --
  69. -- Dumping data for table `t_pbx_inbound_did`
  70. --
  71. LOCK TABLES `t_pbx_inbound_did` WRITE;
  72. /*!40000 ALTER TABLE `t_pbx_inbound_did` DISABLE KEYS */;
  73. /*!40000 ALTER TABLE `t_pbx_inbound_did` ENABLE KEYS */;
  74. UNLOCK TABLES;
  75. --
  76. -- Table structure for table `t_pbx_number_dod`
  77. --
  78. DROP TABLE IF EXISTS `t_pbx_number_dod`;
  79. /*!40101 SET @saved_cs_client = @@character_set_client */;
  80. /*!40101 SET character_set_client = utf8 */;
  81. CREATE TABLE `t_pbx_number_dod` (
  82. `_id` int(16) NOT NULL AUTO_INCREMENT,
  83. `_dodnumber` varchar(32) NOT NULL,
  84. `_dodtrunk` varchar(128) NOT NULL,
  85. PRIMARY KEY (`_id`),
  86. UNIQUE KEY `_dodnumber` (`_dodnumber`)
  87. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  88. /*!40101 SET character_set_client = @saved_cs_client */;
  89. --
  90. -- Dumping data for table `t_pbx_number_dod`
  91. --
  92. LOCK TABLES `t_pbx_number_dod` WRITE;
  93. /*!40000 ALTER TABLE `t_pbx_number_dod` DISABLE KEYS */;
  94. /*!40000 ALTER TABLE `t_pbx_number_dod` ENABLE KEYS */;
  95. UNLOCK TABLES;
  96. --
  97. -- Table structure for table `t_pbx_recording`
  98. --
  99. DROP TABLE IF EXISTS `t_pbx_recording`;
  100. /*!40101 SET @saved_cs_client = @@character_set_client */;
  101. /*!40101 SET character_set_client = utf8 */;
  102. CREATE TABLE `t_pbx_recording` (
  103. `id` int(11) NOT NULL AUTO_INCREMENT,
  104. `src` varchar(64) DEFAULT NULL,
  105. `dest` varchar(64) DEFAULT NULL,
  106. `call_type` varchar(64) DEFAULT NULL,
  107. `record_start_time` double DEFAULT NULL,
  108. `record_len` double DEFAULT NULL,
  109. `record_filename` varchar(255) DEFAULT NULL,
  110. `createdAt` varchar(64) DEFAULT NULL,
  111. `updatedAt` varchar(64) DEFAULT NULL,
  112. `uniqueid` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  113. `note` varchar(255) DEFAULT NULL,
  114. PRIMARY KEY (`id`),
  115. UNIQUE KEY `record_filename` (`record_filename`)
  116. ) ENGINE=InnoDB;
  117. /*!40101 SET character_set_client = @saved_cs_client */;
  118. --
  119. -- Dumping data for table `t_pbx_recording`
  120. --
  121. LOCK TABLES `t_pbx_recording` WRITE;
  122. /*!40000 ALTER TABLE `t_pbx_recording` DISABLE KEYS */;
  123. /*!40000 ALTER TABLE `t_pbx_recording` ENABLE KEYS */;
  124. UNLOCK TABLES;
  125. --
  126. -- Table structure for table `t_pbx_users_extension`
  127. --
  128. DROP TABLE IF EXISTS `t_pbx_users_extension`;
  129. /*!40101 SET @saved_cs_client = @@character_set_client */;
  130. /*!40101 SET character_set_client = utf8 */;
  131. CREATE TABLE `t_pbx_users_extension` (
  132. `_id` int(16) NOT NULL AUTO_INCREMENT,
  133. `_exten` varchar(32) NOT NULL,
  134. `_cid_number` varchar(32) NOT NULL DEFAULT '',
  135. `_transfer` varchar(3) NOT NULL DEFAULT 'yes',
  136. `_mailbox` varchar(16) NOT NULL DEFAULT '',
  137. `_type` varchar(6) NOT NULL DEFAULT 'peer',
  138. `_qualify` varchar(4) NOT NULL DEFAULT 'yes',
  139. `_hasdirectory` varchar(3) NOT NULL DEFAULT 'yes',
  140. `_call-limit` varchar(2) NOT NULL DEFAULT '5',
  141. `_host` varchar(16) NOT NULL DEFAULT 'dynamic',
  142. `_context` varchar(32) NOT NULL DEFAULT 'default',
  143. `_fullname` varchar(64) NOT NULL DEFAULT '',
  144. `_secret` varchar(128) NOT NULL DEFAULT '',
  145. `_outboundcid` varchar(32) NOT NULL DEFAULT '',
  146. `_hasvoicemail` varchar(3) NOT NULL DEFAULT 'yes',
  147. `_vmsecret` varchar(32) NOT NULL DEFAULT '',
  148. `_delete` varchar(3) NOT NULL DEFAULT 'no',
  149. `_email` varchar(64) NOT NULL DEFAULT '',
  150. `_hassip` varchar(3) NOT NULL DEFAULT 'no',
  151. `_hasiax` varchar(3) NOT NULL DEFAULT 'no',
  152. `_dahdichan` varchar(3) NOT NULL DEFAULT '',
  153. `_hasmanager` varchar(3) NOT NULL DEFAULT 'no',
  154. `_hasexten` varchar(3) NOT NULL DEFAULT 'yes',
  155. `_nat` varchar(32) NOT NULL DEFAULT 'no',
  156. `_directmedia` varchar(3) NOT NULL DEFAULT 'no',
  157. `_dtmfmode` varchar(8) NOT NULL DEFAULT 'rfc2833',
  158. `_hasagent` varchar(3) NOT NULL DEFAULT 'no',
  159. `_callwaiting` varchar(3) NOT NULL DEFAULT 'yes',
  160. `_callgroup` varchar(32) NOT NULL DEFAULT '1',
  161. `_pickupgroup` varchar(32) NOT NULL DEFAULT '1',
  162. `_videosupport` varchar(3) NOT NULL DEFAULT 'no',
  163. `_transport` varchar(11) NOT NULL DEFAULT 'udp',
  164. `_encryption` varchar(3) NOT NULL DEFAULT 'no',
  165. `_srtpcapable` varchar(3) NOT NULL DEFAULT 'no',
  166. `_deny` varchar(64) NOT NULL DEFAULT '',
  167. `_permit` varchar(124) NOT NULL DEFAULT '',
  168. `_ulaw` int(1) NOT NULL DEFAULT '1',
  169. `_alaw` int(1) NOT NULL DEFAULT '1',
  170. `_g722` int(1) NOT NULL DEFAULT '0',
  171. `_g729` int(1) NOT NULL DEFAULT '0',
  172. `_g726` int(1) NOT NULL DEFAULT '0',
  173. `_gsm` int(1) NOT NULL DEFAULT '0',
  174. `_speex` int(1) NOT NULL DEFAULT '0',
  175. `_h261` int(1) NOT NULL DEFAULT '0',
  176. `_h263` int(1) NOT NULL DEFAULT '0',
  177. `_h263p` int(1) NOT NULL DEFAULT '0',
  178. `_h264` int(1) NOT NULL DEFAULT '0',
  179. `_vp8` int(4) DEFAULT '0',
  180. `_opus` int(4) DEFAULT '0',
  181. `_position` varchar(256) NOT NULL DEFAULT '',
  182. `_extenbinding` varchar(3) NOT NULL DEFAULT 'no',
  183. `_exmacaddr` varchar(32) DEFAULT '',
  184. `_exdahdichan` varchar(2) DEFAULT '',
  185. `_recordin` varchar(32) NOT NULL DEFAULT '',
  186. `_recordout` varchar(32) NOT NULL DEFAULT '',
  187. `_F1` varchar(128) NOT NULL DEFAULT '',
  188. `_F2` varchar(128) NOT NULL DEFAULT '',
  189. `_F3` varchar(128) NOT NULL DEFAULT '',
  190. `_F4` varchar(128) NOT NULL DEFAULT '',
  191. PRIMARY KEY (`_id`),
  192. UNIQUE KEY `_exten` (`_exten`)
  193. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  194. /*!40101 SET character_set_client = @saved_cs_client */;
  195. --
  196. -- Dumping data for table `t_pbx_users_extension`
  197. --
  198. LOCK TABLES `t_pbx_users_extension` WRITE;
  199. /*!40000 ALTER TABLE `t_pbx_users_extension` DISABLE KEYS */;
  200. /*!40000 ALTER TABLE `t_pbx_users_extension` ENABLE KEYS */;
  201. UNLOCK TABLES;
  202. DROP TRIGGER IF EXISTS `USEREXTEN_INSERT_BEFORE`;
  203. DELIMITER ||
  204. CREATE TRIGGER `USEREXTEN_INSERT_BEFORE` BEFORE INSERT ON `t_pbx_users_extension`
  205. FOR EACH ROW
  206. BEGIN
  207. SET NEW._cid_number=NEW._exten;
  208. SET NEW._mailbox=NEW._exten;
  209. SET NEW._callgroup=NEW._pickupgroup;
  210. SET NEW._srtpcapable=NEW._encryption;
  211. END ||
  212. DELIMITER ;
  213. --
  214. -- Table structure for table `t_pbx_users_webrtc`
  215. --
  216. DROP TABLE IF EXISTS `t_pbx_users_webrtc`;
  217. /*!40101 SET @saved_cs_client = @@character_set_client */;
  218. /*!40101 SET character_set_client = utf8 */;
  219. CREATE TABLE `t_pbx_users_webrtc` (
  220. `_id` int(16) NOT NULL AUTO_INCREMENT,
  221. `_exten` varchar(32) NOT NULL,
  222. `_cid_number` varchar(32) NOT NULL DEFAULT '',
  223. `_transfer` varchar(3) NOT NULL DEFAULT 'yes',
  224. `_mailbox` varchar(16) NOT NULL DEFAULT '',
  225. `_type` varchar(6) NOT NULL DEFAULT 'friend',
  226. `_qualify` varchar(4) NOT NULL DEFAULT 'yes',
  227. `_hasdirectory` varchar(3) NOT NULL DEFAULT 'yes',
  228. `_call-limit` varchar(2) NOT NULL DEFAULT '5',
  229. `_host` varchar(16) NOT NULL DEFAULT 'dynamic',
  230. `_context` varchar(32) NOT NULL DEFAULT 'default',
  231. `_fullname` varchar(64) NOT NULL DEFAULT '',
  232. `_secret` varchar(128) NOT NULL DEFAULT '',
  233. `_outboundcid` varchar(32) NOT NULL DEFAULT '',
  234. `_hasvoicemail` varchar(3) NOT NULL DEFAULT 'no',
  235. `_vmsecret` varchar(32) NOT NULL DEFAULT '',
  236. `_delete` varchar(3) NOT NULL DEFAULT 'no',
  237. `_email` varchar(64) NOT NULL DEFAULT '',
  238. `_hassip` varchar(3) NOT NULL DEFAULT 'yes',
  239. `_hasiax` varchar(3) NOT NULL DEFAULT 'no',
  240. `_dahdichan` varchar(3) NOT NULL DEFAULT '',
  241. `_hasmanager` varchar(3) NOT NULL DEFAULT 'no',
  242. `_hasexten` varchar(3) NOT NULL DEFAULT '',
  243. `_nat` varchar(32) NOT NULL DEFAULT 'force_rport,comedia',
  244. `_directmedia` varchar(3) NOT NULL DEFAULT '',
  245. `_dtmfmode` varchar(8) NOT NULL DEFAULT 'rfc2833',
  246. `_hasagent` varchar(3) NOT NULL DEFAULT 'no',
  247. `_callwaiting` varchar(3) NOT NULL DEFAULT 'yes',
  248. `_callgroup` varchar(32) NOT NULL DEFAULT '1',
  249. `_pickupgroup` varchar(32) NOT NULL DEFAULT '1',
  250. `_videosupport` varchar(3) NOT NULL DEFAULT 'no',
  251. `_transport` varchar(16) NOT NULL DEFAULT 'udp,ws',
  252. `_encryption` varchar(3) NOT NULL DEFAULT 'yes',
  253. `_srtpcapable` varchar(3) NOT NULL DEFAULT 'no',
  254. `_deny` varchar(64) NOT NULL DEFAULT '',
  255. `_permit` varchar(124) NOT NULL DEFAULT '',
  256. `_avpf` varchar(3) NOT NULL DEFAULT 'yes',
  257. `_force_avp` varchar(3) NOT NULL DEFAULT 'yes',
  258. `_icesupport` varchar(3) NOT NULL DEFAULT 'yes',
  259. `_dtlsverify` varchar(3) NOT NULL DEFAULT 'no',
  260. `_dtlsenable` varchar(3) NOT NULL DEFAULT 'yes',
  261. `_dtlscertfile` varchar(64) NOT NULL DEFAULT '/etc/asterisk/keys/asterisk.pem',
  262. `_dtlscafile` varchar(64) NOT NULL DEFAULT '/etc/asterisk/keys/ca.crt',
  263. `_dtlssetup` varchar(32) NOT NULL DEFAULT 'actpass',
  264. `_alaw` int(1) NOT NULL DEFAULT '1',
  265. `_ulaw` int(1) NOT NULL DEFAULT '1',
  266. `_g722` int(1) NOT NULL DEFAULT '0',
  267. `_g729` int(1) NOT NULL DEFAULT '0',
  268. `_g726` int(1) NOT NULL DEFAULT '0',
  269. `_gsm` int(1) NOT NULL DEFAULT '0',
  270. `_speex` int(1) NOT NULL DEFAULT '0',
  271. `_h261` int(1) NOT NULL DEFAULT '0',
  272. `_h263` int(1) NOT NULL DEFAULT '0',
  273. `_h263p` int(1) NOT NULL DEFAULT '0',
  274. `_h264` int(1) NOT NULL DEFAULT '0',
  275. `_position` varchar(256) NOT NULL DEFAULT '',
  276. `_extenbinding` varchar(3) NOT NULL DEFAULT 'no',
  277. `_recordin` varchar(32) NOT NULL DEFAULT '',
  278. `_recordout` varchar(32) NOT NULL DEFAULT '',
  279. `_F1` varchar(128) NOT NULL DEFAULT '',
  280. `_F2` varchar(128) NOT NULL DEFAULT '',
  281. `_F3` varchar(128) NOT NULL DEFAULT '',
  282. `_F4` varchar(128) NOT NULL DEFAULT '',
  283. PRIMARY KEY (`_id`),
  284. UNIQUE KEY `_exten` (`_exten`)
  285. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  286. /*!40101 SET character_set_client = @saved_cs_client */;
  287. --
  288. -- Dumping data for table `t_pbx_users_webrtc`
  289. --
  290. LOCK TABLES `t_pbx_users_webrtc` WRITE;
  291. /*!40000 ALTER TABLE `t_pbx_users_webrtc` DISABLE KEYS */;
  292. /*!40000 ALTER TABLE `t_pbx_users_webrtc` ENABLE KEYS */;
  293. UNLOCK TABLES;
  294. --
  295. -- Table structure for table `t_pbx_users_voiptrunk`
  296. --
  297. DROP TABLE IF EXISTS `t_pbx_users_voiptrunk`;
  298. /*!40101 SET @saved_cs_client = @@character_set_client */;
  299. /*!40101 SET character_set_client = utf8 */;
  300. CREATE TABLE `t_pbx_users_voiptrunk` (
  301. `_id` int(16) NOT NULL AUTO_INCREMENT,
  302. `_trunkactive` varchar(3) NOT NULL DEFAULT 'yes',
  303. `_trunk` varchar(64) NOT NULL DEFAULT '',
  304. `_trunkname` varchar(64) NOT NULL,
  305. `_trunkstyle` varchar(64) NOT NULL DEFAULT '',
  306. `_host` varchar(64) NOT NULL DEFAULT 'yes',
  307. `_port` varchar(8) NOT NULL DEFAULT '',
  308. `_voipusername` varchar(64) NOT NULL DEFAULT '',
  309. `_authuser` varchar(64) NOT NULL DEFAULT '',
  310. `_fromuser` varchar(64) NOT NULL DEFAULT '',
  311. `_fromdomain` varchar(64) NOT NULL DEFAULT '',
  312. `_contact` varchar(64) NOT NULL DEFAULT '',
  313. `_voipsecret` varchar(128) NOT NULL DEFAULT '',
  314. `_outboundcid` varchar(32) NOT NULL DEFAULT '',
  315. `_trunkcid_preferred` varchar(3) NOT NULL DEFAULT 'no',
  316. `_prefix` varchar(16) NOT NULL DEFAULT '',
  317. `_insecure` varchar(16) NOT NULL DEFAULT 'port,invite',
  318. `_calllimit` varchar(3) NOT NULL DEFAULT '0',
  319. `_language` varchar(8) NOT NULL DEFAULT '',
  320. `_qualify` varchar(8) NOT NULL DEFAULT '2000',
  321. `_qualifyfreq` varchar(8) NOT NULL DEFAULT '60',
  322. `_transport` varchar(16) NOT NULL DEFAULT 'udp',
  323. `_faxdetect` varchar(3) NOT NULL DEFAULT 'no',
  324. `_hassip` varchar(3) NOT NULL DEFAULT 'yes',
  325. `_registersip` varchar(3) NOT NULL DEFAULT 'no',
  326. `_hasiax` varchar(3) NOT NULL DEFAULT 'no',
  327. `_registeriax` varchar(3) NOT NULL DEFAULT 'no',
  328. `_context` varchar(32) NOT NULL DEFAULT 'default',
  329. `_hasexten` varchar(3) NOT NULL DEFAULT 'yes',
  330. `_nat` varchar(32) NOT NULL DEFAULT 'force_rport,comedia',
  331. `_directmedia` varchar(16) NOT NULL DEFAULT 'no',
  332. `_dtmfmode` varchar(8) NOT NULL DEFAULT 'rfc2833',
  333. `_videosupport` varchar(3) NOT NULL DEFAULT 'yes',
  334. `_encryption` varchar(3) NOT NULL DEFAULT 'no',
  335. `_srtpcapable` varchar(3) NOT NULL DEFAULT 'no',
  336. `_prack` varchar(3) NOT NULL DEFAULT 'no',
  337. `_alaw` int(1) NOT NULL DEFAULT '1',
  338. `_ulaw` int(1) NOT NULL DEFAULT '1',
  339. `_g722` int(1) NOT NULL DEFAULT '0',
  340. `_g729` int(1) NOT NULL DEFAULT '0',
  341. `_g726` int(1) NOT NULL DEFAULT '0',
  342. `_gsm` int(1) NOT NULL DEFAULT '0',
  343. `_speex` int(1) NOT NULL DEFAULT '0',
  344. `_h261` int(1) NOT NULL DEFAULT '0',
  345. `_h263` int(1) NOT NULL DEFAULT '0',
  346. `_h263p` int(1) NOT NULL DEFAULT '0',
  347. `_h264` int(1) NOT NULL DEFAULT '0',
  348. `_vp8` int(1) DEFAULT '0',
  349. `_opus` int(1) DEFAULT '0',
  350. `_position` varchar(256) NOT NULL DEFAULT '',
  351. `_recordin` varchar(32) NOT NULL DEFAULT '',
  352. `_recordout` varchar(32) NOT NULL DEFAULT '',
  353. `_F1` varchar(128) NOT NULL DEFAULT '',
  354. `_F2` varchar(128) NOT NULL DEFAULT '',
  355. `_F3` varchar(128) NOT NULL DEFAULT '',
  356. `_F4` varchar(128) NOT NULL DEFAULT '',
  357. PRIMARY KEY (`_id`),
  358. UNIQUE KEY `_trunk` (`_trunk`),
  359. UNIQUE KEY `_trunkname` (`_trunkname`)
  360. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  361. /*!40101 SET character_set_client = @saved_cs_client */;
  362. --
  363. -- Dumping data for table `t_pbx_users_voiptrunk`
  364. --
  365. LOCK TABLES `t_pbx_users_voiptrunk` WRITE;
  366. /*!40000 ALTER TABLE `t_pbx_users_voiptrunk` DISABLE KEYS */;
  367. /*!40000 ALTER TABLE `t_pbx_users_voiptrunk` ENABLE KEYS */;
  368. UNLOCK TABLES;
  369. DROP TRIGGER IF EXISTS `VOIPTRUNK_INSERT_BEFORE`;
  370. DELIMITER ||
  371. CREATE TRIGGER `VOIPTRUNK_INSERT_BEFORE` BEFORE INSERT ON `t_pbx_users_voiptrunk`
  372. FOR EACH ROW
  373. BEGIN
  374. IF (NEW._hassip='yes') THEN
  375. SET NEW._registersip='no';
  376. SET NEW._srtpcapable=NEW._encryption;
  377. IF (NEW._voipusername='') THEN
  378. SET NEW._trunkstyle="SP-SIP";
  379. ELSE
  380. SET NEW._trunkstyle="SIP";
  381. END IF;
  382. IF (NEW._host='dynamic') THEN
  383. SET NEW._trunkstyle="Peer";
  384. SET NEW._trunk=NEW._voipusername;
  385. ELSE
  386. SET NEW._trunk=CONCAT("trunk-sip-",NEW._trunkname);
  387. END IF;
  388. ELSEIF (NEW._hasiax='yes') THEN
  389. IF (NEW._voipusername='') THEN
  390. SET NEW._trunkstyle="SP-IAX";
  391. ELSE
  392. SET NEW._trunkstyle="IAX";
  393. SET NEW._registeriax='yes';
  394. END IF;
  395. IF (NEW._host='dynamic') THEN
  396. SET NEW._trunk=NEW._voipusername;
  397. ELSE
  398. SET NEW._trunk=CONCAT("trunk-iax-",NEW._trunkname);
  399. END IF;
  400. END IF;
  401. END ||
  402. DELIMITER ;
  403. --
  404. -- Table structure for table `t_pbx_call_queues`
  405. --
  406. DROP TABLE IF EXISTS `t_pbx_call_queues`;
  407. /*!40101 SET @saved_cs_client = @@character_set_client */;
  408. /*!40101 SET character_set_client = utf8 */;
  409. CREATE TABLE `t_pbx_call_queues` (
  410. `id` int(16) NOT NULL AUTO_INCREMENT,
  411. `queuenum` varchar(32) NOT NULL,
  412. `waittime` varchar(8) NOT NULL DEFAULT '',
  413. `label` varchar(64) NOT NULL DEFAULT '',
  414. `queuename` varchar(64) NOT NULL DEFAULT '',
  415. `dest` varchar(64) NOT NULL DEFAULT 'yes',
  416. `setinterfacevar` varchar(3) NOT NULL DEFAULT 'yes',
  417. `setqueueentryvar` varchar(3) NOT NULL DEFAULT 'yes',
  418. `retry` int(2) NOT NULL DEFAULT '1',
  419. `ringinuse` varchar(3) NOT NULL DEFAULT 'no',
  420. `musicclass` varchar(32) NOT NULL DEFAULT 'queuemusic',
  421. `context` varchar(32) NOT NULL DEFAULT 'queue-custom',
  422. `strategy` varchar(16) NOT NULL DEFAULT 'rrordered',
  423. `timeout` varchar(8) NOT NULL DEFAULT '15',
  424. `wrapuptime` varchar(8) NOT NULL DEFAULT '0',
  425. `autofill` varchar(3) NOT NULL DEFAULT 'yes',
  426. `autopause` varchar(3) NOT NULL DEFAULT 'no',
  427. `joinempty` varchar(32) NOT NULL DEFAULT 'no',
  428. `leavewhenempty` varchar(32) NOT NULL DEFAULT 'no',
  429. `reportholdtime` varchar(3) NOT NULL DEFAULT 'no',
  430. `rreminder` varchar(3) NOT NULL DEFAULT 'no',
  431. `maxlen` varchar(4) NOT NULL DEFAULT '16',
  432. `announce_frequency` varchar(4) NOT NULL DEFAULT '30',
  433. `announce_holdtime` varchar(3) NOT NULL DEFAULT 'no',
  434. `announce_position` varchar(8) NOT NULL DEFAULT 'yes',
  435. `periodic_announce_frequency` varchar(4) NOT NULL DEFAULT '30',
  436. `periodic_announce` varchar(64) NOT NULL DEFAULT '/var/lib/asterisk/prompts/all-busy',
  437. `queue_youarenext` varchar(8) NOT NULL DEFAULT '',
  438. `queue_thankyou` varchar(16) NOT NULL DEFAULT '',
  439. `static_members` varchar(2048) DEFAULT NULL,
  440. `dynamic_members` varchar(2048) DEFAULT NULL,
  441. `work_order` varchar(3) NOT NULL DEFAULT '',
  442. PRIMARY KEY (`id`),
  443. UNIQUE KEY `queuenum` (`queuenum`),
  444. UNIQUE KEY `queuename` (`queuename`)
  445. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  446. /*!40101 SET character_set_client = @saved_cs_client */;
  447. --
  448. -- Dumping data for table `t_pbx_call_queues`
  449. --
  450. LOCK TABLES `t_pbx_call_queues` WRITE;
  451. /*!40000 ALTER TABLE `t_pbx_call_queues` DISABLE KEYS */;
  452. /*!40000 ALTER TABLE `t_pbx_call_queues` ENABLE KEYS */;
  453. UNLOCK TABLES;
  454. --
  455. -- Table structure for table `t_pbx_dialrule`
  456. --
  457. DROP TABLE IF EXISTS `t_pbx_dialrule`;
  458. /*!40101 SET @saved_cs_client = @@character_set_client */;
  459. /*!40101 SET character_set_client = utf8 */;
  460. CREATE TABLE `t_pbx_dialrule` (
  461. `id` int(11) NOT NULL AUTO_INCREMENT,
  462. `name` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  463. `trunks` varchar(64) DEFAULT NULL,
  464. `rule` varchar(64) DEFAULT NULL,
  465. `del_prefix` int(2) DEFAULT NULL,
  466. `add_before` varchar(32) DEFAULT NULL,
  467. `add_after` varchar(32) DEFAULT NULL,
  468. PRIMARY KEY (`id`),
  469. UNIQUE KEY `name` (`name`)
  470. ) ENGINE=InnoDB;
  471. /*!40101 SET character_set_client = @saved_cs_client */;
  472. --
  473. -- Dumping data for table `t_pbx_dialrule`
  474. --
  475. LOCK TABLES `t_pbx_dialrule` WRITE;
  476. /*!40000 ALTER TABLE `t_pbx_dialrule` DISABLE KEYS */;
  477. INSERT INTO `t_pbx_dialrule` VALUES ('0','紧急电话规则','trunk_1','_1XX',NULL,NULL,NULL);
  478. INSERT INTO `t_pbx_dialrule` VALUES ('1','本地电话规则','trunk_1','_ZXX.',NULL,NULL,NULL);
  479. INSERT INTO `t_pbx_dialrule` VALUES ('2','国内长途规则','trunk_1','_0ZXX.',NULL,NULL,NULL);
  480. INSERT INTO `t_pbx_dialrule` VALUES ('3','国际长途规则','trunk_1','_00ZXX.',NULL,NULL,NULL);
  481. /*!40000 ALTER TABLE `t_pbx_dialrule` ENABLE KEYS */;
  482. UNLOCK TABLES;
  483. --
  484. -- Table structure for table `t_pbx_dialrule`
  485. --
  486. DROP TABLE IF EXISTS `t_pbx_ivr`;
  487. /*!40101 SET @saved_cs_client = @@character_set_client */;
  488. /*!40101 SET character_set_client = utf8 */;
  489. CREATE TABLE `t_pbx_ivr` (
  490. `id` int(11) NOT NULL AUTO_INCREMENT,
  491. `name` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  492. `extension` varchar(32) DEFAULT NULL,
  493. `prompt` varchar(255) DEFAULT NULL,
  494. `loops` int(2) DEFAULT NULL,
  495. `timeout` int(8) DEFAULT NULL,
  496. `language` varchar(8) DEFAULT NULL,
  497. `dialplan` varchar(64) DEFAULT NULL,
  498. `keys_action` json DEFAULT NULL,
  499. PRIMARY KEY (`id`),
  500. UNIQUE KEY `name` (`name`),
  501. UNIQUE KEY `extension` (`extension`)
  502. ) ENGINE=InnoDB;
  503. /*!40101 SET character_set_client = @saved_cs_client */;
  504. --
  505. -- Dumping data for table `t_pbx_ivr`
  506. --
  507. LOCK TABLES `t_pbx_ivr` WRITE;
  508. /*!40000 ALTER TABLE `t_pbx_ivr` DISABLE KEYS */;
  509. INSERT INTO `t_pbx_ivr` VALUES ('0','上班时间话务员','6500','/etc/asterisk/sysconf/prompts/welcome',1,3,NULL,'default','{"i":"hangup","t":"hangup"}');
  510. INSERT INTO `t_pbx_ivr` VALUES ('1','下班时间话务员','6501','/etc/asterisk/sysconf/prompts/closed',1,3,NULL,'default','{"i":"hangup","t":"hangup"}');
  511. /*!40000 ALTER TABLE `t_pbx_ivr` ENABLE KEYS */;
  512. UNLOCK TABLES;
  513. --
  514. -- Table structure for table `t_cdr`
  515. --
  516. DROP TABLE IF EXISTS `t_pbx_cdr`;
  517. /*!40101 SET @saved_cs_client = @@character_set_client */;
  518. /*!40101 SET character_set_client = utf8 */;
  519. CREATE TABLE `t_pbx_cdr` (
  520. `id` int(11) NOT NULL AUTO_INCREMENT,
  521. `clid` varchar(80) DEFAULT NULL,
  522. `src` varchar(80) DEFAULT NULL,
  523. `dst` varchar(80) DEFAULT NULL,
  524. `dcontext` varchar(80) DEFAULT NULL,
  525. `channel` varchar(80) DEFAULT NULL,
  526. `dstchannel` varchar(80) DEFAULT NULL,
  527. `lastapp` varchar(80) DEFAULT NULL,
  528. `lastdata` varchar(80) DEFAULT NULL,
  529. `start` varchar(80) DEFAULT NULL,
  530. `end` varchar(80) DEFAULT NULL,
  531. `answer` varchar(80) DEFAULT NULL,
  532. `duration` int(11) DEFAULT NULL,
  533. `billsec` int(11) DEFAULT NULL,
  534. `ringduration` int(11) DEFAULT NULL,
  535. `disposition` varchar(32) DEFAULT NULL,
  536. `ama_flags` int(11) DEFAULT NULL,
  537. `accountcode` varchar(150) DEFAULT NULL,
  538. `calltype` varchar(32) DEFAULT 'internal',
  539. `uniqueid` varchar(80) DEFAULT NULL,
  540. `trunk` varchar(64) DEFAULT NULL,
  541. `recordfile` varchar(256) DEFAULT NULL,
  542. `createdAt` datetime DEFAULT NULL,
  543. `updatedAt` datetime DEFAULT NULL,
  544. PRIMARY KEY (`id`),
  545. UNIQUE KEY `id` (`id`)
  546. ) ENGINE=InnoDB;
  547. /*!40101 SET character_set_client = @saved_cs_client */;
  548. --
  549. -- Dumping data for table `t_cdr`
  550. --
  551. LOCK TABLES `t_cdr` WRITE;
  552. /*!40000 ALTER TABLE `t_cdr` DISABLE KEYS */;
  553. /*!40000 ALTER TABLE `t_cdr` ENABLE KEYS */;
  554. UNLOCK TABLES;
  555. DROP TRIGGER IF EXISTS `CDR_INSERT_BEFORE`;
  556. DELIMITER ||
  557. CREATE TRIGGER `CDR_INSERT_BEFORE` BEFORE INSERT ON `t_cdr`
  558. FOR EACH ROW
  559. BEGIN
  560. IF (NEW.calltype!='incoming') THEN
  561. IF (NEW.disposition='ANSWERED') THEN
  562. SET NEW.ringduration=NEW.duration - NEW.billsec;
  563. ELSE
  564. SET NEW.ringduration=NEW.duration;
  565. SET NEW.billsec=0;
  566. END IF;
  567. ELSE
  568. IF (NEW.disposition!='ANSWERED') THEN
  569. SET NEW.ringduration=NEW.duration;
  570. SET NEW.billsec=0;
  571. END IF;
  572. END IF;
  573. IF (NEW.dst='t' OR NEW.dst='s' OR NEW.dst is NULL OR NEW.dst LIKE 'vm-%') THEN
  574. DELETE FROM cdr WHERE id=NEW.id;
  575. END IF;
  576. END ||
  577. DELIMITER ;
  578. --
  579. -- Table structure for table `t_paging_tasks`
  580. --
  581. DROP TABLE IF EXISTS `t_paging_tasks`;
  582. /*!40101 SET @saved_cs_client = @@character_set_client */;
  583. /*!40101 SET character_set_client = utf8 */;
  584. CREATE TABLE `t_paging_tasks` (
  585. `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  586. `enable` tinyint(1) NOT NULL DEFAULT 1,
  587. `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  588. `mode` varchar(16) NOT NULL,
  589. `start_date` date DEFAULT NULL,
  590. `end_date` date DEFAULT NULL,
  591. `week_days` varchar(32) DEFAULT NULL,
  592. `start_time` time DEFAULT NULL,
  593. `end_time` time DEFAULT NULL,
  594. `type` varchar(32) DEFAULT NULL,
  595. `sound_type` varchar(32) DEFAULT NULL,
  596. `play_mode` varchar(32) DEFAULT NULL,
  597. `content` varchar(128) DEFAULT NULL,
  598. `group_ids` JSON NOT NULL,
  599. `createdAt` datetime DEFAULT NULL,
  600. `updatedAt` datetime DEFAULT NULL,
  601. PRIMARY KEY (`id`),
  602. UNIQUE KEY `name` (`name`)
  603. ) ENGINE=InnoDB;
  604. /*!40101 SET character_set_client = @saved_cs_client */;
  605. --
  606. -- Table structure for table `t_paging_devices`
  607. --
  608. DROP TABLE IF EXISTS `t_paging_devices`;
  609. /*!40101 SET @saved_cs_client = @@character_set_client */;
  610. /*!40101 SET character_set_client = utf8 */;
  611. CREATE TABLE `t_paging_devices` (
  612. `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  613. `model` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL,
  614. `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  615. `extension` int(32) NOT NULL,
  616. `contact` varchar(64) DEFAULT NULL,
  617. `phonenumber` int(32) DEFAULT NULL,
  618. `address` varchar(255) DEFAULT NULL,
  619. `type_id` int(11) DEFAULT NULL,
  620. `remark` varchar(255) DEFAULT NULL,
  621. `features` json DEFAULT NULL,
  622. `createdAt` datetime DEFAULT NULL,
  623. `updatedAt` datetime DEFAULT NULL,
  624. PRIMARY KEY (`id`),
  625. UNIQUE KEY `extension` (`extension`)
  626. ) ENGINE=InnoDB;
  627. /*!40101 SET character_set_client = @saved_cs_client */;
  628. --
  629. -- Table structure for table `t_paging_groups`
  630. --
  631. DROP TABLE IF EXISTS `t_paging_groups`;
  632. /*!40101 SET @saved_cs_client = @@character_set_client */;
  633. /*!40101 SET character_set_client = utf8 */;
  634. CREATE TABLE `t_paging_groups` (
  635. `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  636. `name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  637. `extension` int(32) NOT NULL,
  638. `device_ids` JSON DEFAULT NULL,
  639. `remark` varchar(255) DEFAULT NULL,
  640. `createdAt` datetime DEFAULT NULL,
  641. `updatedAt` datetime DEFAULT NULL,
  642. PRIMARY KEY (`id`),
  643. UNIQUE KEY `name` (`name`),
  644. UNIQUE KEY `extension` (`extension`)
  645. ) ENGINE=InnoDB;
  646. /*!40101 SET character_set_client = @saved_cs_client */;
  647. --
  648. -- Dumping data for table `t_paging_groups`
  649. --
  650. LOCK TABLES `t_paging_groups` WRITE;
  651. /*!40000 ALTER TABLE `t_paging_groups` DISABLE KEYS */;
  652. INSERT INTO `t_paging_groups` VALUES ('0','all',6000,'{"device":[]}',NULL,'2019-07-10 09:23:37','2019-07-10 09:23:37');
  653. /*!40000 ALTER TABLE `t_paging_groups` ENABLE KEYS */;
  654. UNLOCK TABLES;
  655. --
  656. -- Table structure for table `t_paging_types`
  657. --
  658. DROP TABLE IF EXISTS `t_paging_types`;
  659. /*!40101 SET @saved_cs_client = @@character_set_client */;
  660. /*!40101 SET character_set_client = utf8 */;
  661. CREATE TABLE `t_paging_types` (
  662. `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  663. `name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  664. `remark` varchar(255) DEFAULT NULL,
  665. `createdAt` datetime DEFAULT NULL,
  666. `updatedAt` datetime DEFAULT NULL,
  667. PRIMARY KEY (`id`),
  668. UNIQUE KEY `name` (`name`)
  669. ) ENGINE=InnoDB;
  670. /*!40101 SET character_set_client = @saved_cs_client */;
  671. --
  672. -- Dumping data for table `t_paging_types`
  673. --
  674. LOCK TABLES `t_paging_types` WRITE;
  675. /*!40000 ALTER TABLE `t_paging_types` DISABLE KEYS */;
  676. INSERT INTO `t_paging_types` VALUES (0,'广播终端',NULL,'2019-07-10 09:23:37','2019-07-10 09:23:37');
  677. INSERT INTO `t_paging_types` VALUES (1,'对讲终端',NULL,'2019-07-10 09:23:37','2019-07-10 09:23:37');
  678. INSERT INTO `t_paging_types` VALUES (2,'视频终端',NULL,'2019-07-10 09:23:37','2019-07-10 09:23:37');
  679. INSERT INTO `t_paging_types` VALUES (3,'IP电话',NULL,'2019-07-10 09:23:37','2019-07-10 09:23:37');
  680. /*!40000 ALTER TABLE `t_paging_types` ENABLE KEYS */;
  681. UNLOCK TABLES;
  682. --
  683. -- Table structure for table `t_paging_users`
  684. --
  685. DROP TABLE IF EXISTS `t_paging_users`;
  686. /*!40101 SET @saved_cs_client = @@character_set_client */;
  687. /*!40101 SET character_set_client = utf8 */;
  688. CREATE TABLE `t_paging_users` (
  689. `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  690. `username` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  691. `useraccount` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL,
  692. `secret` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  693. `phonenumber` int(32) DEFAULT NULL,
  694. `leftphone` int(32) DEFAULT NULL,
  695. `rightphone` int(32) DEFAULT NULL,
  696. `level` int(2) DEFAULT NULL,
  697. `service_ids` JSON NOT NULL,
  698. `group_ids` JSON NOT NULL,
  699. `currentSessionId` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  700. `lastActiveTime` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  701. `lastip` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  702. `createdAt` datetime DEFAULT NULL,
  703. `updatedAt` datetime DEFAULT NULL,
  704. PRIMARY KEY (`id`),
  705. UNIQUE KEY `useraccount` (`useraccount`)
  706. ) ENGINE=InnoDB;
  707. /*!40101 SET character_set_client = @saved_cs_client */;
  708. --
  709. -- Dumping data for table `t_paging_users`
  710. --
  711. LOCK TABLES `t_paging_users` WRITE;
  712. /*!40000 ALTER TABLE `t_paging_users` DISABLE KEYS */;
  713. INSERT INTO `t_paging_users` VALUES (0,'admin','admin','admin',NULL,NULL,NULL,1,'{"service":[0,1,2,3,4,5,6,7]}','{"group":[0]}',NULL,NULL,NULL,'2019-07-10 09:23:37','2019-07-10 09:23:37');
  714. /*!40000 ALTER TABLE `t_paging_users` ENABLE KEYS */;
  715. UNLOCK TABLES;
  716. --
  717. -- Table structure for table `t_paging_service`
  718. --
  719. DROP TABLE IF EXISTS `t_paging_service`;
  720. /*!40101 SET @saved_cs_client = @@character_set_client */;
  721. /*!40101 SET character_set_client = utf8 */;
  722. CREATE TABLE `t_paging_service` (
  723. `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  724. `name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  725. `level` int(2) DEFAULT NULL,
  726. `createdAt` datetime DEFAULT NULL,
  727. `updatedAt` datetime DEFAULT NULL,
  728. PRIMARY KEY (`id`),
  729. UNIQUE KEY `name` (`name`),
  730. UNIQUE KEY `level` (`level`)
  731. ) ENGINE=InnoDB;
  732. /*!40101 SET character_set_client = @saved_cs_client */;
  733. --
  734. -- Dumping data for table `t_paging_service`
  735. --
  736. LOCK TABLES `t_paging_service` WRITE;
  737. /*!40000 ALTER TABLE `t_paging_service` DISABLE KEYS */;
  738. INSERT INTO `t_paging_service` VALUES (0,'寻呼喊话',1,'2019-07-10 09:23:37','2019-07-10 09:23:37');
  739. INSERT INTO `t_paging_service` VALUES (1,'一键告警',2,'2019-07-10 09:23:37','2019-07-10 09:23:37');
  740. INSERT INTO `t_paging_service` VALUES (2,'消防告警',3,'2019-07-10 09:23:37','2019-07-10 09:23:37');
  741. INSERT INTO `t_paging_service` VALUES (3,'设备对讲',4,'2019-07-10 09:23:37','2019-07-10 09:23:37');
  742. INSERT INTO `t_paging_service` VALUES (4,'钟声提醒',5,'2019-07-10 09:23:37','2019-07-10 09:23:37');
  743. INSERT INTO `t_paging_service` VALUES (5,'定时插播',6,'2019-07-10 09:23:37','2019-07-10 09:23:37');
  744. INSERT INTO `t_paging_service` VALUES (6,'定时广播',7,'2019-07-10 09:23:37','2019-07-10 09:23:37');
  745. INSERT INTO `t_paging_service` VALUES (7,'背景音乐',8,'2019-07-10 09:23:37','2019-07-10 09:23:37');
  746. /*!40000 ALTER TABLE `t_paging_service` ENABLE KEYS */;
  747. UNLOCK TABLES;
  748. --
  749. -- Table structure for table `t_paging_action_log`
  750. --
  751. DROP TABLE IF EXISTS `t_paging_action_log`;
  752. /*!40101 SET @saved_cs_client = @@character_set_client */;
  753. /*!40101 SET character_set_client = utf8 */;
  754. CREATE TABLE `t_paging_action_log` (
  755. `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  756. `action_time` varchar(80) DEFAULT NULL,
  757. `operator` varchar(64) DEFAULT NULL,
  758. `action_info` json DEFAULT NULL,
  759. `service_id` int(2) DEFAULT NULL,
  760. `status` varchar(32) DEFAULT NULL,
  761. PRIMARY KEY (`id`)
  762. ) ENGINE=InnoDB;
  763. /*!40101 SET character_set_client = @saved_cs_client */;
  764. --
  765. -- Dumping data for table `t_paging_action_log`
  766. --
  767. LOCK TABLES `t_paging_action_log` WRITE;
  768. /*!40000 ALTER TABLE `t_paging_action_log` DISABLE KEYS */;
  769. /*!40000 ALTER TABLE `t_paging_action_log` ENABLE KEYS */;
  770. UNLOCK TABLES;
  771. --
  772. -- Table structure for table `t_paging_alarm_log`
  773. --
  774. DROP TABLE IF EXISTS `t_paging_alarm_log`;
  775. /*!40101 SET @saved_cs_client = @@character_set_client */;
  776. /*!40101 SET character_set_client = utf8 */;
  777. CREATE TABLE `t_paging_alarm_log` (
  778. `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  779. `alarm_time` varchar(80) DEFAULT NULL,
  780. `device_id` varchar(64) DEFAULT NULL,
  781. `alarm_info` varchar(255) DEFAULT NULL,
  782. PRIMARY KEY (`id`)
  783. ) ENGINE=InnoDB;
  784. /*!40101 SET character_set_client = @saved_cs_client */;
  785. --
  786. -- Dumping data for table `t_paging_alarm_log`
  787. --
  788. LOCK TABLES `t_paging_alarm_log` WRITE;
  789. /*!40000 ALTER TABLE `t_paging_alarm_log` DISABLE KEYS */;
  790. /*!40000 ALTER TABLE `t_paging_alarm_log` ENABLE KEYS */;
  791. UNLOCK TABLES;
  792. --
  793. -- Table structure for table `t_holidays_range`
  794. --
  795. DROP TABLE IF EXISTS `t_holidays_range`;
  796. /*!40101 SET @saved_cs_client = @@character_set_client */;
  797. /*!40101 SET character_set_client = utf8 */;
  798. CREATE TABLE `t_holidays_range` (
  799. `_holidayname` varchar(512) NOT NULL DEFAULT '',
  800. `_start` datetime NOT NULL,
  801. `_end` datetime NOT NULL
  802. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  803. /*!40101 SET character_set_client = @saved_cs_client */;
  804. --
  805. -- Dumping data for table `t_holidays_range`
  806. --
  807. LOCK TABLES `t_holidays_range` WRITE;
  808. /*!40000 ALTER TABLE `t_holidays_range` DISABLE KEYS */;
  809. /*!40000 ALTER TABLE `t_holidays_range` ENABLE KEYS */;
  810. UNLOCK TABLES;
  811. --
  812. -- Table structure for table `t_week_range`
  813. --
  814. DROP TABLE IF EXISTS `t_week_range`;
  815. /*!40101 SET @saved_cs_client = @@character_set_client */;
  816. /*!40101 SET character_set_client = utf8 */;
  817. CREATE TABLE `t_week_range` (
  818. `_rulename` varchar(512) NOT NULL DEFAULT '',
  819. `_week` int(1) NOT NULL,
  820. `_start` time NOT NULL DEFAULT '00:00:00',
  821. `_end` time NOT NULL DEFAULT '23:59:00'
  822. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  823. /*!40101 SET character_set_client = @saved_cs_client */;
  824. --
  825. -- Dumping data for table `t_week_range`
  826. --
  827. LOCK TABLES `t_week_range` WRITE;
  828. /*!40000 ALTER TABLE `t_week_range` DISABLE KEYS */;
  829. INSERT INTO `t_week_range` VALUES ('office%20time',2,'09:00:00','12:00:00'),('office%20time',2,'14:00:00','18:00:00'),('office%20time',3,'09:00:00','12:00:00'),('office%20time',3,'14:00:00','18:00:00'),('office%20time',4,'09:00:00','12:00:00'),('office%20time',4,'14:00:00','18:00:00'),('office%20time',5,'09:00:00','12:00:00'),('office%20time',5,'14:00:00','18:00:00'),('office%20time',6,'09:00:00','12:00:00'),('office%20time',6,'14:00:00','18:00:00'),('office%20time',7,'09:00:00','12:00:00');
  830. /*!40000 ALTER TABLE `t_week_range` ENABLE KEYS */;
  831. UNLOCK TABLES;
  832. DROP TABLE IF EXISTS `t_sip_settings`;
  833. CREATE TABLE `t_sip_settings` (
  834. `id` INT(11) NOT NULL AUTO_INCREMENT,
  835. `key_name` VARCHAR(40) DEFAULT NULL,
  836. `key_value` VARCHAR(40) DEFAULT NULL,
  837. PRIMARY KEY (`id`)
  838. ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
  839. --
  840. -- Dumping data for table `t_sip_settings`
  841. --
  842. LOCK TABLES `t_sip_settings` WRITE;
  843. /*!40000 ALTER TABLE `t_sip_settings` DISABLE KEYS */;
  844. INSERT INTO `t_sip_settings` VALUES (1,'UDP','5060'),(2,'TCP','5060'),(3,'TLS','5061'),(4,'UDP,TCP','5060');
  845. /*!40000 ALTER TABLE `t_sip_settings` ENABLE KEYS */;
  846. UNLOCK TABLES;
  847. DROP TABLE IF EXISTS `t_phone_manufacturer`;
  848. CREATE TABLE `t_phone_manufacturer` (
  849. `id` INT(11) NOT NULL AUTO_INCREMENT,
  850. `conf_name` VARCHAR(32) NOT NULL UNIQUE,
  851. `show_name` VARCHAR(32) NOT NULL,
  852. PRIMARY KEY (`id`)
  853. ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
  854. INSERT INTO t_phone_manufacturer(id,conf_name,show_name)
  855. VALUES(1,'Zycoo','Zycoo'),(2,'Cisco','Cisco'),
  856. (3,'MOCET','MOCET'),(4,'Snom','Snom');
  857. DROP TABLE IF EXISTS `t_phone_model`;
  858. CREATE TABLE `t_phone_model` (
  859. `id` INT(11) NOT NULL AUTO_INCREMENT,
  860. `manufacturer_id` INT(11) NOT NULL,
  861. `conf_name` VARCHAR(32) NOT NULL,
  862. `show_name` VARCHAR(32) NOT NULL,
  863. `mac_prefix` VARCHAR(20) NOT NULL,
  864. PRIMARY KEY (`id`)
  865. ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
  866. /*zycoo*/
  867. INSERT INTO t_phone_model(manufacturer_id,conf_name,show_name,mac_prefix)
  868. VALUES(1,'D30/D30P','D30/D30P','68692e'),(1,'D60','D60','68692e'),(1,'H81/H81P','H81/H81P','68692e'),
  869. (1,'H83','H83','68692e'),(1,'B20/C20','B20/C20','68692e');
  870. /*Cisco*/
  871. INSERT INTO t_phone_model(manufacturer_id,conf_name,show_name,mac_prefix)
  872. VALUES(2,'SPA303','SPA303','3cce73'),(2,'SPA502G','SPA502G','3cce73'),
  873. (2,'SPA504G','SPA504G','3cce73'),(2,'SPA508G','SPA508G','3cce73'),
  874. (2,'SPA525G','SPA525G','3cce73'),(2,'SPA525G2','SPA525G2','3cce73'),
  875. (2,'SPA121','SPA121','3cce73'),(2,'7911','7911','3cce73'),(2,'7941','7941','3cce73'),
  876. (2,'7942','7942','3cce73'),(2,'7945','7945','3cce73');
  877. /*MOCET*/
  878. INSERT INTO t_phone_model(manufacturer_id,conf_name,show_name,mac_prefix)
  879. VALUES(3,'IP3032E','IP3032E','001915');
  880. /*Snom*/
  881. INSERT INTO t_phone_model(manufacturer_id,conf_name,show_name,mac_prefix)
  882. VALUES(4,'D305','D305','000413');
  883. DROP TABLE IF EXISTS `t_phone_device`;
  884. CREATE TABLE `t_phone_device` (
  885. `id` INT(11) NOT NULL AUTO_INCREMENT,
  886. `mac` VARCHAR(20) NOT NULL UNIQUE,
  887. `ip` VARCHAR(20) NOT NULL,
  888. `manufacturer_id` INT(11) NOT NULL,
  889. `model_id` INT(11) DEFAULT 0,
  890. `status` ENUM('fresh','configed','activated') DEFAULT 'fresh',
  891. `call_waiting` TINYINT(1) DEFAULT 1,
  892. `greeting_word` VARCHAR(20) DEFAULT '',
  893. PRIMARY KEY (`id`)
  894. ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
  895. DROP TRIGGER IF EXISTS `INSERT_PHONE_DEVICE_AFTER`;
  896. DELIMITER ;;
  897. CREATE TRIGGER `INSERT_PHONE_DEVICE_AFTER`
  898. AFTER INSERT ON `t_phone_device`
  899. FOR EACH ROW
  900. BEGIN
  901. INSERT INTO t_phone_exten (device_id,exten) VALUES (NEW.id,'');
  902. END;;
  903. DELIMITER ;
  904. DROP TABLE IF EXISTS `t_phone_exten`;
  905. CREATE TABLE `t_phone_exten` (
  906. `id` INT(11) NOT NULL AUTO_INCREMENT,
  907. `device_id` INT(11) NOT NULL,
  908. `exten` VARCHAR(40) DEFAULT NULL,
  909. `exten_index` INT(11) DEFAULT 1,
  910. PRIMARY KEY (`id`)
  911. ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
  912. /*
  913. * zycoo h83
  914. */
  915. DROP TABLE IF EXISTS `t_phone_func_key`;
  916. CREATE TABLE `t_phone_func_key` (
  917. `id` INT(11) NOT NULL AUTO_INCREMENT,
  918. `device_id` INT(11) NOT NULL,
  919. `key_name` VARCHAR(40) DEFAULT NULL,
  920. `func_type` VARCHAR(40) DEFAULT NULL,
  921. `show_name` VARCHAR(40) DEFAULT NULL,
  922. `key_value` VARCHAR(40) DEFAULT NULL,
  923. `line` VARCHAR(40) DEFAULT NULL,
  924. `sub_type` VARCHAR(40) DEFAULT NULL,
  925. `pickup_number` VARCHAR(40) DEFAULT NULL,
  926. PRIMARY KEY (`id`)
  927. ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
  928. /*
  929. * SELECT func_record_discover_phone_device('005544444444','zycoo','h83','192.168.10.12');
  930. */
  931. DROP FUNCTION IF EXISTS `func_record_discover_phone_device`;
  932. DELIMITER ;;
  933. CREATE FUNCTION `func_record_discover_phone_device`(
  934. `in_mac` VARCHAR(20),
  935. `in_manufacturer` VARCHAR(32),
  936. `in_model` VARCHAR(32),
  937. `in_ip` VARCHAR(20)
  938. )
  939. RETURNS text
  940. BEGIN
  941. DECLARE var_count INT(11);
  942. DECLARE var_model_id INT(11) DEFAULT 0;
  943. DECLARE var_manufacturer_id INT(11);
  944. SELECT COUNT(*) INTO var_count
  945. FROM t_phone_device
  946. WHERE mac=in_mac;
  947. IF(var_count=0) THEN
  948. SELECT id INTO var_manufacturer_id
  949. FROM t_phone_manufacturer
  950. WHERE conf_name=in_manufacturer;
  951. IF(in_model!='') THEN
  952. SELECT id INTO var_model_id
  953. FROM t_phone_model
  954. WHERE conf_name=in_model AND manufacturer_id=var_manufacturer_id;
  955. END IF;
  956. IF(var_manufacturer_id!='') THEN
  957. INSERT INTO t_phone_device(mac,ip,manufacturer_id,model_id)
  958. VALUE(in_mac,in_ip,var_manufacturer_id,var_model_id);
  959. END IF;
  960. ELSE
  961. UPDATE t_phone_device
  962. SET ip=in_ip
  963. WHERE mac=in_mac;
  964. END IF;
  965. RETURN 'true';
  966. END
  967. ;;
  968. DELIMITER ;
  969. /*
  970. * SELECT func_record_add_phone_device('1','005544444444','zycoo','h83','801','configed','1','ZycooTech');
  971. */
  972. DROP FUNCTION IF EXISTS `func_record_add_phone_device`;
  973. DELIMITER ;;
  974. CREATE FUNCTION `func_record_add_phone_device`(
  975. `in_id` INT(11),
  976. `in_mac` VARCHAR(20),
  977. `in_manufacturer` VARCHAR(32),
  978. `in_model` VARCHAR(32),
  979. `in_exten` VARCHAR(40),
  980. `in_status` VARCHAR(24),
  981. `in_call_waiting` TINYINT(1),
  982. `in_greeting_word` VARCHAR(20)
  983. )
  984. RETURNS text
  985. BEGIN
  986. DECLARE var_count INT(11);
  987. DECLARE var_model_id INT(11) DEFAULT 0;
  988. DECLARE var_manufacturer_id INT(11);
  989. SELECT COUNT(*) INTO var_count
  990. FROM t_phone_device
  991. WHERE mac=in_mac;
  992. IF(var_count=0) THEN
  993. SELECT id INTO var_manufacturer_id
  994. FROM t_phone_manufacturer
  995. WHERE conf_name=in_manufacturer;
  996. IF(in_model!='') THEN
  997. SELECT id INTO var_model_id
  998. FROM t_phone_model
  999. WHERE conf_name=in_model AND manufacturer_id=var_manufacturer_id;
  1000. END IF;
  1001. IF(var_manufacturer_id!='') THEN
  1002. INSERT INTO t_phone_device(id,mac,manufacturer_id,model_id,status,call_waiting,greeting_word)
  1003. VALUE(in_id,in_mac,var_manufacturer_id,var_model_id,in_status,in_call_waiting,in_greeting_word);
  1004. UPDATE t_phone_exten SET exten=in_exten where device_id=in_id;
  1005. END IF;
  1006. ELSE
  1007. UPDATE t_phone_device
  1008. SET ip=in_ip
  1009. WHERE mac=in_mac;
  1010. END IF;
  1011. RETURN 'true';
  1012. END
  1013. ;;
  1014. DELIMITER ;
  1015. /*
  1016. * SELECT func_delete_phone_device(1);
  1017. */
  1018. DROP FUNCTION IF EXISTS `func_delete_phone`;
  1019. DELIMITER ;;
  1020. CREATE FUNCTION `func_delete_phone`(
  1021. `in_device_id` VARCHAR(20)
  1022. )
  1023. RETURNS text
  1024. BEGIN
  1025. DELETE FROM t_phone_func_key WHERE device_id=in_device_id;
  1026. DELETE FROM t_phone_exten WHERE device_id=in_device_id;
  1027. DELETE FROM t_phone_device WHERE id=in_device_id;
  1028. RETURN 'true';
  1029. END
  1030. ;;
  1031. DELIMITER ;
  1032. /*
  1033. +---------------+-------------+------+-----+---------+-------+
  1034. | Field | Type | Null | Key | Default | Extra |
  1035. +---------------+-------------+------+-----+---------+-------+
  1036. | id | int(11) | NO | | 0 | |
  1037. | mac | varchar(20) | NO | | NULL | |
  1038. | ip | varchar(20) | NO | | NULL | |
  1039. | manufacturer | varchar(32) | NO | | NULL | |
  1040. | model | varchar(32) | YES | | NULL | |
  1041. | call_waiting | tinyint(1) | YES | | 1 | |
  1042. | greeting_word | varchar(20) | YES | | | |
  1043. +---------------+-------------+------+-----+---------+-------+
  1044. */
  1045. DROP VIEW IF EXISTS `v_phone_device_activated`;
  1046. CREATE VIEW v_phone_device_activated
  1047. AS
  1048. SELECT t_phone_device.id AS id,
  1049. mac,
  1050. ip,
  1051. t_phone_manufacturer.conf_name AS manufacturer,
  1052. t_phone_model.conf_name AS model,
  1053. exten,
  1054. _fullname,
  1055. _transport,
  1056. t_sip_settings.key_value AS port,
  1057. _secret,
  1058. call_waiting,
  1059. greeting_word
  1060. FROM t_phone_device
  1061. JOIN t_phone_manufacturer ON status='activated'
  1062. AND t_phone_device.manufacturer_id=t_phone_manufacturer.id
  1063. LEFT JOIN t_phone_exten ON t_phone_device.id=t_phone_exten.device_id
  1064. LEFT JOIN t_users_extension ON t_phone_exten.exten=t_users_extension._exten
  1065. LEFT JOIN t_sip_settings ON t_users_extension._transport=t_sip_settings.key_name
  1066. LEFT JOIN t_phone_model ON t_phone_device.model_id=t_phone_model.id;
  1067. /*
  1068. *
  1069. +---------------+-------------+------+-----+---------+-------+
  1070. | Field | Type | Null | Key | Default | Extra |
  1071. +---------------+-------------+------+-----+---------+-------+
  1072. | id | int(11) | NO | | 0 | |
  1073. | dodexten | varchar(32) | NO | | NULL | |
  1074. | trunkname | varchar(64) | NO | | NULL | |
  1075. | trunk | varchar(128)| NO | | NULL | |
  1076. +---------------+-------------+------+-----+---------+-------+
  1077. */
  1078. DROP VIEW IF EXISTS `v_extension_trunk_dod`;
  1079. CREATE VIEW v_extension_trunk_dod
  1080. AS
  1081. SELECT t_number_dod._id AS id,
  1082. _dodnumber AS dodexten,
  1083. _dodtrunk AS trunkname,
  1084. _trunk AS trunk
  1085. FROM t_number_dod
  1086. JOIN t_users_voiptrunk ON t_users_voiptrunk._trunkname=t_number_dod._dodtrunk;
  1087. /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
  1088. /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
  1089. /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
  1090. /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
  1091. /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
  1092. /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
  1093. /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
  1094. /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
  1095. -- Dump completed on 2010-01-04 7:18:52