Skip to content
Snippets Groups Projects
  • Matt Jordan's avatar
    9cffcca5
    res/ari: Register Stasis application on WebSocket attempt · 9cffcca5
    Matt Jordan authored
    Prior to this patch, when a WebSocket connection is made, ARI would not
    be informed of the connection until after the WebSocket layer had
    accepted the connection. This created a brief race condition where the
    ARI client would be notified that it was connected, a channel would be
    sent into the Stasis dialplan application, but ARI would not yet have
    registered the Stasis application presented in the HTTP request that
    established the WebSocket.
    
    This patch resolves this issue by doing the following:
     * When a WebSocket attempt is made, a callback is made into the ARI
       application layer, which verifies and registers the apps presented in
       the HTTP request. Because we do not yet have a WebSocket, we cannot
       have an event session for the corresponding applications. Some
       defensive checks were thus added to make the application objects
       tolerant to a NULL event session.
     * When a WebSocket connection is made, the registered application is
       updated with the newly created event session that wraps the WebSocket
       connection.
    
    ASTERISK-24988 #close
    Reported by: Joshua Colp
    
    Change-Id: Ia5dc60dc2b6bee76cd5aff0f69dd53b36e83f636
    9cffcca5
    History
    res/ari: Register Stasis application on WebSocket attempt
    Matt Jordan authored
    Prior to this patch, when a WebSocket connection is made, ARI would not
    be informed of the connection until after the WebSocket layer had
    accepted the connection. This created a brief race condition where the
    ARI client would be notified that it was connected, a channel would be
    sent into the Stasis dialplan application, but ARI would not yet have
    registered the Stasis application presented in the HTTP request that
    established the WebSocket.
    
    This patch resolves this issue by doing the following:
     * When a WebSocket attempt is made, a callback is made into the ARI
       application layer, which verifies and registers the apps presented in
       the HTTP request. Because we do not yet have a WebSocket, we cannot
       have an event session for the corresponding applications. Some
       defensive checks were thus added to make the application objects
       tolerant to a NULL event session.
     * When a WebSocket connection is made, the registered application is
       updated with the newly created event session that wraps the WebSocket
       connection.
    
    ASTERISK-24988 #close
    Reported by: Joshua Colp
    
    Change-Id: Ia5dc60dc2b6bee76cd5aff0f69dd53b36e83f636