Making a Call Using DivaCreateCall and DivaDial
Sometimes it is necessary to create an outgoing call with the Dialogic
® Diva
® API Function
DivaDial (in the Dialogic
® Diva
® C# Framework: "
Dial") rather than the
DivaConnectXXX functions. Examples where this might happen include:
1. When you want to call on a specific channel (especially for Analog boards, where each channel represents a separate PSTN line).
2. When you want to modify timers.
3. In cases where it is important that the call request includes the calling number
To use
DivaDial the basic procedure is as follows:
1. Create a call object with
DivaCreateCall (in the C# Framework:
CreateCall )
2. Modify the object using DivaSetCallProperties (for the C# Framework, see below). You can set as many properties as you need.
3.Call
DivaDial on the call object, specifying the called number.
As with
DivaConnect, when the call has connected, you receive an event,
DivaEventCallConnected, or for the C# Framework, your override handler for
OnCallConnected is called.
Example 1: Setting the Channel Number
result = DivaCreateCall( app, ah, &handle );
if(result==DivaSuccess)
{
DivaCallPropertyValue value;
value.DataChannel = channel;
result=DivaSetCallProperties( handle, DivaCPT_DataChannel, &value, sizeof(value.DataChannel) );
if(result==DivaSuccess)
Log("DataChannel set to %d", value.DataChannel);
result = DivaDial( handle, telnum );
}
Note that a channel is not the same as a linedevice. The linedevice normally refers to the 'span' and the channel selects within that span. So for example a Dialogic
® Diva
® 4E1 board has 4 spans (4 linedevices) and on each span has 30 channels.
Dialogic
® Diva
® Analog boards are different in that they have one linedevice under which the 4 or 8 physical PSTN lines appear as 4 or 8 channels.
You can also set the linedevice/span using call properties:
value.LineDevice = linedev;
result=DivaSetCallProperties( handle, DivaCPT_LineDevice, &value, sizeof(value.LineDevice) );
if(result==DivaSuccess)
Log("LineDevice set to %d", value.LineDevice);
2. Set the "No Answer" Timer
Normally the no answer timer is set to two minutes, so an outgoing call will ring for all this time if not picked up before giving up. You can shorten this timer if you choose:
result = DivaCreateCall( app, ah, &handle );
if(result==DivaSuccess)
{
DivaCallPropertyValue value;
value.NoAnswerTimeout = 20;
result=DivaSetCallProperties( handle, DivaCPT_NoAnswerTimeout, &value, sizeof(value.NoAnswerTimeout) );
if(result==DivaSuccess)
Log("No answer timeout set to %d", value.NoAnswerTimeout);
result = DivaDial( handle, telnum );
}
3. Set the Calling Number
result = DivaCreateCall( app, ah, &handle );
if(result==DivaSuccess)
{
DivaCallPropertyValue value;
lstrcpy( value.CallingNumber.Number, localnum );
result=DivaSetCallProperties( handle, DivaCPT_CallingNumber, &value, sizeof(DivaPlainNumber) );
if(result==DivaSuccess)
Log("Local Number set to %s", localnum);
result = DivaDial( handle, telnum );
}
Dialogic® Diva® C# Framework API
In the Diva C# Framework API, most attributes are already exposed as members of the CallBase class. So you can modify Called/Calling address, LineDevice, CallType and DataChannel directly without using SetCallProperty. For example:
class MyCall : CallBase
{
:
:
public void Run( InstanceBase Inst )
{
Create( Inst ); // create a call object
if(m_IsFax)
this.CallType = DSAPI.CallType.Fax; // set the desired call type fax/voice
else
this.CallType = DSAPI.CallType.Voice;
this.LineDevice = 2;
this.CallingNumber = "7777";
this.DataChannel = 4;
Dial( m_NumberToDial );
}
First published: 24-Oct-2008
Open access: Product rule: ; Page rule: Auto