SIP¶
Ella PSAP receives and answers emergency calls as a SIP user agent server, from the SIP trunks.
Trunks¶
Ella PSAP accepts a request only from an address in the inbound_cidrs of an enabled SIP trunk. It answers any other request with 403 Forbidden, and drops an ACK. It trusts P-Asserted-Identity only from a trunk.
INVITE¶
What Ella PSAP does with an INVITE from a trunk.
| Case | Behaviour |
|---|---|
| On arrival | Sends 100 Trying, then 180 Ringing. |
| While ringing | Sends 180 Ringing again every 3 seconds. |
Require: 100rel |
Sends each 180 Ringing reliably, and answers the PRACK with 200 OK. When the INVITE has no SDP offer, the first 180 Ringing carries one (see Media), and no later response carries another. |
Service urn:service:test.*, or urn:service:sos.test and its sub-services |
Answers 404 Not Found. The call is not recorded. |
| A call taker answers | Sends 200 OK with the SDP answer, or with an SDP offer when no offer was exchanged yet. The call becomes answered. |
| CANCEL, or BYE before an answer | Answers 200 OK, and 487 Request Terminated to the INVITE. The call becomes abandoned. |
| UPDATE without SDP | Answers 200 OK. A location in the UPDATE is added to the call's locations. |
| UPDATE with an SDP offer while the INVITE's offer is unanswered | Answers 500 Server Internal Error with Retry-After. |
| UPDATE with an SDP offer once the first offer is answered | Answers as for an answered call. |
| PRACK missing for 32 seconds | Answers 500 Server Internal Error to the INVITE. The call becomes ended. |
| Unanswered for 24 hours | Answers 480 Temporarily Unavailable. The call becomes ended. |
| Shutdown of Ella PSAP | Answers 503 Service Unavailable. The call becomes ended. |
| The call cannot be recorded | Answers 500 Server Internal Error. |
| A body Ella PSAP does not understand | Ignores the body and handles the call. |
Ella PSAP answers INFO, MESSAGE and other methods with 405 Method Not Allowed.
Answered calls¶
What Ella PSAP does once a call taker has answered.
| Case | Behaviour |
|---|---|
| BYE from the caller | Answers 200 OK. The call becomes ended. |
| The call taker hangs up | Sends BYE. The call becomes ended. |
| re-INVITE or UPDATE with an SDP offer | Answers 200 OK with an SDP answer (see Media), or 488 Not Acceptable Here with Warning: 305 when the offer has no audio stream Ella PSAP supports. |
| re-INVITE without SDP | Answers 200 OK with its last SDP as an offer, and uses the answer in the ACK. |
| re-INVITE or UPDATE that refreshes the session | Answers 200 OK with the last SDP. |
Ella PSAP sends a request inside a call to the top Route when it is a loose router, or else to the Request-URI, over the transport that the URI resolves to; a sips: Request-URI is sent over TLS.
Contact¶
The Contact of the responses is the address and port the INVITE arrived on.
| INVITE | Contact |
|---|---|
| Over UDP | sip: URI. |
| Over TCP | sip: URI with transport=tcp. |
| Over TLS | sips: URI. |
sips: Request-URI, or a sips: top Record-Route, over UDP or TCP |
sips: URI on the TLS port, when sip.tls is set. |
Caller¶
Where the callback number of a call comes from.
| Source | Callback |
|---|---|
A tel URI in P-Asserted-Identity |
The number. |
A SIP URI with user=phone in P-Asserted-Identity |
The number in the user part. |
Another SIP URI in P-Asserted-Identity |
The URI. |
No P-Asserted-Identity |
Empty. |
Incident¶
Which incident a call joins, from the Call-Info with purpose=emergency-IncidentId.
Call-Info |
Incident |
|---|---|
| The URN of an open incident, or of an incident merged into it | That open incident. |
| The URN of a closed incident, or of an incident merged into it | That incident, reopened. |
| A URN that Ella PSAP does not know | A new incident with that URN. |
A URN that is not urn:emergency:uid:incidentid:<10 to 32 letters and digits>:<domain>, or none |
A new incident with a URN of Ella PSAP. |
Location¶
Where the locations of a call come from.
| Source | Behaviour |
|---|---|
Geolocation with a cid URI |
Reads the PIDF-LO body part with that Content-ID, at any depth of multipart/mixed or multipart/alternative. A URI listed twice is read once. |
Geolocation with another URI |
Keeps the URI as a reference. It is not fetched. |
An application/pidf+xml body part that no Geolocation names, at any depth |
Reads it. |
loc-src holding an IP address |
Removes it. |
Ella PSAP reads the shapes Point, Polygon, Circle, Ellipse, ArcBand, Sphere, Ellipsoid and Prism, in 2D (urn:ogc:def:crs:EPSG::4326) and 3D (urn:ogc:def:crs:EPSG::4979). It reads every civic address, each with its language. It logs an element it cannot read and skips it.
Media¶
Ella PSAP exchanges audio with the caller over RTP, and with the call taker's browser over WebRTC.
| Codec | Payload format |
|---|---|
| AMR (AMR-NB), the first choice | RTP payload format of RFC 4867, octet-aligned or bandwidth-efficient, with crc and robust-sorting as offered. All eight modes, at 12.2 kbit/s unless mode-set or the caller's mode request asks for less. |
| PCMU | G.711 ยต-law. |
| PCMA | G.711 A-law. |
An SDP answer from Ella PSAP:
- accepts the first
RTP/AVPaudio stream with a supported codec, and refuses every other stream with port 0, such as video, real-time text, or audio over SRTP (RTP/SAVP,RTP/SAVPF,UDP/TLS/RTP/SAVPF); - takes the first payload type of the offer that it supports: AMR without
interleavingor more than one channel, PCMU or PCMA; - keeps
octet-align,mode-set,crc,robust-sortingandchannelsfrom the offer, and addsmode-change-capability=2andmax-red=0; - follows the offer's
mode-change-periodandmode-change-neighborwhen it sends; - accepts
telephone-eventat 8000 Hz, and ignores the events; - asks for 20 ms packets, and sends packets as long as the offer's
ptime, up to itsmaxptimeand 240 ms.
An SDP offer from Ella PSAP lists AMR octet-aligned (96), AMR bandwidth-efficient (97), PCMU (0), PCMA (8) and telephone-event (101). Ella PSAP then receives any of them, and sends in the first codec of the answer, at the answer's ptime.
What Ella PSAP does with the caller's RTP.
| Case | Behaviour |
|---|---|
| RTP | Sent to the address and port of the caller's SDP. Received from any source, in any codec of the last answer. |
| RTCP | Sent and received on the port above each RTP port, or on the caller's a=rtcp port. Sender or receiver report with a CNAME every 5 seconds on average, and BYE when the call ends. |
Connection address 0.0.0.0 |
No RTP sent. |
sendonly or inactive from the caller |
No RTP sent. |
Ella PSAP takes the RTP and RTCP ports from media.rtp in the configuration file. It does not support SRTP, AMR-WB or EVS.
A call that offers no supported codec still rings and is recorded, but cannot be answered.
Callbacks¶
Ella PSAP calls a caller back through the SIP trunk the call came through, when the trunk has a callback_uri and the callback number is in international format.
| Element | Value |
|---|---|
| Request-URI and To | sip: followed by the callback number, @ and the host and port of callback_uri, with user=phone and the other parameters of callback_uri. |
| Destination | The host of callback_uri, resolved by RFC 3263. |
| From | sip: followed by the trunk's callback_number, @ and the SIP address, with user=phone, or sip:psap@ and the SIP address when the trunk has no callback_number. |
P-Asserted-Identity |
tel: followed by the trunk's callback_number, when the trunk has one. |
Priority |
psap-callback |
Resource-Priority |
esnet.0 |
| Body | An SDP offer (see Media). |
How a callback ends.
| Case | State |
|---|---|
200 OK, then BYE from either side |
ended |
408, 480, 486, 487, 600 or 603 |
unanswered |
| No answer within 60 seconds | Ella PSAP sends CANCEL. unanswered |
| The call taker hangs up before an answer | Ella PSAP sends CANCEL. unanswered |
| Another final response, or no response | failed |
OPTIONS¶
Ella PSAP answers OPTIONS from a trunk with 200 OK, and from any other address with 403 Forbidden.