# Signaling

Signaling is implementing softphone functionality and maybe VPN signaling functionality, which can be controlled by RCC. It can be included in the myApps native code, so that phone calls can be established without the web user interface active.

The App Signaling can be used to test this functionality on the AP. In this case no real audio interface is available, but a audio loopback function is used instead.

## Objects

The following diagram shows an overview about the implemented objects

Signaling
  The main class. Uses the WebserverPlugin to receive AppWebsocket connections from the user interface. It uses ISignaling as base class to provide an interface to other C++ modules
SignalingSession
  Is allocated for each incoming AppWebsocket connection. It uses the JsonApi mechanism to provide a RCC api. Also the functions from ISignaling can be used by AppWebsocket messages for testing purposes.
SignalingClient
  This object is allocated/deleted with the ISignalingService::SetClient function, or the respective AppWebsocket request. When allocated it establishes a client connection to a PBX user, using a session created by the login. This client connection stays active independent of the AppWebsocket sessions.
  The state of the client connection can be monitored using the Signaling::AddClientMonitor function
  When the login fails, or the AppWebsocket client connection breaks an automatic retry is done after a configurable timeout.
SignalingRegistration
  This object is allocated/deleted with the ISignaling::SetRegistration function, or the respective AppWebsocket request. When allocated it establishes a PbxSignal registration. This registration stays up independent of the AppWebsocket sessions.
  When the registration fails, or the client connection breaks, a retry is done after a configurable timeout, or when the client connection comes back.
SignalingCall
  These objects are allocated each call established with the PbxSignal Api. A the btree calls in SignalingRegistration is used to find the object based on the call handle (positive for outgoiing calls, negativ for incoming calls).
  A SignalingCall object is created on receiving a new incoming call by SignalingRegistration or with the RCC UserCall request for outgoing calls.
  A class SignalingCallMonitor can be used to monitor all messages sent or received for this call
  For each call an IMedia and an IAudioIoChannel is created for the RTP send/recv and Audio IO using the IMediaProvider and IAudioIo interfaces, provided when Signaling is created.
SignalingRccSession
  This object is allocated for each SignalingSession, when the first time a request for the RCC Api is received. It manages all the other RCC objects
SignalingRccUser
  These objects are allocated with the RCC UserInitialize request, to monitor the registrations. Multiple SignalingRccUser objects may be created all refering to the same single registration.
SignalingRccCall
  These objects are created for each SignalingCall for each SignalingRccUser. For each of these objects a unique handle is created which can be used by the RCC Api to address the call.
  The CallInfo messages are created by these objects.