Francesco PRIOR

@priorfra
.: Numbers
.: Numbers
There are only

types of people in the world:
Those who understand binary,
and those who don't.
.: Happy Birthday
.: INTROMe
About 2
I’m freelancer:
“The idea is my boss”.
[Pablo Bernasconi – TEDx Cordoba]
.: INTRO 2 2012
Astricon

Available on:
.: The Definitive Guide

You need
this book !
.: Summary
.: Sandwich Layers

“In order to get you into the right frame of
mind for what follows, we want you to
picture a Dagwood s...
.: Premises
.: MySQL: installation
root@ubuntu001:~# apt-get install mysql-server

root@ubuntu001:~# /usr/bin/mysql_secure_installatio...
.: MySQL: configuration
root@ubuntu001:~# mysql -u root -p
mysql> CREATE USER 'asterisk'@'%' IDENTIFIED BY 'some_secret_pa...
.: ODBC: installation

root@ubuntu001:~# apt-get install unixODBC unixODBC-dev
root@ubuntu001:~# apt-get install libmyodbc
.: ODBC: configuration
Edit /etc/odbcinst.ini

Edit /etc/odbc.ini
.: Asterisk: installation
./configure
./make menuselect

make install
.: Asterisk: configuration
/etc/asterisk/res_odbc.conf

/etc/asterisk/func_odbc.conf
.: Checks
Show changes in system
.: Resuming
/etc/asterisk/func_odbc.conf

/etc/asterisk/res_odbc.conf

/etc/odbc.ini
/etc/odbcinst.ini
.: Access from Dialplan
.: Access from Dialplan
extensions.conf

SQL Queries

SELECT
SELECT
UPDATE
EXEC Procedure
………
.: Access from Dialplan
…a practical example.

create a table

/etc/asterisk/func_odbc.conf
.: Access from Dialplan
/etc/asterisk/extensions.conf
.: CDR saved in Database
.: CDR saved in DB
Call Detail Records
.: CDR saved in DB

More details with customized fields.
.: CDR saved in DB
/etc/asterisk/cdr_adaptive_odbc.conf

*CLI> module reload cdr_adaptive_odbc.so
.: Now, a Demo
Call now to test Dialplan and CDR on Database.

281 864 ****

Phone Number no loger available

It will exec...
.: Now, a Demo
.: Asterisk Realtime Architecture
.: Asterisk Realtime Architecture
Configuration saved in DB
/etc/asterisk
sip.conf

ARA

iax.conf
voicemail.conf
musiconho...
.: Asterisk Realtime Architecture
• SIP/IAX peers/users
• Dialplan
• Queue Members
• Access Control Lists
• Voicemail boxe...
.: Asterisk Realtime Architecture
/etc/asterisk/extconfig.conf

[settings]
sippeers => odbc,asterisk,ast_sippeers
extensio...
.: Asterisk Realtime Architecture
Server 1

Server 2

Server 3

Server N

Scalable
Replicable
• Sip Peers/Users
• Voicemai...
.: Conclusion

