home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Network Support Encyclopedia 96-1
/
novell-nsepro-1996-1-cd2.iso
/
download
/
netware
/
kvfon2.exe
/
XFERDLG.H
< prev
Wrap
C/C++ Source or Header
|
1994-11-16
|
7KB
|
221 lines
/****************************************************************************
** File: XFERDLG.H
**
** Desc: Include files for the dialpad program.
**
** This file is an include file for the dialpad program. It contains the
** dialog source for transferring 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 transfer dialog's class.
*/
class TXferDlg:public TDialog
{
public:
ACSHandle_t globalACSHandle;
DeviceID_t xferExt,callerExt;
ConnectionID_t *callID,newCallID;
CSTAEvent_t eventBuffer;
unsigned short eventBufferSize;
unsigned short numEvents;
RetCode_t rCode;
InvokeID_t invokeID;
TEdit *extEntryBox;
TXferDlg(TWindow *parent,TResId resId,ACSHandle_t *acsHandle,
DeviceID_t *caller,ConnectionID_t *oldCallID);
void SetupWindow();
void CleanupWindow();
void CmTransfer();
DECLARE_RESPONSE_TABLE(TXferDlg);
};
/****************************************************************************
** this is how OWL adds message handling to the windows message loop
*/
DEFINE_RESPONSE_TABLE1(TXferDlg,TDialog)
EV_COMMAND(IDOK,CmTransfer),
END_RESPONSE_TABLE;
/****************************************************************************
** constructor for the transfer call dialog
*/
TXferDlg::TXferDlg(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 TXferDlg::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 TXferDlg::CleanupWindow()
{
delete extEntryBox;
TDialog::CleanupWindow();
}
/****************************************************************************
** Here we actually transfer the call
*/
void TXferDlg::CmTransfer()
{
/*-----------------------------------------------------------------------
** get the extension to transfer to
*/
extEntryBox->GetLine(xferExt,30,0);
if(strlen(xferExt)<1)
{
return;
}
else
{
/*----------------------------------------------------------------
** put the first call on hold
*/
rCode=cstaHoldCall(globalACSHandle,invokeID,callID,FALSE,NULL);
if(rCode<=0)
{
MessageBox("Can't transfer 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;
}
/*---------------------------------------------------------------------
** make the second call
*/
rCode=cstaMakeCall(globalACSHandle,invokeID,&callerExt,&xferExt,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)
{
/*-----------------------------------------------------------
** get the new call id
*/
newCallID=eventBuffer.event.cstaConfirmation.u.makeCall.newCall;
}
}
}
else
{
MessageBox("Unable to make call","TS Error!");
}
/*---------------------------------------------------------------------
** with the first call (callID) on hold, and the second call active
** (newCallID), we can transfer the call.
*/
rCode=cstaTransferCall(globalACSHandle,invokeID,callID,&newCallID,NULL);
if(rCode<=0)
{
MessageBox("Can't transfer","Transfer Error");
return;
}
else
{
eventBufferSize=sizeof(CSTAEvent_t);
rCode=acsGetEventBlock(globalACSHandle,&eventBuffer,&eventBufferSize,
NULL,&numEvents);
if(rCode==ACSPOSITIVE_ACK)
{
/*------------------------------------------------------------
** set the appropriate button states, as we no longer have the
** active call at this extension
*/
::EnableWindow(Parent->GetDlgItem(IDC_HANGUPCONN),0);
::EnableWindow(Parent->GetDlgItem(IDC_HANGUPCALL),0);
::EnableWindow(Parent->GetDlgItem(IDC_CONFERENCE),0);
::EnableWindow(Parent->GetDlgItem(IDC_HOLD),0);
::EnableWindow(Parent->GetDlgItem(IDC_UNHOLD),0);
::EnableWindow(Parent->GetDlgItem(IDC_TRANSFER),0);
}
}
}
TDialog::CmOk();
return;
}