0

i have Call Center Using Avaya System I need To manage this System by my application that's developed by my there are dll Called devlink have 4 Events

DEVLINK_COMMS_OPERATIONAL
DEVLINK_COMMS_NORESPONSE
DEVLINK_COMMS_REJECTED
DEVLINK_COMMS_MISSEDPACKETS

the first Event

DEVLINK_COMMS_OPERATIONAL

meen the connection was establish

when Click The Button Connect

    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;

we note DlOpen Method Take the IP of system And Password and Event that will fire to test the Dlopen

Always appear message of the event DEVLINK_COMMS_NORESPONSE that is no response
i need to know where the error where the IP And Password Was correct. There are The 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; 

if Any one need more info and details i'm ready. The Message of NO Response Always appear


for more Details
This is 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.
user3420275
  • 27
  • 2
  • 12

2 Answers2

1

Your DB management is manipulating the DB cursor while you are iterating with the same cursor. There is no need to Locate() the record that you are actively processing.

Your call to DlOpen() should look more like this, based on the Delphi example provided in the official Avaya DevLink API documentation (which I assume you have read):

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;
Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770
  • Also get the case of DEVLINK_COMMS_NORESPONSE: No response – user3420275 Jul 14 '15 at 09:41
  • Did you make sure `vAddress` and `vPass` are accurate, and the server is running and reachable on the network? You will likely need to contact Avaya and talk to them about this issue. It is their API, and they provide commercial support for it. – Remy Lebeau Jul 14 '15 at 15:03
  • vAddress and vPass are accurate , and the server is running and reachable on the network all is accurate – user3420275 Jul 15 '15 at 09:17
  • Can Send To me my friend dll that we connect with it i think the error in my dll – user3420275 Aug 10 '15 at 07:58
-1

upload logs for more details..

and write else part of case to check value of Comms_status