REFERENCES:
Asterisk Project Wiki
[https://wiki.asterisk.org/wiki/display/AST/Realtime+Database+Configurati...
.: Any Questions ?
PRIOR Francesco
priorfra@gmail.com
@priorfra
Upcoming SlideShare
Loading in …5
×

Astricon 2013: "Asterisk and Database"

5,273 views

Published on

A very practical discussion on how to connect Asterisk with Relational Databases using ODBC database abstraction layer. This session will cover the basics of MySQL/ODBC installation, configuration and integration with Asterisk.

Additionally will be made practical examples about the benefits of this union: improving dialplan with SQL Queries, store Call Detail Records (CDR) in DB, implementing Realtime Architecture (ARA).

Proposed session is for those who do not yet know benefits of connecting an Asterisk box to a database or are interested to learn about it through a very simple step-by-step demo.

Published in: Technology
3 Comments
5 Likes
Statistics
Notes
No Downloads
Views
Total views
5,273
On SlideShare
0
From Embeds
0
Number of Embeds
28
Actions
Shares
0
Downloads
180
Comments
3
Likes
5
Embeds 0
No embeds

No notes for slide

Astricon 2013: "Asterisk and Database"

  1. 1. Francesco PRIOR @priorfra
  2. 2. .: Numbers
  3. 3. .: Numbers There are only types of people in the world: Those who understand binary, and those who don't.
  4. 4. .: Happy Birthday
  5. 5. .: INTROMe About 2 I’m freelancer: “The idea is my boss”. [Pablo Bernasconi – TEDx Cordoba]
  6. 6. .: INTRO 2 2012 Astricon Available on:
  7. 7. .: The Definitive Guide You need this book !
  8. 8. .: Summary
  9. 9. .: Sandwich Layers “In order to get you into the right frame of mind for what follows, we want you to picture a Dagwood sandwich.” [Asterisk™: The Definitive Guide]
  10. 10. .: Premises
  11. 11. .: MySQL: installation root@ubuntu001:~# apt-get install mysql-server root@ubuntu001:~# /usr/bin/mysql_secure_installation NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY! Select a strong password
  12. 12. .: MySQL: configuration root@ubuntu001:~# mysql -u root -p mysql> CREATE USER 'asterisk'@'%' IDENTIFIED BY 'some_secret_password'; Query OK, 0 rows affected (0.00 sec) mysql> CREATE DATABASE asterisk; Query OK, 0 rows affected (0.00 sec) mysql> GRANT ALL PRIVILEGES ON asterisk.* TO 'asterisk'@'%'; root@ubuntu001:~# mysql -u asterisk -p asterisk Enter password: mysql>
  13. 13. .: ODBC: installation root@ubuntu001:~# apt-get install unixODBC unixODBC-dev root@ubuntu001:~# apt-get install libmyodbc
  14. 14. .: ODBC: configuration Edit /etc/odbcinst.ini Edit /etc/odbc.ini
  15. 15. .: Asterisk: installation ./configure ./make menuselect make install
  16. 16. .: Asterisk: configuration /etc/asterisk/res_odbc.conf /etc/asterisk/func_odbc.conf
  17. 17. .: Checks Show changes in system
  18. 18. .: Resuming /etc/asterisk/func_odbc.conf /etc/asterisk/res_odbc.conf /etc/odbc.ini /etc/odbcinst.ini
  19. 19. .: Access from Dialplan
  20. 20. .: Access from Dialplan extensions.conf SQL Queries SELECT SELECT UPDATE EXEC Procedure ………
  21. 21. .: Access from Dialplan …a practical example. create a table /etc/asterisk/func_odbc.conf
  22. 22. .: Access from Dialplan /etc/asterisk/extensions.conf
  23. 23. .: CDR saved in Database
  24. 24. .: CDR saved in DB Call Detail Records
  25. 25. .: CDR saved in DB More details with customized fields.
  26. 26. .: CDR saved in DB /etc/asterisk/cdr_adaptive_odbc.conf *CLI> module reload cdr_adaptive_odbc.so
  27. 27. .: Now, a Demo Call now to test Dialplan and CDR on Database. 281 864 **** Phone Number no loger available It will execute:
  28. 28. .: Now, a Demo
  29. 29. .: Asterisk Realtime Architecture
  30. 30. .: Asterisk Realtime Architecture Configuration saved in DB /etc/asterisk sip.conf ARA iax.conf voicemail.conf musiconhold.conf queues.conf ....... Static/Dynamic
  31. 31. .: Asterisk Realtime Architecture • SIP/IAX peers/users • Dialplan • Queue Members • Access Control Lists • Voicemail boxes • MeetMe conferences • Music on Hold
  32. 32. .: Asterisk Realtime Architecture /etc/asterisk/extconfig.conf [settings] sippeers => odbc,asterisk,ast_sippeers extensions => odbc,asterisk,dialplan
  33. 33. .: Asterisk Realtime Architecture Server 1 Server 2 Server 3 Server N Scalable Replicable • Sip Peers/Users • Voicemail • Extensions Centralized
  34. 34. .: Conclusion REFERENCES: Asterisk Project Wiki [https://wiki.asterisk.org/wiki/display/AST/Realtime+Database+Configuration] Asterisk: The Definitive Guide, 4th Edition [http://shop.oreilly.com/product/0636920025894.do]
  35. 35. .: Any Questions ? PRIOR Francesco priorfra@gmail.com @priorfra

×