Files Loading and Callbacks Order

This section describes the steps that take place when different actions are executed or an event is triggered.

System Events

OverSIP starts

When OverSIP is started it performs the following steps:

  1. oversip.conf and proxies.conf are loaded and configuration parameters validated.
  2. server.rb is loaded.
  3. OverSIP::SystemEvents.on_started method is called.
  4. The event loop starts.

OverSIP terminates

When OverSIP is stopped it performs the following steps:

  1. OverSIP::SystemEvents.on_terminated method is called.
    • NOTE: This step does not take place if OverSIP failed to start.

OverSIP is reloaded

When OverSIP is reloaded (via a HUP signal or /etc/init.d/oversip reload) it performs the following steps:

  1. proxies.conf is reloaded and configuration parameters validated.
  2. server.rb is reloaded.

OverSIP is user-reloaded

When OverSIP is user-reloaded (via a USR1 signal or /etc/init.d/oversip user-reload) it performs the following steps:

  1. OverSIP::SystemEvents.on_user_reload method is called.
    • Here the user can place custom code (i.e. for reloading an Array variable with data retrieved from the database).

SIP Events

A SIP client initiates a TLS connection with OverSIP

When a SIP client initiates a TLS handshake OverSIP performs the following steps:

  1. OverSIP::SipEvents.on_client_tls_handshake method is called.

OverSIP initiates a TLS connection with a SIP server

When OverSIP attempts to open a SIP TLS connection with a server it performs the following steps:

  1. OverSIP::SipEvents.on_server_tls_handshake method is called.

A SIP request is received

When OverSIP receives a SIP request it performs the following steps:

  1. OverSIP::SipEvents.sip_on_request method is called.

WebSocket Events

A WebSocket client initiates a TLS connection with OverSIP

When a WebSocket client initiates a TLS handshake (thus WSS protocol) OverSIP performs the following steps:

  1. OverSIP::WebSocketEvents.on_client_tls_handshake method is called.

A WebSocket handshake request is received

When OverSIP receives a WebSocket handshake request (HTTP GET method) it performs the following steps:

  1. OverSIP::WebSocketEvents.on_connection method is called.

A WebSocket established connection is closed

When a successfully established WebSocket connection is closed (by the client or by OverSIP) OverSIP performs the following steps:

  1. OverSIP::WebSocketEvents.on_disconnection method is called.