The two major functional blocks in the base code are the SIP and Worker threads.
The SIP thread is a conceptual bundling of the threads that run the SIP stack. As we’ve seen in Chapter 8, there are actually several threads in the SIP stack, but it is easier to understand how the base code works with the SIP stack if you think of all the SIP threads as one complex thread that sends and receives SIP messages to and from the network. SIP messages are received by the SIP thread from its stack’s message queue and placed in its output First In First Out (FIFO) queue. See Chapter 8 for more information about FIFOs.
The Worker thread is the application thread that takes messages from the FIFO and processes them using the builder, feature, state, and operator structures. Each class in the structure is a class container for the class below it. The content is filled according to the designer’s requirements. For example, the Marshal server (Chapter 11) has one builder, one feature, and one state but multiple operators for each message type, whereas the UA (Chapter 10) has multiple operators and multiple states. In the event that the Worker thread needs to send a response or forward a request, it makes a call to asynchronously send the message. The SIP thread then sends the message over the network.