Algo for Event Handling For Digital Lines

From: General Listmanager <General.listmanager@pysdiscussext.py.intel.com>
Date: Fri Apr 23 2004 - 01:02:34 EDT

From: "ritesh taksali" <ritesh@Go4Customer.com>

Algo for Event Handling For Digital Lines
Hello every body

i want to know whether below algo is correct for handling Incoming IVR on digital lines, pls suggest me any thing

this model is design for Mulththreaded ASYC model . because database operation take more time that's why each channel is handled by seprate thread. so if any reason one channel block because of thread operation , then another thread can continue work on.

#define MaxChannels 30

Struct Voice
{
int VoxHandle;
int callState;
// other data
} V[MaxChannels+1]; // custom structure variables stores voice handles

struct Digital
{
int TsHandle;
CRN vCRN;
// other data
}
Ts[MaxChannels+1]; // custom structure variables stores digital timeslot handle

Main()
{
for (i=1 to 30)
{
OpenDigitalChannel()// open the channel using CC_OPEN()
OpenVoiceChannel()//open channel using dx_OPEN
MapVoiceResourceToDigitalChannels() //nr_scroute();
InitializeVoiceChannels() // dx_deltones, dx_SetEvtmsk, dx_SETHook

InitializeDigitalChannel()//cc_SetEvtMsk , cc_Reset() , cc_waitcall() , cc_StartTrace , ;
}

for (int i=1 to 30)
{
CreateThread(ProcessChannel,i)
}
wait(); // by using getchar()
}//end of main

int ProcessChannel(int index)
{
sr_enablrhanlr(V[index].channelId,ALL_EVT,VoiceEventHandler)
sr_enablrhanlr(ts[index].channelId,ALL_EVT,DigitalEventHandler)

wait();
}

VoiceEventHandler()
{
int VoxHnd= sr_getevtdev();
switch (sr_getevttype())
{
case TDX_CST:
case TDX_PLAY:
case ..... ALL othere TDX_EVENTS
}
}//End of VoiceEventHandler()

DigitalEventHandler()
{

int VoxHnd= sr_getevtdev();
switch (sr_getevttype())
{
case CCEV_OFFERING:
case CCEV_ACCEPT:
case CCEV_ANSWER:
ProcessIVRLogic();//this function contain the logic of IVR
case CCEV_DISCONNECT:
case ALL other CCEV_EVENTS

}

}//End of DigitalEventHandler()

Question
1)whether above algo is correct, what improvment can be done on this
2)each channel is handle in seperate thread but two types of events can come on each channel Digital Events and Voice Events
if one thred is handling digital events like CC_ANSWER , and the same time voice EVent come on this channel then what happen ?

3)whether to use sr_enablehanlr or use sr_waitevtex() function
4)this is callback event handling what happen if i use sr_waitevtex() method for polling , then a single eventhandler will handle all digitalChannel and voicechannl events

int ProcessChannel(int index)
{
//sr_enablrhanlr(V[index].channelId,ALL_EVT,VoiceEventHandler)
//sr_enablrhanlr(ts[index].channelId,ALL_EVT,DigitalEventHandler)

in above there is two handler call back function VoiceEventHandler handle voices recource events
DigitalEventHandler handle digital recource events

but if i want to handle both events in the same function then it is possible like this
sr_enablrhanlr(V[index].channelId,ALL_EVT,EventHandler)
sr_enablrhanlr(V[index].channelId,ALL_EVT,EventHandler)
then in this both (digital + voice )events come in single call back function

wait();
}

EventHandler()
{
   int deviceHandle= sr_getevtdevice();
   switch (sr_getevttype(deviceHandle))
   {
     case CCEV_EVENTS_ALL //all CCEV_ events
     case TDX_EVENTS_ALL // all TDX_ events
   }
}

thanks

To reply: mailto:General.28121@pysdiscussext.py.intel.com
To start a new topic: mailto:General@pysdiscussext.py.intel.com
To login: http://members.support.dialogic.com/wbproxy/wbpx.dll/~general
Received on Fri Apr 23 00:12:38 2004

This archive was generated by hypermail 2.1.8 : Sat Jul 16 2005 - 03:48:32 EDT