@startuml "TD_VoLTE_NGC_INT_ABT_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


  participant "PSAP"

'
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"      <--> "PGw"      : Not possible
' & "PGw"     <--> "PSAP" : Not possible
' "UE A"      ->   "P-CSCF"   : INVITE (urn:service:sos*)
' "P-CSCF"    ->   "PCRF"     : AAR
' & "PCRF"    ->   "PGw"      : RAR
' rnote over "UE A", PGw #FFAAAA: Installation of media Bearer
' "PGw"       ->   "PCRF"     : RAA
' & "PCRF"    ->   "P-CSCF"   : AAA
' "PGw"       ->   "PCRF"     : CCR
' & "PCRF"    ->   "P-CSCF"   : RAR
'   "P-CSCF"  ->   "PCRF"     : RAA
' & "PCRF"    ->   "PGw"      : CCA
' & "P-CSCF"  ->   "E-CSCF"   : INVITE

' alt PSAP in IMS A network (option 1)
' "E-CSCF"  -> "PSAP"     : INVITE
' "PSAP"  -> "E-CSCF"     : 183 Session\nProgress
' else PSAP not in IMS A network (option 2)\n
' "E-CSCF"  -> "IBCF"     : INVITE
' &"IBCF"  --> "PSAP"     : INVITE
' "PSAP"  --> "IBCF"     : 183 Session\nProgress
' &"IBCF"  -> "E-CSCF"     : 183 Session\nProgress
' else PSAP in PSTN network (option 3)\n
' "E-CSCF"  -> "BGCF"     : INVITE
' &"BGCF"  --> "PSTN"     : INVITE
' &"PSTN"  --> "PSAP"     : INVITE
' "PSAP"  --> "PSTN"     : 183 Session\nProgress
' &"PSTN"  --> "BGCF"     : 183 Session\nProgress
' &"BGCF"  -> "E-CSCF"     : 183 Session\nProgress
' end



'  "E-CSCF"  ->   "P-CSCF"   : 183 Session\nProgress
' & "P-CSCF"  ->   "PCRF"     : AAR
' & "PCRF"    ->   "PGw"      : RAR
' rnote over "UE A", PGw #FFAAAA: Modification of media Bearer
' "PGw"       ->   "PCRF"     : RAA
' & "PCRF"    ->   "P-CSCF"   : AAA
' "P-CSCF"    ->   "UE A"     : 183 Session\nProgress
' "PSAP"  -->  "UE A"     : Early media

' alt PSAP in IMS A network (option 1)

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

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

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

rnote over "PGw", PSAP #FFAAAA: \s\s                         \s\sEmergency session establishment as in TD_VoLTE_ECO_INT_INI_01 until 180 ringing (Event 22)\s\s                         \s\s

"UE A"      ->   "P-CSCF"   : CANCEL
"P-CSCF"    ->   "PCRF"     : STR
& "PCRF"    ->   "PGw"      : RAR
rnote over "PCRF", PCRF #FFAAAA: Removal of Early-media Bearer
"PGw"       ->   "PCRF"     : RAA
& "PCRF"    ->   "P-CSCF"   : STA
 "P-CSCF"  ->   "E-CSCF"   : CANCEL

alt PSAP in IMS A network (option 1)
"E-CSCF"  -> "PSAP"     : CANCEL
"PSAP"  -> "E-CSCF"     : 200 OK (CANCEL)
else PSAP not in IMS A network (option 2)\n
"E-CSCF"  -> "IBCF"     : CANCEL
&"IBCF"  --> "PSAP"     : CANCEL
"PSAP"  --> "IBCF"     : 200 OK (CANCEL)
&"IBCF"  -> "E-CSCF"     : 200 OK (CANCEL)
else PSAP in PSTN network (option 3)\n
"E-CSCF"  -> "BGCF"     : CANCEL
&"BGCF"  --> "PSAP"     : CANCEL
'&"PSTN"  --> "PSAP"     : CANCEL
"PSAP"  --> "BGCF"     : 200 OK (CANCEL)
'&"PSTN"  --> "BGCF"     : 200 OK (CANCEL)
&"BGCF"  -> "E-CSCF"     : 200 OK (CANCEL)

end


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

alt PSAP in IMS A network (option 1)

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

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

 "E-CSCF"  ->   "P-CSCF"   : 487 (INVITE)
&"P-CSCF"   ->   "UE A"     : 487 (INVITE)

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

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

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

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



end




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