Difference between revisions of "OpenBTS: 2.8 Instalasi Real Time Asterisk"

From OnnoWiki
Jump to navigation Jump to search
Line 74: Line 74:
 
  Timeout=2000
 
  Timeout=2000
  
You will also need symbolic links to the files in the following places:
+
==Link Simbolik==
 +
 
 +
Kita juga perlu membuat simbolik link ke file di tempat ini
  
 
  /usr/local/etc/odbcinst.ini /usr/local/etc/odbc.ini
 
  /usr/local/etc/odbcinst.ini /usr/local/etc/odbc.ini
Line 86: Line 88:
 
  cd ~openbts; 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:
+
Kita juga perlu link simbolik untuk home directory asterisk jika asterisk di jalankan sebagai user asterisk:
  
 
  cd ~asterisk; ln -s /etc/odbc.ini .odbc.ini; ln -s /etc/odbcinst.ini .odbcinst.ini
 
  cd ~asterisk; ln -s /etc/odbc.ini .odbc.ini; ln -s /etc/odbcinst.ini .odbcinst.ini

Revision as of 16:42, 26 April 2012

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

Buang sqlite3 dan asterisk. Kita perlu menginstalasi ulang semuanya,

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

Instalasi Aplikasi yang dibutuhkan

  • Download sqlite3 dari
http://www.sqlite.org/download.html
http://www.sqlite.org/sqlite-amalgamation-3071100.zip
http://www.sqlite.org/sqlite-autoconf-3071100.tar.gz

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
  • Download sqliteodbc
http://www.ch-werner.de/sqliteodbc/
http://www.ch-werner.de/sqliteodbc/sqliteodbc-0.94.tar.gz
  • Compile
./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".
  • Pastikan "res_realtime" dipilih di "resource modules".
  • Harusnya tidak ada "XXX" di pilihan Sqlite3 dan ODBC di menu konfigurasi.

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

Edit /etc/odbcinst.ini

[SQLite3]
Description=SQLite3 ODBC Driver
Driver=/usr/local/lib/libsqlite3odbc.so
Setup=/usr/local/lib/libsqlite3odbc.so
Threading=2

Edit /etc/odbc.ini

[asterisk]
Description=SQLite3 database
Driver=SQLite3
Database=/var/lib/asterisk/sqlite3dir/sqlite3.db
# optional lock timeout in milliseconds
Timeout=2000

Link Simbolik

Kita juga perlu membuat simbolik link ke file di tempat ini

/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

Kita juga perlu link simbolik untuk home directory asterisk jika asterisk di jalankan sebagai user asterisk:

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

Standard untuk unit BTS yang terkonfigurasi biasanya menyimpan file "asli" di /usr/local/etc dan membuat link simbolik ke

/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