# Changelog

## 0.1.0 (2026-11-30)

First release.

* Outbound calls through a 3CX PBX with `Sippy.call/2`, optionally playing a
  WAV file (`:audio`) once answered. The `:parent_pid` receives
  `{:call_answered, pid}` and `{:call_ended, pid, reason}` for every end the
  application did not cause itself: `:remote_hangup`, `{:rejected, status}`,
  `:ring_timeout`, `:hangup_after_audio`, `:max_duration`,
  `:no_common_codec`, `:invalid_sdp`, `:auth_failed` or `{:error, reason}`.
* One set of functions for both kinds of call: `Sippy.hangup/1`,
  `Sippy.play_audio/2`, `Sippy.stop_audio/1` and `Sippy.dtmf_digits/1`.
  Inbound calls are answered with `Sippy.answer/2` and also have
  `Sippy.hold/1`, `Sippy.unhold/1`, `Sippy.caller_id/1` and the transfers;
  `Sippy.dialog_info/1` gives an outbound call's dialog for an attended
  transfer.
* `Sippy.reject/2` turns down a ringing incoming call with `486 Busy Here`,
  `603 Decline` or `480 Temporarily Unavailable`.
* An incoming call that was rejected, cancelled, timed out or turned away as
  busy is remembered for 32 seconds: a retransmitted INVITE gets the same
  final response again instead of being reported as a new call.
* Every DTMF digit is sent to the `:parent_pid` as `{:dtmf, call_pid, digit}`,
  on outbound and inbound calls. A digit neither hangs up the call nor stops
  the audio: that is up to the application.
* The end of the audio is reported as `{:audio_completed, call_pid}`. An
  outbound call hangs up after its audio only when `:hangup_after_audio` is
  set to a number of milliseconds; it defaults to `false`.
* `:max_duration` hangs up an answered call, outbound or inbound, after that
  many milliseconds (default: 10 minutes, `:infinity` turns it off). An
  inbound call reports it as `{:call_ended, pid, :max_duration}`.
* Calls use the G.711 codec the other side picks: PCMU or PCMA (A-law),
  also on a dynamic payload type. An inbound call is answered with just that
  codec, and an offer without either is rejected with `488 Not Acceptable
  Here`; an outbound call answered without either is acknowledged and hung
  up.
* DTMF is read from the negotiated telephone-event payload type instead of
  always 101.
* Audio played one file after another keeps one RTP stream: the sequence
  numbers continue, the timestamp follows the wall clock through the silence
  in between, and each new file starts with the marker bit set.
* Audio packets are sent on a fixed 20 ms schedule from the start of the
  file, so playback no longer drifts behind and sounds distorted.
* Playing a file replaces the audio that is playing, and `Sippy.play_audio/2`
  returns an error for a file it cannot read.
* The exit reason of an outbound call and `Sippy.dtmf_digits/1` hold all
  the digits pressed, oldest first.
* Inbound calls: registration as an extension, answering, playing audio, hold
  and resume, DTMF, attended and blind transfer, SIP session timers
  (RFC 4028).
* `Sippy.Registrar` can run under a supervisor (`{Sippy.Registrar, config: ..., notify: pid}`)
  or be started with `Sippy.register/2`; `Sippy.registered?/1` reports its state.
* Incoming calls arrive as `{:incoming_call, %Sippy.IncomingCall{}}` and
  `{:incoming_call_cancelled, call_id}`; answer one with
  `Sippy.start_inbound_call/2`.
* Ringing without answering (`Sippy.ring/1`): a CANCEL is answered with
  `200 OK` and the INVITE with `487 Request Terminated`.
* OPTIONS keepalives are answered with `200 OK`.
* UDP transport only.
* A `Session-Expires` below RFC 4028's minimum of 90 seconds is raised to 90.
* Call-IDs (128 bits), tags (64 bits), branches (96 bits) and RTP SSRCs and
  sequence numbers are cryptographically random.
* SDP addresses and ports are validated: answering a call with unusable SDP
  returns `{:error, :invalid_sdp}`, and an outbound call answered with one is
  acknowledged and hung up.
* A failed registration (rejected credentials, an error response, no answer,
  a failed send or socket) is retried with a fresh challenge and a growing
  delay instead of stopping the registrar; a `stale=true` challenge is answered
  at once.
* At most `:max_pending_calls` incoming calls ring at once (further ones get
  `486 Busy Here`), and one left ringing for `:pending_call_timeout` is ended with
  `480 Temporarily Unavailable`.
* Responses only count when they belong to Sippy's own transaction (Call-ID,
  CSeq, Via branch, and for calls the From tag).
* SIP is only accepted from the PBX (or `:trusted_sources`), and RTP only from
  the negotiated remote media address.
* Every DTMF key press is detected, also the same digit twice in a row.
* WAV files at any sample rate play at the right speed, and audio is encoded as
  standard G.711 mu-law.
* Digest authentication follows RFC 2617 with and without `qop=auth`, and
  echoes the server's `opaque`.
* Outbound calls acknowledge every non-2xx final response to an INVITE (such as
  3CX's 407 challenge) with an ACK in the INVITE's transaction.
* Responses copy every Via header of the request, so Sippy works behind SIP
  proxies, and compact header forms (`v:`, `i:`, `f:`, `t:`, ...) are understood.
* Outbound and inbound calls run under `Sippy.CallSupervisor` and are not
  restarted when they crash.
* Transfers run inside the inbound call, and each REFER uses the next CSeq.
  Their outcome is reported as `{:transfer_completed, pid}`, after which the
  call hangs up and ends with `:transferred`, or as
  `{:transfer_failed, pid, status}` when the PBX rejects the REFER or its
  NOTIFY reports a failure. In-dialog NOTIFYs go to the call they belong to.
* Configuration is passed explicitly with `Sippy.config/1`; Sippy reads no
  application environment, and unknown options raise an `ArgumentError`.
