SERWEB Menggunakan OpenSER

From OnnoWiki
Jump to navigation Jump to search

Install software pendukung

# pear install MDB2
# pear install DB
# pear install lOG
# pear install XML_RPC

Install runkit karena Ubuntu terbaru mengunakan PHP 5

# apt-get install php5-dev
# pecl install -f runkit

Kemungkinan gagal tinggi dalam menginstalasi runkit masih banyak bug di runkit, kalau ada punya nyali ada baiknya mengedit source code runkit jika terjadi bug

# cd /tmp/pear/cache/runkit-0.9/
# vi runkit_import.c

Buang kalimat

#ifdef ZEND_ENGINE_2
   zend_unmangle_property_name(key, &cname, &pname);
#endif

Save file runkit_import.c, lakukan

# ./configure
# make
# make install
# make test (untuk melihat apakah runkit berjala dengan benar)

Jangan lupa mengaktifkan extension runkit.so tersebut

# vi /etc/php5/apache2/php.ini

Pastikan ada

extension=runkit.so

Jangan lupa untuk me-restart Apache Web Server

# /etc/init.d/apache2 restart



Ambil source code SERWEB dari

http://ftp.iptel.org/pub/serweb/

Copykan source code SERWEB ke Folder Web

# cp serweb-0.9.6.tar.gz /var/www/
# cd /var/www
# tar zxvf serweb-0.9.6.tar.gz
# mv serweb-0.9.6 serweb
# chown -Rf www-data /var/www/serweb


# cp -Rf /var/www/serweb/phplib/ /var/www
# chown -Rf www-data /var/www/phplib



Edit konfigurasi Apache agar ada alias utk SERWEB

# vi /etc/apache2/httpd.conf

Isi dengan entry

Alias /serweb "/var/www/serweb/html"


Ubah konfigurasi SERWEB agar sesuai dengan OpenSER ikuti langkah yang dijelaskan di VoIP-Info http://www.voip-info.org/wiki/view/OpenSER+1.1.x+and+SerWEB+0.9.4 sebagai berikut ..




Edit file /var/www/serweb/config/config_data_layer.php

# vi /var/www/serweb/config/config_data_layer.php

Ubah parameter berikut agar cocok dengan openser

$i=0;
$config->data_sql->host[$i]['host']="localhost";        //database host
$config->data_sql->host[$i]['port']="";                 //database port - leave empty for default
$config->data_sql->host[$i]['name']="openser";          //database name
$config->data_sql->host[$i]['user']="openser";          //database conection user
$config->data_sql->host[$i]['pass']="openserrw";        //database conection password
// If you want to configure additional backup SQL servers, do so below.
/*
$i++;
$config->data_sql->host[$i]['host']="localhost";        //database host
$config->data_sql->host[$i]['port']="";                 //database port - leave empty for default
$config->data_sql->host[$i]['name']="openser";          //database name
$config->data_sql->host[$i]['user']="openser";          //database conection user
$config->data_sql->host[$i]['pass']="openserrw";        //database conection password
*/
// If you want to configure more SQL backup servers, copy and paste the above (including the "$i++;")


Lanjut ..

- $config->data_sql->table_user_preferences_types="preferences_types";
+ $config->data_sql->table_user_preferences_types="usr_preferences_types";


Lanjut

- $config->fifo_server="/tmp/ser_fifo";
+ $config->fifo_server="/tmp/openser_fifo";



Edit /var/www/serweb/config/config_paths.php

# vi /var/www/serweb/config/config_paths.php

Edit

- $config->fifo_server="/tmp/ser_fifo";
+ $config->fifo_server="/tmp/openser_fifo";



Edit /var/www/serweb/data_layer/method.add_contact.php

# vi /var/www/serweb/data_layer/method.add_contact.php 

Lakukan

-
- ($config->ul_replication ? 			// if replication is supported by FIFO 
-		$replication."\n":
-		"").
-
- ($config->ul_flags ?				// if flags is supported by FIFO
-		$flags."\n":
-		"").
-
- "\n";
+ "0\n128\n4294967295\n"; // replication/flags/methods 



