home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Network Support Encyclopedia 96-1
/
novell-nsepro-1996-1-cd2.iso
/
download
/
netware
/
kvfon2.exe
/
KVPHONE.CPP
< prev
next >
Wrap
C/C++ Source or Header
|
1994-11-16
|
6KB
|
178 lines
/****************************************************************************
** File: KVPHONE2.CPP
**
** Desc: Sample telephony program
**
** This NetWare Telephony Services program is a phone dialpad. It uses the
** TSAPI for opening a stream, making calls, clearing calls and connections,
** conferencing and transfering calls, putting calls on hold, and demonstrates
** event polling loops. Also demonstrates using the CSTA.LIB functions from
** a C++ program.
**
** It is written for OWL 2.0 with Borland C++ 4.x. To compile this program,
** create a project in BC4.x, similar to the .IDE project file included.
**
** DISCLAIMER
**
** Novell, Inc. makes no representations or warranties with respect to
** any NetWare software, and specifically disclaims any express or
** implied warranties of merchantability, title, or fitness for a
** particular purpose.
**
** You may use this sample code in your own programs.
**
** Distribution of any NetWare software is forbidden without the
** express written consent of Novell, Inc. Further, Novell reserves
** the right to discontinue distribution of any NetWare software.
**
** Novell is not responsible for lost profits or revenue, loss of use
** of the software, loss of data, costs of re-creating lost data, the
** cost of any substitute equipment or program, or claims by any party
** other than you. Novell strongly recommends a backup be made before
** any software is installed. Technical support for this software
** may be provided at the discretion of Novell.
**
** Programmers:
**
** Ini Who Firm
** -----------------------------------------------------------------------
** KVW Kevin V White Novell Developer Support.
**
** History:
**
** When Who What
** -----------------------------------------------------------------------
** 11-2 KVW First code release
** 11-16 KVW Added functionality for conference, transfer, hold
** 11-16 KVW Split "hangup" into clear connection and clear call
*/
/****************************************************************************
** Include headers, macros, function prototypes, etc.
*/
/*------------------------------------------------------------------------
** Borland C++ 4.x OWL libraries
*/
#include <owl\applicat.h>
#include <owl\framewin.h>
#include <owl\dialog.h>
#include <owl\edit.h>
#include <owl\combobox.h>
/*------------------------------------------------------------------------
** NetWare Telephony Services TSAPI libraries
*/
#include <acs.h>
#include <csta.h>
/*------------------------------------------------------------------------
** Project include files for the dialogs, #define's, and other functions.
*/
#include "phonerc.h"
#include "confdlg.h"
#include "xferdlg.h"
#include "phonedlg.h"
#include "logindlg.h"
/****************************************************************************
** This is the main window class.
*/
class TPhoneWindow:public TFrameWindow
{
public:
TPhoneWindow(TWindow *parent, const char far *title,TWindow *clientWnd,
BOOL shrinkToClient,ACSHandle_t *globalACSHandle,
DeviceID_t *deviceID);
char numberToDial[20];
ACSHandle_t *acsHandle;
DeviceID_t *phoneExt;
TWindow *mainWindowDialog;
DECLARE_RESPONSE_TABLE(TPhoneWindow);
};
DEFINE_RESPONSE_TABLE1(TPhoneWindow,TFrameWindow)
END_RESPONSE_TABLE;
/****************************************************************************
** Main window constructor
*/
TPhoneWindow::TPhoneWindow(TWindow *parent, const char far *title,
TWindow *clientWnd,BOOL shrinkToClient,ACSHandle_t *globalACSHandle,
DeviceID_t *deviceID)
:TFrameWindow(parent,title,clientWnd,shrinkToClient),TWindow(parent,title)
{
acsHandle=globalACSHandle;
phoneExt=deviceID;
mainWindowDialog=clientWnd;
numberToDial[0]=0;
AssignMenu(1);
}
/****************************************************************************
** Application class.
*/
class TPhoneApp:public TApplication
{
public:
ACSHandle_t *globalACSHandle;
DeviceID_t *deviceID;
TPhoneApp(char *title,ACSHandle_t *acsHandle,DeviceID_t *extension);
void InitMainWindow();
};
/****************************************************************************
** Application constructor.
*/
TPhoneApp::TPhoneApp(char *title,ACSHandle_t *acsHandle,DeviceID_t *extension)
:TApplication(title)
{
globalACSHandle=acsHandle;
deviceID=extension;
}
/****************************************************************************
** declare a new main window, using a dialog as the main window
*/
void TPhoneApp::InitMainWindow()
{
MainWindow=new TPhoneWindow(0,"KVPhone",
new TPhoneDlg(0,2,globalACSHandle,deviceID),
TRUE,globalACSHandle,deviceID);
}
/****************************************************************************
** this is the main function
*/
int OwlMain(int /*argc*/,char */*argv*/[])
{
ACSHandle_t acsHandle;
DeviceID_t extension;
int rCode;
/*------------------------------------------------------------------------
** If they login successfully to the TServer, then continue on with
** the program, aborting the stream when exiting. Otherwise, just
** return an error code.
*/
TLoginDlg *loginDlg=new TLoginDlg(0,TResId(3),&acsHandle,&extension);
if(loginDlg->Execute()==IDOK)
{
if(acsHandle!=0)
{
TPhoneApp app("KVPhone",&acsHandle,&extension);
rCode=app.Run();
acsAbortStream(acsHandle,NULL);
return rCode;
}
else
{
return 0xFF;
}
}
}