Asterisk call process

2023-01-23   ES  

(Welcome to teach, penguin: 2172243813 More information is in www.ttkmwl.com)

 

code analysis:
First of all, the name CQUEUESERVICEEVENT is very tempting ,,, you feel that he is an event, but it is not. Its actual function should be an event queue with a packing function ,,, or a specified Event Queue Delivery Event like a specified EventQueue. From the interface point of view, this Dongdong can submit a timeReventDataBaseEvent 
SocketAcceptEvent 
SocketReadEvent 
SocketCloseEvent

Should hold a CQUEUESERVICE pointer itself, so it is not responsible for data management, but is only responsible for packaging and added to the CQUEUESERVICE instance.

First look at the timer event: 1 
 
// timer event

 
 
boolPostTimerEvent(WORD wTimerID, WPARAM wBindParam)


 
 
 
{


 
 
 
 
 
 
// Effective parameters

 
 
 
 
 
 
ASSERT(m_pIQueueService!=NULL);


 
 
 
 
 
 
if (m_pIQueueService==NULL) return false;

7


 
 
 
 
 
 
// buffer lock

 
 
 
 
 
 
CThreadLockHandle BufferLockHandle(&m_BufferLock);

10

11 
 
 
 
 
 
 
// Submit message
12 
 
 
 
 
 
 
NTY_TimerEvent * pTimerEvent=(NTY_TimerEvent *)m_cbBuffer;

13 
 
 
 
 
 
 
pTimerEvent->wTimerID=wTimerID;

14 
 
 
 
 
 
 
pTimerEvent->wBindParam=wBindParam;

15 
 
 
 
 
 
 
m_pIQueueService->AddToQueue(EVENT_TIMER,m_cbBuffer,sizeof(NTY_TimerEvent));

16

17 
 
 
 
 
 
 
return true;

18 
 
 
}

Hmm, the quality of the code is very high ,,,

The
entrance has an assertion to help expose errors during the debug stage. After the assertion, the if statement is judged again, so that even if the release version is wrong, it will not be missed ,,,,,,,,,
About the encapsulation of the incident, it is actually stratified here ,,,

Here is the first floor:
1struct tagDataHead

2 {


 
 
WORD 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
wDataSize; 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
// Data size

 
 
WORD 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
wIdentifier; 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
// Type logo

 
 
DWORD 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
dwInsertTime; 
 
 
 
 
 
 
 
 
 
 
 
 
 

Related Posts

[Programmer Interview Gold Code] Use two stacks to implement a queue to complete the queue’s Push and POP operations. The element in the queue is int type.

Center6.5 MySQL installation, configuration, optimization My

LOGSTASH nested json/multi -layer JSON parsing configuration configuration zhcha

How to connect the Raspberry Pi gateway to the built -in LORAWAN Network Server -teach you how to connect the Raspberry Pi gateway to the 5th article of the server

Asterisk call process

Random Posts

qt5 Daily Study (Wed) QT login dialog box Bryce1010

response.getWriter (). The difference between write () and out.print ()

Big Data Offline Data Collection (SQOOP)

qt5 Daily Study (Wed) QT login dialog box Bryce1010

Common network testing tool