+7 (499) 271-31-54 обратный звонок
КУПИТЬ

Интеграция CommuniGate Pro Contact Center с Microsoft Dynamics



Ниже приведен пример простого CG/PL модуля, реализующего интеграцию Контакт-центра CommuniGate Pro и системы Microsoft Dynamics CRM. В качестве промежуточного звена, реализующего аутентификацию и коммуникацию между ними, используется Perl-скрипт, размещенный на сервере CommuniGate Pro.

#!/usr/bin/perl

use strict;
use warnings;
use LWP::UserAgent;
use Authen::NTLM;
use HTTP::Request::Common;
use CGI qw(:standard);

my $oData = '/XRMServices/2011/OrganizationData.svc/';

my $crmServer = param('crmserver');
my $crmName = param('crmname');
my $username = param('username');
my $password = param('password');
my $set = param('set');
my $select = param('select');
my $filter = param('filter');

unless($crmServer && $crmName && $username && $password && $set && $select && $filter) {
  my $msg = '{"error":{"message":{"value":"incorrect params"}}}';
  print "Content-Length: " . length($msg) . "\n";
  print "Content-Type: application/json\n\n";
  print $msg;
  exit(0);
}

my $url = $crmServer . '/' . $crmName . $oData . $set . '?$select=' . $select . '&$filter=' . $filter;

my $ua = new LWP::UserAgent(keep_alive=>1);
$ua->default_header('Accept' => 'application/json');
my $crmRealm = $crmServer;
$crmRealm =~ s/^https*\:\/\///;
$ua->credentials($crmRealm, '', $username, $password);

my $request = GET $url;
my $response = $ua->request($request);

my $msg = $response->content;
print "Content-Length: " . length($msg) . "\n";
print "Content-Type: application/json\n\n";
print $msg;
exit(0);

// ================================================== //
//  Contact Center integration with MS Dynamics CRM   //
//                   Version 2.0.1d                   //
// ================================================== //

function  consultCRM()                      forward;

var monitorSettings;

function ccDynamicsCRM() {
  return consultCRM();
}

///////////////

function consultCRM() {
  var qParam = EmailUserPart(SIPURItoEmail(RemoteURI())) || "";
  if(!IsString(qParam) || qParam == "" || !IsString(monitorSettings.crmServer) || monitorSettings.crmServer == "") {
    return null;
  }
  var url = "http://127.0.0.1:8100/cgi-bin/msdynntlmproxy.pl";
  var params = NewDictionary();
  params.method = "GET";
  params.timeout = 20;
  params.urlParams = NewDictionary();
  params.urlParams.crmserver = monitorSettings.crmServer;
  params.urlParams.crmname = monitorSettings.crmName || "Demo"; // CRM instance name
  params.urlParams.username = monitorSettings.crmUser || "DOMAIN\\username"; // CRM administrator username
  params.urlParams.password = monitorSettings.crmPass || "password"; // CRM administrator password
  params.urlParams.set = "ContactSet";
  params.urlParams.select = "ContactId,FullName,EMailAddress1";
  params.urlParams.filter = "Telephone1 eq \'" + qParam + "\'";
  var result = HTTPCall(url,params);
  if(IsDictionary(result) && IsData(result.body)) {
    var resultJSON = Convert(result.body,"utf-8");
    var data = JSONToObject(resultJSON);
    if(IsDictionary(data)) {
      if(!data.error) {
        if(IsDictionary(data.d)) {
          if(IsArray(data.d.results)) {
            if(Length(data.d.results)) {
              var crm = NewArray();
              for(var i = 0; i < Length(data.d.results); i += 1) {
                if(IsDictionary(data.d.results[i])) {
                  if(IsString(data.d.results[i].ContactId) && IsString(data.d.results[i].FullName)) {
                    var ent = NewDictionary();
                    ent.id = data.d.results[i].ContactId;
                    ent.name = data.d.results[i].FullName;
                    if(IsString(data.d.results[i].EMailAddress1)) {
                      ent.email = data.d.results[i].EMailAddress1;
                    } else {
                      ent.email = "";
                    }
                    AddElement(crm,ent);
                  }
                }
              }
              return crm;
            }
          }
        }
      }
    }
  }
  return null;
}

Для получения более подробной информации пишите на support@communigate.com





Яндекс.Метрика
Заказ звонка
Ваш телефон: +7