am trying to implement a SIP UA and to do so, I studied the Asterisk console in debug mode for SIP. I tried to call one extension (A) from another extension (B).
The initial message flow up to the RINGING message, I understood, including the Digest Authentication part. These are:
Followed by a series of back-and-forth messages:
401 Unauthorized with NONCE
INVITE with correct Digest
After the ringing phone (A) is picked up, I see the following exchange of message:
(A) >----> OK >-----> [Asterisk]
(A) <----< ACK>-----< [Asterisk]
[Asterisk] >----- OK ------> (B)
(A) >—(re)INVITE–> [Asterisk]
[Asterisk] <-----ACK-------< (B) [Asterisk] >---(re)INVITE--> (B)
(A) >—TRYING -----> [Asterisk]
[Asterisk] <-----OK--------< (B)
(A) >-----OK--------> [Asterisk]
(A) <----ACK--------< [Asterisk]
I am writing the UA part on the (B) side and know the SDP for A beforehand and can generate the SDP for B, which is in my control. My call flow will always be from B to A. I can control all message going from (B). How can I reduce the above message flow? Also, I do not fully understand the need for so many messages after the initial SDPs are exchanged until RINGING. Or are they? Can someone mark a one-liner comment for the messages shown, specifically, what the OK and ACK correspond to?