@startuml
!include skin.inc

autonumber "#'.'"

participant "Server" as srv 
participant "Application" as app 
participant "Browser" as bro 

note left of srv: Receive session invitation \nwith offerSdp1
srv -> app: POST or NOTIFY VvoipSessionInvitationNotification(offerSdp1, sessionId)

app -> bro: Create PeerConnection and set up media sources
app -> bro: peerConnection.SetRemoteDescription(offer, offerSdp1)
app -> bro: answerSdp1=peerConnection.CreateAnswer()
app -> bro: peerConnection.SetLocalDescription(answer, answerSdp1)

app -> srv: PUT VvoipAnswer(answer, answerSdp1)
srv --> app: Response
note left of srv: Send answer 

note over bro, srv
 Running ICE connectivity checks
end note
bro -> app: oniceconnectionstatechange(completed)
app -> srv: PUT VvoipIceStatus(Connected)
srv --> app: Response

app -> srv: PUT VvoipSessionStatus(Ringing)
srv --> app: Response

note left of srv: Send ringing indication
app -> app: Alert the user
note right of app: User accepts
app -> srv: PUT VvoipSessionStatus(Connected)
srv --> app: Response

note left of srv: Send acceptance indication
note over bro, srv
 Originator and Terminating Participant are in a call now.
end note

note left of srv: Receive termination request
srv -> app: POST or NOTIFY VvoipEventNotification(SessionEnded)
app -> bro: peerConnection.Close()

@enduml