@startuml
!include skin.inc

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

== handle an incoming offer ==
note right of srv: Receive offer from the network
srv -> app: VvoipOfferAnswerNotification(offer, offerSdp)
app -> bro: peerConn.setRemoteDescription(offer, offerSdp)
app -> bro: sdp=peerConn.CreateAnswer()
app -> srv: PUT VvoipAnswer(sdp)
note right of srv: Send answer to the network

== initiate an offer ==
note over app, bro: modify the Peerconnection (e.g. adding video)
app -> bro: sdp=peerConnection.CreateOffer()
app -> srv: PUT VvoipOffer(sdp)
note right of srv: Send offer to the network
note right of srv: Eventually, an answer or \nprovisional answer will arrive

== handle an incoming provisional answer ==
note right of srv: There must be a pending offer \n(i.e. without answer)
note right of srv: Receive answer from the network \nand classify as provisional
srv -> app: VvoipOfferAnswerNotification(pranswer, answerSdp)
app -> bro: peerConn.setRemoteDescription(pranswer, answerSdp)

== handle an incoming answer ==
note right of srv: There must be a pending offer \n(i.e. without answer)
note right of srv: Receive answer from the network
srv -> app: VvoipOfferAnswerNotification(answer, answerSdp)
app -> bro: peerConn.setRemoteDescription(answer, answerSdp)



@enduml