Skip to content

SIP OPTIONS (sip) ​

Sends a SIP OPTIONS request, the "are you there" request of the protocol, over UDP, TCP or TLS, and reports the status code of the final answer and how long it took. The codes that count as healthy are configurable. Over TLS it reads the server's certificate from the same connection and reports how long it remains valid.

OPTIONS opens no call and rings no phone: the server answers with a status line and its capabilities, and the exchange is over. It tells a registrar, a proxy or a PBX that is up from one that accepts connections and does nothing.

What it looks like ​

The page of a sip sensor in the light theme

The sensor's page after a few polls, sending OPTIONS over UDP to a SIP server. In the dark theme: the sensor's page. The form for adding it, with its parameters filled in: light, dark.

Channels ​

KeyNameUnitDefault limits
status_codeStatus codenonenone
response_msResponse timemswarning above 1000, error above 5000
cert_days_remainingDays until the certificate expiresdayswarning below 21, error below 7; only over TLS
chain_days_remainingDays until the earliest expiry in the chaindayswarning below 21, error below 7; only over TLS

response_ms runs from the start of the exchange to the final answer, so over TCP and TLS it includes connecting and the handshake. A provisional answer (100 Trying, 180 Ringing) is not final and is waited past. A status outside the expected set is a successful poll that is Down and says which status arrived and from which server software, if it named itself.

Parameters ​

ParameterDefaultMeaning
transportudpudp, tcp or tls.
port5060, or 5061 with tlsThe server's port.
domainthe device's host name, else its addressThe host in the request URI and in To. Some servers answer 404 or 403 to a domain they do not serve; set it to the one they do.
expected_status["200"]Codes that are healthy: single codes (200), classes (2xx) or inclusive ranges (200-299). SIP codes run from 100 to 699, so 6xx is allowed. Many servers answer an OPTIONS without a known user with 401, 403 or 404 while being perfectly well: add that code here.
server_namedomainOver TLS, the name the certificate has to be valid for.
verify_tlstrueOver TLS, verify the certificate against the probe host's trust store.
tls_fingerprintnoneOver TLS, trust exactly the certificate with this SHA-256 fingerprint. See pinning a certificate.
check_certificatetrueOver TLS, report the two certificate channels.

Suggested interval: 60 seconds. No credential.

Over UDP, a request that gets no answer is sent again after 500 ms, then after 1 s, 2 s and 4 s, as RFC 3261 says for the first request of a client, so one lost datagram does not fail a poll. The retransmissions stop at the poll's timeout. The request carries a random Call-ID and branch, and an answer to anything else is ignored.

On the target ​

A SIP server that answers OPTIONS from the probe's address. Nothing is installed. Some servers answer only addresses they know; check the server's access list if the poll times out while the port is open.

Failures ​

MessageMeaning
<server> sent no final answer to OPTIONS within N ms (kind timeout)Nothing answered, or only provisional answers arrived.
the answer is not a SIP response: ... (kind protocol)Something that is not SIP is listening on the port.
<server> closed the connection without a final answer to OPTIONS (kind protocol)A TCP or TLS server hung up.
TLS error: ... (kind protocol)The certificate was refused, or the port does not speak TLS. The text says which and how to fix it.
connection refused (kind unreachable)Nothing listens on the TCP port. Over UDP a refusal is reported the same way when the host answers with an ICMP error.
<status> <reason> is not in the expected set [...]A successful poll that is Down.

Verification ​

Run against Kamailio in a container on a test network, over UDP and TCP, and against servers the tests start themselves: a UDP server that answers with a provisional and then a final answer, one that loses the first datagram, one that stays silent, a TCP server, one that answers HTTP instead, one that hangs up, and a TLS server read with the certificate not verified, with the right pin and with a wrong one, and one whose untrusted certificate is refused with its fingerprint offered. The TLS transport was not run against a real SIP server: the lab's has no TLS listener. The messages are built and read by hand.

The live test reads its target from the environment and says so and returns when it is not set:

VariableMeaning
PROBEWARD_TEST_SIP_HOSTThe server's address. It must answer OPTIONS with 200 over UDP and TCP.
sh
cargo test -p probeward-sensors --test live_protocols sip -- --nocapture

AGPL-3.0-only