使用Delphi编程将Avaya系统与我的系统连接?

时间:2015-07-13 10:17:27

标签: delphi delphi-7 avaya

我有呼叫中心使用Avaya系统我需要管理此系统 通过我的应用程序,我的开发 有dll被叫devlink有4个事件

  

DEVLINK_COMMS_OPERATIONAL
    DEVLINK_COMMS_NORESPONSE
  DEVLINK_COMMS_REJECTED
  DEVLINK_COMMS_MISSEDPACKETS

第一个事件

  

DEVLINK_COMMS_OPERATIONAL

建立连接

单击按钮连接

    procedure TfrmMain.btnConnectClick(Sender: TObject);
    var
      hEvent:integer;
      vPass,vAddress:PChar;

    begin
      with frmSetup.tblConnections do
        begin
        First;
        while not Eof do
        begin
          if FieldByName('IPEnabled').AsInteger=1 then
          Begin
            vPass:=PChar(FieldByName('IPPassword').AsString);
            vAddress:=PChar(FieldByName('IpAddress').AsString);
            DLOpen(fNextHandle,  vAddress,vPass, nil, nil,HandleCommsEvent);
            Edit;
            FieldByName('pbxh').AsInteger:=fNextHandle;
            Post;
            hEvent := CreateEvent(nil, FALSE, FALSE, nil);
        try
          WaitForSingleObject(hEvent, 10000);
          if (Locate('pbxh',fNextHandle,[]))and(FieldByName('connected').AsInteger=1) then
          else

            LogAddLine(fNextHandle,'No Responce');

        finally
          CloseHandle(hEvent);
          inc(fNextHandle);
        end;

      End;
      next;
    end;
  end;
end;

我们注意 DlOpen 方法获取系统和密码的IP 和事件将开始测试Dlopen

始终显示事件 DEVLINK_COMMS_NORESPONSE 的消息 这是没有回应的 我需要知道IP和密码正确的错误在哪里。那里 是 HandleCommsEvent

procedure HandleCommsEvent(pbxh: LongInt; Comms_status: DWORD; Parm1: DWORD);stdcall;
  stdcall;
begin
//4 cases for   event of DLOPEN
  LogAddLine(pbxh,'HandleCommsEvent happend');
  case Comms_status of
    DEVLINK_COMMS_OPERATIONAL:
    Begin
      DLRegisterType2CallDeltas(pbxh, HandleEvent);
      LogAddLine(pbxh,'Connected Done');
      if frmSetup.tblConnections.Locate('pbxh',pbxh,[]) then
      Begin
        frmSetup.tblConnections.Edit;
        frmSetup.tblConnections.FieldByName('connected').AsInteger:=1;
        frmSetup.tblConnections.Post;
      End;
    end;
    DEVLINK_COMMS_NORESPONSE:
    begin
      LogAddLine(pbxh,'Connected NORESPONSE There Are Problem In network ');
      if frmSetup.tblConnections.Locate('pbxh',pbxh,[]) then
      Begin
        frmSetup.tblConnections.Edit;
        frmSetup.tblConnections.FieldByName('pbxh').AsInteger:=pbxh;
        frmSetup.tblConnections.FieldByName('connected').AsInteger:=0;
        frmSetup.tblConnections.Post;
      End;
    end ;
    DEVLINK_COMMS_REJECTED:
    begin
      LogAddLine(pbxh,'Connected REJECTED,Password was incorrect');
      if frmSetup.tblConnections.Locate('pbxh',pbxh,[]) then
      Begin
        frmSetup.tblConnections.Edit;
        frmSetup.tblConnections.FieldByName('pbxh').AsInteger:=pbxh;
        frmSetup.tblConnections.FieldByName('connected').AsInteger:=0;
        frmSetup.tblConnections.Post;
      End;
    end;
    // Case of  Packets were generated by IP Office System unit ,but Not recieved by Devlink
    DEVLINK_COMMS_MISSEDPACKETS:
    begin
      LogAddLine(pbxh,'Connected MISSEDPACKETS ,Packets were generated by IP Office System unit ,but Not recieved by Devlink ');
    end;
    //Case of NO Response from From System Unit
  end;
end; 

如果任何人需要更多信息和细节我准备好了。 NO Response 的消息始终显示

了解更多详情
这是Devlink

unit UDevLink;
{**************************************************************************}
{ Delphi unit for DevLink (c) 2001 Avaya Global SME Solutions }
{ Contents:- }
{ IP Office DevLink DLL provides an interface for managing }
{ the IP Office product ranges from a Windows PC }
{**************************************************************************}
interface
uses
  Windows, SysUtils , Classes, UfrmMain,strutils,Ustrings;
const
  DEVLINK_SUCCESS = 0;
  DEVLINK_UNSPECIFIEDFAIL = 1;
  DEVLINK_LICENCENOTFOUND = 2;
const
  DEVLINK_COMMS_OPERATIONAL = 0;
  DEVLINK_COMMS_NORESPONSE = 1;
  DEVLINK_COMMS_REJECTED = 2;
  DEVLINK_COMMS_MISSEDPACKETS = 3;
type
  TCallLogEvent = procedure(pbxh: LongInt; info: PChar); stdcall;
type
  TCommsEvent = procedure(pbxh: LongInt;
    Comms_status: DWORD;
    Parm1: DWORD); stdcall;

    function DLOpen(pbxh: LongInt;
  pbx_address: PChar;
  pbx_password: PChar;
  reserved1: PChar;
  reserved2: PChar;
  cb: TCommsEvent): LongInt; stdcall;

function DLClose(pbxh: THandle): LongInt; stdcall;

function DLRegisterType2CallDeltas(pbxh: LongInt;
  cb: TCallLogEvent): LongInt; stdcall;

implementation


function DLOpen; external 'DEVLINK.DLL';
function DLClose; external 'DEVLINK.DLL';
function DLRegisterType2CallDeltas; external 'DEVLINK.DLL';





end.

2 个答案:

答案 0 :(得分:1)

当您使用相同的光标进行迭代时,您的数据库管理正在操作数据库游标。无需create/build您正在积极处理的记录。

根据官方Avaya DevLink API文档中提供的Delphi示例(我假设您已阅读),您对Locate()的调用应该更像这样:

DlOpen()

答案 1 :(得分:-1)

上传日志了解更多详情..

并写下其他部分案例以检查Comms_status的值