asterisk realtime sip数据库实时添加sip peers
来源:互联网 发布:虚拟服务器软件下载 编辑:程序博客网 时间:2024/05/21 17:48
通话数据库维护sip 用户信息,
1、首先我们需要创建保存用户信息的表
## Table structure for table `sip_devices`#CREATE TABLE IF NOT EXISTS `sip_devices` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(10) NOT NULL, `ipaddr` varchar(15) DEFAULT NULL, `port` int(5) DEFAULT NULL, `regseconds` int(11) DEFAULT NULL, `defaultuser` varchar(10) DEFAULT NULL, `fullcontact` varchar(35) DEFAULT NULL, `regserver` varchar(20) DEFAULT NULL, `useragent` varchar(20) DEFAULT NULL, `lastms` int(11) DEFAULT NULL, `host` varchar(40) DEFAULT NULL, `type` enum('friend','user','peer') DEFAULT NULL, `context` varchar(40) DEFAULT NULL, `permit` varchar(40) DEFAULT NULL, `deny` varchar(40) DEFAULT NULL, `secret` varchar(40) DEFAULT NULL, `md5secret` varchar(40) DEFAULT NULL, `remotesecret` varchar(40) DEFAULT NULL, `transport` enum('udp','tcp','udp,tcp','tcp,udp') DEFAULT NULL, `dtmfmode` enum('rfc2833','info','shortinfo','inband','auto') DEFAULT NULL, `directmedia` enum('yes','no','nonat','update') DEFAULT NULL, `nat` enum('yes','no','never','route') DEFAULT NULL, `callgroup` varchar(40) DEFAULT NULL, `pickupgroup` varchar(40) DEFAULT NULL, `language` varchar(40) DEFAULT NULL, `allow` varchar(40) DEFAULT NULL, `disallow` varchar(40) DEFAULT NULL, `insecure` varchar(40) DEFAULT NULL, `trustrpid` enum('yes','no') DEFAULT NULL, `progressinband` enum('yes','no','never') DEFAULT NULL, `promiscredir` enum('yes','no') DEFAULT NULL, `useclientcode` enum('yes','no') DEFAULT NULL, `accountcode` varchar(40) DEFAULT NULL, `setvar` varchar(40) DEFAULT NULL, `callerid` varchar(40) DEFAULT NULL, `amaflags` varchar(40) DEFAULT NULL, `callcounter` enum('yes','no') DEFAULT NULL, `busylevel` int(11) DEFAULT NULL, `allowoverlap` enum('yes','no') DEFAULT NULL, `allowsubscribe` enum('yes','no') DEFAULT NULL, `videosupport` enum('yes','no') DEFAULT NULL, `maxcallbitrate` int(11) DEFAULT NULL, `rfc2833compensate` enum('yes','no') DEFAULT NULL, `mailbox` varchar(40) DEFAULT NULL, `session-timers` enum('accept','refuse','originate') DEFAULT NULL, `session-expires` int(11) DEFAULT NULL, `session-minse` int(11) DEFAULT NULL, `session-refresher` enum('uac','uas') DEFAULT NULL, `t38pt_usertpsource` varchar(40) DEFAULT NULL, `regexten` varchar(40) DEFAULT NULL, `fromdomain` varchar(40) DEFAULT NULL, `fromuser` varchar(40) DEFAULT NULL, `qualify` varchar(40) DEFAULT NULL, `defaultip` varchar(40) DEFAULT NULL, `rtptimeout` int(11) DEFAULT NULL, `rtpholdtimeout` int(11) DEFAULT NULL, `sendrpid` enum('yes','no') DEFAULT NULL, `outboundproxy` varchar(40) DEFAULT NULL, `callbackextension` varchar(40) DEFAULT NULL, `registertrying` enum('yes','no') DEFAULT NULL, `timert1` int(11) DEFAULT NULL, `timerb` int(11) DEFAULT NULL, `qualifyfreq` int(11) DEFAULT NULL, `constantssrc` enum('yes','no') DEFAULT NULL, `contactpermit` varchar(40) DEFAULT NULL, `contactdeny` varchar(40) DEFAULT NULL, `usereqphone` enum('yes','no') DEFAULT NULL, `textsupport` enum('yes','no') DEFAULT NULL, `faxdetect` enum('yes','no') DEFAULT NULL, `buggymwi` enum('yes','no') DEFAULT NULL, `auth` varchar(40) DEFAULT NULL, `fullname` varchar(40) DEFAULT NULL, `trunkname` varchar(40) DEFAULT NULL, `cid_number` varchar(40) DEFAULT NULL, `callingpres` enum('allowed_not_screened','allowed_passed_screen','allowed_failed_screen','allowed','prohib_not_screened','prohib_passed_screen','prohib_failed_screen','prohib') DEFAULT NULL, `mohinterpret` varchar(40) DEFAULT NULL, `mohsuggest` varchar(40) DEFAULT NULL, `parkinglot` varchar(40) DEFAULT NULL, `hasvoicemail` enum('yes','no') DEFAULT NULL, `subscribemwi` enum('yes','no') DEFAULT NULL, `vmexten` varchar(40) DEFAULT NULL, `autoframing` enum('yes','no') DEFAULT NULL, `rtpkeepalive` int(11) DEFAULT NULL, `call-limit` int(11) DEFAULT NULL, `g726nonstandard` enum('yes','no') DEFAULT NULL, `ignoresdpversion` enum('yes','no') DEFAULT NULL, `allowtransfer` enum('yes','no') DEFAULT NULL, `dynamic` enum('yes','no') DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`), KEY `ipaddr` (`ipaddr`,`port`), KEY `host` (`host`,`port`)) ENGINE=MyISAM;
2、修改配置文件extconfig.conf,开启realtime sip 访问mysql数据
;iaxusers => odbc,asterisk;iaxpeers => odbc,asterisk;sippeers => odbc,asterisk;sipregs => odbc,asterisk ; (avoid sipregs if possible, e.g. by using a view);voicemail => odbc,asterisk;extensions => odbc,asterisk;meetme => mysql,general;queues => odbc,asterisk;queue_members => odbc,asterisk;musiconhold => mysql,general;queue_log => mysql,general;;; While most dynamic realtime engines are automatically used when defined in; this file, 'extensions', distinctively, is not. To activate dynamic realtime; extensions, you must turn them on in each respective context within; extensions.conf with a switch statement. The syntax is:; switch => Realtime/[[db_context@]tablename]/<opts>; The only option available currently is the 'p' option, which disallows; extension pattern queries to the database. If you have no patterns defined; in a particular context, this will save quite a bit of CPU time. However,; note that using dynamic realtime extensions is not recommended anymore as a; best practice; instead, you should consider writing a static dialplan with; proper data abstraction via a tool like func_odbc.sippeers => mysql,general,sip_devices
3、修改配置文件res_config_mysql.conf,配置mysql数据库连接
[general]dbhost = 127.0.0.1dbname = callcenterdbuser = rootdbpass = rootdbport = 3306;dbsock = /var/lib/mysql/mysql.sock;dbcharset = latin1;requirements=warn ; or createclose or createchar
4、修改配置文件sip.conf,开启rtcachefriends=yes,使sip show peers命令能查看到realtime表中的配置数据
;----------------------------------------- REALTIME SUPPORT ------------------------; For additional information on ARA, the Asterisk Realtime Architecture,; please read https://wiki.asterisk.org/wiki/display/AST/Realtime+Database+Configuration;rtcachefriends=yes; Cache realtime friends by adding them to the internal list; just like friends added from the config file only on a; as-needed basis? (yes|no)
- asterisk realtime sip数据库实时添加sip peers
- asterisk实时添加sip号码--sqlite篇
- Asterisk realtime 之SIP用户动态写入mysql 数据库
- Asterisk realtime 之SIP用户动态写入mysql 数据库
- SIP client - SIP Peers
- Asterisk realtime 之SIP用户动态写入mysql 数据库(1)
- Asterisk realtime 之SIP用户动态写入mysql 数据库(2)
- asterisk realtime 之静态SIP篇(2)
- asterisk realtime 之动态SIP篇(1)
- Asterisk sip canreinvite
- Asterisk SIP media path
- Asterisk config sip.conf
- Asterisk sip canreinvite
- Asterisk sip event MWI
- Asterisk SIP NAT solutions
- Asterisk sip canreinvite
- Asterisk SIP media path
- Asterisk SIP channels
- Base64 加密 解密
- android分辨率
- Linux多点触控协议
- 根据年月计算当月天数的SQL函数
- 内核对象和进程基础
- asterisk realtime sip数据库实时添加sip peers
- AutoCompleteTextView输入汉字拼音首字母实现过滤提示(支持多音字)
- 利用java反射调用类的的私有方法
- 垃圾收集与对象生命拯救(读书笔记)
- json-c-0.9 在linux上编译使用
- 《iOS5 programming cookbook》学习笔记5 Concurrency
- elipse颜色设置
- 如果是GBK编码的返回该字符串的utf8编码格式 如果该字符串是UTF-8编码的直接返回
- AIDL 2 之 传递复杂数据的AIDL服务