@startuml "TD_VoLTE_ECO_INT_INI_09.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
& rnote right "PCRF"        : Rx
& rnote right "PGw"         : Gx
& rnote right "BGCF"         : Mi
& rnote right "PSAP"         : Mm
'                
rnote over "UE A", PSAP #FFAAAA:   \s\s                                                                                   Emergency call terminated                                                                                   \s\s                                                                                   

alt Option 1: PSAP in IMS A network
"PSAP"  -> "E-CSCF"     : INVITE

else Option 2: PSAP NOT in IMS A network\n
"PSAP" --> "IBCF"     : INVITE
&"IBCF"  -> "E-CSCF"     : INVITE

else Option 3: PSAP in PSTN network\n
"PSAP"  --> "BGCF"     : INVITE
'&"PSTN"  --> "E-CSCF"     : INVITE
&"BGCF"  -> "E-CSCF"     : INVITE

end

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

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

'& "PCRF"    -> "PGw"        : RAR
'

rnote over "UE A", PSAP #FFAAAA:   \s\s                                                                                   Installation Session Beares(s).                                                                                   \s\s 
'rnote over "UE A", PGw #FFAAAA: Installation Session Beares(s).

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



"UE A" -> "P-CSCF"      : 183 Session Progress
&"P-CSCF" -> "E-CSCF"      : 183 Session Progress

alt Option 1: PSAP in IMS A network
"E-CSCF"  -> "PSAP"     : 183 Session Progress

else Option 2: PSAP NOT in IMS A network\n
"E-CSCF"  -> "IBCF"     : 183 Session Progress
&"IBCF"  --> "PSAP"     : 183 Session Progress

else Option 3: PSAP in PSTN network\n
"E-CSCF"  -> "BGCF"     : 183 Session Progress
&"BGCF"  --> "PSAP"     : 183 Session Progress
'&"PSTN"  --> "PSAP"     : 183 Session Progress

end


'
"UE A"  <--> "PSAP"      : Early Media
'
'& "PGw"     <--> "PSAP"     : Not possible

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

alt Option 1: PSAP in IMS A network
"E-CSCF"  -> "PSAP"     : 180 Ringing
"E-CSCF"  -> "PSAP"     : 200 OK
"PSAP"  -> "E-CSCF"     : ACK
else Option 2: PSAP NOT in IMS A network\n
"E-CSCF"  -> "IBCF"     : 180 Ringing
&"IBCF"  --> "PSAP"     : 180 Ringing
"E-CSCF"  -> "IBCF"     : 200 OK
&"IBCF"  --> "PSAP"     : 200 OK
"PSAP" --> "IBCF"     : ACK
&"IBCF"  -> "E-CSCF"     : ACK
else Option 3: PSAP in PSTN network\n
"E-CSCF"  -> "BGCF"     : 180 Ringing
&"BGCF"  --> "PSAP"     : 180 Ringing
'&"PSTN"  --> "PSAP"     : 180 Ringing
"E-CSCF"  -> "BGCF"     : 200 OK
&"BGCF"  --> "PSAP"     : 200 OK
'&"PSTN"  --> "PSAP"     : 200 OK
"PSAP"  --> "BGCF"     : ACK
&"BGCF"  -> "E-CSCF"     : ACK
'&"BGCF"  -> "E-CSCF"     : ACK

end

"E-CSCF"  -> "P-CSCF"     : ACK
&"P-CSCF"  -> "UE A"     : ACK

"UE A"  <--> "PSAP"      : Media exchange
'
@enduml
