欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Asterisk使用数据库配置方法 博客分类: Asterisk asterisksip数据库配置

程序员文章站 2024-03-18 14:02:22
...

安装:

1、安装 unixODBC unixODBC-devel libtool-ltdl libtool-ltdl-devel ,为了使asterisk支持数据库存储(必须先安装)

2、安装 mysql 并设置好 C_INCLUDE_PATH 和 LD_LIBRARY_PATH

3、从 http://www.asterisk.org/downloads 下载新版的asterisk(asterisk-11-current.tar.gz)

4、复制解压。

5、进入解压后的目录 asterisk-11.2.1,执行./configure

6、执行 make menuselect 选择要按照的组件

7、执行 make

8、执行 make install

9、执行 make samples

10、安装mysql

11、安装mysql-connector-odbc-5.1.12-1.rhel5.x86_64.rpm

 

配置ODBC

1、/etc/odbcinst.ini

[MySQL]

Description   = ODBC for MySQL

Driver          = /usr/lib64/libmyodbc5.so

Setup           = /usr/lib64/libodbcmyS.so

FileUsage      = 1

 

2、/etc/odbc.ini

[asterisk]

Description     = MySQL connection to 'asterisk' database

Driver            = MySQL

Database        = asterisk

Server            = localhost

UserName       = asterisk

Password        = asterisk

Port                = 3306

Socket             = /tmp/mysql.sock

 

配置Asterisk:

1、modules.conf

[modules]

preload => res_odbc.so

preload => res_config_odbc.so

 

2、extconfig.conf

sipusers => odbc,asterisk,sippeers

sippeers => odbc,asterisk,sippeers

 

3、res_odbc.conf

[asterisk]

enabled => yes

dsn => asterisk

username => asterisk

password => asterisk

pre-connect => yes

limit => 5

 

4、http.conf

[general]

enabled=yes

bindaddr=0.0.0.0

bindport=8088

prefix=asterisk

enablestatic=yes

 

5、manager.conf

[general]

enabled = yes

webenabled = yes

port = 5038

bindaddr = 0.0.0.0

 

[admin]

secret = admin

read = system,call,log,verbose,command,agent,config,read,write,originate

write = system,call,log,verbose,command,agent,config,read,write,originate

 

[manager]

secret=manager

permit=0.0.0.0/0.0.0.0

read=all

write=all

 

6、extensions.conf

[from-sip]

exten => _XXX,1,Dial(SIP/${EXTEN},60)

 

7、sip.conf(支持视频)

videosupport=yes

allow=h263

allow=h263p

allow=h264

 

配置数据库:

1、建立asterisk库,并用asterisk安装包里面提供的SQL脚本建立表

/asterisk-11.2.1/contrib/realtime/mysql

 

2、建立用户asterisk,并授予asterisk库的操作权限

 

3、在sippeers表中建立用户数据

id     name     regseconds     defaultuser     host     type     context     secret

1     101     0     101     dynamic     friend     from-sip     101

2     102     0     102     dynamic     friend     from-sip     102

 

配置完以上信息后,通过asterisk -vvvc方式启动

使用eyeBeam客户端就可以相互通话了

 

Web方式管理asterisk:

可以通过 http://10.10.18.108:8088/asterisk/manager 对asterisk进行管理

 

可通过CLI命令查看odbc状态

vm-108*CLI> odbc show

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

  Name:   asterisk
  DSN:    asterisk
    Last connection attempt: 1970-01-01 08:00:00
  Pooled: No
  Connected: Yes

 

 

可通过CLI命令查看http服务状态

vm-108*CLI> http show status
HTTP Server Status:
Prefix: /asterisk
Server Enabled and Bound to 0.0.0.0:8088

Enabled URI's:
/asterisk/httpstatus => Asterisk HTTP General Status
/asterisk/phoneprov/... => Asterisk HTTP Phone Provisioning Tool
/asterisk/amanager => HTML Manager Event Interface w/Digest authentication
/asterisk/arawman => Raw HTTP Manager Event Interface w/Digest authentication
/asterisk/manager => HTML Manager Event Interface
/asterisk/rawman => Raw HTTP Manager Event Interface
/asterisk/static/... => Asterisk HTTP Static Delivery
/asterisk/amxml => XML Manager Event Interface w/Digest authentication
/asterisk/mxml => XML Manager Event Interface
/asterisk/ws => Asterisk HTTP WebSocket

Enabled Redirects:
  None.

  

 

整个配置过程比较复杂,主要参考了Asterisk.The.Definitive.Guide

http://vdisk.weibo.com/s/rQ6BY