@startuml "TD_VoLTE_ECO_INT_REL_02.png"
/'Editor: https://plantuml-editor.kkeisuke.com/ '/
/'Syntax: http://plantuml.com/fr/sequence-diagram '/
!include etsi-style.iuml
!pragma teoz true
'
participant "PSAP"



box "IMS A" #LightBlue
participant "BGCF"
        participant "IBCF"
        participant "E-CSCF"
	participant "P-CSCF"
	
  
end box
box "EPC A" #LightBlue
  participant PCRF
  participant PGw
end box

participant "UE A"

'
rnote right  "UE A"         : Gm
& rnote right "P-CSCF"      : Mw
& rnote right "E-CSCF"      : Mw
& rnote right "IBCF"        : Mx\n\n
& rnote right "PCRF"        : Rx
& rnote right "PGw"         : Gx
& rnote right "BGCF"         : \nMi\n
& rnote right "PSAP"         : \n\nMm
& rnote left "E-CSCF"      : Mx\nMi\nMm
'
"PSAP"      <--> "UE A" : Media Exchange

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

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

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

end



"E-CSCF"  -> "P-CSCF"     : BYE
&"P-CSCF"  -> "UE A"     : BYE
'

"P-CSCF"    -> "PCRF"       : STR
'

& "PCRF"    -> "PGw"        : RAR
'
rnote over "UE A", PGw #FFAAAA: Removal of Session Beares(s).

"PGw"       -> "PCRF"       : RAA
'
& "PCRF"    -> "P-CSCF"     : STA



"UE A" -> "P-CSCF"      : 200 OK
&"P-CSCF" -> "E-CSCF"      : 200 OK

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

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

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

end


'
"UE A"  <--> "PGw"      : Not possible
'
& "PGw"     <--> "PSAP"     : Not possible
'
@enduml
