OpenBTS: 2.8 Instalasi Real Time Asterisk

From OnnoWiki
Jump to navigation Jump to search

Konfigurasi Asterisk Realtime

Di bawah ini adalah beberapa langkah untuk membuat Sqlite3 dapat bekerja secara realtime di Asterisk. Ini masih dilakukan secara manual semua, belum ada script yang melakukan hal ini.

Cleaning sebelum Install

sqlite3 dan asterisk keduanya di install secara sederhana melalui apt. Kita perlu membuang ke dua-nya agar dapat mengcompile dari Nol. Cara membuang adalah

sudo apt-get remove asterisk sqlite3
sudo apt-get autoremove

Instalasi Software yang dibutuhkan Sistem Operasi

Lakukan perintah

  • Download sqlite3 dari
http://www.sqlite.org/download.html
sqlite3 harus di combile dengan terdefinisikan SQLITE_ENABLE_COLUMN_METADATA
./configure CFLAGS="-DSQLITE_ENABLE_COLUMN_METADATA -O2"
make
make install
sudo apt-get install libsqlite3-dev
sudo apt-get install erlang



   If you are going to install Erlang anyway, do that now with apt-get install since it includes ODBC. Otherwise:
       download  unixODBC. This is available from the packages branch in SVN.
       configure, make, make install 
   download  sqliteodbc. This is available from the packages branch in SVN.
   configure, make, make install

(Re)Building Asterisk

Kita perlu membuat ulang Asterisk

./configure --disable-xmldoc
make menuselect

Pastikan Sqlite3 dan ODBC dipilih, terutama di "applications", "resource modules" dan "dialplan functions".

       Make sure "res_realtime" is selected in "resource modules".
       You should NOT see "XXX" on the Sqlite3 and ODBC selections anywhere in the configuration menus. If you see "XXX" for Sqlite3 or ODBC features anywhere, that means that those packages are not installed correctly (or at least in the way that Asterisk expects to see them). Look at the config.log file for clues.
           If you are building a full BTS unit, you will need to install Erlang with apt-get install and that will include an ODBC installation that Asterisk likes. 
make
make install 

Yes, you need to rebuild Asterisk. And if you are going to add Speex support, this would be the time to do it. You are supposed to be able to install Speex with apt-get install, but I have not gotten that to work yet. ODBC configuration files

/etc/odbcinst.ini
[SQLite3]
Description=SQLite3 ODBC Driver
Driver=/usr/local/lib/libsqlite3odbc.so
Setup=/usr/local/lib/libsqlite3odbc.so
Threading=2
/etc/odbc.ini
[asterisk]
Description=SQLite3 database
Driver=SQLite3
Database=/var/lib/asterisk/sqlite3dir/sqlite3.db
# optional lock timeout in milliseconds
Timeout=2000

You will also need symbolic links to the files in the following places:

/usr/local/etc/odbcinst.ini /usr/local/etc/odbc.ini
root/.odbcinst.ini /root/.odbc.ini
~openbts/.odbcinst.ini ~openbts/.odbc.ini 

Dengan kata lain, sebagai root lakukan

cd /usr/local/etc; ln -s /etc/odbc.ini; ln -s /etc/odbcinst.ini
cd /root; ln -s /etc/odbc.ini .odbc.ini; ln -s /etc/odbcinst.ini .odbcinst.ini
cd ~openbts; ln -s /etc/odbc.ini .odbc.ini; ln -s /etc/odbcinst.ini .odbcinst.ini

You might also need symbolic links in the asterisk home directory if asterisk is running as user asterisk:

cd ~asterisk; ln -s /etc/odbc.ini .odbc.ini; ln -s /etc/odbcinst.ini .odbcinst.ini

The standard for configured BTS units is actually to put the real files in /usr/local/etc and then put symbolic links in:

/etc
~root 

If Asterisk is running, modifying these files might make it crash. Be aware of that. Asterisk configuration files

modules.conf 

Autoload must be enabled, plus make sure you're not overriding that by telling it NOT to load particular files, like res_config_odbc.so. The noload is commented out here.

[modules]
autoload=yes
; noload => res_config_odbc.so

extconfig.conf

Ini akan meminta asterisk untuk menggunakan odbc untuk realtime sip. Ada sedikit kebingungan apakah kolom ke dua (dalam hal ini, asterisk adalah database, handel odbc database, atau odbc context. Disini dibuat sama agar kita tidak pusing.

[settings]
sipusers => odbc,asterisk,sip_buddies
sippeers => odbc,asterisk,sip_buddies

res_odbc.conf

Standard konfigirasi odbc. Semua diberi nama "asterisk" untuk menghindari kebingungan.

[asterisk]
enabled => yes
dsn => asterisk
pre-connect => yes

func_odbc.conf

Ini akan memungkinkan kita untuk menggunakan fungsi ODBC_SQL untuk menjalankan perintah SQL di dial plan. Kita menggunakan ini untuk memperoleh nomor SIP setelah diberi extension.

[SQL]
dsn=asterisk
readsql=${ARG1}

extensions.conf

Here's how the dialplan uses the ODBC_SQL function to get the SIP number from the extension. This is just here as an example, though. Use the extensions.conf file in openbts/trunk/AsteriskConfigs.

[phones]
; This is the context for handsets provisioned through the realtime database.
exten => _N.,1,Set(Name=${ODBC_SQL(select dial from dialdata_table where exten = \"${EXTEN}\")})
exten => _N.,n,GotoIf($["${Name}" = ""] ?outbound-trunk,${EXTEN},1)
exten => _N.,n,Set(IPAddr=${ODBC_SQL(select ipaddr from sip_buddies where name = \"${Name}\")})
exten => _N.,n,GotoIf($["${IPAddr}" = ""] ?outbound-trunk,${EXTEN},1)
exten => _N.,n,Dial(SIP/${Name}@${IPAddr}:5062)

In this example, OpenBTS has it's inbound SIP interface at port 5062 and the context "outbound-trunk" is used for handling phones not provisioned in the realtime database.

Sqlite3 database location

The default path for the Asterisk realtime database file is /var/lib/asterisk/sqlite3dir/sqlite3.db. (Note that this path was referenced above in /etc/odbc.ini.)

The sqlite3 database file must be readable and writable by asterisk, smqueue and sipauthserve, AND the directory in which the sqlite3 database file is located must ALSO be readable and writable by the applications. This is because sqlite3 generates temporary files in the directory.


Referensi

Pranala Menarik

Persiapan

OpenBTS 2.6

OpenBTS 2.8

Ettus E110

Lain Lain

Catatan Legal dan Pendukung

Catatan Sejarah