0

我有使用 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.
4

2 回答 2

1

当您使用相同的游标进行迭代时,您的数据库管理正在操作数据库游标。不需要Locate()您正在积极处理的记录。

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

var
  hEvent: THandle;
  Status: DWORD;
  Starting: Boolean;

procedure HandleCommsEvent(pbxh: LongInt; Comms_status: DWORD; Parm1: DWORD); stdcall;
begin
  //4 cases for   event of DLOPEN
  LogAddLine(pbxh, 'HandleCommsEvent happend');
  case Comms_status of
    DEVLINK_COMMS_OPERATIONAL,
    DEVLINK_COMMS_NORESPONSE,
    DEVLINK_COMMS_REJECTED:
    begin
      if Starting then begin
        Status := Comms_status;
        SetEvent(hEvent);
      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; 

procedure TfrmMain.btnConnectClick(Sender: TObject);
var
  vPass, vAddress: String;
begin
  hEvent := CreateEvent(nil, TRUE, FALSE, nil);
  try
    with frmSetup.tblConnections do
    begin
      First;
      while not Eof do
      begin
        if FieldByName('IPEnabled').AsInteger = 1 then
        begin
          vPass := FieldByName('IPPassword').AsString;
          vAddress := FieldByName('IpAddress').AsString;
          Edit;
          FieldByName('pbxh').AsInteger := fNextHandle;
          FieldByName('connected').AsInteger := 0;
          Post;
          Status := DEVLINK_COMMS_NORESPONSE;
          Starting := True;
          ResetEvent(hEvent);
          DLOpen(fNextHandle, PChar(vAddress), PChar(vPass), nil, nil, HandleCommsEvent);
          WaitForSingleObject(hEvent, 10000);
          Starting := False;
          if Status = DEVLINK_COMMS_OPERATIONAL then
          begin
            DLRegisterType2CallDeltas(fNextHandle, HandleEvent);
            LogAddLine(fNextHandle, 'Connected Done');
            Edit;
            FieldByName('connected').AsInteger := 1;
            Post;
          end else
          begin
            DLClose(fNextHandle);
            case Status of
              DEVLINK_COMMS_NORESPONSE:
              begin
                LogAddLine(fNextHandle, 'Connected NORESPONSE There Are Problem In network ');
              end;
              DEVLINK_COMMS_REJECTED:
              begin
                LogAddLine(fNextHandle, 'Connected REJECTED,Password was incorrect');
              end;
            end;
          end;
        end;
        Inc(fNextHandle);
      end;
      Next;
    end;
  finally
    CloseHandle(hEvent);
  end;
end;
于 2015-07-14T05:30:59.047 回答
-1

上传日志以获取更多详细信息..

并写 else 部分 case 来检查 Comms_status 的值

于 2015-07-14T04:20:34.300 回答