Asterisk 13 RealTime SIP

см также: Asterisk PJSIP Realtime

CREATE TABLE `sip_peers` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `accountcode` varchar(20) DEFAULT NULL,
  `directmedia` varchar(128) DEFAULT NULL,
  `disallow` varchar(100) DEFAULT 'all',
  `allow` varchar(100) DEFAULT 'alaw;ulaw;gsm;g729',
  `allowoverlap` enum('yes','no') DEFAULT 'yes',
  `allowsubscribe` enum('yes','no') DEFAULT 'yes',
  `allowtransfer` varchar(3) DEFAULT NULL,
  `amaflags` varchar(13) DEFAULT NULL,
  `autoframing` varchar(3) DEFAULT NULL,
  `auth` varchar(40) DEFAULT NULL,
  `buggymwi` enum('yes','no') DEFAULT 'no',
  `callgroup` varchar(10) DEFAULT NULL,
  `callerid` varchar(80) DEFAULT NULL,
  `cid_number` varchar(40) DEFAULT NULL,
  `fullname` varchar(40) DEFAULT NULL,
  `call-limit` int(8) DEFAULT '0',
  `callingpres` varchar(80) DEFAULT NULL,
  `canreinvite` char(6) DEFAULT 'yes',
  `context` varchar(80) DEFAULT NULL,
  `callbackextension` varchar(80) DEFAULT NULL,
  `defaultip` varchar(15) DEFAULT NULL,
  `defaultuser` varchar(128) DEFAULT NULL,
  `dtmfmode` varchar(7) DEFAULT NULL,
  `encryption` varchar(128) DEFAULT NULL,
  `fromuser` varchar(80) DEFAULT NULL,
  `fromdomain` varchar(80) DEFAULT NULL,
  `fullcontact` varchar(80) DEFAULT NULL,
  `g726nonstandard` enum('yes','no') DEFAULT 'no',
  `host` varchar(31) NOT NULL DEFAULT '',
  `insecure` varchar(20) DEFAULT NULL,
  `ipaddr` varchar(15) NOT NULL DEFAULT '',
  `language` char(2) DEFAULT NULL,
  `lastms` varchar(20) DEFAULT NULL,
  `mailbox` varchar(50) DEFAULT NULL,
  `maxcallbitrate` int(8) DEFAULT '384',
  `mohsuggest` varchar(80) DEFAULT NULL,
  `md5secret` varchar(80) DEFAULT NULL,
  `musiconhold` varchar(100) DEFAULT NULL,
  `name` varchar(80) NOT NULL DEFAULT '',
  `nat` varchar(128) DEFAULT NULL,
  `outboundproxy` varchar(80) DEFAULT NULL,
  `deny` varchar(95) DEFAULT NULL,
  `permit` varchar(95) DEFAULT NULL,
  `pickupgroup` varchar(10) DEFAULT NULL,
  `port` varchar(5) NOT NULL DEFAULT '',
  `progressinband` enum('yes','no','never') DEFAULT 'no',
  `promiscredir` enum('yes','no') DEFAULT 'no',
  `qualify` char(3) DEFAULT NULL,
  `regexten` varchar(80) NOT NULL DEFAULT '',
  `regseconds` int(11) NOT NULL DEFAULT '0',
  `rfc2833compensate` enum('yes','no') DEFAULT 'no',
  `rtptimeout` char(3) DEFAULT NULL,
  `rtpholdtimeout` char(3) DEFAULT NULL,
  `secret` varchar(80) DEFAULT NULL,
  `sendrpid` enum('yes','no') DEFAULT 'yes',
  `setvar` varchar(100) NOT NULL DEFAULT '',
  `subscribecontext` varchar(80) DEFAULT NULL,
  `subscribemwi` varchar(3) DEFAULT NULL,
  `t38pt_udptl` enum('yes','no') DEFAULT 'no',
  `transport` varchar(128) DEFAULT NULL,
  `trustrpid` enum('yes','no') DEFAULT 'no',
  `type` varchar(6) NOT NULL DEFAULT 'friend',
  `useclientcode` enum('yes','no') DEFAULT 'no',
  `usereqphone` varchar(3) NOT NULL DEFAULT 'no',
  `username` varchar(128) DEFAULT NULL,
  `videosupport` enum('yes','no') DEFAULT 'yes',
  `vmexten` varchar(80) DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `name` (`name`),
  KEY `name_2` (`name`)
) ENGINE=InnoDB AUTO_INCREMENT=74 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC;

/etc/odbcinst.ini

# Driver from the mysql-connector-odbc package
# Setup from the unixODBC package
[MySQL]
Description     = ODBC for MySQL
Driver          = /usr/lib/libmyodbc5.so
Setup           = /usr/lib/libodbcmyS.so
Driver64        = /usr/lib64/libmyodbc5.so
Setup64         = /usr/lib64/libodbcmyS.so
FileUsage       = 1

/etc/odbc.ini

[asterisk]
Driver=MySQL
SERVER=localhost
PORT=3306
DATABASE=asterisk
USER=asterisk
PASSWORD= PASSWORD

/etc/asterisk/res_odbc.conf

[sql]
enabled => yes
dsn => asterisk
username => asterisk
password => PASSWORD
pre-connect => yes

/etc/asterisk/extconfig.conf

[settings]
sipusers => odbc,sql,sip_peers
sippeers => odbc,sql,sip_peers

/etc/asterisk.modules.conf

load = res_odbc.so
load = res_config_odbc.so
CLI> module show like odbc
Module                         Description                              Use Count  Status      Support Level
res_config_odbc.so             Realtime ODBC configuration              0          Running              core
res_odbc.so                    ODBC resource                            0          Running              core
2 modules loaded
*CLI> odbc show all

ODBC DSN Settings
-----------------

  Name:   sql
  DSN:    asterisk
    Last connection attempt: 1970-01-01 03:00:00

/etc/asterisk/sip.conf

[general]
rtcachefriends=yes

Добавление данных

INSERT INTO asterisk.sip_peers ( NAME, username, secret, context, HOST, nat, qualify, TYPE) VALUES ('1001', '1001', 'USERPASSWORD', 'USERCONTEXT', 'dynamic', 'yes', 'no', 'friend'); 

http://vetal-daw.blogspot.ru/2015/08/realtime-config-sip-asterisk-13.html

Asterisk Realtime Extensions with MySQL

Asterisk Realtime: extconfig.conf

Asterisk: res_odbc.conf

function 'REALTIME'

function 'REALTIME_DESTROY'

function 'REALTIME_FIELD'

function 'REALTIME_HASH'

Asterisk: queue_log в MySQL через unixODBC

Asterisk PJSIP Realtime

Только авторизованные участники могут оставлять комментарии.

Войти через: Google Facebook