[asterisk-dev] [Code Review] 4467: res_pjsip: Fix pjsip.conf type=global object default value handling.

Joshua Colp reviewboard at asterisk.org
Tue Mar 10 08:25:10 CDT 2015


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/4467/#review14621
-----------------------------------------------------------



/branches/13/res/res_pjsip/config_global.c
<https://reviewboard.asterisk.org/r/4467/#comment25178>

    Give a suggestion of what the user should do to resolve this/the requirement that only one can exist



/branches/13/res/res_pjsip/config_global.c
<https://reviewboard.asterisk.org/r/4467/#comment25177>

    Why the change of this from a define to not a device?


- Joshua Colp


On March 9, 2015, 7:43 p.m., rmudgett wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/4467/
> -----------------------------------------------------------
> 
> (Updated March 9, 2015, 7:43 p.m.)
> 
> 
> Review request for Asterisk Developers.
> 
> 
> Bugs: ASTERISK-24807
>     https://issues.asterisk.org/jira/browse/ASTERISK-24807
> 
> 
> Repository: Asterisk
> 
> 
> Description
> -------
> 
> When a type=global section is not defined in pjsip.conf the global
> defaults are not applied.  As a result the mandatory Max-Forwards header
> is not added to SIP messages for res_pjsip/chan_pjsip.
> 
> The handling of pjsip.conf type=global objects has several problems:
> 
> 1) If the global object is missing the defaults are not applied.
> 
> 2) If the global object is missing the default_outbound_endpoint's default
> value is not returned by ast_sip_global_default_outbound_endpoint().
> 
> 3) Defines are needed so default values only need to be changed in one
> place.
> 
> * Added a sorcery instance observer callback to check if there were any
> type=global sections loaded.  If there were more than one then issue an
> error message.  If there were none then apply the global defaults.
> 
> * Fixed ast_sip_global_default_outbound_endpoint() to return the
> documented default when no type=global object is defined.
> 
> * Made defines for the global default values.
> 
> * Increased the default_useragent[] size because SVN version strings can
> get lengthy and 128 characters may not be enough.
> 
> * Fixed an off-nominal code path ref leak in global_alloc() if the string
> fields fail to initialize.
> 
> * Eliminated RAII_VAR in get_global_cfg() and
> ast_sip_global_default_outbound_endpoint().
> 
> 
> The changes to res/res_pjsip/pjsip_global_headers.c are for the
> independent but related global options issue.  These changes will be
> committed separately.
> 
> res_pjsip: Fixed invalid empty Server and User-Agent SIP headers.
> 
> Setting pjsip.conf useragent to an empty string results in an empty SIP
> header being sent.
> 
> * Made not add an empty SIP header item to the global SIP headers list.
> 
> 
> Diffs
> -----
> 
>   /branches/13/res/res_pjsip/pjsip_global_headers.c 432661 
>   /branches/13/res/res_pjsip/pjsip_configuration.c 432661 
>   /branches/13/res/res_pjsip/config_global.c 432661 
>   /branches/13/include/asterisk/res_pjsip.h 432661 
> 
> Diff: https://reviewboard.asterisk.org/r/4467/diff/
> 
> 
> Testing
> -------
> 
> Ran through the following pjsip.conf type=global permutations:
> 
> 1) No global object defined.  The defaults are applied with the patch and the Max-Forwards header goes out when it did not before.
> 2) Two global objects defined.  An error message is now output complaining of the multiple global objects.
> 3) One global object defined with custom user_agent value set.  The User-Agent and Server headers have the custom value.
> 4) One global object defined with user_agent value set to an empty string.  The User-Agent and Server headers do not go out when they would go out without a value before.
> 
> 
> Thanks,
> 
> rmudgett
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20150310/899d5b1d/attachment.html>


More information about the asterisk-dev mailing list