diff --git a/bin/ADMIN_keepalive_ALL.pl b/bin/ADMIN_keepalive_ALL.pl index c0db1194..6822c31d 100644 --- a/bin/ADMIN_keepalive_ALL.pl +++ b/bin/ADMIN_keepalive_ALL.pl @@ -566,7 +566,7 @@ if ( ($active_asterisk_server =~ /Y/) && ($generate_vicidial_conf =~ /Y/) && ($r $iax .= "register => $server_id:test\@$server_ip[$i]:4569\n"; $Lext .= "; Remote Server VDAD extens: $server_id[$i] $server_ip[$i]\n"; - $Lext .= "exten => _$VARremDIALstr*.,1,Dial(\${TRUNK$server_id[$i]}/\${EXTEN:16},55,o)\n"; + $Lext .= "exten => _$VARremDIALstr*.,1,Dial(\${TRUNK$server_id[$i]}/\${EXTEN:16},55,oT)\n"; $Liax .= "\n"; $Liax .= "[$server_id[$i]]\n"; diff --git a/docs/AGENT_API.txt b/docs/AGENT_API.txt index 98cacc72..995c6f84 100644 --- a/docs/AGENT_API.txt +++ b/docs/AGENT_API.txt @@ -141,6 +141,8 @@ dial_prefix - OPTIONAL, any dial prefix that you want to add to the beginning of the dial string for this call group_alias - OPTIONAL, the outbound callerID(from an existing group-alias) that you want to use for this call +vtiger_callback - + OPTIONAL, YES or NO, will lookup the phone number and Vtiger account ID from the provided Event ID RESPONSES: ERROR: external_dial not valid - 7275551212|1|YES|6666 @@ -148,6 +150,7 @@ ERROR: agent_user is not allowed to place manual dial calls - 6666 ERROR: agent_user is not logged in - 6666 ERROR: caller_id_number from group_alias is not valid - 6666|TESTING|123 ERROR: group_alias is not valid - 6666|TESTING +ERROR: vtiger callback activity does not exist in vtiger system - 12345 SUCCESS: external_dial function set - 7275551212|1|YES|1232020456|6666 diff --git a/docs/VTIGER.txt b/docs/VTIGER.txt index 99afdfa6..c8904dd1 100644 --- a/docs/VTIGER.txt +++ b/docs/VTIGER.txt @@ -11,6 +11,7 @@ Current integration features: - Added ViciDial status synchronization after each call to set the siccode field in Vtiger to the last selected VICIDIAL status - Ability to un-delete or resurrect deleted Accounts within Vtiger from the web form(this is a VICIDIAL campaign option) - Ability to click-to-dial a phone number from a record in Vtiger screen to the vicidial.php screen +- Ability to click-to-dial from a Planned Activity record then have it changed to Held after VICIDIAL dispo - Ability for an agent to click on a VC fax log or VC email log link to account for fax or email time through VICIDIAL - Optional script to bulk load leads into Vtiger from a CSV file since Vtiger only seems to want to load 500 at a time: Vtiger_IN_new_accounts_file.pl @@ -22,6 +23,8 @@ There has been a basic vtiger integration option available in VICIDIAL since the More in-depth integration with Vtiger is a bit complicated due to the fact that it has 312 database tables to start with(and you though VICIDIAL had a lot with about 70). Attempts at using the built-in 5.0.4 API structure were unsuccessful because of inaccurate documentation and the inability to use the modules easily outside of the vtiger directory tree without major reworking of the vtiger code, so we decided to have VICIDIAL work directly with the database instead. Unfortunately, working only with the database doesn't get you the whole way with Vtiger. For user synchronization you need to make sure that the patch(Vtiger504_vicidial.patch) is applied to Vtiger(see instructions below). Part of this patch is used to create blank user profile files so Vtiger will load properly with synchronized users from VICIDIAL. Vtiger doesn't check to see if these user profile files exist before trying to use them, so one thing this patch does is check if the files exist for each user, and if they do not, it will create them with a simple placeholder. Another purpose of this patch is to allow for click-to-dial phone numbers in Vtiger, so that the numbers will be dialed as manual dial calls in a VICIDIAL agent screen. For this to work you must have applied the patch, you need to have user 1000 set up in VICIDIAL with a password of 1234 and Agent API set to '1', and the agent needs to be logged into vicidial.php(there is also a VICIDIAL Campaign Detail option to automatically login to Vtiger when an agent logs into vicidial.php, this can log the agent into Vtiger within the SCRIPT tab or by opening a new browser window) then when the agent clicks on any phone number with a "VCcall:" label next to it, a call will be placed in their vicidial.php agent screen and the Vtiger window will be closed(or left open if using alternate patch) so that they can open it up again with the vicidial.php WEB FORM button in VICIDIAL. +Since the 2.0.5 release we have added the ability to initiate a callback from a Planned Event screen that also will alter the event to Held status after the call is dispositioned. + as of 2008-12-31, several user synchronization features have been added to allow for the creation of vtiger users from the vicidial_users user database. The vtiger_search.php script has also been updated to work with the current vtiger release 5.0.4. To enable the Vtiger integration features you will need to go to the Admin -> System Settings section of the admin.php Administration web page to set Vtiger Integration to enabled and configure the connection details for the Vtiger database. There are options in the VICIDIAL Modify Campaign Detail screen that you can choose how you want the vtiger_search.php to search for a Vtiger record in the Vtiger system. If Vtiger integration is enabled in the system_settings then this setting will define where the vtiger_search.php page will search for the phone number that was entered. There are 4 options that can be used in this field: @@ -98,8 +101,8 @@ ls -l * change default admin(vtadmin) and standarduser(vtuser) passwords * click to install vtiger, then follow the on-screen instructions # patch vtiger to fix issue with user synchronization and add click-to-dial: -wget http://www.eflo.net/files/Vtiger504_vicidial.patch -patch -p1 < ./Vtiger504_vicidial.patch +cp /usr/src/astguiclient/trunk/extras/Vtiger504_vicidial_005.patch ./ +patch -p1 < ./Vtiger504_vicidial_005.patch diff --git a/extras/Vtiger504_vicidial.patch b/extras/Vtiger504_vicidial_005.patch similarity index 91% rename from extras/Vtiger504_vicidial.patch rename to extras/Vtiger504_vicidial_005.patch index 0d0f3b09..1c60f91c 100644 --- a/extras/Vtiger504_vicidial.patch +++ b/extras/Vtiger504_vicidial_005.patch @@ -75,75 +75,6 @@ {elseif $keyid eq '15' || $keyid eq '16' || $keyid eq '111'} {foreach item=arr from=$keyoptions} ---- ./vtigerservice.php 2009-01-26 20:13:22.000000000 -0500 -+++ ./vtigerservice.php 2009-01-26 22:16:02.000000000 -0500 -@@ -42,6 +42,58 @@ - } - else - { -+ if(isset($_REQUEST['VCcall'])) -+ { -+ $CL=':'; -+ $server_name = getenv("SERVER_NAME"); -+ $server_port = getenv("SERVER_PORT"); -+ if (eregi("443",$server_port)) {$HTTPprotocol = 'https://';} -+ else {$HTTPprotocol = 'http://';} -+ if (($server_port == '80') or ($server_port == '443') ) {$server_port='';} -+ else {$server_port = "$CL$server_port";} -+ $URLbase = "$HTTPprotocol$server_name$server_port"; -+ -+ global $entityDel; -+ global $display; -+ global $category; -+ header('Content-Type: text/html; charset='. $charset); -+ session_start(); -+ require_once('include/utils/utils.php'); -+ require_once('config.inc.php'); -+ $default_config_values = Array( "allow_exports"=>"all","upload_maxsize"=>"3000000", "listview_max_textlength" => "40" ); -+ set_default_config($default_config_values); -+ require_once('include/logging.php'); -+ require_once('modules/Users/Users.php'); -+ global $currentModule; -+ $current_user = new Users(); -+ -+ $log =& LoggerManager::getLogger('index'); -+ global $seclog; -+ $seclog =& LoggerManager::getLogger('SECURITY'); -+ $log->debug($_REQUEST); -+ -+ // Check to see if there is an authenticated user in the session. -+ if(isset($_SESSION["authenticated_user_id"]) && (isset($_SESSION["app_unique_key"]) && $_SESSION["app_unique_key"] == $application_unique_key)) -+ { -+ $log->debug("We have an authenticated user id: ".$_SESSION["authenticated_user_id"]); -+ $result = $current_user->retrieveCurrentUserInfoFromFile($_SESSION['authenticated_user_id']); -+ $log->debug('Current user is: '.$current_user->user_name); -+ } -+ -+ $phone = $_REQUEST['phone']; $vendor_id = $_REQUEST['vendor_id']; -+ $user = $current_user->user_name; -+ -+ $VCapiURL = "/agc/api.php"; -+ $VCpauseQuery = "?source=vtiger&user=1000&pass=1234&agent_user=$user&function=external_pause&value=PAUSE"; -+ $VCcallQuery = "?source=vtiger&user=1000&pass=1234&agent_user=$user&function=external_dial&value=$phone&phone_code=1&search=YES&preview=NO&focus=YES&vendor_id=$vendor_id"; -+ $replyP = file("$URLbase$VCapiURL$VCpauseQuery"); -+// sleep(1); -+ $replyC = file("$URLbase$VCapiURL$VCcallQuery"); -+ echo "$replyP[0]|$replyC[0]\n"; -+// echo "$URLbase$VCapiURL$VCcallQuery\n"; -+ } -+ else -+ { - echo "

vtigerCRM Soap Services

"; - echo "
  • vtigerCRM Outlook Plugin EndPoint URL -- Click here
  • "; - echo "
  • vtigerCRM Word Plugin EndPoint URL -- Click here
  • "; -@@ -49,6 +101,7 @@ - echo "
  • vtigerCRM Customer Portal EndPoint URL -- Click here
  • "; - echo "
  • vtigerCRM WebForm EndPoint URL -- Click here
  • "; - echo "
  • vtigerCRM FireFox Extension EndPoint URL -- Click here
  • "; -+ } - } - - --- ./include/js/dtlviewajax.js 2009-01-26 13:59:25.000000000 -0500 +++ ./include/js/dtlviewajax.js 2009-01-26 15:02:33.000000000 -0500 @@ -293,6 +293,9 @@ @@ -204,9 +135,10 @@ {if $MODULE eq 'Quotes' || $MODULE eq 'PurchaseOrder' || $MODULE eq 'SalesOrder' || $MODULE eq 'Invoice'} {if $CREATEPDF eq 'permitted'}   + --- ./include/js/general.js 2008-03-10 08:54:31.000000000 -0400 -+++ ./include/js/general.js 2009-03-26 20:07:23.000000000 -0400 -@@ -1768,6 +1768,68 @@ ++++ ./include/js/general.js 2009-04-07 19:31:16.000000000 -0400 +@@ -1768,6 +1768,77 @@ openPopUp('xComposeEmail',this,url,'createemailWin',830,662,opts); } @@ -233,6 +165,15 @@ + } +if (xmlhttp) + { ++ var callback_flag=''; ++ if (field_name=='CallBack') ++ { ++ var log_call = record_id + ''; ++ while (log_call.length < 10) ++ {log_call = "0" + log_call;} ++ phone = "99" + log_call; ++ callback_flag = '&callback=1'; ++ } + if (field_name=='fax') + { + var log_call = record_id + ''; @@ -247,7 +188,7 @@ + {log_call = "0" + log_call;} + phone = "19" + log_call; + } -+ var VCcallQuery = "VCcall=1&phone=" + phone + "&vendor_id=" + record_id; ++ var VCcallQuery = "VCcall=1&phone=" + phone + "&vendor_id=" + record_id + '' + callback_flag; + xmlhttp.open('POST', 'vtigerservice.php'); + xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8'); + xmlhttp.send(VCcallQuery); @@ -275,3 +216,91 @@ function fnHide_Event(obj){ document.getElementById(obj).style.visibility = 'hidden'; } +--- ./vtigerservice.php 2008-03-10 08:54:31.000000000 -0400 ++++ ./vtigerservice.php 2009-04-07 19:16:44.000000000 -0400 +@@ -42,6 +42,63 @@ + } + else + { ++ if(isset($_REQUEST['VCcall'])) ++ { ++ $CL=':'; ++ $server_name = getenv("SERVER_NAME"); ++ $server_port = getenv("SERVER_PORT"); ++ if (eregi("443",$server_port)) {$HTTPprotocol = 'https://';} ++ else {$HTTPprotocol = 'http://';} ++ if (($server_port == '80') or ($server_port == '443') ) {$server_port='';} ++ else {$server_port = "$CL$server_port";} ++ $URLbase = "$HTTPprotocol$server_name$server_port"; ++ ++ $callback_flag=''; ++ if(isset($_REQUEST['callback'])) ++ { ++ $callback_flag = '&vtiger_callback=YES'; ++ } ++ global $entityDel; ++ global $display; ++ global $category; ++ header('Content-Type: text/html; charset='. $charset); ++ session_start(); ++ require_once('include/utils/utils.php'); ++ require_once('config.inc.php'); ++ $default_config_values = Array( "allow_exports"=>"all","upload_maxsize"=>"3000000", "listview_max_textlength" => "40" ); ++ set_default_config($default_config_values); ++ require_once('include/logging.php'); ++ require_once('modules/Users/Users.php'); ++ global $currentModule; ++ $current_user = new Users(); ++ ++ $log =& LoggerManager::getLogger('index'); ++ global $seclog; ++ $seclog =& LoggerManager::getLogger('SECURITY'); ++ $log->debug($_REQUEST); ++ ++ // Check to see if there is an authenticated user in the session. ++ if(isset($_SESSION["authenticated_user_id"]) && (isset($_SESSION["app_unique_key"]) && $_SESSION["app_unique_key"] == $application_unique_key)) ++ { ++ $log->debug("We have an authenticated user id: ".$_SESSION["authenticated_user_id"]); ++ $result = $current_user->retrieveCurrentUserInfoFromFile($_SESSION['authenticated_user_id']); ++ $log->debug('Current user is: '.$current_user->user_name); ++ } ++ ++ $phone = $_REQUEST['phone']; $vendor_id = $_REQUEST['vendor_id']; ++ $user = $current_user->user_name; ++ ++ $VCapiURL = "/agc/api.php"; ++ $VCpauseQuery = "?source=vtiger&user=1000&pass=1234&agent_user=$user&function=external_pause&value=PAUSE"; ++ $VCcallQuery = "?source=vtiger&user=1000&pass=1234&agent_user=$user&function=external_dial&value=$phone&phone_code=1&search=YES&preview=NO&focus=YES&vendor_id=$vendor_id$callback_flag"; ++ $replyP = file("$URLbase$VCapiURL$VCpauseQuery"); ++// sleep(1); ++ $replyC = file("$URLbase$VCapiURL$VCcallQuery"); ++ echo "$replyP[0]|$replyC[0]\n"; ++// echo "$URLbase$VCapiURL$VCcallQuery\n"; ++ } ++ else ++ { + echo "

    vtigerCRM Soap Services

    "; + echo "
  • vtigerCRM Outlook Plugin EndPoint URL -- Click here
  • "; + echo "
  • vtigerCRM Word Plugin EndPoint URL -- Click here
  • "; +@@ -49,6 +106,7 @@ + echo "
  • vtigerCRM Customer Portal EndPoint URL -- Click here
  • "; + echo "
  • vtigerCRM WebForm EndPoint URL -- Click here
  • "; + echo "
  • vtigerCRM FireFox Extension EndPoint URL -- Click here
  • "; ++ } + } + + +--- ./Smarty/templates/ActivityDetailView.tpl 2008-03-10 08:54:31.000000000 -0400 ++++ ./Smarty/templates/ActivityDetailView.tpl 2009-04-07 18:50:36.000000000 -0400 +@@ -104,7 +104,10 @@ + + {strip} + {/strip} + +
    +- {$header} ++ {$header}               ++ {if $ACTIVITYDATA.eventstatus eq 'Planned'} ++ VCcall: Place VC Callback ++ {/if} +
    diff --git a/extras/Vtiger504_vicidial_noclose.patch b/extras/Vtiger504_vicidial_005_noclose.patch similarity index 90% rename from extras/Vtiger504_vicidial_noclose.patch rename to extras/Vtiger504_vicidial_005_noclose.patch index 63a059af..5140a92a 100644 --- a/extras/Vtiger504_vicidial_noclose.patch +++ b/extras/Vtiger504_vicidial_005_noclose.patch @@ -75,75 +75,6 @@ {elseif $keyid eq '15' || $keyid eq '16' || $keyid eq '111'} {foreach item=arr from=$keyoptions} ---- ./vtigerservice.php 2009-01-26 20:13:22.000000000 -0500 -+++ ./vtigerservice.php 2009-01-26 22:16:02.000000000 -0500 -@@ -42,6 +42,58 @@ - } - else - { -+ if(isset($_REQUEST['VCcall'])) -+ { -+ $CL=':'; -+ $server_name = getenv("SERVER_NAME"); -+ $server_port = getenv("SERVER_PORT"); -+ if (eregi("443",$server_port)) {$HTTPprotocol = 'https://';} -+ else {$HTTPprotocol = 'http://';} -+ if (($server_port == '80') or ($server_port == '443') ) {$server_port='';} -+ else {$server_port = "$CL$server_port";} -+ $URLbase = "$HTTPprotocol$server_name$server_port"; -+ -+ global $entityDel; -+ global $display; -+ global $category; -+ header('Content-Type: text/html; charset='. $charset); -+ session_start(); -+ require_once('include/utils/utils.php'); -+ require_once('config.inc.php'); -+ $default_config_values = Array( "allow_exports"=>"all","upload_maxsize"=>"3000000", "listview_max_textlength" => "40" ); -+ set_default_config($default_config_values); -+ require_once('include/logging.php'); -+ require_once('modules/Users/Users.php'); -+ global $currentModule; -+ $current_user = new Users(); -+ -+ $log =& LoggerManager::getLogger('index'); -+ global $seclog; -+ $seclog =& LoggerManager::getLogger('SECURITY'); -+ $log->debug($_REQUEST); -+ -+ // Check to see if there is an authenticated user in the session. -+ if(isset($_SESSION["authenticated_user_id"]) && (isset($_SESSION["app_unique_key"]) && $_SESSION["app_unique_key"] == $application_unique_key)) -+ { -+ $log->debug("We have an authenticated user id: ".$_SESSION["authenticated_user_id"]); -+ $result = $current_user->retrieveCurrentUserInfoFromFile($_SESSION['authenticated_user_id']); -+ $log->debug('Current user is: '.$current_user->user_name); -+ } -+ -+ $phone = $_REQUEST['phone']; $vendor_id = $_REQUEST['vendor_id']; -+ $user = $current_user->user_name; -+ -+ $VCapiURL = "/agc/api.php"; -+ $VCpauseQuery = "?source=vtiger&user=1000&pass=1234&agent_user=$user&function=external_pause&value=PAUSE"; -+ $VCcallQuery = "?source=vtiger&user=1000&pass=1234&agent_user=$user&function=external_dial&value=$phone&phone_code=1&search=YES&preview=NO&focus=YES&vendor_id=$vendor_id"; -+ $replyP = file("$URLbase$VCapiURL$VCpauseQuery"); -+// sleep(1); -+ $replyC = file("$URLbase$VCapiURL$VCcallQuery"); -+ echo "$replyP[0]|$replyC[0]\n"; -+// echo "$URLbase$VCapiURL$VCcallQuery\n"; -+ } -+ else -+ { - echo "

    vtigerCRM Soap Services

    "; - echo "
  • vtigerCRM Outlook Plugin EndPoint URL -- Click here
  • "; - echo "
  • vtigerCRM Word Plugin EndPoint URL -- Click here
  • "; -@@ -49,6 +101,7 @@ - echo "
  • vtigerCRM Customer Portal EndPoint URL -- Click here
  • "; - echo "
  • vtigerCRM WebForm EndPoint URL -- Click here
  • "; - echo "
  • vtigerCRM FireFox Extension EndPoint URL -- Click here
  • "; -+ } - } - - --- ./include/js/dtlviewajax.js 2009-01-26 13:59:25.000000000 -0500 +++ ./include/js/dtlviewajax.js 2009-01-26 15:02:33.000000000 -0500 @@ -293,6 +293,9 @@ @@ -204,9 +135,10 @@ {if $MODULE eq 'Quotes' || $MODULE eq 'PurchaseOrder' || $MODULE eq 'SalesOrder' || $MODULE eq 'Invoice'} {if $CREATEPDF eq 'permitted'}   + --- ./include/js/general.js 2008-03-10 08:54:31.000000000 -0400 -+++ ./include/js/general.js 2009-03-26 20:07:23.000000000 -0400 -@@ -1768,6 +1768,64 @@ ++++ ./include/js/general.js 2009-04-07 19:31:16.000000000 -0400 +@@ -1768,6 +1768,73 @@ openPopUp('xComposeEmail',this,url,'createemailWin',830,662,opts); } @@ -233,6 +165,15 @@ + } +if (xmlhttp) + { ++ var callback_flag=''; ++ if (field_name=='CallBack') ++ { ++ var log_call = record_id + ''; ++ while (log_call.length < 10) ++ {log_call = "0" + log_call;} ++ phone = "99" + log_call; ++ callback_flag = '&callback=1'; ++ } + if (field_name=='fax') + { + var log_call = record_id + ''; @@ -247,7 +188,7 @@ + {log_call = "0" + log_call;} + phone = "19" + log_call; + } -+ var VCcallQuery = "VCcall=1&phone=" + phone + "&vendor_id=" + record_id; ++ var VCcallQuery = "VCcall=1&phone=" + phone + "&vendor_id=" + record_id + '' + callback_flag; + xmlhttp.open('POST', 'vtigerservice.php'); + xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8'); + xmlhttp.send(VCcallQuery); @@ -271,3 +212,91 @@ function fnHide_Event(obj){ document.getElementById(obj).style.visibility = 'hidden'; } +--- ./vtigerservice.php 2008-03-10 08:54:31.000000000 -0400 ++++ ./vtigerservice.php 2009-04-07 19:16:44.000000000 -0400 +@@ -42,6 +42,63 @@ + } + else + { ++ if(isset($_REQUEST['VCcall'])) ++ { ++ $CL=':'; ++ $server_name = getenv("SERVER_NAME"); ++ $server_port = getenv("SERVER_PORT"); ++ if (eregi("443",$server_port)) {$HTTPprotocol = 'https://';} ++ else {$HTTPprotocol = 'http://';} ++ if (($server_port == '80') or ($server_port == '443') ) {$server_port='';} ++ else {$server_port = "$CL$server_port";} ++ $URLbase = "$HTTPprotocol$server_name$server_port"; ++ ++ $callback_flag=''; ++ if(isset($_REQUEST['callback'])) ++ { ++ $callback_flag = '&vtiger_callback=YES'; ++ } ++ global $entityDel; ++ global $display; ++ global $category; ++ header('Content-Type: text/html; charset='. $charset); ++ session_start(); ++ require_once('include/utils/utils.php'); ++ require_once('config.inc.php'); ++ $default_config_values = Array( "allow_exports"=>"all","upload_maxsize"=>"3000000", "listview_max_textlength" => "40" ); ++ set_default_config($default_config_values); ++ require_once('include/logging.php'); ++ require_once('modules/Users/Users.php'); ++ global $currentModule; ++ $current_user = new Users(); ++ ++ $log =& LoggerManager::getLogger('index'); ++ global $seclog; ++ $seclog =& LoggerManager::getLogger('SECURITY'); ++ $log->debug($_REQUEST); ++ ++ // Check to see if there is an authenticated user in the session. ++ if(isset($_SESSION["authenticated_user_id"]) && (isset($_SESSION["app_unique_key"]) && $_SESSION["app_unique_key"] == $application_unique_key)) ++ { ++ $log->debug("We have an authenticated user id: ".$_SESSION["authenticated_user_id"]); ++ $result = $current_user->retrieveCurrentUserInfoFromFile($_SESSION['authenticated_user_id']); ++ $log->debug('Current user is: '.$current_user->user_name); ++ } ++ ++ $phone = $_REQUEST['phone']; $vendor_id = $_REQUEST['vendor_id']; ++ $user = $current_user->user_name; ++ ++ $VCapiURL = "/agc/api.php"; ++ $VCpauseQuery = "?source=vtiger&user=1000&pass=1234&agent_user=$user&function=external_pause&value=PAUSE"; ++ $VCcallQuery = "?source=vtiger&user=1000&pass=1234&agent_user=$user&function=external_dial&value=$phone&phone_code=1&search=YES&preview=NO&focus=YES&vendor_id=$vendor_id$callback_flag"; ++ $replyP = file("$URLbase$VCapiURL$VCpauseQuery"); ++// sleep(1); ++ $replyC = file("$URLbase$VCapiURL$VCcallQuery"); ++ echo "$replyP[0]|$replyC[0]\n"; ++// echo "$URLbase$VCapiURL$VCcallQuery\n"; ++ } ++ else ++ { + echo "

    vtigerCRM Soap Services

    "; + echo "
  • vtigerCRM Outlook Plugin EndPoint URL -- Click here
  • "; + echo "
  • vtigerCRM Word Plugin EndPoint URL -- Click here
  • "; +@@ -49,6 +106,7 @@ + echo "
  • vtigerCRM Customer Portal EndPoint URL -- Click here
  • "; + echo "
  • vtigerCRM WebForm EndPoint URL -- Click here
  • "; + echo "
  • vtigerCRM FireFox Extension EndPoint URL -- Click here
  • "; ++ } + } + + +--- ./Smarty/templates/ActivityDetailView.tpl 2008-03-10 08:54:31.000000000 -0400 ++++ ./Smarty/templates/ActivityDetailView.tpl 2009-04-07 18:50:36.000000000 -0400 +@@ -104,7 +104,10 @@ + + {strip} + {/strip} + +
    +- {$header} ++ {$header}               ++ {if $ACTIVITYDATA.eventstatus eq 'Planned'} ++ VCcall: Place VC Callback ++ {/if} +
    diff --git a/www/agc/SCRIPT_busy_button.php b/www/agc/SCRIPT_busy_button.php new file mode 100644 index 00000000..92dcf517 --- /dev/null +++ b/www/agc/SCRIPT_busy_button.php @@ -0,0 +1,102 @@ + +# +# Copyright (C) 2009 Matt Florell LICENSE: AGPLv2 +# +########## DB SCHEMA +# CREATE TABLE qr_busy_button_log ( +# button_id INT(9) UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL, +# lead_id INT(9) UNSIGNED, +# event_time DATETIME, +# user VARCHAR(20), +# stage ENUM('DISPLAY','CLICK'), +# campaign_id VARCHAR(8), +# phone_number VARCHAR(18), +# vendor_lead_code VARCHAR(20), +# list_id BIGINT(14) UNSIGNED, +# click_seconds INT(5) UNSIGNED, +# index (lead_id) +# ); + +if (isset($_GET["button_id"])) {$button_id=$_GET["button_id"];} + elseif (isset($_POST["button_id"])) {$button_id=$_POST["button_id"];} +if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];} + elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];} +if (isset($_GET["vendor_id"])) {$vendor_id=$_GET["vendor_id"];} + elseif (isset($_POST["vendor_id"])) {$vendor_id=$_POST["vendor_id"];} +if (isset($_GET["list_id"])) {$list_id=$_GET["list_id"];} + elseif (isset($_POST["list_id"])) {$list_id=$_POST["list_id"];} +if (isset($_GET["phone_number"])) {$phone_number=$_GET["phone_number"];} + elseif (isset($_POST["phone_number"])) {$phone_number=$_POST["phone_number"];} +if (isset($_GET["user"])) {$user=$_GET["user"];} + elseif (isset($_POST["user"])) {$user=$_POST["user"];} +if (isset($_GET["campaign"])) {$campaign=$_GET["campaign"];} + elseif (isset($_POST["campaign"])) {$campaign=$_POST["campaign"];} +if (isset($_GET["stage"])) {$stage=$_GET["stage"];} + elseif (isset($_POST["stage"])) {$stage=$_POST["stage"];} +if (isset($_GET["epoch"])) {$epoch=$_GET["epoch"];} + elseif (isset($_POST["epoch"])) {$epoch=$_POST["epoch"];} + +### security strip all non-alphanumeric characters out of the variables ### +$button_id=ereg_replace("[^0-9]","",$button_id); +$lead_id=ereg_replace("[^0-9]","",$lead_id); +$list_id=ereg_replace("[^0-9]","",$list_id); +$phone_number=ereg_replace("[^0-9]","",$phone_number); +$vendor_id = ereg_replace("[^- \:\/\_0-9a-zA-Z]","",$vendor_id); +$user=ereg_replace("[^0-9a-zA-Z]","",$user); +$campaign = ereg_replace("[^-\_0-9a-zA-Z]","",$campaign); +$stage = ereg_replace("[^-\_0-9a-zA-Z]","",$stage); +$epoch = ereg_replace("[^0-9]","",$epoch); + +require("dbconnect.php"); + +if (eregi("CLICK",$stage)) + { + $epochNOW = date("U"); + $click_seconds = ($epochNOW - $epoch); + if ( ($click_seconds < 0) or ($click_seconds > 3600) ) + {$click_seconds=0;} + + $stmt="UPDATE qr_busy_button_log SET stage='$stage',click_seconds='$click_seconds' where button_id='$button_id';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + echo "Thank you for clicking the button\n"; + + exit; + } + +else + { + $CL=':'; + $script_name = getenv("SCRIPT_NAME"); + $server_name = getenv("SERVER_NAME"); + $server_port = getenv("SERVER_PORT"); + if (eregi("443",$server_port)) {$HTTPprotocol = 'https://';} + else {$HTTPprotocol = 'http://';} + if (($server_port == '80') or ($server_port == '443') ) {$server_port='';} + else {$server_port = "$CL$server_port";} + $agcPAGE = "$HTTPprotocol$server_name$server_port$script_name"; + + $epoch = date("U"); + $SQLdate = date("Y-m-d H:i:s"); + + $stmt="INSERT INTO qr_busy_button_log SET lead_id='$lead_id',list_id='$list_id',phone_number='$phone_number',vendor_lead_code='$vendor_id',user='$user',campaign_id='$campaign',stage='DISPLAY',event_time='$SQLdate';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $button_id = mysql_insert_id($link); + + echo "
    \n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
    \n\n"; + } + +?> + diff --git a/www/agc/api.php b/www/agc/api.php index 84e462f5..bc8827d3 100644 --- a/www/agc/api.php +++ b/www/agc/api.php @@ -22,6 +22,7 @@ # - $dial_prefix # - $source - ('vtiger','webform','adminweb') # - $format - ('text','debug') +# - $vtiger_callback - ('YES','NO') # CHANGELOG: # 80703-2225 - First build of script @@ -29,10 +30,11 @@ # 90118-1051 - Added logging of API functions # 90128-0229 - Added vendor_id to dial function # 90303-0723 - Added group alias and dial prefix +# 90407-1920 - Added vtiger_callback option for external_dial function # -$version = '2.0.5-5'; -$build = '90303-0723'; +$version = '2.0.5-6'; +$build = '90407-1920'; require("dbconnect.php"); @@ -67,9 +69,8 @@ if (isset($_GET["source"])) {$source=$_GET["source"];} elseif (isset($_POST["source"])) {$source=$_POST["source"];} if (isset($_GET["format"])) {$format=$_GET["format"];} elseif (isset($_POST["format"])) {$format=$_POST["format"];} - -$group_alias = ereg_replace("[^0-9a-zA-Z]","",$group_alias); -$dial_prefix = ereg_replace("[^0-9a-zA-Z]","",$dial_prefix); +if (isset($_GET["vtiger_callback"])) {$vtiger_callback=$_GET["vtiger_callback"];} + elseif (isset($_POST["vtiger_callback"])) {$vtiger_callback=$_POST["vtiger_callback"];} header ("Content-type: text/html; charset=utf-8"); header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 @@ -109,6 +110,7 @@ $group_alias = ereg_replace("[^0-9a-zA-Z]","",$group_alias); $dial_prefix = ereg_replace("[^0-9a-zA-Z]","",$dial_prefix); $source = ereg_replace("[^0-9a-zA-Z]","",$source); $format = ereg_replace("[^0-9a-zA-Z]","",$format); +$vtiger_callback = ereg_replace("[^A-Z]","",$vtiger_callback); } ### date and fixed variables @@ -439,7 +441,105 @@ if ($function == 'external_dial') exit; } } - $stmt="UPDATE vicidial_live_agents set external_dial='$value!$phone_code!$search!$preview!$focus!$vendor_id!$epoch!$dial_prefix!$group_alias!$caller_id_number' where user='$agent_user';"; + + ####### Begin Vtiger CallBack Launching ####### + $vtiger_callback_id=''; + if ( (eregi("YES",$vtiger_callback)) and (preg_match("/^99/",$value)) ) + { + $value = preg_replace("/^99/",'',$value); + $value = ($value + 0); + + $stmt = "SELECT enable_vtiger_integration,vtiger_server_ip,vtiger_dbname,vtiger_login,vtiger_pass,vtiger_url FROM system_settings;"; + $rslt=mysql_query($stmt, $link); + $ss_conf_ct = mysql_num_rows($rslt); + if ($ss_conf_ct > 0) + { + $row=mysql_fetch_row($rslt); + $enable_vtiger_integration = $row[0]; + $vtiger_server_ip = $row[1]; + $vtiger_dbname = $row[2]; + $vtiger_login = $row[3]; + $vtiger_pass = $row[4]; + $vtiger_url = $row[5]; + } + + if ($enable_vtiger_integration > 0) + { + $stmt = "SELECT campaign_id FROM vicidial_live_agents where user='$agent_user';"; + $rslt=mysql_query($stmt, $link); + $vtc_camp_ct = mysql_num_rows($rslt); + if ($vtc_camp_ct > 0) + { + $row=mysql_fetch_row($rslt); + $campaign_id = $row[0]; + } + $stmt = "SELECT vtiger_search_category,vtiger_create_call_record,vtiger_create_lead_record,vtiger_search_dead,vtiger_status_call FROM vicidial_campaigns where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $vtc_conf_ct = mysql_num_rows($rslt); + if ($vtc_conf_ct > 0) + { + $row=mysql_fetch_row($rslt); + $vtiger_search_category = $row[0]; + $vtiger_create_call_record = $row[1]; + $vtiger_create_lead_record = $row[2]; + $vtiger_search_dead = $row[3]; + $vtiger_status_call = $row[4]; + } + + ### connect to your vtiger database + $linkV=mysql_connect("$vtiger_server_ip", "$vtiger_login","$vtiger_pass"); + if (!$linkV) {die("Could not connect: $vtiger_server_ip|$vtiger_dbname|$vtiger_login|$vtiger_pass" . mysql_error());} + mysql_select_db("$vtiger_dbname", $linkV); + + # make sure the ID is present in Vtiger database as an account + $stmt="SELECT count(*) from vtiger_seactivityrel where activityid='$value';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $linkV); + $vt_act_ct = mysql_num_rows($rslt); + if ($vt_act_ct > 0) + { + $row=mysql_fetch_row($rslt); + $activity_check = $row[0]; + } + if ($activity_check > 0) + { + $stmt="SELECT crmid from vtiger_seactivityrel where activityid='$value';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $linkV); + $vt_actsel_ct = mysql_num_rows($rslt); + if ($vt_actsel_ct > 0) + { + $row=mysql_fetch_row($rslt); + $vendor_id = $row[0]; + } + if (strlen($vendor_id) > 0) + { + $stmt="SELECT phone from vtiger_account where accountid='$vendor_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $linkV); + $vt_acct_ct = mysql_num_rows($rslt); + if ($vt_acct_ct > 0) + { + $row=mysql_fetch_row($rslt); + $vtiger_callback_id="$value"; + $value = $row[0]; + } + } + } + else + { + $result = 'ERROR'; + $result_reason = "vtiger callback activity does not exist in vtiger system"; + echo "$result: $result_reason - $value\n"; + api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data); + exit; + } + } + } + ####### End Vtiger CallBack Launching ####### + + ### If no errors, run the update to place the call ### + $stmt="UPDATE vicidial_live_agents set external_dial='$value!$phone_code!$search!$preview!$focus!$vendor_id!$epoch!$dial_prefix!$group_alias!$caller_id_number!$vtiger_callback_id' where user='$agent_user';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); $result = 'SUCCESS'; diff --git a/www/agc/conf_exten_check.php b/www/agc/conf_exten_check.php index dd338763..726c59e1 100644 --- a/www/agc/conf_exten_check.php +++ b/www/agc/conf_exten_check.php @@ -43,10 +43,11 @@ # 90102-1402 - Added check for system and database time synchronization # 90120-1720 - Added compatibility for API pause/resume and dial a number # 90307-1855 - Added shift enforcement to send logout flag if outside of shift hours +# 90408-0020 - Added API vtiger specific callback activity record ability # -$version = '2.0.5-18'; -$build = '90307-1855'; +$version = '2.2.0-19'; +$build = '90408-0020'; $mel=1; # Mysql Error Log enabled = 1 $mysql_log_count=17; $one_mysql_log=0; diff --git a/www/agc/vdc_db_query.php b/www/agc/vdc_db_query.php index eace6b67..a5687f3a 100644 --- a/www/agc/vdc_db_query.php +++ b/www/agc/vdc_db_query.php @@ -83,6 +83,7 @@ # - $agent_dialed_number - ('1','') # - $agent_dialed_type - ('MANUAL_OVERRIDE','MANUAL_DIALNOW','MANUAL_PREVIEW',...) # - $wrapup - ('WRAPUP','') +# - $vtiger_callback_id - ('16534'...) # # CHANGELOG: # 50629-1044 - First build of script @@ -195,10 +196,11 @@ # 90323-2013 - Added function to put phone numbers in the DNC lists if they were set to status type dnc=Y # 90324-1316 - Added functions to log calls to Vtiger accounts and update status to siccode # 90327-1348 - Changed Vtiger status populate to use status name +# 90408-0021 - Added API vtiger specific callback activity record ability # -$version = '2.2.0-107'; -$build = '90327-1348'; +$version = '2.2.0-108'; +$build = '90408-0021'; $mel=1; # Mysql Error Log enabled = 1 $mysql_log_count=212; $one_mysql_log=0; @@ -366,7 +368,8 @@ if (isset($_GET["agent_dialed_type"])) {$agent_dialed_type=$_GET["agent_diale elseif (isset($_POST["agent_dialed_type"])) {$agent_dialed_type=$_POST["agent_dialed_type"];} if (isset($_GET["wrapup"])) {$wrapup=$_GET["wrapup"];} elseif (isset($_POST["wrapup"])) {$wrapup=$_POST["wrapup"];} - +if (isset($_GET["vtiger_callback_id"])) {$vtiger_callback_id=$_GET["vtiger_callback_id"];} + elseif (isset($_POST["vtiger_callback_id"])) {$vtiger_callback_id=$_POST["vtiger_callback_id"];} header ("Content-type: text/html; charset=utf-8"); @@ -3586,48 +3589,101 @@ if ($ACTION == 'updateDISPO') if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkV,$mel,$stmt,'00200',$user,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); $user_id = $row[0]; - - # Get next aviable id from vtiger_crmentity_seq to use as activityid in vtiger_crmentity - $stmt="SELECT id from vtiger_crmentity_seq ;"; - if ($DB) {echo "$stmt\n";} - $rslt=mysql_query($stmt, $linkV); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkV,$mel,$stmt,'00201',$user,$server_ip,$session_name,$one_mysql_log);} - $row=mysql_fetch_row($rslt); - $activityid = ($row[0] + 1); - # Increase next aviable crmid with 1 so next record gets proper id - $stmt="UPDATE vtiger_crmentity_seq SET id = '$activityid';"; - if ($DB) {echo "$stmt\n";} - $rslt=mysql_query($stmt, $linkV); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkV,$mel,$stmt,'00202',$user,$server_ip,$session_name,$one_mysql_log);} - - #Insert values into vtiger_salesmanactivityrel - $stmt = "INSERT INTO vtiger_salesmanactivityrel SET smid='$user_id',activityid='$activityid';"; - if ($DB) {echo "|$stmt|\n";} - $rslt=mysql_query($stmt, $linkV); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkV,$mel,$stmt,'00203',$user,$server_ip,$session_name,$one_mysql_log);} - if ($DB) {echo "|$leadid|\n";} - - #Insert values into vtiger_seactivityrel - $stmt = "INSERT INTO vtiger_seactivityrel SET crmid='$vendor_id',activityid='$activityid';"; - if ($DB) {echo "|$stmt|\n";} - $rslt=mysql_query($stmt, $linkV); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkV,$mel,$stmt,'00204',$user,$server_ip,$session_name,$one_mysql_log);} - if ($DB) {echo "|$leadid|\n";} - - #Insert values into vtiger_crmentity - $stmt = "INSERT INTO vtiger_crmentity (crmid, smcreatorid, smownerid, modifiedby, setype, description, createdtime, modifiedtime, viewedtime, status, version, presence, deleted) VALUES ('$activityid', '$user_id', '$user_id','$user_id', 'Calendar', 'VICIDIAL Call user $user', '$NOW_TIME', '$NOW_TIME', '$NOW_TIME', NULL, '0', '1', '0');"; - if ($DB) {echo "|$stmt|\n";} - $rslt=mysql_query($stmt, $linkV); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkV,$mel,$stmt,'00205',$user,$server_ip,$session_name,$one_mysql_log);} - if ($DB) {echo "|$leadid|\n";} + ## if numbered callback activity record, alter existing record + $vtiger_callback_modified=0; + if ($vtiger_callback_id > 0) + { + # make sure the ID is present in Vtiger database as an account + $stmt="SELECT count(*) from vtiger_seactivityrel where activityid='$vtiger_callback_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $linkV); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkV,$mel,$stmt,'00213',$user,$server_ip,$session_name,$one_mysql_log);} + $vt_act_ct = mysql_num_rows($rslt); + if ($vt_act_ct > 0) + { + $row=mysql_fetch_row($rslt); + $activity_check = $row[0]; + } + if ($activity_check > 0) + { + $act_description=''; + $stmt="SELECT description from vtiger_crmentity where crmid='$vtiger_callback_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $linkV); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkV,$mel,$stmt,'00214',$user,$server_ip,$session_name,$one_mysql_log);} + $vt_actd_ct = mysql_num_rows($rslt); + if ($vt_actd_ct > 0) + { + $row=mysql_fetch_row($rslt); + $act_description = $row[0]; + } + $act_subject=''; + $stmt="SELECT subject from vtiger_activity where activityid='$vtiger_callback_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $linkV); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkV,$mel,$stmt,'00215',$user,$server_ip,$session_name,$one_mysql_log);} + $vt_actd_ct = mysql_num_rows($rslt); + if ($vt_actd_ct > 0) + { + $row=mysql_fetch_row($rslt); + $act_subject = $row[0]; + } - #Insert values into vtiger_activity - $stmt = "INSERT INTO vtiger_activity SET activityid='$activityid',subject='VC Call: $status_name',activitytype='Call',date_start='$TODAY',due_date='$TODAY',time_start='$HHMMnow',time_end='$HHMMend',sendnotification='0',duration_hours='0',duration_minutes='1',status='',eventstatus='Held',priority='Medium',location='VICIDIAL User $user',notime='0',visibility='Public',recurringtype='--None--';"; - if ($DB) {echo "|$stmt|\n";} - $rslt=mysql_query($stmt, $linkV); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkV,$mel,$stmt,'00206',$user,$server_ip,$session_name,$one_mysql_log);} - if ($DB) {echo "|$leadid|\n";} + $stmt = "UPDATE vtiger_crmentity SET modifiedby='$user_id', description='$act_description - VICIDIAL Call user $user',modifiedtime='$NOW_TIME',viewedtime='$NOW_TIME' where crmid='$vtiger_callback_id';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $linkV); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkV,$mel,$stmt,'00216',$user,$server_ip,$session_name,$one_mysql_log);} + $stmt = "UPDATE vtiger_activity SET subject='VC Call: $status_name - $act_subject',date_start='$TODAY',time_start='$HHMMnow',time_end='$HHMMend',eventstatus='Held' where activityid='$vtiger_callback_id';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $linkV); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkV,$mel,$stmt,'00217',$user,$server_ip,$session_name,$one_mysql_log);} + $vtiger_callback_modified=1; + } + } + + ## create new activity record + if ($vtiger_callback_modified < 1) + { + # Get next aviable id from vtiger_crmentity_seq to use as activityid in vtiger_crmentity + $stmt="SELECT id from vtiger_crmentity_seq ;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $linkV); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkV,$mel,$stmt,'00201',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $activityid = ($row[0] + 1); + + # Increase next aviable crmid with 1 so next record gets proper id + $stmt="UPDATE vtiger_crmentity_seq SET id = '$activityid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $linkV); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkV,$mel,$stmt,'00202',$user,$server_ip,$session_name,$one_mysql_log);} + + #Insert values into vtiger_salesmanactivityrel + $stmt = "INSERT INTO vtiger_salesmanactivityrel SET smid='$user_id',activityid='$activityid';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $linkV); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkV,$mel,$stmt,'00203',$user,$server_ip,$session_name,$one_mysql_log);} + + #Insert values into vtiger_seactivityrel + $stmt = "INSERT INTO vtiger_seactivityrel SET crmid='$vendor_id',activityid='$activityid';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $linkV); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkV,$mel,$stmt,'00204',$user,$server_ip,$session_name,$one_mysql_log);} + + #Insert values into vtiger_crmentity + $stmt = "INSERT INTO vtiger_crmentity (crmid, smcreatorid, smownerid, modifiedby, setype, description, createdtime, modifiedtime, viewedtime, status, version, presence, deleted) VALUES ('$activityid', '$user_id', '$user_id','$user_id', 'Calendar', 'VICIDIAL Call user $user', '$NOW_TIME', '$NOW_TIME', '$NOW_TIME', NULL, '0', '1', '0');"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $linkV); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkV,$mel,$stmt,'00205',$user,$server_ip,$session_name,$one_mysql_log);} + + #Insert values into vtiger_activity + $stmt = "INSERT INTO vtiger_activity SET activityid='$activityid',subject='VC Call: $status_name',activitytype='Call',date_start='$TODAY',due_date='$TODAY',time_start='$HHMMnow',time_end='$HHMMend',sendnotification='0',duration_hours='0',duration_minutes='1',status='',eventstatus='Held',priority='Medium',location='VICIDIAL User $user',notime='0',visibility='Public',recurringtype='--None--';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $linkV); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkV,$mel,$stmt,'00206',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "|$leadid|\n";} + } } ### update the status of the record in vtiger if (ereg('Y',$vtiger_status_call)) diff --git a/www/agc/vicidial.php b/www/agc/vicidial.php index aa92bc36..96f50d04 100644 --- a/www/agc/vicidial.php +++ b/www/agc/vicidial.php @@ -225,10 +225,11 @@ # 90315-1009 - Changed revision for new trunk 2.2.0 # 90320-0309 - Fixed agent log bug when using wrapup time # 90323-1555 - Initial call to agent phone now has campaign callerIDnumber +# 90408-0104 - Added Vtiger callback record ability # -$version = '2.2.0-203'; -$build = '90323-1555'; +$version = '2.2.0-204'; +$build = '90408-0104'; $mel=1; # Mysql Error Log enabled = 1 $mysql_log_count=60; $one_mysql_log=0; @@ -2386,6 +2387,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} var VtigeREnableD = ''; var alert_enabled = '' var shift_logout_flag = 0; + var vtiger_callback_id = 0; var DiaLControl_auto_HTML = "\"\"Resume\""; var DiaLControl_auto_HTML_ready = "\"\"Resume\""; var DiaLControl_auto_HTML_OFF = "\"\"Resume\""; @@ -3074,6 +3076,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} prefix_choice = APIDiaL_array_detail[7]; active_group_alias = APIDiaL_array_detail[8]; cid_choice = APIDiaL_array_detail[9]; + vtiger_callback_id = APIDiaL_array_detail[10]; // alert(APIDiaL_array_detail[1] + "-----" + APIDiaL + "-----" + document.vicidial_form.MDDiaLCodE.value + "-----" + document.vicidial_form.phone_code.value); @@ -4239,7 +4242,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} else {var call_prefix = dial_prefix;} - manDiaLnext_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&ACTION=manDiaLnextCaLL&conf_exten=" + session_id + "&user=" + user + "&pass=" + pass + "&campaign=" + campaign + "&ext_context=" + ext_context + "&dial_timeout=" + dial_timeout + "&dial_prefix=" + call_prefix + "&campaign_cid=" + call_cid + "&preview=" + man_preview + "&agent_log_id=" + agent_log_id + "&callback_id=" + mdnCBid + "&lead_id=" + mdnBDleadid + "&phone_code=" + mdnDiaLCodE + "&phone_number=" + mdnPhonENumbeR + "&list_id=" + mdnLisT_id + "&stage=" + mdnStagE + "&use_internal_dnc=" + use_internal_dnc + "&use_campaign_dnc=" + use_campaign_dnc + "&omit_phone_code=" + omit_phone_code + "&manual_dial_filter=" + manual_dial_filter + "&vendor_lead_code=" + mdVendorid + "&usegroupalias=" + mdgroupalias + "&account=" + active_group_alias + "&agent_dialed_number=" + agent_dialed_number + "&agent_dialed_type=" + agent_dialed_type; + manDiaLnext_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&ACTION=manDiaLnextCaLL&conf_exten=" + session_id + "&user=" + user + "&pass=" + pass + "&campaign=" + campaign + "&ext_context=" + ext_context + "&dial_timeout=" + dial_timeout + "&dial_prefix=" + call_prefix + "&campaign_cid=" + call_cid + "&preview=" + man_preview + "&agent_log_id=" + agent_log_id + "&callback_id=" + mdnCBid + "&lead_id=" + mdnBDleadid + "&phone_code=" + mdnDiaLCodE + "&phone_number=" + mdnPhonENumbeR + "&list_id=" + mdnLisT_id + "&stage=" + mdnStagE + "&use_internal_dnc=" + use_internal_dnc + "&use_campaign_dnc=" + use_campaign_dnc + "&omit_phone_code=" + omit_phone_code + "&manual_dial_filter=" + manual_dial_filter + "&vendor_lead_code=" + mdVendorid + "&usegroupalias=" + mdgroupalias + "&account=" + active_group_alias + "&agent_dialed_number=" + agent_dialed_number + "&agent_dialed_type=" + agent_dialed_type + "&vtiger_callback_id=" + vtiger_callback_id; // alert(manual_dial_filter + "\n" +manDiaLnext_query); xmlhttp.open('POST', 'vdc_db_query.php'); xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8'); @@ -6156,13 +6159,13 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} } if (xmlhttp) { - DSupdate_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&ACTION=updateDISPO&format=text&user=" + user + "&pass=" + pass + "&dispo_choice=" + DispoChoice + "&lead_id=" + document.vicidial_form.lead_id.value + "&campaign=" + campaign + "&auto_dial_level=" + auto_dial_level + "&agent_log_id=" + agent_log_id + "&CallBackDatETimE=" + CallBackDatETimE + "&list_id=" + document.vicidial_form.list_id.value + "&recipient=" + CallBackrecipient + "&use_internal_dnc=" + use_internal_dnc + "&use_campaign_dnc=" + use_campaign_dnc + "&MDnextCID=" + LasTCID + "&stage=" + group + "&comments=" + CallBackCommenTs; - xmlhttp.open('POST', 'vdc_db_query.php'); + DSupdate_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&ACTION=updateDISPO&format=text&user=" + user + "&pass=" + pass + "&dispo_choice=" + DispoChoice + "&lead_id=" + document.vicidial_form.lead_id.value + "&campaign=" + campaign + "&auto_dial_level=" + auto_dial_level + "&agent_log_id=" + agent_log_id + "&CallBackDatETimE=" + CallBackDatETimE + "&list_id=" + document.vicidial_form.list_id.value + "&recipient=" + CallBackrecipient + "&use_internal_dnc=" + use_internal_dnc + "&use_campaign_dnc=" + use_campaign_dnc + "&MDnextCID=" + LasTCID + "&stage=" + group + "&vtiger_callback_id=" + vtiger_callback_id + "&comments=" + CallBackCommenTs; + xmlhttp.open('POST', 'vdc_db_query.php'); xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8'); xmlhttp.send(DSupdate_query); xmlhttp.onreadystatechange = function() { - // alert(xmlhttp.responseText); + // alert(DSupdate_query + "\n" +xmlhttp.responseText); if ( (xmlhttp.readyState == 4 && xmlhttp.status == 200) && (auto_dial_level < 1) ) { @@ -6212,6 +6215,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} VDCL_group_id = ''; fronter = ''; inOUT = 'OUT'; + vtiger_callback_id='0'; if (manual_dial_in_progress==1) {