@startuml "TD_VoLTE_EMC_INT_REL_01.png"
/'Editor: https://plantuml-editor.kkeisuke.com/ '/
/'Syntax: http://plantuml.com/fr/sequence-diagram '/
!include etsi-style.iuml
!pragma teoz true
'
participant "UE A"
box "EPC A" #LightBlue
  participant "PGw"
  participant "PCRF"
end box
box "IMS A" #LightBlue
  participant "P-CSCF"
  participant "E-CSCF"
  participant "IBCF"
participant "BGCF"
end box


'box "NW B" #LightGray
  participant "PSAP"
'end box

'
rnote right  "UE A"         : Gm
& rnote right "P-CSCF"      : Mw
& rnote right "E-CSCF"      : Mm\nMx\nMi
& rnote right "IBCF"        : Ici
& rnote right "PCRF"        : Rx
& rnote right "PGw"         : Gx
& rnote left "IBCF"        : \nMx\n
& rnote left "BGCF"        : \n\nMi
& rnote left "PSAP"        : Mm\n\n

'
"UE A"      <--> "PSAP" : Media Exchange
'
"UE A"      -> "P-CSCF"     : BYE
'
"P-CSCF"  -> "E-CSCF"     : BYE

alt PSAP in IMS A network (option 1)
"E-CSCF"  -> "PSAP"     : BYE

else PSAP not in IMS A network (option 2)\n
"E-CSCF"  -> "IBCF"     : BYE
&"IBCF"  --> "PSAP"     : BYE

else PSAP in PSTN network (option 3)\n
"E-CSCF"  -> "BGCF"     : BYE
&"BGCF"  --> "PSAP"     : BYE
'&"PSTN"  --> "PSAP"     : BYE

end


'
"P-CSCF"    -> "PCRF"       : STR
'
& "PCRF"    -> "PGw"        : RAR
'

rnote over "PCRF", PGw  #FFAAAA: Removal of Session Beares(s).

"PGw"       -> "PCRF"       : RAA
'
& "PCRF"    -> "P-CSCF"     : STA
'
alt PSAP in IMS A network (option 1)
'"E-CSCF"  -> "PSAP"     : BYE
"PSAP"  -> "E-CSCF"     : 200 OK
else PSAP not in IMS A network (option 2)\n
'"E-CSCF"  -> "IBCF"     : BYE
'&"IBCF"  --> "PSAP"     : BYE
"PSAP"  --> "IBCF"     : 200 OK
&"IBCF"  -> "E-CSCF"     : 200 OK

else PSAP in PSTN network (option 3)\n
'"E-CSCF"  -> "BGCF"     : BYE
'&"BGCF"  --> "PSAP"     : BYE
'&"PSTN"  --> "PSAP"     : BYE
"PSAP"  --> "BGCF"     : 200 OK
&"BGCF"  -> "E-CSCF"     : 200 OK
'&"PSAP"  --> "PSTN"     : 200 OK
end
'
"E-CSCF"  -> "P-CSCF"     : 200 OK
& "P-CSCF"  -> "UE A"     : 200 OK
'
"UE A"      <--> "PGw"      : Not possible
'
& "PGw"     <--> "PSAP"  : Not possible
@enduml
