Fix crashes in res_pjsip_sdp_rtp and res_pjsip_t38 when a stream is rejected and external_media_address is set.

The callback function for changing the media address in streams wrongly assumes that a connection line
will always be present. This is false as no line is present if a stream has been rejected.

(closes issue ASTERISK-22645)
Reported by: Rusty Newton
........

Merged revisions 400360 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: http://svn.asterisk.org/svn/asterisk/trunk@400361 f38db490-d61c-443f-a65b-d21fe96a405b
Cache string values of formats on ast_format_cap() to save processing.

Channel snapshots have string representations of the channel's native formats.
Prior to this change, the format strings were re-created on ever channel snapshot
creation. Since channel native formats rarely change, this was very wasteful.
Now, string representations of formats may optionally be stored on the ast_format_cap
for cases where string representations may be requested frequently. When formats
are altered, the string cache is marked as invalid. When strings are requested, the
cache validity is checked. If the cache is valid, then the cached strings are copied.
If the cache is invalid, then the string cache is rebuilt and copied, and the cache
is marked as being valid again.

Review: https://reviewboard.asterisk.org/r/2879
........

Merged revisions 400356 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: http://svn.asterisk.org/svn/asterisk/trunk@400363 f38db490-d61c-443f-a65b-d21fe96a405b
Get rid of uses of stasis_topic_wait()
........

Merged revisions 400362 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: http://svn.asterisk.org/svn/asterisk/trunk@400364 f38db490-d61c-443f-a65b-d21fe96a405b