Suppose we have two UAs that one invites the other, then they start a media session and then the connection is terminated. How exactly the media session is being terminated? I mean, one of the UA terminates the Media Session and then sends a BYE SIP message to the other party; or once the media session is opened and the UA decide to close it will send first a BYE message and then will close the media session?
UA1 UA2 |-----------> INVITE Close Media Session
|-----------> BYE INVITE BYE |-----------> Close Media Session