@startuml
!include skin.inc

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


note left of bro 
	Visit site and 
	download Application
end note
app -> bro: peerConn=(Create PeerConnection)
app -> bro: (Set up media sources)
app -> bro: sdp=peerConn.CreateOffer
app -> bro: peerConn.SetLocalDescription(offer, sdp)

app -> srv: POST VvoipSession(userId, sdp)
srv --> app: Response with sessionId
srv ->]: INVITE(userId, offerSdp)

srv <-]: 180 Session Progress (answerSdp; 100rel)
srv ->]: PRACK
srv -> app: POST or NOTIFY\nVvoipAnswerNotification(answerSdp)
app -> bro: peerConn.setRemoteDescription(answer, answerSdp)
srv <-]: 200 OK PRACK

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

note right of srv: Terminating participant is alerted
srv<-]: 180 Ringing
srv -> app: POST or NOTIFY VvoipEventNotification(Alerting)

note right of srv: Terminating participant accepts
srv<-]: 200 OK INVITE

srv -> app: POST or NOTIFY\nVvoipAcceptanceNotification()

note over bro, srv
 Originator and Terminating Participant are in a call now.
end note

app -> srv: DELETE VvoipSession with sessionId
srv --> app: Response
srv ->]: BYE
app -> bro: peerConn.Close()

@enduml