Difference between revisions of "Instalasi CDRTool"

From OnnoWiki
Jump to navigation Jump to search
 
(17 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
Tingkat kesulitan menginstalasi CDRTool cukup tinggi, kemungkinan gagal sangat besar.
 +
 +
 
Siapkan software pendukung
 
Siapkan software pendukung
  
  # apt-get install apache2 libapache2-mod-php5 php5 php5-cli php5-mysql php5-curl php-pear
+
  # apt-get install apache2 libapache2-mod-php5 php5 php5-cli php5-mysql \
# apt-get install php-soap mrtg php5-memcache memcached monit smarty
+
php5-curl php-pear php-soap mrtg php5-memcache memcached monit smarty
  
 
Download Source Code CDRTool dari situs
 
Download Source Code CDRTool dari situs
Line 8: Line 11:
 
  http://cdrtool.ag-projects.com/
 
  http://cdrtool.ag-projects.com/
 
  http://download.dns-hosting.info/CDRTool/
 
  http://download.dns-hosting.info/CDRTool/
 +
 +
 +
Siapkan database CDRTool di MySQL
 +
 +
# mysql -u root -p
 +
Enter password:
 +
 +
mysql> create database cdrtool;
 +
mysql> grant INSERT,SELECT on root.* to cdradmin@localhost;
 +
mysql> grant INSERT,SELECT on root.* to locker@localhost;
 +
mysql> GRANT ALL ON cdrtool.* TO cdradmin@localhost IDENTIFIED by 'PASSWORD';
 +
mysql> GRANT ALL ON cdrtool.* TO cdradmin IDENTIFIED by 'PASSWORD';
 +
mysql> GRANT ALL ON cdrtool.* TO locker@localhost IDENTIFIED by 'lockadm18';
 +
mysql> GRANT ALL ON cdrtool.* TO locker IDENTIFIED by 'lockadm18';
 +
mysql> exit
  
  
 
Instalasi yang mudah mungkin
 
Instalasi yang mudah mungkin
  
  # cp -Rf cdrtool_6.2.3_all.deb /usr/local/src/
+
  # cp -Rf cdrtool_6.4.1_all.deb /usr/local/src/
 
  # cd /usr/local/src/
 
  # cd /usr/local/src/
  # dpkg -i cdrtool_6.2.3_all.deb
+
  # dpkg -i cdrtool_6.4.1_all.deb
 +
 
 +
 
 +
Lakuan
 +
 
 +
# cd /var/www/CDRTool/setup/mysql
 +
# mysql -u root -p<password-root> mysql < ./create_users.mysql
 +
# mysql -u root -p<password-root> cdrtool < ./create_tables.mysql
 +
# mysql -u root -p<password-root> cdrtool < ./create_data.mysql
 +
 
 +
Alternatif lain yang mungkin bisa dilakukan juga adalah
 +
 
 +
# ./setup_mysql.sh <password-root-MySQL> <ip-address-database-server>
 +
 
 +
 
 +
Copykan setup Apache Web Server
 +
 
 +
# cd /var/www/CDRTool
 +
# cp setup/apache2/conf.d/cdrtool /etc/apache2/conf.d/
 +
# cp setup/apache2/sites-available/cdrtool.example.com /etc/apache2/sites-enabled
 +
 
 +
 
 +
Edit file
 +
 
 +
# vi /etc/apache2/sites-enabled/cdrtool.example.com
 +
 
 +
 
 +
Pastikan isinya
 +
 
 +
<VirtualHost sipcdr.example.com:443>
 +
  ServerName          sipcdr.example.com
 +
  DocumentRoot        /var/www/
 +
  CustomLog          /var/log/apache2/cdrtool-access.log combined
 +
  ErrorLog            /var/log/apache2/cdrtool-errors.log
 +
  SetEnvIf User-Agent ".*MSIE.*"      nokeepalive ssl-unclean-shutdown
 +
 
 +
  # To enable SSL:
 +
  # a2enmode ssl
 +
  # add Listen 443 to ports.conf file
 +
  # generate site certificates
 +
 
 +
  # SSLEngine          On
 +
  # SSLCertificateFile    /etc/apache2/ssl/snakeoil-rsa.crt
 +
  # SSLCertificateKeyFile /etc/apache2/ssl/snakeoil-rsa.key
 +
 
 +
  # RewriteEngine is required for Multimedia Service Platform
 +
  #
 +
  # a2enmode rewrite proxy
 +
  # RewriteEngine      On
 +
  # RewriteRule        ^/ngnpro/voicemail/(.*) http://10.0.0.1:9200/$1 [L,P]
 +
  # RewriteRule        ^/ngnpro/(.*) http://10.0.0.2:9200/$1 [L,P]
 +
  # ProxyVia            On
 +
 
 +
  # <Proxy *>
 +
  #      Order Allow,Deny
 +
  #      Allow from all
 +
  # </Proxy>
 +
 
 +
        <Directory /var/www/CDRTool>
 +
                Options FollowSymLinks
 +
                AllowOverride All
 +
        </Directory>
 +
</VirtualHost>
 +
 
 +
 
 +
Atau yang lebih sederhana
 +
 
 +
<VirtualHost cdrtool.example.com:80>
 +
  ServerName          cdrtool.example.com
 +
  DocumentRoot        /var/www/
 +
  CustomLog          /var/log/apache2/cdrtool-access.log combined
 +
  ErrorLog            /var/log/apache2/cdrtool-errors.log
 +
  SetEnvIf User-Agent ".*MSIE.*"      nokeepalive ssl-unclean-shutdown
 +
 
 +
  # To enable SSL:
 +
  # a2enmode ssl
 +
  # add Listen 443 to ports.conf file
 +
  # generate site certificates
 +
 
 +
  # SSLEngine          On
 +
  # SSLCertificateFile    /etc/apache2/ssl/snakeoil-rsa.crt
 +
  # SSLCertificateKeyFile /etc/apache2/ssl/snakeoil-rsa.key
 +
</VirtualHost>
 +
 
 +
 
 +
 
  
 
Edit /etc/default/cdrtool
 
Edit /etc/default/cdrtool
Line 24: Line 127:
 
  RUN_ratingEngine=yes
 
  RUN_ratingEngine=yes
 
  START_MEMCACHE=yes
 
  START_MEMCACHE=yes
 +
 +
 +
Edit konfigurasi
 +
 +
# cp /var/www/CDRTool/setup/global.inc.new.installation /var/www/CDRTool/
 +
 +
 +
Edit global.inc
 +
 +
# vi /var/www/CDRTool/global.inc
 +
 +
 +
Pastikan
 +
 +
----
 +
 +
$RatingEngine=array("socketIP"  => "127.0.0.1",
 +
                    "socketPort" => "9024",
 +
                    "CDRS_class" => "ser_radius",
 +
                    "prepaid_lock" => true,
 +
                    "log_delay"  => 0.05
 +
                    );
 +
 +
 +
----
 +
 +
$CDRTool['normalize']['defaultCountryCode']      = "62";
 +
 +
 +
----
 +
 +
###########################################
 +
# CDRTool datasources
 +
 +
class DB_CDRTool extends DB_Sql {
 +
  var $Host    = "127.0.0.1.";
 +
  var $Database = "cdrtool";
 +
  var $User    = "cdradmin";
 +
  var $Password = "PASSWORD";
 +
  var $Halt_On_Error ="yes";
 +
}
 +
 +
class DB_Locker extends DB_Sql {
 +
  var $Host    = "127.0.0.1.";
 +
  var $Database = "cdrtool";
 +
  var $User    = "locker";
 +
  var $Password = "PASSWORD";
 +
  var $Halt_On_Error ="no";
 +
}
 +
 +
class DB_radius extends DB_Sql {
 +
  var $Host    = "127.0.0.1.";
 +
  var $Database = "radius";
 +
  var $User    = "radius";
 +
  var $Password = "PASSWORD";
 +
  var $Halt_On_Error ="no";
 +
}
 +
 +
class DB_radius2 extends DB_Sql {
 +
  var $Host    = "127.0.0.1.";
 +
  var $Database = "radius";
 +
  var $User    = "radius";
 +
  var $Password = "PASSWORD";
 +
  var $Halt_On_Error ="no";
 +
}
 +
 +
 +
 +
 +
 +
 +
----
 +
 +
# set IP server
 +
if ($_SERVER['REMOTE_ADDR']=="192.168.0.2") {
 +
    //$verbose=1;
 +
} else {
 +
    // prevent set of verbose via post/get
 +
    unset($verbose);
 +
 +
 +
 +
 +
----
 +
 +
Restart
 +
 +
# /etc/init.d/cdrtool restart
 +
# /etc/init.d/apache2 restart
 +
# /etc/init.d/cdrtool startmemcache
 +
 +
 +
Mencoba akses ke
 +
 +
http://localhost/CDRTool/index.phtml
 +
 +
Username password default admin/admin
 +
 +
 +
 +
 +
Untuk konfigurasi yang lebih kompleks yang melibatkan FreeRADIUS dapat meneruskan mengkonfigurasi perintah berikut.
 +
 +
 +
----
 +
 +
 +
Bersihkan sampah dll secara periodik
 +
 +
# cp /var/www/CDRTool/setup/crontabs/cdrtool /var/spool/cron/crontabs/
 +
 +
 +
 +
----
 +
 +
 +
Siapkan FreeRadius Server
 +
 +
# apt-get install freeradius freeradius-mysql
 +
 +
# mysqladmin -u root -p create radius
 +
Enter password: <masukan password root MySQL>
 +
 +
# cp /usr/share/doc/freeradius/examples/mysql.sql.gz /usr/local/src/
 +
# cd /usr/local/src
 +
# gunzip mysql.sql.gz
 +
# mysql -u root -p radius < /usr/local/src/mysql.sql
 +
Enter password: <masukan password root MySQL>
 +
 +
Patch radacct untuk OpenSER
 +
 +
# /var/www/CDRTool/setup/radius/OpenSER/radacct-patch.sh
 +
Please type in MySQL root password (^C to abort): <masukan password root MySQL>
 +
 +
# cp /var/www/CDRTool/setup/radius/OpenSER/sql.conf /etc/freeradius/sql.conf 
 +
 +
Edit file /etc/freeradius/clients.conf, pastikan ada konfigurasi client yang akan tersambung, misalnya ..
 +
 +
client 192.168.0.0/16 {
 +
        secret=rahasiabangetpasswordnya
 +
        nastype=other
 +
        shortname=localnet
 +
}
 +
 +
 +
 +
Edit file /etc/freeradius/radiusd.conf, pastikan pada entry accounting diaktifkan "sql", kira-kira seperti,
 +
 +
accounting {
 +
        detail
 +
        sql
 +
}
 +
 +
 +
Copy directionary.ser ke /etc/freeradius
 +
 +
# cp /var/www/CDRTool/setup/radius/OpenSER/dictionary.ser /etc/freeradius
 +
 +
 +
----
 +
 +
Pastikan OpenSER sudah di instalasi, ada baiknya menggunakan cara meng-[[Compile OpenSER]].
 +
 +
Jika kita meng-[[Compile OpenSER]] maka kita perlu mengedit file /usr/local/etc/openser/openser.cfg
 +
 +
# vi /usr/local/etc/openser/openser.cfg
 +
 +
Tambahkan parameter berikut adalah Accounting dilakukan menggunakan FreeRadius & CDRTool
 +
 +
loadmodule "acc.so"
 +
 +
modparam("acc", "failed_transaction_flag", 1)
 +
modparam("acc", "report_cancels",    0)
 +
modparam("acc", "report_ack",        0)
 +
modparam("acc", "early_media",        0)
 +
 +
modparam("acc", "log_level",          1)
 +
modparam("acc", "log_flag",          1)
 +
modparam("acc", "log_missed_flag",    1)
 +
 +
modparam("acc", "radius_config",      "/usr/local/etc/openser/radius/client.conf")
 +
modparam("acc", "radius_flag",        1)
 +
modparam("acc", "radius_missed_flag", 1)
 +
modparam("acc", "radius_extra",      "User-Name=$Au; \
 +
                                        Calling-Station-Id=$from; \
 +
                                        Called-Station-Id=$to; \
 +
                                        Sip-Translated-Request-URI=$ruri; \
 +
                                        Sip-RPid=$avp(s:rpid); \
 +
                                        Source-IP=$si; \
 +
                                        Source-Port=$sp; \
 +
                                        Canonical-URI=$avp(s:can_uri); \
 +
                                        Billing-Party=$avp(billing_party); \
 +
                                        Divert-Reason=$avp(s:divert_reason); \
 +
                                        X-RTP-Stat=$hdr(X-RTP-Stat); \
 +
                                        User-Agent=$hdr(user-agent); \
 +
                                        Contact=$hdr(contact); \
 +
                                        Event=$hdr(event); \
 +
                                        SIP-Proxy-IP=$avp(s:sip_proxy_ip); \
 +
                                        ENUM-TLD=$avp(s:enum_tld)")
 +
 +
 +
Selanjutnya kita perlu menambahkan perintah berikut di banyak lokasi di route.
 +
 +
route {
 +
        ...
 +
        setflag(ACCOUNTING_FLAG);
 +
        $avp(s:can_uri) = $ru;
 +
        ...
 +
}
 +
 +
 +
Pada saat kita meng-[[Compile OpenSer]] tampaknya di folder konfigurasi OpenSER /etc/openser atau /usr/loca/etc/openser sudah ada file
 +
 +
dictionary.radius
 +
 +
Jika anda ingin yang lebih lengkap, copykan dictionary.ser ke folder /etc/openser/radius. Jika mengcompile, maka gunakan perintah berikut,
 +
 +
# cp /var/www/CDRTool/setup/radius/OpenSER/dictionary.ser /user/local/etc/openser/
 +
 +
Jika anda meng-[[Instalasi OpenSER]] menggunakan apt-get, maka gunakan perintah berikut,
 +
 +
# cp /var/www/CDRTool/setup/radius/OpenSER/dictionary.ser /etc/openser/
 +
  
  
Line 30: Line 356:
 
==Pranala Menarik==
 
==Pranala Menarik==
  
 +
* [[OpenSER Softswitch]]
 
* [[VoIP]]
 
* [[VoIP]]

Latest revision as of 15:18, 17 July 2008

Tingkat kesulitan menginstalasi CDRTool cukup tinggi, kemungkinan gagal sangat besar.


Siapkan software pendukung

# apt-get install apache2 libapache2-mod-php5 php5 php5-cli php5-mysql \
php5-curl php-pear php-soap mrtg php5-memcache memcached monit smarty

Download Source Code CDRTool dari situs

http://cdrtool.ag-projects.com/
http://download.dns-hosting.info/CDRTool/


Siapkan database CDRTool di MySQL

# mysql -u root -p
Enter password: 
mysql> create database cdrtool;
mysql> grant INSERT,SELECT on root.* to cdradmin@localhost;
mysql> grant INSERT,SELECT on root.* to locker@localhost;
mysql> GRANT ALL ON cdrtool.* TO cdradmin@localhost IDENTIFIED by 'PASSWORD'; 
mysql> GRANT ALL ON cdrtool.* TO cdradmin IDENTIFIED by 'PASSWORD'; 
mysql> GRANT ALL ON cdrtool.* TO locker@localhost IDENTIFIED by 'lockadm18';
mysql> GRANT ALL ON cdrtool.* TO locker IDENTIFIED by 'lockadm18';
mysql> exit


Instalasi yang mudah mungkin

# cp -Rf cdrtool_6.4.1_all.deb /usr/local/src/
# cd /usr/local/src/
# dpkg -i cdrtool_6.4.1_all.deb


Lakuan

# cd /var/www/CDRTool/setup/mysql
# mysql -u root -p<password-root> mysql < ./create_users.mysql
# mysql -u root -p<password-root> cdrtool < ./create_tables.mysql
# mysql -u root -p<password-root> cdrtool < ./create_data.mysql

Alternatif lain yang mungkin bisa dilakukan juga adalah

# ./setup_mysql.sh <password-root-MySQL> <ip-address-database-server>


Copykan setup Apache Web Server

# cd /var/www/CDRTool
# cp setup/apache2/conf.d/cdrtool /etc/apache2/conf.d/
# cp setup/apache2/sites-available/cdrtool.example.com /etc/apache2/sites-enabled


Edit file

# vi /etc/apache2/sites-enabled/cdrtool.example.com


Pastikan isinya

<VirtualHost sipcdr.example.com:443>
  ServerName          sipcdr.example.com
  DocumentRoot        /var/www/
  CustomLog           /var/log/apache2/cdrtool-access.log combined
  ErrorLog            /var/log/apache2/cdrtool-errors.log
  SetEnvIf User-Agent ".*MSIE.*"      nokeepalive ssl-unclean-shutdown
  # To enable SSL:
  # a2enmode ssl
  # add Listen 443 to ports.conf file
  # generate site certificates
  # SSLEngine           On
  # SSLCertificateFile    /etc/apache2/ssl/snakeoil-rsa.crt
  # SSLCertificateKeyFile /etc/apache2/ssl/snakeoil-rsa.key
  # RewriteEngine is required for Multimedia Service Platform
  #
  # a2enmode rewrite proxy
  # RewriteEngine       On
  # RewriteRule         ^/ngnpro/voicemail/(.*) http://10.0.0.1:9200/$1 [L,P]
  # RewriteRule         ^/ngnpro/(.*) http://10.0.0.2:9200/$1 [L,P]
  # ProxyVia            On
  # <Proxy *>
  #      Order Allow,Deny
  #      Allow from all
  # </Proxy>
       <Directory /var/www/CDRTool>
               Options FollowSymLinks
               AllowOverride All
       </Directory>
</VirtualHost>


Atau yang lebih sederhana

<VirtualHost cdrtool.example.com:80>
  ServerName          cdrtool.example.com
  DocumentRoot        /var/www/
  CustomLog           /var/log/apache2/cdrtool-access.log combined
  ErrorLog            /var/log/apache2/cdrtool-errors.log
  SetEnvIf User-Agent ".*MSIE.*"      nokeepalive ssl-unclean-shutdown
  # To enable SSL:
  # a2enmode ssl
  # add Listen 443 to ports.conf file
  # generate site certificates
  # SSLEngine           On
  # SSLCertificateFile    /etc/apache2/ssl/snakeoil-rsa.crt
  # SSLCertificateKeyFile /etc/apache2/ssl/snakeoil-rsa.key
</VirtualHost>



Edit /etc/default/cdrtool

# vi /etc/default/cdrtool

Pastikan

RUN_ratingEngine=yes
START_MEMCACHE=yes


Edit konfigurasi

# cp /var/www/CDRTool/setup/global.inc.new.installation /var/www/CDRTool/


Edit global.inc

# vi /var/www/CDRTool/global.inc


Pastikan


$RatingEngine=array("socketIP"   => "127.0.0.1",
                   "socketPort" => "9024",
                   "CDRS_class" => "ser_radius",
                   "prepaid_lock" => true,
                   "log_delay"   => 0.05
                   );



$CDRTool['normalize']['defaultCountryCode']      = "62";



###########################################
# CDRTool datasources
class DB_CDRTool extends DB_Sql {
 var $Host     = "127.0.0.1.";
 var $Database = "cdrtool";
 var $User     = "cdradmin";
 var $Password = "PASSWORD";
 var $Halt_On_Error ="yes";
}
class DB_Locker extends DB_Sql {
 var $Host     = "127.0.0.1.";
 var $Database = "cdrtool";
 var $User     = "locker";
 var $Password = "PASSWORD";
 var $Halt_On_Error ="no";
}
class DB_radius extends DB_Sql {
 var $Host     = "127.0.0.1.";
 var $Database = "radius";
 var $User     = "radius";
 var $Password = "PASSWORD";
 var $Halt_On_Error ="no";
}
class DB_radius2 extends DB_Sql {
 var $Host     = "127.0.0.1.";
 var $Database = "radius";
 var $User     = "radius";
 var $Password = "PASSWORD";
 var $Halt_On_Error ="no";
}





# set IP server
if ($_SERVER['REMOTE_ADDR']=="192.168.0.2") {
   //$verbose=1;
} else {
   // prevent set of verbose via post/get
   unset($verbose);




Restart

# /etc/init.d/cdrtool restart
# /etc/init.d/apache2 restart
# /etc/init.d/cdrtool startmemcache


Mencoba akses ke

http://localhost/CDRTool/index.phtml

Username password default admin/admin



Untuk konfigurasi yang lebih kompleks yang melibatkan FreeRADIUS dapat meneruskan mengkonfigurasi perintah berikut.




Bersihkan sampah dll secara periodik

# cp /var/www/CDRTool/setup/crontabs/cdrtool /var/spool/cron/crontabs/




Siapkan FreeRadius Server

# apt-get install freeradius freeradius-mysql
# mysqladmin -u root -p create radius
Enter password: <masukan password root MySQL>
# cp /usr/share/doc/freeradius/examples/mysql.sql.gz /usr/local/src/
# cd /usr/local/src
# gunzip mysql.sql.gz 
# mysql -u root -p radius < /usr/local/src/mysql.sql
Enter password: <masukan password root MySQL>

Patch radacct untuk OpenSER

# /var/www/CDRTool/setup/radius/OpenSER/radacct-patch.sh 
Please type in MySQL root password (^C to abort): <masukan password root MySQL>
# cp /var/www/CDRTool/setup/radius/OpenSER/sql.conf /etc/freeradius/sql.conf  

Edit file /etc/freeradius/clients.conf, pastikan ada konfigurasi client yang akan tersambung, misalnya ..

client 192.168.0.0/16 {
        secret=rahasiabangetpasswordnya
        nastype=other
        shortname=localnet
}


Edit file /etc/freeradius/radiusd.conf, pastikan pada entry accounting diaktifkan "sql", kira-kira seperti,

accounting {
        detail
        sql
}


Copy directionary.ser ke /etc/freeradius

# cp /var/www/CDRTool/setup/radius/OpenSER/dictionary.ser /etc/freeradius



Pastikan OpenSER sudah di instalasi, ada baiknya menggunakan cara meng-Compile OpenSER.

Jika kita meng-Compile OpenSER maka kita perlu mengedit file /usr/local/etc/openser/openser.cfg

# vi /usr/local/etc/openser/openser.cfg

Tambahkan parameter berikut adalah Accounting dilakukan menggunakan FreeRadius & CDRTool

loadmodule "acc.so"
modparam("acc", "failed_transaction_flag", 1)
modparam("acc", "report_cancels",     0)
modparam("acc", "report_ack",         0)
modparam("acc", "early_media",        0) 
modparam("acc", "log_level",          1)
modparam("acc", "log_flag",           1)
modparam("acc", "log_missed_flag",    1)
modparam("acc", "radius_config",      "/usr/local/etc/openser/radius/client.conf")
modparam("acc", "radius_flag",        1)
modparam("acc", "radius_missed_flag", 1)
modparam("acc", "radius_extra",       "User-Name=$Au; \
                                       Calling-Station-Id=$from; \
                                       Called-Station-Id=$to; \
                                       Sip-Translated-Request-URI=$ruri; \
                                       Sip-RPid=$avp(s:rpid); \
                                       Source-IP=$si; \
                                       Source-Port=$sp; \
                                       Canonical-URI=$avp(s:can_uri); \
                                       Billing-Party=$avp(billing_party); \
                                       Divert-Reason=$avp(s:divert_reason); \
                                       X-RTP-Stat=$hdr(X-RTP-Stat); \
                                       User-Agent=$hdr(user-agent); \ 
                                       Contact=$hdr(contact); \
                                       Event=$hdr(event); \
                                       SIP-Proxy-IP=$avp(s:sip_proxy_ip); \
                                       ENUM-TLD=$avp(s:enum_tld)") 


Selanjutnya kita perlu menambahkan perintah berikut di banyak lokasi di route.

route {
       ...
       setflag(ACCOUNTING_FLAG);
       $avp(s:can_uri) = $ru;
       ...
}


Pada saat kita meng-Compile OpenSer tampaknya di folder konfigurasi OpenSER /etc/openser atau /usr/loca/etc/openser sudah ada file

dictionary.radius

Jika anda ingin yang lebih lengkap, copykan dictionary.ser ke folder /etc/openser/radius. Jika mengcompile, maka gunakan perintah berikut,

# cp /var/www/CDRTool/setup/radius/OpenSER/dictionary.ser /user/local/etc/openser/

Jika anda meng-Instalasi OpenSER menggunakan apt-get, maka gunakan perintah berikut,

# cp /var/www/CDRTool/setup/radius/OpenSER/dictionary.ser /etc/openser/



Pranala Menarik