 Non-INVITE server INVITE server INVITE client Non-INVITE client Non-INVITE server INVITE server Receive Message Message The subnet model of UA1 FIGURE 16.7 Simple SIP model though HPN. From the model, there are some places in the subnet UA1 called port places containing input, output and I/O socket places as the interface with which the subnet could communicate with its surroundings. Figure 16.7b is the sub- net of the substitution transition UA1 in Figure 16.7a and the place Send which refers to place T1 is the output socket labeled Out and the place Receive, which refers to place R1 is input socket labeled In. As SIP works with SIP agents, e.g., SIP UA, SIP proxy server and SIP interacts with dif- ferent protocols, it's necessary to use HPN to model the interaction in high level and the functions of SIP agents in subnets. Colored Petri Net (CPN) [27], introduced by Kurt Jensen, is well-known for its capability in modeling discrete event systems [26]. The concept of color set, trigger functions, and other properties are suitable for modeling protocol and folding a large model. Color sets are tokens carrying complex information C 2009 by Taylor & Francis Group, LLC SIP Handbook: Services, Technologies, and Security TABLE 16.1 Formal Definition of SIP Messages through CPN colset Message = with INVITE ACK BYE CANCEL OK200 Templxx Error Trying100 NotFound404 timed; colset STATE STATE IDLE STATE_TALKING STATE WAITRING STATE_WAIT200 ATE_WAITBYEOK STATE_ WAITACK STATE_CALLCOMING CALLING Terminated Completed Proceeding Confirmed; and data. The passing scenario of color sets describes the control flow of a system. As SIP is a text-based protocol and SIP messages are of different kinds between server and client, color set is suitable to model a SIP message. The Table 16.1 is a simple color set example of SIP messages and system states through CPN. CPN is capable of describing the dynamic behavior of process systems and handling the hierarchy [26]. Combined with HPN and CPN into Hierarchical Colored Petri Net (HCPN), it a