@startuml
!include skin.inc

participant "<i>Browser</i>" as bro #ffffff
participant "Application" as app 
participant "Server" as srv 

== handle an incoming offer ==
note right of srv: Receive offer from the network
srv -> app: POST or NOTIFY VvoipOfferAnswerNotification(offer, offerSdp)
app -->> bro: <i>peerConnection.setRemoteDescription(offer, offerSdp)</i>
app -->> bro: <i>sdp=peerConnection.CreateAnswer()</i>
app -> srv: PUT VvoipAnswer(sdp)
app <-- srv: Response
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: <i>sdp=peerConnection.CreateOffer()</i>
app -> srv: PUT VvoipOffer(sdp)
app <-- srv: Response
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: POST or NOTIFY VvoipOfferAnswerNotification(pranswer, answerSdp)
app -->> bro: <i>peerConnection.setRemoteDescription(pranswer, answerSdp)</i>

== 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: POST or NOTIFY VvoipOfferAnswerNotification(answer, answerSdp)
app -->> bro: <i>peerConnection.setRemoteDescription(answer, answerSdp)</i>

@enduml