[Asterisk-code-review] pjsip: Rewrite OPTIONS support with new eyes. (asterisk[13])

Richard Mudgett asteriskteam at digium.com
Sun Jan 14 23:09:16 CST 2018


Richard Mudgett has posted comments on this change. ( https://gerrit.asterisk.org/7710 )

Change subject: pjsip: Rewrite OPTIONS support with new eyes.
......................................................................


Patch Set 1:

(1 comment)

https://gerrit.asterisk.org/#/c/7710/1/res/res_pjsip/pjsip_options.c
File res/res_pjsip/pjsip_options.c:

https://gerrit.asterisk.org/#/c/7710/1/res/res_pjsip/pjsip_options.c@102
PS1, Line 102: 	/*! \brief The names of the AORs feeding this compositor */
             : 	struct ao2_container *aors;
             : 	/*! \brief The number of AORs that are available */
             : 	unsigned int available;
             : 	/*! \brief The name of the endpoint */
> Clarify how you envision this working.
endpoint compositor layer

struct sip_options_endpoint_aor_status {
   /*! \brief The last contributed available status of the named AOR (1 if available, 0 if not available) */
   char available;
   /*! \brief The name of the aor */
   char name[0];
}

struct sip_options_endpoint_state_compositor {
   /*! \brief The last contributed available status of the AORs feeding this compositor */
   struct ao2_container *aor_statuses;
   /*!
    * \brief Non-zero if the compositor is in normal operation. i.e. Not being setup/reconfigured.
    * \details The aor layer can only update its aor_statuses record when not active.
    * When active the aor layer can update its aor_statuses record, calculate the new
    * number of available aors, determine if the endpoint compositor changed state,
    * and report it.
    */
   char active;
   /*! \brief The name of the endpoint */
   char name[0];
};

endpoint_observer create/update
  Since the endpoint knows which aors are associated with the endpoint the endpoint layer must maintain the links between the endpoint and aor layers.
  * Gets/creates the associated endpoint compositor from the global container.
  * Sets the compositor to inactive.  The aor layer can only update its aor_statuses record.
  * Unlinks the compositor from the linked aors in the aor_statuses container using async requests to each aor.
  * Empties the aor_statuses container
  * For each aor listed in the endpoint aors option comma separated list:
  ** get/create the sip_options_aor record of an existing aor
  ** Failing to obtain a sip_options_aor record complain and skip to the next aor in the list
  ** Send a synchronous request to the sip_options layer.  (Synchronous to pace requests and because we need to get the current status.)  The request does:
  *** Create a new aor_status record
  *** Add the record to the aor_statuses container with the current aor status
  *** Add the endpoint compositor link to the compositor vector
  * With the compositor locked
  ** Traverse the current statuses in the aor_statuses container until find the first available aor status
  ** Report to the persistent endpoint the current ONLINE/OFFLINE status.
  ** Set the compositor active

endpoint_observer delete
  * Gets the associated endpoint compositor from the global container and unlinks it
  * Sets the compositor to inactive.  The aor layer can only update its aor_statuses record.
  * Unlinks the compositor from the linked aors in the aor_statuses container using synchronous requests to each aor.  Synchronous requests to avoid flooding the serializer during shutdown


aor compositor layer
  The aor observer callbacks need to maintain their flock of contacts, the scheduled qualify OPTIONS pings, and switching between qualifying/non-qualifying mode.
  The only member of the sip_options_aor struct not manipulated by the aor serializer is the sched id.  The management_serializer must start the scheduled pings to avoid starting it twice and stop the scheduled pings to avoid deadlock.


contact layer
  The contact layer is also managed by the aor compositor layer serializer basically as it is currently coded.


When an aor compositor reports a status change to the endpoint compositor layer:
  * With the compositor locked
  ** Set the new aor status into the aor_statuses container
  ** If the endpoint compositor is not active then
  *** Done
  ** If the new aor status is available then
  *** Report to the persistent endpoint the endpoint's ONLINE status.
  *** Done
  ** Traverse the current statuses in the aor_statuses container until find the first available aor status
  ** Report to the persistent endpoint the current ONLINE/OFFLINE status.



-- 
To view, visit https://gerrit.asterisk.org/7710
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-MessageType: comment
Gerrit-Change-Id: I6a5ebbfca9001dfe933eaeac4d3babd8d2e6f082
Gerrit-Change-Number: 7710
Gerrit-PatchSet: 1
Gerrit-Owner: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
Gerrit-Comment-Date: Mon, 15 Jan 2018 05:09:16 +0000
Gerrit-HasComments: Yes
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20180114/c1c47606/attachment.html>


More information about the asterisk-code-review mailing list