Author Message
DaveMatheis
Joined: Jun 13, 2013
Messages: 0
Offline
I recently got the CTI License installed on my Avaya IP Office 500, and installed the devlink sdk. I have read the developers manual and put together a test application. I can connect to the IP Office with the DLOpen() function, but when I call the DLRegisterType2CallDeltas() function the program stops at this point and I do not receive any events. My code is:

#include <windows.h>
#include <iostream>
#include "conio.h"
#include "devlink.h"

using namespace std;


HANDLE hEvent;
DWORD dwCommsEvent;
BOOL bStarting;

void CALLBACK HandleCallLogEvent(DWORD pbxh, TEXT * info) {
   cout << "A Call Event has occurred..." << endl;
   cout << "info is " << info << endl;
}

void CALLBACK HandleCommsEvent( DWORD pbxh, DWORD comms_evt, DWORD parm1 ) {
   cout << "starting CALLBACK HandleCommsEvent..." << endl;
   switch( comms_evt ) {
      case DEVLINK_COMMS_OPERATIONAL:
         cout << "Got comms operational message" << endl;
         // we are working fine... fall through
      case DEVLINK_COMMS_NORESPONSE:
         // system not found (initial connection),
         // or network connection lost (rebooted?)
         // fall through...
      case DEVLINK_COMMS_REJECTED:
         // incorrect system password specified...
         if( bStarting ) {
            dwCommsEvent = comms_evt;
            SetEvent( hEvent );
         }
         else {
            // insert your code here...
         }
         break;
      case DEVLINK_COMMS_MISSEDPACKETS:
         // Indicates that the system is under
         // heavy load. IP Office always prioritises
         // data routing and call handling above CTI events.
         // (parm1 contains the number of packets missed)
         break;
   }
}

int main(int argc, char* argv[]) {
   int i = 0;
   long res;

   cout<< "connecting..." << endl;
   bStarting = TRUE;
   hEvent = CreateEvent( NULL, FALSE, FALSE, NULL );
   DLOpen( 1,
      "10.120.4.4",
      "password",
      NULL,
      NULL,
      HandleCommsEvent );
   dwCommsEvent = DEVLINK_COMMS_NORESPONSE;
   WaitForSingleObject( hEvent, 20000 ); // 20 seconds
   bStarting = FALSE;
   if( dwCommsEvent == DEVLINK_COMMS_OPERATIONAL ) {
      cout << "Connected OK" << endl;
      for (i=0; i<20; i++) {
         cout << "waiting for event[" << i << "]" << endl;
         res = DLRegisterType2CallDeltas( 1, HandleCallLogEvent );
         switch(res) {
         case DEVLINK_SUCCESS:
            cout << "Event successful!" << endl;
            break;
         case DEVLINK_UNSPECIFIEDFAIL:
            cout << "Event result is unspecified error" << endl;
            break;
         case DEVLINK_LICENCENOTFOUND:
            cout << "No CTI license for Events on IP Office" << endl;
         }
      }
   }
   else {
      cout << "Error connecting to IP Office" << endl;
   }
   
   DLClose( 1 );
   CloseHandle( hEvent );
   _getch();
   return 0;
}

Console output:
connecting...
starting CALLBACK HandleCommsEvent...
Got comms operational message
Connected OK
waiting for event[0]

(at this point nothing further happens as it waits for an event to return)

Any input on what I have done wrong or links to example code beyond what is in the developer's guide would be great. I am using Visual C++ Express 2012 as the compiler.

Thanks,

Dave
JohnBiggs
Joined: Jun 20, 2005
Messages: 1139
Location: Rural, Virginia
Offline
This forum is not for IP Office related questions. DevConnect does not host a free service for addressing IP Office technical support requests. If you wish to pursue a for fee based support Please take a look at the Technical Support link to the left for details. If you wish to go that route, enter a technical support request with your question.
Go to:   
Mobile view