Edit /var/www/serweb/data_layer/method.add_new_alias.php

# vi /var/www/serweb/data_layer/method.add_new_alias.php 


Lakukan

+ "0\n128\n4294967295\n"; // replication/flags/methods
- ($config->ul_replication ? 			// if replication is supported by FIFO 
-		$replication."\n":
-		"").
-
- ($config->ul_flags ?				// if flags is supported by FIFO
-		$flags."\n":
-		"").
-
-	"\n";



Edit /var/www/serweb/data_layer/method.get_acc_entries.php

# vi /var/www/serweb/data_layer/method.get_acc_entries.php

Lakukan pada line 301

$q = "(".$this->acc_sql['select_out'].", 'outgoing' as call_type ".
         $this->acc_sql['from_1'].
         $this->acc_sql['where_1']." and ".$this->get_indexing_sql_where_phrase($user, 't1.caller_UUID', 't1.username', 't1.domain').
- "and t1.caller_deleted != '1' ".
      ")";
      else
$q = "(".$this->acc_sql['select_out'].", 'outgoing' as call_type ".
         $this->acc_sql['from_1'].
         $this->acc_sql['where_1']." and ".$this->get_indexing_sql_where_phrase($user, 't1.caller_UUID', 't1.username', 't1.domain').
- "and t1.caller_deleted != '1' ".
     ") union (".
         $this->acc_sql['select_out'].", 'outgoing' as call_type ".
         $this->acc_sql['from_2'].
         $this->acc_sql['where_2']." and ".$this->get_indexing_sql_where_phrase($user, 't2.callee_UUID', 't2.username', 't2.domain').
- "and t2.callee_deleted != '1' ".
      ")";
return $q;
	

Lakukan pada line 326

if ($config->users_indexed_by=='uuid'){
    $q[] = "select count(*) ".
    $this->acc_sql['from_1'].
-   $this->acc_sql['where_1']." and ".$this->get_indexing_sql_where_phrase($user, 't1.caller_UUID', 't1.username', 't1.domain').
-   " and t1.caller_deleted != '1' ";
+   $this->acc_sql['where_1']." and ".$this->get_indexing_sql_where_phrase($user, 't1.caller_UUID', 't1.username', 't1.domain');
 }
else{
$q[] = "select count(*) ".
    $this->acc_sql['from_1'].
-   $this->acc_sql['where_1']." and ".$this->get_indexing_sql_where_phrase($user, 't1.caller_UUID', 't1.username', 't1.domain').
-   " and t1.caller_deleted != '1' ";
+   $this->acc_sql['where_1']." and ".$this->get_indexing_sql_where_phrase($user, 't1.caller_UUID', 't1.username', 't1.domain');
$q[] = "select count(*) ".
    $this->acc_sql['from_2'].
-   $this->acc_sql['where_2']." and ".$this->get_indexing_sql_where_phrase($user, 't2.callee_UUID', 't2.username', 't2.domain').
-   " and t2.callee_deleted != '1' ";
+   $this->acc_sql['where_2']." and ".$this->get_indexing_sql_where_phrase($user, 't2.callee_UUID', 't2.username', 't2.domain');
 }
return $q;	
}




Edit /var/www/serweb/html/main_prepend.php

# vi /var/www/serweb/html/main_prepend.php

Lakukan edit pada line 38

require_once 'DB.php';

//require PEAR XML_RPC class
-require_once 'XML/RPC.php';
-require_once ($_SERWEB["serwebdir"] . "xml_rpc_patch.php");
+//require_once 'XML/RPC.php';
+//require_once ($_SERWEB["serwebdir"] . "xml_rpc_patch.php");



Langkah lain. Ambil file patch di atas di http://www.openser.org/downloads/serweb-0.9.4-openser-1.1.0.patch.

Lakukan patch pada serweb-0.9.4.tar.gz sebagai berikut

# tar xvfz serweb-0.9.4.tar.gz
# cd serweb-0.9.4
# patch -p1<serweb-0.9.4-openser-1.1.0.patch




Pranala Menarik