home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Network Support Encyclopedia 96-1
/
novell-nsepro-1996-1-cd2.iso
/
download
/
netware
/
kvfon2.exe
/
CONFDLG.H
next >
Wrap
C/C++ Source or Header
|
1994-11-16
|
8KB
|
228 lines
/****************************************************************************
** File: CONFDLG.H
**
** Desc: Include files for the dialpad program.
**
** This file is an include file for the dialpad program. It contains the
** dialog source for conferencing a call.
**
** 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-16 KVW This feature is new
*/
/****************************************************************************
** This is the conference dialog's class.
*/
class TConfDlg:public TDialog
{
public:
ACSHandle_t globalACSHandle;
DeviceID_t confExt,callerExt;
ConnectionID_t *callID,newCallID;
CSTAEvent_t eventBuffer;
unsigned short eventBufferSize;
unsigned short numEvents;
RetCode_t rCode;
InvokeID_t invokeID;
TEdit *extEntryBox;
TConfDlg(TWindow *parent,TResId resId,ACSHandle_t *acsHandle,
DeviceID_t *caller,ConnectionID_t *oldCallID);
void SetupWindow();
void CleanupWindow();
void CmConference();
DECLARE_RESPONSE_TABLE(TConfDlg);
};
/****************************************************************************
** this is how OWL adds message handling to the windows message loop
*/
DEFINE_RESPONSE_TABLE1(TConfDlg,TDialog)
EV_COMMAND(IDOK,CmConference),
END_RESPONSE_TABLE;
/****************************************************************************
** constructor for the conference call dialog
*/
TConfDlg::TConfDlg(TWindow *parent,TResId resId,ACSHandle_t *acsHandle,
DeviceID_t *caller,ConnectionID_t *oldCallID)
:TDialog(parent,resId),TWindow(parent)
{
globalACSHandle=*acsHandle;
strcpy(callerExt,*caller);
callID=oldCallID;
}
/****************************************************************************
** SetupWindow is called when the dialog window is created
*/
void TConfDlg::SetupWindow()
{
/*------------------------------------------------------------------------
** first, call the parent's SetupWindow
*/
TDialog::SetupWindow();
/*------------------------------------------------------------------------
** create an alias to the text box in the dialog, as the alias will be
** easier to enter text into and retrieve text from than the dialog
*/
extEntryBox=new TEdit(this,IDC_EDIT1,30);
extEntryBox->Create();
}
/****************************************************************************
** CleanupWindow is called when the window is destroyed. We just use it to
** free the memory allocated to our TEdit alias in SetupWindow, then call
** the parent's CleanupWindow
*/
void TConfDlg::CleanupWindow()
{
delete extEntryBox;
TDialog::CleanupWindow();
}
/****************************************************************************
** Here we actually do the conference call.
*/
void TConfDlg::CmConference()
{
/*---------------------------------------------------------------------
** get the extension the user entered
*/
extEntryBox->GetLine(confExt,30,0);
if(strlen(confExt)<1)
{
return;
}
else
{
/*------------------------------------------------------------------
** put the first call on hold
*/
rCode=cstaHoldCall(globalACSHandle,invokeID,callID,FALSE,NULL);
if(rCode<=0)
{
MessageBox("Can't Conference a Call. Can't put the call on hold",
"Hold Call");
return;
}
eventBufferSize=sizeof(CSTAEvent_t);
rCode=acsGetEventBlock(globalACSHandle,&eventBuffer,&eventBufferSize,NULL,
&numEvents);
if(rCode==ACSPOSITIVE_ACK)
{
::EnableWindow(Parent->GetDlgItem(IDC_UNHOLD),1);
::EnableWindow(Parent->GetDlgItem(IDC_HOLD),0);
}
else
{
MessageBox("rCode wrong from getEventBlock","Can't hold call");
return;
}
/*------------------------------------------------------------------
** call the next extension
*/
rCode=cstaMakeCall(globalACSHandle,invokeID,&callerExt,&confExt,NULL);
/*---------------------------------------------------------------------
** if MakeCall was successful, it will return the invokeID (above 0)
*/
if(rCode>0)
{
eventBufferSize=sizeof(CSTAEvent_t);
/*---------------------------------------------------------------
** get the event, and check its type
*/
rCode=acsGetEventBlock(globalACSHandle,&eventBuffer,&eventBufferSize,
NULL,&numEvents);
if(rCode==ACSPOSITIVE_ACK)
{
if(eventBuffer.eventHeader.eventType==CSTA_MAKE_CALL_CONF)
{
/*---------------------------------------------------------
** if it's the right event type, the callID is stored in
** the confirmation event structure, which we will need to
** store so that the user can hangup on the call later.
*/
newCallID=eventBuffer.event.cstaConfirmation.u.makeCall.newCall;
}
}
}
else
{
MessageBox("Unable to make call","TS Error!");
}
/*------------------------------------------------------------------
** with the first call on hold (callID) and the second call active
** (newCallID), conference the two calls to make one single call,
** for which we will retrieve a new call id
*/
rCode=cstaConferenceCall(globalACSHandle,invokeID,callID,&newCallID,NULL);
if(rCode<=0)
{
MessageBox("Can't conference","Conference Error");
return;
}
else
{
eventBufferSize=sizeof(CSTAEvent_t);
rCode=acsGetEventBlock(globalACSHandle,&eventBuffer,&eventBufferSize,
NULL,&numEvents);
if(rCode==ACSPOSITIVE_ACK)
{
/*---------------------------------------------------------------
** this is the new call id from the conference call confirmation
** event
*/
newCallID=eventBuffer.event.cstaConfirmation.u.makeCall.newCall;
*callID=newCallID;
/*--------------------------------------------------------------
** set the appropriate button states for an active call
*/
::EnableWindow(Parent->GetDlgItem(IDC_HANGUPCONN),1);
::EnableWindow(Parent->GetDlgItem(IDC_HANGUPCALL),1);
::EnableWindow(Parent->GetDlgItem(IDC_CONFERENCE),0);
::EnableWindow(Parent->GetDlgItem(IDC_HOLD),1);
::EnableWindow(Parent->GetDlgItem(IDC_UNHOLD),0);
}
}
}
TDialog::CmOk();
return;
}