Tìm trong chuyên mục này…
Tìm kiếm trong chủ đề này…
|
|
|
|
|
|
Đang thực thi yêu cầu! Nếu đợi quá lâu vui lòng refresh! |
| Trang 1 trên 2 |
[ 12 bài viết ] | Chuyển đến trang 1, 2 Trang kế tiếp |
| T.Hai Tháng 7 14, 2008 9:46 pm | ||
|
||
| Asterisk Realtime with MySQL. | ||
|
Asterisk Realtime with MySQL.
*************************************************************** Hi This is a How-to for the beginners to work Realtime Asterisk with MySQL. Getting Asterisk-addons. ----------------------------------------- 1. Download asterisk-addons tar ball from the asterisk.org site. 2. Untar it under /usr/src 3. cd /usr/src/asterisk-addons 4. make clean 5. make install 6. This installs the module for mysql, "res_config_mysql.so" into your asterisk modules dir. 7. Copy "res_mysql.conf.sample" from "/usr/src/asterisk-addons/configs" and place it under "/etc/asterisk/" 8. Rename "res_mysql.conf.sample" it to "res_mysql.conf" Creating database in MySQL. ---------------------------------------- I have created a database by name "test" with two tables "sip_buddies" and "extensions" Create table "sip_buddies" using: ----------------------------------------- CREATE TABLE `sip_buddies` ( `id` int(11) NOT NULL auto_increment, `name` varchar(80) NOT NULL default '', `accountcode` varchar(20) default NULL, `amaflags` varchar(13) default NULL, `callgroup` varchar(10) default NULL, `callerid` varchar(80) default NULL, `canreinvite` char(3) default 'yes', `context` varchar(80) default NULL, `defaultip` varchar(15) default NULL, `dtmfmode` varchar(7) default NULL, `fromuser` varchar(80) default NULL, `fromdomain` varchar(80) default NULL, `fullcontact` varchar(80) default NULL, `host` varchar(31) NOT NULL default '', `insecure` varchar(4) default NULL, `language` char(2) default NULL, `mailbox` varchar(50) default NULL, `md5secret` varchar(80) default NULL, `nat` varchar(5) NOT NULL default 'no', `deny` varchar(95) default NULL, `permit` varchar(95) default NULL, `mask` varchar(95) default NULL, `pickupgroup` varchar(10) default NULL, `port` varchar(5) NOT NULL default '', `qualify` char(3) default NULL, `restrictcid` char(1) default NULL, `rtptimeout` char(3) default NULL, `rtpholdtimeout` char(3) default NULL, `secret` varchar(80) default NULL, `type` varchar(6) NOT NULL default 'friend', `username` varchar(80) NOT NULL default '', `disallow` varchar(100) default 'all', `allow` varchar(100) default 'g729;ilbc;gsm;ulaw;alaw', `musiconhold` varchar(100) default NULL, `regseconds` int(11) NOT NULL default '0', `ipaddr` varchar(15) NOT NULL default '', `regexten` varchar(80) NOT NULL default '', `cancallforward` char(3) default 'yes', `setvar` varchar(100) NOT NULL default '', PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`), KEY `name_2` (`name`) ) TYPE=MyISAM ROW_FORMAT=DYNAMIC; Create table "extensions" using: --------------------------------------- CREATE TABLE `extensions` ( `id` int(11) NOT NULL auto_increment, `context` varchar(20) NOT NULL default '', `exten` varchar(20) NOT NULL default '', `priority` tinyint(4) NOT NULL default '0', `app` varchar(20) NOT NULL default '', `appdata` varchar(128) NOT NULL default '', PRIMARY KEY (`context`,`exten`,`priority`), KEY `id` (`id`) ) TYPE=MyISAM; Add some data into them, no need to enter all the details in sip_buddies, add only the necessary fields. I have added a context like name = 102 canreinvite = no context = default dtmfmode = rfc2833 host = dynamic port= yes type = friend username = 102 secret = 102 (if u r getting error in uploadin data, change the field type from NOT NULL to NULL) Add some data into extensions table also. 500 default VoiceMailMain 123 default Playback welcome Configuration in res_mysql.conf. ------------------------------------------- [general] dbhost = localhost dbname = test dbuser = username dbpass = password dbport = 3306 dbsock = /tmp/mysql.sock (check the mysql.sock path, it could be /var/lib/mysql/mysql.sock) Configuration in extconfig.conf. -------------------------------------------- sipusers => mysql,test,sip_buddies sippeers => mysql,test,sip_buddies extensions => mysql,test,extensions Configuration in sip.conf. -------------------------------------------- [general] rtcachefriends=yes Configuration in extensions.conf. -------------------------------------------- [default] switch => [email="Realtime/default@extensions"]Realtime/default@extensions[/email] Start the asterisk, -------------------------------------------- In the CLI mode, -------------------------------------------- CLI> realtime mysql status This shows the status of your mysql connection, like "Connected to [email="test@localhost"]test@localhost[/email], port 3306 with username root for 46 minutes, 30 seconds" This confirms that u have successfully made the connection with mysql, try registering a softphone and dial 500, u will get the voicemail menu, and dialing 123 will playback welcome music file :) _________________ :045::045:
|
| T.Hai Tháng 7 14, 2008 9:51 pm | ||
|
||
|
Asterisk - Realtime Installation Guide
By default, you rely heavily on Asterisk .conf file for creating your dialplans, iax and sip users and peers, as well as voicemail users. And after making changes to the configuration files, you have to reload Asterisk to apply them. However, the guys at Asterisk have made it easier. With Asterisk Realtime, you can add new users and modify your dialplans on the fly. Everything is neatly stored in a database, and loaded on the fly. So in this article, we will discuss how to get started so that you can make use of Asterisk Realtime. You are going to begin by installing Asterisk. You can check out my quick install guide here. Once you have that all complete, you will want to make sure that MYSQL is running. So we can start it by issuing the following command from ssh: /etc/init.d/mysqld start We need to create our Asterisk database, and setup our tables now, from the mysql command line: CREATE DATABASE asterisk; GRANT ALL PRIVILEGES ON asterisk.* TO 'asterisk'@'localhost' IDENTIFIED BY 'yourpassword' WITH GRANT OPTION; A table for your sip users and peers: CREATE TABLE `asterisk`.`sip_buddies` ( `id` int(11) NOT NULL auto_increment, `name` varchar(80) NOT NULL default '', `accountcode` varchar(20) default NULL, `amaflags` varchar(7) default NULL, `callgroup` varchar(10) default NULL, `callerid` varchar(80) default NULL, `canreinvite` char(3) default 'yes', `context` varchar(80) default NULL, `defaultip` varchar(15) default NULL, `dtmfmode` varchar(7) default NULL, `fromuser` varchar(80) default NULL, `fromdomain` varchar(80) default NULL, `fullcontact` varchar(80) default NULL, `host` varchar(31) NOT NULL default '', `insecure` varchar(20) default NULL, `language` char(2) default NULL, `mailbox` varchar(50) default NULL, `md5secret` varchar(80) default NULL, `nat` varchar(5) NOT NULL default 'no', `deny` varchar(95) default NULL, `permit` varchar(95) default NULL, `mask` varchar(95) default NULL, `pickupgroup` varchar(10) default NULL, `port` varchar(5) NOT NULL default '', `qualify` char(3) default NULL, `restrictcid` char(1) default NULL, `rtptimeout` char(3) default NULL, `rtpholdtimeout` char(3) default NULL, `secret` varchar(80) default NULL, `type` varchar(6) NOT NULL default 'friend', `username` varchar(80) NOT NULL default '', `disallow` varchar(100) default 'all', `allow` varchar(100) default 'g729;ilbc;gsm;ulaw;alaw', `musiconhold` varchar(100) default NULL, `regseconds` int(11) NOT NULL default '0', `ipaddr` varchar(15) NOT NULL default '', `regexten` varchar(80) NOT NULL default '', `cancallforward` char(3) default 'yes', PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`), KEY `name_2` (`name`)) ENGINE=MyISAM; And a table for extensions - the backbone of Asterisk: CREATE TABLE `asterisk`.`extensions` ( `id` int(11) NOT NULL auto_increment, `context` varchar(20) NOT NULL default '', `exten` varchar(20) NOT NULL default '', `priority` tinyint(4) NOT NULL default '0', `app` varchar(20) NOT NULL default '', `appdata` varchar(128) NOT NULL default '', PRIMARY KEY (`context`,`exten`,`priority`), KEY `id` (`id`)) ENGINE=MyISAM; And a table for the voicemail users: CREATE TABLE `asterisk`.`voicemessages` ( `id` int(11) NOT NULL auto_increment, `msgnum` int(11) NOT NULL default '0', `dir` varchar(80) default '', `context` varchar(80) default '', `macrocontext` varchar(80) default '', `callerid` varchar(40) default '', `origtime` varchar(40) default '', `duration` varchar(20) default '', `mailboxuser` varchar(80) default '', `mailboxcontext` varchar(80) default '', `recording` longblob, PRIMARY KEY (`id`), KEY `dir` (`dir`)) ENGINE=MyISAM; So now we need to make the needed configuration changes so Asterisk knows to use the database. Assuming that you followed my installation guide (or that you have asterisk-addons installed) we need to copy the res_mysql.conf file, so: cd /usr/src/asterisk-addons/configs/cp res_mysql.conf.sample /etc/asterisk/res_mysql.conf And we can edit that new /etc/asterisk/res_mysql.conf file to show your database settings: [general] dbhost = localhost dbname = asterisk dbuser = asterisk dbpass = yourpassword dbport = 3306 dbsock = /var/lib/mysql/mysql.sock Next we’ll edit the /etc/asterisk/extconfig.conf to show as follows: [settings] sipusers => mysql,asterisk,sip_buddies sippeers => mysql,asterisk,sip_buddies extensions => mysql,asterisk,extensions voicemail => mysql,asterisk,voicemessages For extensions to be loaded of the database, we need to edit the /etc/asterisk/extensions.conf file as well. Each context that will be getting their information from the database, will need the following: switch => Realtime/@extensions - For example: [incoming] switch => Realtime/@extensions Restart Asterisk and you’re all set. Now you just need to load your data into the database. Let’s have a look at an example of that. So here’s my extension: exten => 105,1,Dial(SIP/105) Here’s my database insert for the above extension: INSERT into extensions (id, context, exten, priority, app, appdata)VALUES ('','incoming','105','1','Dial','SIP/105'); And for an example of my sip user, I had the following in my sip.conf at one time: [105]type=friend context=internal callerid=105 host=dynamic secret=password canreinvite=no insecure=port, inviteallow=all nat=yes Here is my insert code for the database: INSERT into sip_buddies (id, name, callerid, context, canreinvite, insecure, type, host, secret, allow, nat)VALUES ('','105','Robert','incoming','no','port,invite','friend','dynamic','bob123','all','yes'); I hope this example works well for you. I got it working fairly easy. It is important to note, that I haven’t been able to successfully setup the connection I have with my carrier in the realtime database. So I have to define those in my sip.conf or iax.conf - which isn’t a big deal. _________________ :045::045:
|
| T.Ba Tháng 7 15, 2008 9:30 am | ||
|
||
|
Ngòai ra, theo kinh nghiệm cá nhân, tùy vào version của asterisk, thì các field của table bên trên có thể phải thêm bớt.
_________________ Nguyễn Đình Long welcome to FREE, opened and sharedvoip-server vnsip.uni.cc with FREE (05 minutes) International calls, call SkypeID xxx by 7xxx sip:30@vnsip.uni.cc (on nokia-e51) (sipbroker *9015-30) US: +1-253-2971591 --> sip:572775@fwd (sipbroker alias *011-12345678 ) or DE: +49-931-6639173 --> [email="6639173@sipgate.de"]sip:6639173@sipgate.de[/email] My friends: StockOnMobile.com ;www.andivn.com[url=http://www.stockonmobile.com/] [/URL] |
| T.Ba Tháng 7 15, 2008 9:33 am | ||
|
||
|
Thank thocon
Mình đã phát hiện chỗ lỗi của mình. Khi mình đăng nhập trực tiếp bằng user asterisk, và thực hiện kết nối với ODBC thì mọi chuyện ok (kết nối được mysql với ODBC). Nhưng khi đăng nhập user root, sao đó chuyển về user asterisk thì bị lỗi (lỗi giống như mình đã nói). Hiện nay, mình vẫn chưa hiểu lý do tại sao. Nhờ bác nào giải thích giúp. Với cách lam` của mình thì mysql vẫn lưu lại được thông tin cdr. |
| T.Ba Tháng 7 15, 2008 1:36 pm | ||
|
||
|
user root (của mysql) có thể chưa được gán quyền truy cập thích hợp cho mysql.
Bạn xem/so sánh trong table "user" of database"mysql" _________________ Nguyễn Đình Long welcome to FREE, opened and sharedvoip-server vnsip.uni.cc with FREE (05 minutes) International calls, call SkypeID xxx by 7xxx sip:30@vnsip.uni.cc (on nokia-e51) (sipbroker *9015-30) US: +1-253-2971591 --> sip:572775@fwd (sipbroker alias *011-12345678 ) or DE: +49-931-6639173 --> [email="6639173@sipgate.de"]sip:6639173@sipgate.de[/email] My friends: StockOnMobile.com ;www.andivn.com[url=http://www.stockonmobile.com/] [/URL] |
| T.Hai Tháng 7 21, 2008 4:43 pm | ||
|
||
|
Vất vả ngôi` liên kết asterisk - ODBC - MySQL. Liên kết thành công. Có thể show dữ liệu từ asterisk sang MySQL tốt. Thì phát hiện được: Asterisk có sẵn module cdr-mysql trong asterisk-addon. Chỉ cần khai báo vai` dòng trong đây (/etc/asterisk/cdr_mysql.conf) thì có thể chỉ đường dẫn cho dữ liệu cdr sang mysql 1 cách ngon lanh`. Thank các bác nhiêu` về vụ nay`.
Hiện giờ đang làm cái predictive dialer. Nhưng chưa biết nên dùng thằng nào. Thằng astguiclient nó hỗ trợ khá tốt các tính năng, nhưng nó thì chỉ chạy trên linux, trong khi đang cần chương trình chạy trên nền window. Hik, chưa biết làm cách nao`. Bác nào biết chỉ giúp. |
| T.Ba Tháng 7 22, 2008 5:59 am | ||
|
||
|
Hi all Minh` dang muon tao database cho asterisk Minh` làm theo hướng dẫn của sách "Asterisk: the future of telephony", chương 12, trang 291 nhưng với database là mysql Mình tạo database của mình như sau: Tạo cơ sở dữ liệu với : Databasename = asteriskcdr Databaseusername = asterisk Userpassword = 123456 Tablename = cdr ................... ........... hehe database cùng * có thể làm nhiều việc, 1. lưu trữ CDR, như trong bài viết của bạn 2. lưu trữ thông tin đăng ký của các users, như trong bài viết của Thocon .... bạn không nhấn mạnh đến CDR và người đọc kô chú ý đến CDR(cũng như mấy câu sql :) ) nên có sự hiểu nhầm hehe good luck and have fun! _________________ Nguyễn Đình Long welcome to FREE, opened and sharedvoip-server vnsip.uni.cc with FREE (05 minutes) International calls, call SkypeID xxx by 7xxx sip:30@vnsip.uni.cc (on nokia-e51) (sipbroker *9015-30) US: +1-253-2971591 --> sip:572775@fwd (sipbroker alias *011-12345678 ) or DE: +49-931-6639173 --> [email="6639173@sipgate.de"]sip:6639173@sipgate.de[/email] My friends: StockOnMobile.com ;www.andivn.com[url=http://www.stockonmobile.com/] [/URL] |
| T.Sáu Tháng 9 05, 2008 9:35 am | ||
|
||
|
Chào các anh!
Em đã thử làm như bài viết của anh Toàn nhưng khi thực hiện: *CLI> realtime mysql status No such command 'realtime mysql status' (type 'help realtime mysql status' for help) Mong các anh giúp đỡ em. |
| T.Sáu Tháng 9 05, 2008 11:46 pm | ||
|
||
|
Bạn đã làm các bước này chưa ?
1. Download asterisk-addons tar ball from the asterisk.org site. 2. Untar it under /usr/src 3. cd /usr/src/asterisk-addons 4. make clean 5. make install 6. This installs the module for mysql, "res_config_mysql.so" into your asterisk modules dir. 7. Copy "res_mysql.conf.sample" from "/usr/src/asterisk-addons/configs" and place it under "/etc/asterisk/" 8. Rename "res_mysql.conf.sample" it to "res_mysql.conf" Creating database in MySQL. trên server của tui : .... vnsip*CLI> realtime mysql status Connected to asterisk@localhost, port 3306 with username xxxxxxxxxxx for 22 seconds. vnsip*CLI> .... _________________ Nguyễn Đình Long welcome to FREE, opened and sharedvoip-server vnsip.uni.cc with FREE (05 minutes) International calls, call SkypeID xxx by 7xxx sip:30@vnsip.uni.cc (on nokia-e51) (sipbroker *9015-30) US: +1-253-2971591 --> sip:572775@fwd (sipbroker alias *011-12345678 ) or DE: +49-931-6639173 --> [email="6639173@sipgate.de"]sip:6639173@sipgate.de[/email] My friends: StockOnMobile.com ;www.andivn.com[url=http://www.stockonmobile.com/] [/URL] |
| Trang 1 trên 2 |
[ 12 bài viết ] | Chuyển đến trang 1, 2 Trang kế tiếp |
| Các chủ đề liên quan | Người gửi | Trả lời | Xem | Bài viết sau cùng | |
|---|---|---|---|---|---|
| Hướng dẫn cấu hình freepbx để thực hiện cuộc gọi trong LAn | 0 |
93 |
T.Năm Tháng 4 22, 2010 2:32 am |
||
|
|
Ứng dụng IVR 1900/1800 | 1 |
353 |
T.Tư Tháng 8 20, 2008 6:15 pm |
|
| cau hinh IVR | 1 |
373 |
T.Ba Tháng 11 11, 2008 8:31 am |
||
|
Đề cương phần I
trong Các hệ CSTT |
0 |
93 |
CN Tháng 2 08, 2009 9:26 pm |
||
| iptables???help me...thanks moi nguoi | 2 |
187 |
T.Sáu Tháng 6 05, 2009 9:50 pm |
||
Đang trực tuyến |
|---|
Đang xem chuyên mục này: Không có thành viên nào trực tuyến. và 1 khách. |
Múi giờ UTC + 7 Giờ - Hôm nay, CN Tháng 9 05, 2010 5:38 am