Review Board 1.7.16

res_pjsip: Fix pjsip.conf type=global object default value handling.

Review Request #4467 - Created March 9, 2015 and submitted

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

* 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

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.
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.
Review request changed
Updated (March 11, 2015, 12:23 p.m.)
  • changed from pending to submitted
Committed in revision 432806 runs on a server provided by Digium, Inc. and uses bandwidth donated to the open source Asterisk community by API Digital Communications in Huntsville, AL USA.
Please report problems with this site to