Sippy.Registrar (sippy v0.1.0)

Copy Markdown View Source

Keeps an extension registered with the PBX and reports its incoming calls.

Start it under a supervisor:

children = [
  {Sippy.Registrar, config: Sippy.config(...), notify: MyApp.Phone}
]

or with Sippy.register/2. Options:

  • :config - Sippy.Config (required)
  • :notify - pid or registered name that receives the call messages (required)
  • :name - registers the registrar under this name

The :notify process receives:

  • {:incoming_call, %Sippy.IncomingCall{}} for a new call, after the registrar sent 100 Trying
  • {:incoming_call_cancelled, call_id} when an unanswered call is cancelled by the caller, or rings for longer than the config's :pending_call_timeout and is ended with 480 Temporarily Unavailable

An incoming call that is not answered can be rung with Sippy.ring/1 or turned down with Sippy.reject/2. A CANCEL for it is answered with 200 OK and ends the INVITE with 487 Request Terminated. An offer without PCMU or PCMA is rejected with 488 Not Acceptable Here, and calls beyond the config's :max_pending_calls with 486 Busy Here; neither is reported.

Retransmitted INVITEs and CANCELs are answered again but reported only once, also for 32 seconds after the call was turned down, so a lost final response does not show up as a new call. OPTIONS keepalives are answered with 200 OK.

The registrar keeps retrying a failed registration with a growing delay, see the config's :register_retry_interval.

Summary

Functions

Returns a specification to start this module under a supervisor.

Whether the PBX accepted the last REGISTER.

Starts a registrar, see the module documentation for the options.

Unregisters from the PBX and stops the registrar.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

registered?(registrar)

@spec registered?(GenServer.server()) :: boolean()

Whether the PBX accepted the last REGISTER.

start_link(opts)

@spec start_link(keyword()) :: GenServer.on_start()

Starts a registrar, see the module documentation for the options.

unregister(registrar)

@spec unregister(GenServer.server()) :: :ok

Unregisters from the PBX and stops the registrar.