diff options
author | Scott Griepentrog <sgriepentrog@digium.com> | 2014-01-17 21:33:26 +0000 |
---|---|---|
committer | Scott Griepentrog <sgriepentrog@digium.com> | 2014-01-17 21:33:26 +0000 |
commit | 2b14601bdc3a5a98095e25b3b70ec7908c908308 (patch) | |
tree | a5233f6a22c2781747dad2b907ffc40f91b0dea6 /main/sorcery.c | |
parent | 2704b49c1b038ffd4a6a413b9973814bee7a42b3 (diff) |
pjsip: fix support for allow=all
This change adds improvements to support for allow=all in
pjsip.conf so that it functions as intended. Previously,
the allow/disallow socery configuration would set & clear
codecs from the media.codecs and media.prefs list, but if
all was specified the prefs list was not updated. Then a
call would fail when create_outgoing_sdp_stream() created
an SDP with no audio codecs.
A new function ast_codec_pref_append_all() is provided to
add all codecs to the prefs list - only those not already
on the list. This enables the configuration to specify a
codec preference, but still add all codecs, and even then
remove some codecs, as shown in this example:
allow = ulaw, alaw, all, !g729, !g723
Also, the display order of allow in cli output is updated
to match the configuration by using prefs instead of caps
when generating a human readable string.
Finally, a change to create_outgoing_sdp_stream() skips a
codec when it does not have a payload code instead of the
call failing.
(closes issue ASTERISK-23018)
Reported by: xrobau
Review: https://reviewboard.asterisk.org/r/3131/
........
Merged revisions 405875 from http://svn.asterisk.org/svn/asterisk/branches/12
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@405876 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/sorcery.c')
-rw-r--r-- | main/sorcery.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/main/sorcery.c b/main/sorcery.c index 1753ba198..b3620ddf0 100644 --- a/main/sorcery.c +++ b/main/sorcery.c @@ -43,6 +43,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include "asterisk/taskprocessor.h" #include "asterisk/threadpool.h" #include "asterisk/json.h" +#include "asterisk/format_pref.h" /* To prevent DEBUG_FD_LEAKS from interfering with things we undef open and close */ #undef open @@ -222,8 +223,9 @@ static int chararray_handler_fn(const void *obj, const intptr_t *args, char **bu static int codec_handler_fn(const void *obj, const intptr_t *args, char **buf) { char tmp_buf[256]; - struct ast_format_cap **cap = (struct ast_format_cap **)(obj + args[1]); - return !(*buf = ast_strdup(ast_getformatname_multiple(tmp_buf, sizeof(tmp_buf), *cap))); + struct ast_codec_pref *pref = (struct ast_codec_pref *)(obj + args[0]); + ast_codec_pref_string(pref, tmp_buf, sizeof(tmp_buf)); + return !(*buf = ast_strdup(tmp_buf)); } static sorcery_field_handler sorcery_field_default_handler(enum aco_option_type type) |