設定 VtigerCRM
設定權限
chmod -R a+rw /var/www/html/vtigercrm/
chown -R asterisk:asterisk /var/www/html/vtigercrm/
設定 PHP 的建議參數
cd /var/www/html/vtigercrm
mv htaccess.txt .htaccess
vi .htaccess
.htaccess :
Options -Indexes
php_value max_execution_time 600
php_flag display_errors on
php_flag allow_call_time_pass_reference on
php_flag log_errors off
php_value error_reporting "2 8 8192"
新增一個 Apache 設定檔
/etc/httpd/conf.d/vtigercrm.conf(Ubuntu:/etc/apache2/conf.d)
<Directory "/var/www/html/vtigercrm">
Options Indexes FollowSymLinks
AllowOverride Options
Order allow,deny
Allow from all
</Directory>
Tips:
* 目錄路徑 /var/www/html/vtigercrm 必需正確。
* 如果不使用分開的 Apache 設定檔,會影響到 FreePBX 的運用。
重啟 Apache 服務
使用瀏覽器,輸入 123.123.123.123/vtigercrm,以介面方式來安裝。
選擇 Install > Agree > PHP 建議參數偵測
註:如果有出現紅字,必須先作修正,IMAP Support 必須有安裝 Webmail 模組。
Next >
Database Information
HostName = localhost
UserName = db_user
Password = db_pass
DatabaseName = db_name
[*] Create Database 如果尚未建立料庫,這要勾選,且必須在下方輸入 root 帳號密碼
CRM Configuration
URL = 首頁網址
Currnecy Name = 幣別
User Configuration
Password = 管理密碼
Email = 管理者信箱
確認所有設定 > Next > 選擇所有模組 > Next >
系統開始安裝
Finish
電話整合的設定
- 設定 Asterisk 連結
Vtiger Admin > Settings > Module Manager > PBX Manager Settings
Asterisk Server IP = localhost
Asterisk Server Port = 5038
Asterisk Username = vtigercrm
Asterisk Password = THISisPASS
Asterisk Version = 這裡無法選擇,請直接修改資料庫 vtigercrm520.vtiger_asterisk。 - 為 admin 設定一個分機號碼
Vtiger Admin > Settings > Users > Edit
Asterisk Extension = 分機號
Receive Incoming Calls = [勾選]
設定有電話來電時,可以跳出訊息視窗
下載 AsteriskClient.php for Vtiger 5.2.0
cp 520AsteriskClient.php /var/www/html/vtigercrm/cron/modules/PBXManager/
chown asterisk:asterisk /var/www/html/vtigercrm/cron/modules/PBXManager/520AsteriskClient.php
chmod 0755 /var/www/html/vtigercrm/cron/modules/PBXManager/520AsteriskClient.php
測試 520AsteriskClient.php
cd /var/www/html/vtigercrm/cron/modules/PBXManager/
php 520AsteriskClient.php
正常應該要出現:
Connecting to asterisk server @ 2011-08-01 09:57:21
Connected successfully
Trying to login to asterisk
Logged in successfully to asterisk server
設定這個程序保持運行中
新增一個啟動的 PHP 檔 或 BASH
PHP: /var/www/html/vtigercrm/cron/modules/PBXManager/cron-inbound-popup.php
reference to undefined name 'syntax' Exception of type 'MindTouch.Deki.Script.Runtime.DekiScriptUndefinedNameException' was thrown. (click for details)Callstack:
at User:alang/Private_Zone/整合_VtigerCRM_與_Asterisk
MindTouch.Deki.Script.Runtime.DekiScriptUndefinedNameException: reference to undefined name 'syntax' Exception of type 'MindTouch.Deki.Script.Runtime.DekiScriptUndefinedNameException' was thrown.
at MindTouch.Deki.Script.Compiler.DekiScriptExpressionEvaluation.Visit (MindTouch.Deki.Script.Expr.DekiScriptVar expr, DekiScriptExpressionEvaluationState state) [0x00000] in <filename unknown>:0
at MindTouch.Deki.Script.Expr.DekiScriptVar.VisitWith[DekiScriptExpressionEvaluationState,Range] (IDekiScriptExpressionVisitor`2 visitor, DekiScriptExpressionEvaluationState state) [0x00000] in <filename unknown>:0
at MindTouch.Deki.Script.Compiler.DekiScriptExpressionEvaluation.Evaluate (MindTouch.Deki.Script.Expr.DekiScriptAccess expr, DekiScriptExpressionEvaluationState state, Boolean evaluateProperties) [0x00000] in <filename unknown>:0
at MindTouch.Deki.Script.Compiler.DekiScriptExpressionEvaluation.Visit (MindTouch.Deki.Script.Expr.DekiScriptAccess expr, DekiScriptExpressionEvaluationState state) [0x00000] in <filename unknown>:0
at MindTouch.Deki.Script.Expr.DekiScriptAccess.VisitWith[DekiScriptExpressionEvaluationState,Range] (IDekiScriptExpressionVisitor`2 visitor, DekiScriptExpressionEvaluationState state) [0x00000] in <filename unknown>:0
at MindTouch.Deki.Script.Compiler.DekiScriptExpressionEvaluation.Visit (MindTouch.Deki.Script.Expr.DekiScriptCall expr, DekiScriptExpressionEvaluationState state) [0x00000] in <filename unknown>:0
at MindTouch.Deki.Script.Expr.DekiScriptCall.VisitWith[DekiScriptExpressionEvaluationState,Range] (IDekiScriptExpressionVisitor`2 visitor, DekiScriptExpressionEvaluationState state) [0x00000] in <filename unknown>:0
at MindTouch.Deki.Script.Compiler.DekiScriptExpressionEvaluation.Visit (MindTouch.Deki.Script.Expr.DekiScriptSequence expr, DekiScriptExpressionEvaluationState state) [0x00000] in <filename unknown>:0
at MindTouch.Deki.Script.Expr.DekiScriptSequence.VisitWith[DekiScriptExpressionEvaluationState,Range] (IDekiScriptExpressionVisitor`2 visitor, DekiScriptExpressionEvaluationState state) [0x00000] in <filename unknown>:0
at MindTouch.Deki.Script.Compiler.DekiScriptExpressionEvaluation.Visit (MindTouch.Deki.Script.Expr.DekiScriptReturnScope expr, DekiScriptExpressionEvaluationState state) [0x00000] in <filename unknown>:0
BASH: /var/www/html/vtigercrm/cron/modules/PBXManager/cron-inbound-popup.sh
#!/bin/bash
PROG="530AsteriskClient_ast18_fix_by_alang.php";
WORK_DIR="/var/www/html/vtigerCRM/cron/modules/PBXManager";
DEBUG="no";
DEBUG_LOG="/tmp/vtiger_AMI.log";
RUN=$(ps -ef | grep $PROG | grep -v grep >/dev/null ; echo $?)
if [ $RUN -ne 0 ];then
if [ $DEBUG = "yes" -o $DEBUG = "Yes" ];then
cd $WORK_DIR && nohup php $PROG > $DEBUG_LOG &
else
cd $WORK_DIR && nohup php $PROG > /dev/null &
fi
fi
/etc/crontab
# for VtigerCRM
*/5 * * * * root /usr/bin/php /var/www/html/vtigercrm/cron/modules/PBXManager/cron-inbound-popup.php&
設定網頁撥號
編輯 /var/www/html/vtigercrm/modules/PBXManager/utils/AsteriskClass.php
reference to undefined name 'syntax' Exception of type 'MindTouch.Deki.Script.Runtime.DekiScriptUndefinedNameException' was thrown. (click for details)Callstack:
at User:alang/Private_Zone/整合_VtigerCRM_與_Asterisk
MindTouch.Deki.Script.Runtime.DekiScriptUndefinedNameException: reference to undefined name 'syntax' Exception of type 'MindTouch.Deki.Script.Runtime.DekiScriptUndefinedNameException' was thrown.
at MindTouch.Deki.Script.Compiler.DekiScriptExpressionEvaluation.Visit (MindTouch.Deki.Script.Expr.DekiScriptVar expr, DekiScriptExpressionEvaluationState state) [0x00000] in <filename unknown>:0
at MindTouch.Deki.Script.Expr.DekiScriptVar.VisitWith[DekiScriptExpressionEvaluationState,Range] (IDekiScriptExpressionVisitor`2 visitor, DekiScriptExpressionEvaluationState state) [0x00000] in <filename unknown>:0
at MindTouch.Deki.Script.Compiler.DekiScriptExpressionEvaluation.Evaluate (MindTouch.Deki.Script.Expr.DekiScriptAccess expr, DekiScriptExpressionEvaluationState state, Boolean evaluateProperties) [0x00000] in <filename unknown>:0
at MindTouch.Deki.Script.Compiler.DekiScriptExpressionEvaluation.Visit (MindTouch.Deki.Script.Expr.DekiScriptAccess expr, DekiScriptExpressionEvaluationState state) [0x00000] in <filename unknown>:0
at MindTouch.Deki.Script.Expr.DekiScriptAccess.VisitWith[DekiScriptExpressionEvaluationState,Range] (IDekiScriptExpressionVisitor`2 visitor, DekiScriptExpressionEvaluationState state) [0x00000] in <filename unknown>:0
at MindTouch.Deki.Script.Compiler.DekiScriptExpressionEvaluation.Visit (MindTouch.Deki.Script.Expr.DekiScriptCall expr, DekiScriptExpressionEvaluationState state) [0x00000] in <filename unknown>:0
at MindTouch.Deki.Script.Expr.DekiScriptCall.VisitWith[DekiScriptExpressionEvaluationState,Range] (IDekiScriptExpressionVisitor`2 visitor, DekiScriptExpressionEvaluationState state) [0x00000] in <filename unknown>:0
at MindTouch.Deki.Script.Compiler.DekiScriptExpressionEvaluation.Visit (MindTouch.Deki.Script.Expr.DekiScriptSequence expr, DekiScriptExpressionEvaluationState state) [0x00000] in <filename unknown>:0
at MindTouch.Deki.Script.Expr.DekiScriptSequence.VisitWith[DekiScriptExpressionEvaluationState,Range] (IDekiScriptExpressionVisitor`2 visitor, DekiScriptExpressionEvaluationState state) [0x00000] in <filename unknown>:0
at MindTouch.Deki.Script.Compiler.DekiScriptExpressionEvaluation.Visit (MindTouch.Deki.Script.Expr.DekiScriptReturnScope expr, DekiScriptExpressionEvaluationState state) [0x00000] in <filename unknown>:0
Tips:
from-internal 是在 Asterisk 用來撥出的 context。