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

rmudgett reviewboard at asterisk.org
Wed Mar 11 10:19:12 CDT 2015


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

(Updated March 11, 2015, 10:19 a.m.)


Status
------

This change has been marked as submitted.


Review request for Asterisk Developers.


Changes
-------

Committed in revision 432764


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 432718 
  /branches/13/res/res_pjsip/pjsip_configuration.c 432718 
  /branches/13/res/res_pjsip/config_global.c 432718 
  /branches/13/include/asterisk/res_pjsip.h 432718 

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/20150311/b85b9885/attachment.html>


More information about the asterisk-dev mailing list