{"id":373,"date":"2012-09-04T18:25:18","date_gmt":"2012-09-04T21:25:18","guid":{"rendered":"http:\/\/blog.abratel.com.br\/?p=373"},"modified":"2012-09-04T18:33:15","modified_gmt":"2012-09-04T21:33:15","slug":"373","status":"publish","type":"post","link":"https:\/\/blog.abratel.com.br\/?p=373","title":{"rendered":"Asterisk realtime sip mysql"},"content":{"rendered":"<p>Criar a tabela:<br \/>\nPor padr\u00e3o organizo tudo dentro de um banco chamadao asterisk<br \/>\nCREATE TABLE IF NOT EXISTS `sip_accounts` (<br \/>\n  `id` int(11) NOT NULL AUTO_INCREMENT,<br \/>\n  `name` varchar(80) NOT NULL DEFAULT &#8221;,<br \/>\n  `host` varchar(31) NOT NULL DEFAULT &#8216;dynamic&#8217;,<br \/>\n  `nat` varchar(5) NOT NULL DEFAULT &#8216;route&#8217;,<br \/>\n  `type` enum(&#8216;user&#8217;,&#8217;peer&#8217;,&#8217;friend&#8217;) NOT NULL DEFAULT &#8216;friend&#8217;,<br \/>\n  `accountcode` varchar(20) DEFAULT NULL,<br \/>\n  `amaflags` varchar(13) DEFAULT NULL,<br \/>\n  `callgroup` varchar(10) DEFAULT NULL,<br \/>\n  `callerid` varchar(80) DEFAULT NULL,<br \/>\n  `call-limit` int(11) NOT NULL DEFAULT &#8216;0&#8217;,<br \/>\n  `cancallforward` char(3) DEFAULT &#8216;no&#8217;,<br \/>\n  `canreinvite` char(3) DEFAULT &#8216;no&#8217;,<br \/>\n  `context` varchar(80) DEFAULT &#8216;pre_outgoing&#8217;,<br \/>\n  `defaultip` varchar(15) DEFAULT NULL,<br \/>\n  `dtmfmode` varchar(7) DEFAULT NULL,<br \/>\n  `fromuser` varchar(80) DEFAULT NULL,<br \/>\n  `fromdomain` varchar(80) DEFAULT NULL,<br \/>\n  `insecure` varchar(4) DEFAULT NULL,<br \/>\n  `language` char(2) DEFAULT NULL,<br \/>\n  `mailbox` varchar(50) DEFAULT NULL,<br \/>\n  `md5secret` varchar(80) DEFAULT NULL,<br \/>\n  `deny` varchar(95) DEFAULT NULL,<br \/>\n  `permit` varchar(95) DEFAULT NULL,<br \/>\n  `mask` varchar(95) DEFAULT NULL,<br \/>\n  `musiconhold` varchar(100) DEFAULT NULL,<br \/>\n  `pickupgroup` varchar(10) DEFAULT NULL,<br \/>\n  `qualify` char(3) DEFAULT NULL,<br \/>\n  `regexten` varchar(80) DEFAULT NULL,<br \/>\n  `restrictcid` char(3) DEFAULT NULL,<br \/>\n  `rtptimeout` char(3) DEFAULT NULL,<br \/>\n  `rtpholdtimeout` char(3) DEFAULT NULL,<br \/>\n  `secret` varchar(80) DEFAULT NULL,<br \/>\n  `setvar` varchar(100) DEFAULT NULL,<br \/>\n  `disallow` varchar(100) DEFAULT &#8216;all&#8217;,<br \/>\n  `allow` varchar(100) DEFAULT &#8216;g729&#8217;,<br \/>\n  `fullcontact` varchar(80) NOT NULL DEFAULT &#8221;,<br \/>\n  `ipaddr` varchar(15) NOT NULL DEFAULT &#8221;,<br \/>\n  `port` smallint(5) unsigned NOT NULL DEFAULT &#8216;0&#8217;,<br \/>\n  `regserver` varchar(100) DEFAULT NULL,<br \/>\n  `regseconds` int(11) NOT NULL DEFAULT &#8216;0&#8217;,<br \/>\n  `username` varchar(80) NOT NULL DEFAULT &#8221;,<br \/>\n  `user` varchar(255) NOT NULL,<br \/>\n  `placement` varchar(255) NOT NULL,<br \/>\n  `description` varchar(255) NOT NULL,<br \/>\n  `delay` int(4) NOT NULL DEFAULT &#8216;0&#8217;,<br \/>\n  `sortorder` int(11) NOT NULL DEFAULT &#8216;1&#8217;,<br \/>\n  `useragent` varchar(20) DEFAULT NULL,<br \/>\n  `lastms` int(11) NOT NULL DEFAULT &#8216;0&#8217;,<br \/>\n  PRIMARY KEY (`id`),<br \/>\n  UNIQUE KEY `name` (`name`)<br \/>\n) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=2357 ;<\/p>\n<p>Vim \/etc\/asterisk\/res_config_mysql.conf<\/p>\n<p>[asterisk]<br \/>\ndbhost = 127.0.0.1<br \/>\ndbname = asterisk<br \/>\ndbuser = root<br \/>\ndbpass =senha<br \/>\ndbport = 3306<br \/>\n;dbsock = \/tmp\/mysql.sock<\/p>\n<p>Vim \/etc\/asterisk\/extconfig.conf<br \/>\nsippeers => mysql,asterisk,sip_accounts<\/p>\n<p>Iniciar o asterisk. <\/p>\n<p>Aten\u00e7\u00e3o: Os peers n\u00e3o ir\u00e3o ser listados com o comando sip show peers.<br \/>\nAcrescente esses item no general do sip.conf para aparecer os ramais conectados em realtime:<\/p>\n<p>rtcachefriends=yes<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Criar a tabela: Por padr\u00e3o organizo tudo dentro de um banco chamadao asterisk CREATE TABLE IF NOT EXISTS `sip_accounts` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(80) NOT NULL DEFAULT &#8221;, `host` varchar(31) NOT NULL DEFAULT &#8216;dynamic&#8217;, `nat` varchar(5) NOT NULL DEFAULT &#8216;route&#8217;, `type` enum(&#8216;user&#8217;,&#8217;peer&#8217;,&#8217;friend&#8217;)&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.abratel.com.br\/index.php?rest_route=\/wp\/v2\/posts\/373"}],"collection":[{"href":"https:\/\/blog.abratel.com.br\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.abratel.com.br\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.abratel.com.br\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.abratel.com.br\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=373"}],"version-history":[{"count":0,"href":"https:\/\/blog.abratel.com.br\/index.php?rest_route=\/wp\/v2\/posts\/373\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.abratel.com.br\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=373"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.abratel.com.br\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=373"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.abratel.com.br\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=373"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}