SIP message handling
Each SIP message has a direction and can be optional. If an incoming message is optional the control logic may skip to the next message and see whether that one matches. If that is optional too, it skips to the next, until it reaches a non-optional message. A non-optional incoming message must match: if it does not, the scenario does not advance. The idea behind optional messages is to handle a scenario that varies slightly from the expected sequence.
Outgoing messages can be optional too. It only makes sense after optional incoming messages: an optional outgoing message is sent only if the optional incoming message before it was received. For an outgoing call it is not known in advance if the server answers with 100, 180 or 200, so 100 and 180 are optional. A registration may be challenged with 401 or accepted at once with 200 OK:
Outgoing call
---> INVITE
<--- 100*
<--- 180*
<--- 200
---> ACK
---- Play pcap=test.pcap
<--- BYE
---> 200Registration
---> REGISTER
<--- 100*
<--- 401*
---> REGISTER*
<--- 200If an incoming message is mandatory the scenario will not advance until the expected message is received. Requests and responses are offered in a drop-down list, but you can always type a new message and add it to the scenario.
Messages that no call owns. A message whose Call-ID does not belong to a running call starts a new call only if the scenario has a dialog that begins with that message, for example a server scenario that begins with <--- INVITE, or a dialog after a New Dialog that waits for an incoming request. A dialog that begins with a message that SIP Inspector sends is started by SIP Inspector only. A late response or NOTIFY of an earlier call is counted as unexpected and is logged, and does not start anything. (Without this rule a client that subscribed on a real server could be flooded with calls created by the server's late NOTIFYs.)