chan_iax2: Restore codec choice behavior from media formats branch

After merging the media formats branch, chan_iax2 was discarding
codec preferences for the purpose of choosing which codec a
channel would use once a call started. This patch restores the
Asterisk 1.8-12 codec choice behaviors.

ASTERISK-23958 #close
Review: https://reviewboard.asterisk.org/r/3800/


git-svn-id: http://svn.asterisk.org/svn/asterisk/trunk@419109 f38db490-d61c-443f-a65b-d21fe96a405b
Fix build in dev-mode

git-svn-id: http://svn.asterisk.org/svn/asterisk/trunk@419110 f38db490-d61c-443f-a65b-d21fe96a405b
Dial API: Prevent crash on NULL cap

This prevents a crash in the Dial API triggered by use of the Page()
application where a format capability struct was used before checking
whether it was NULL.

ASTERISK-24074 #close


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