Merge "Increase account code maximum length to 80."
authorMatt Jordan <mjordan@digium.com>
Wed, 11 Nov 2015 14:09:18 +0000 (08:09 -0600)
committerGerrit Code Review <gerrit2@gerrit.digium.api>
Wed, 11 Nov 2015 14:09:18 +0000 (08:09 -0600)
49 files changed:
CHANGES
Makefile
addons/chan_mobile.c
addons/chan_ooh323.c
apps/app_chanisavail.c
apps/app_dial.c
apps/app_dumpchan.c
apps/app_page.c
bridges/bridge_native_rtp.c
build_tools/make_version_c
channels/chan_alsa.c
channels/chan_console.c
channels/chan_iax2.c
channels/chan_mgcp.c
channels/chan_motif.c
channels/chan_nbs.c
channels/chan_oss.c
channels/chan_phone.c
channels/chan_pjsip.c
channels/chan_sip.c
channels/chan_skinny.c
channels/chan_unistim.c
channels/chan_vpb.cc
funcs/func_callerid.c
funcs/func_channel.c
include/asterisk/ast_version.h
include/asterisk/format_cap.h
include/asterisk/statsd.h
main/app.c
main/asterisk.c
main/channel.c
main/cli.c
main/dial.c
main/dns.c
main/dns_system_resolver.c [changed mode: 0755->0644]
main/file.c
main/format_cap.c
main/logger.c
main/manager.c
main/sorcery.c
main/taskprocessor.c
main/xmldoc.c
res/res_pjsip/location.c
res/res_pjsip/pjsip_configuration.c
res/res_pjsip_sdp_rtp.c
res/res_statsd.c
res/res_statsd.exports.in
tests/test_config.c
tests/test_format_cap.c

diff --git a/CHANGES b/CHANGES
index 7d0b954..dcda33f 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -221,6 +221,16 @@ res_pjsip
  * The ability to use "like" has been added to the pjsip list and show
    CLI commands.  For instance: CLI> pjsip list endpoints like abc
 
+func_callerid
+-------------------
+ * CALLERID(pres) is now documented as a valid alternative to setting both
+   CALLERID(name-pres) and CALLERID(num-pres) at once.  Some channel drivers,
+   like chan_sip, don't make a distinction between the two: they take the
+   least public value from name-pres and num-pres.  By using CALLERID(pres)
+   for reading and writing, you touch the same combined value in the dialplan.
+   The same applies to CONNECTEDLINE(pres), REDIRECTING(orig-pres),
+   REDIRECTING(to-pres) and REDIRECTING(from-pres).
+
 ------------------------------------------------------------------------------
 --- Functionality changes from Asterisk 13.5.0 to Asterisk 13.6.0 ------------
 ------------------------------------------------------------------------------
index 5bc6570..4b1c57b 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -399,7 +399,7 @@ defaults.h: makeopts .lastclean build_tools/make_defaults_h
        @cmp -s $@.tmp $@ || mv $@.tmp $@
        @rm -f $@.tmp
 
-main/version.c: FORCE .lastclean
+main/version.c: FORCE menuselect.makeopts .lastclean
        @build_tools/make_version_c > $@.tmp
        @cmp -s $@.tmp $@ || mv $@.tmp $@
        @rm -f $@.tmp
index 26056f4..64d53b7 100644 (file)
@@ -902,7 +902,7 @@ static struct ast_channel *mbl_request(const char *type, struct ast_format_cap *
        }
 
        if (ast_format_cap_iscompatible_format(cap, DEVICE_FRAME_FORMAT) == AST_FORMAT_CMP_NOT_EQUAL) {
-               struct ast_str *codec_buf = ast_str_alloca(64);
+               struct ast_str *codec_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
                ast_log(LOG_WARNING, "Asked to get a channel of unsupported format '%s'\n", ast_format_cap_get_names(cap, &codec_buf));
                *cause = AST_CAUSE_FACILITY_NOT_IMPLEMENTED;
                return NULL;
index aa9cbaf..7e50bbf 100644 (file)
@@ -576,7 +576,7 @@ static struct ast_channel *ooh323_request(const char *type, struct ast_format_ca
                const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, const char *data, int *cause)
 
 {
-       struct ast_str *codec_buf = ast_str_alloca(64);
+       struct ast_str *codec_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
        struct ast_channel *chan = NULL;
        struct ooh323_pvt *p = NULL;
        struct ooh323_peer *peer = NULL;
@@ -1192,7 +1192,7 @@ static int ooh323_write(struct ast_channel *ast, struct ast_frame *f)
 
                        if (ast_format_cap_iscompatible_format(ast_channel_nativeformats(ast), f->subclass.format) == AST_FORMAT_CMP_NOT_EQUAL) {
                                if (ast_format_cap_count(ast_channel_nativeformats(ast))) {
-                                       struct ast_str *codec_buf = ast_str_alloca(64);
+                                       struct ast_str *codec_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
                                        ast_log(LOG_WARNING,
                                                        "Asked to transmit frame type %s, while native formats is %s (read/write = %s/%s)\n",
                                                        ast_format_get_name(f->subclass.format),
@@ -1545,7 +1545,7 @@ void ooh323_set_write_format(ooCallData *call, struct ast_format *fmt, int txfra
                        return;
                }
                if (gH323Debug) {
-                       struct ast_str *codec_buf = ast_str_alloca(64);
+                       struct ast_str *codec_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
                        ast_verb(0, "Writeformat before update %s/%s\n", 
                          ast_format_get_name(ast_channel_writeformat(p->owner)),
                          ast_format_cap_get_names(ast_channel_nativeformats(p->owner), &codec_buf));
@@ -2114,7 +2114,7 @@ int onNewCallCreated(ooCallData *call)
                }
 
                if (gH323Debug) {
-                       struct ast_str *codec_buf = ast_str_alloca(64);
+                       struct ast_str *codec_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
 
                        ast_verb(0, " Outgoing call %s(%s) - Codec prefs - %s\n", 
                                p->username?p->username:"NULL", call->callToken,
@@ -3231,7 +3231,7 @@ static char *handle_cli_ooh323_show_peer(struct ast_cli_entry *e, int cmd, struc
 static char *handle_cli_ooh323_show_peers(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
        struct ooh323_peer *prev = NULL, *peer = NULL;
-       struct ast_str *codec_buf = ast_str_alloca(64);
+       struct ast_str *codec_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
    char ip_port[30];
 #define FORMAT  "%-15.15s  %-15.15s  %-23.23s  %-s\n"
 
@@ -3370,7 +3370,7 @@ static char *handle_cli_ooh323_show_user(struct ast_cli_entry *e, int cmd, struc
 static char *handle_cli_ooh323_show_users(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
        struct ooh323_user *prev = NULL, *user = NULL;
-       struct ast_str *codec_buf = ast_str_alloca(64);
+       struct ast_str *codec_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
 #define FORMAT1  "%-15.15s  %-15.15s  %-15.15s  %-s\n"
 
        switch (cmd) {
@@ -3504,7 +3504,7 @@ static char *handle_cli_ooh323_show_gk(struct ast_cli_entry *e, int cmd, struct
 static char *handle_cli_ooh323_show_config(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
        char value[FORMAT_STRING_SIZE];
-       struct ast_str *codec_buf = ast_str_alloca(64);
+       struct ast_str *codec_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
        ooAliases *pAlias = NULL, *pAliasNext = NULL;;
 
        switch (cmd) {
index 0c3b27b..dbd4991 100644 (file)
@@ -56,10 +56,10 @@ static const char app[] = "ChanIsAvail";
                        <parameter name="Technology/Resource" required="true" argsep="&amp;">
                                <argument name="Technology2/Resource2" multiple="true">
                                        <para>Optional extra devices to check</para>
-                                       <para>If you need more then one enter them as
-                                       Technology2/Resource2&amp;Technology3/Resourse3&amp;.....</para>
+                                       <para>If you need more than one enter them as
+                                       Technology2/Resource2&amp;Technology3/Resource3&amp;.....</para>
                                </argument>
-                               <para>Specification of the device(s) to check.  These must be in the format of 
+                               <para>Specification of the device(s) to check.  These must be in the format of
                                <literal>Technology/Resource</literal>, where <replaceable>Technology</replaceable>
                                represents a particular channel driver, and <replaceable>Resource</replaceable>
                                represents a resource available to that particular channel driver.</para>
index 55700e9..540f662 100644 (file)
@@ -84,12 +84,12 @@ ASTERISK_REGISTER_FILE()
                                </argument>
                                <argument name="Technology2/Resource2" required="false" multiple="true">
                                        <para>Optional extra devices to dial in parallel</para>
-                                       <para>If you need more then one enter them as
-                                       Technology2/Resource2&amp;Technology3/Resourse3&amp;.....</para>
+                                       <para>If you need more than one enter them as
+                                       Technology2/Resource2&amp;Technology3/Resource3&amp;.....</para>
                                </argument>
                        </parameter>
                        <parameter name="timeout" required="false">
-                               <para>Specifies the number of seconds we attempt to dial the specified devices</para>
+                               <para>Specifies the number of seconds we attempt to dial the specified devices.</para>
                                <para>If not specified, this defaults to 136 years.</para>
                        </parameter>
                        <parameter name="options" required="false">
@@ -491,7 +491,7 @@ ASTERISK_REGISTER_FILE()
 
                        <para>Unless there is a timeout specified, the Dial application will wait
                        indefinitely until one of the called channels answers, the user hangs up, or
-                       if all of the called channels are busy or unavailable. Dialplan executing will
+                       if all of the called channels are busy or unavailable. Dialplan execution will
                        continue if no requested channels can be called, or if the timeout expires.
                        This application will report normal termination if the originating channel
                        hangs up, or if the call is bridged and either of the parties in the bridge
index 93a6506..8b32b93 100644 (file)
@@ -72,7 +72,7 @@ static int serialize_showchan(struct ast_channel *c, char *buf, size_t size)
 {
        long elapsed_seconds = 0;
        int hour = 0, min = 0, sec = 0;
-       struct ast_str *format_buf = ast_str_alloca(64);
+       struct ast_str *format_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
        char cgrp[256];
        char pgrp[256];
        struct ast_str *write_transpath = ast_str_alloca(256);
index 10a96b6..3543d05 100644 (file)
@@ -60,7 +60,7 @@ ASTERISK_REGISTER_FILE()
                                <argument name="Technology2/Resource2" multiple="true">
                                        <para>Optional extra devices to dial in parallel</para>
                                        <para>If you need more than one, enter them as Technology2/Resource2&amp;
-                                       Technology3/Resourse3&amp;.....</para>
+                                       Technology3/Resource3&amp;.....</para>
                                </argument>
                        </parameter>
                        <parameter name="options">
index 606a43a..6c7c1cd 100644 (file)
@@ -387,8 +387,8 @@ static int native_rtp_bridge_compatible(struct ast_bridge *bridge)
                glue1->get_codec(bc1->chan, cap1);
        }
        if (ast_format_cap_count(cap0) != 0 && ast_format_cap_count(cap1) != 0 && !ast_format_cap_iscompatible(cap0, cap1)) {
-               struct ast_str *codec_buf0 = ast_str_alloca(64);
-               struct ast_str *codec_buf1 = ast_str_alloca(64);
+               struct ast_str *codec_buf0 = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
+               struct ast_str *codec_buf1 = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
                ast_debug(1, "Channel codec0 = %s is not codec1 = %s, cannot native bridge in RTP.\n",
                        ast_format_cap_get_names(cap0, &codec_buf0), ast_format_cap_get_names(cap1, &codec_buf1));
                return 0;
index 3fea6ce..fcbd94e 100755 (executable)
@@ -1,4 +1,7 @@
 #!/bin/sh
+
+GREP=${GREP:-grep}
+
 if test ! -f .flavor ; then
     EXTRA=""
 elif test ! -f .version ; then
@@ -9,6 +12,21 @@ else
     aadkflavor=`cat .flavor`
     EXTRA=" (${aadkflavor} ${aadkver})"
 fi
+
+if ${GREP} "AST_DEVMODE" makeopts | ${GREP} -q "yes"
+then
+       BUILDOPTS="AST_DEVMODE"
+fi
+
+TMP=`${GREP} -e "^MENUSELECT_CFLAGS" menuselect.makeopts | sed 's/MENUSELECT_CFLAGS\=//g' | sed 's/-D//g'`
+for x in ${TMP}; do
+       if test "x${BUILDOPTS}" != "x" ; then
+               BUILDOPTS="${BUILDOPTS}, ${x}"
+       else
+               BUILDOPTS="${x}"
+       fi
+done
+
 cat << END
 /*
  * version.c
@@ -23,6 +41,8 @@ static const char asterisk_version[] = "${ASTERISKVERSION}${EXTRA}";
 
 static const char asterisk_version_num[] = "${ASTERISKVERSIONNUM}";
 
+static const char asterisk_build_opts[] = "${BUILDOPTS}";
+
 const char *ast_get_version(void)
 {
        return asterisk_version;
@@ -33,4 +53,9 @@ const char *ast_get_version_num(void)
        return asterisk_version_num;
 }
 
+const char *ast_get_build_opts(void)
+{
+       return asterisk_build_opts;
+}
+
 END
index 9441800..0e2b257 100644 (file)
@@ -620,7 +620,7 @@ static struct ast_channel *alsa_request(const char *type, struct ast_format_cap
        struct ast_channel *tmp = NULL;
 
        if (ast_format_cap_iscompatible_format(cap, ast_format_slin) == AST_FORMAT_CMP_NOT_EQUAL) {
-               struct ast_str *codec_buf = ast_str_alloca(64);
+               struct ast_str *codec_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
                ast_log(LOG_NOTICE, "Asked to get a channel of format '%s'\n", ast_format_cap_get_names(cap, &codec_buf));
                return NULL;
        }
index a8dbc97..9fdecd7 100644 (file)
@@ -479,7 +479,7 @@ static struct ast_channel *console_request(const char *type, struct ast_format_c
        }
 
        if (!(ast_format_cap_iscompatible(cap, console_tech.capabilities))) {
-               struct ast_str *cap_buf = ast_str_alloca(64);
+               struct ast_str *cap_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
                ast_log(LOG_NOTICE, "Channel requested with unsupported format(s): '%s'\n",
                        ast_format_cap_get_names(cap, &cap_buf));
                goto return_unref;
index da6bec7..dd1bc4c 100644 (file)
@@ -3803,7 +3803,7 @@ static char *handle_cli_iax2_show_peer(struct ast_cli_entry *e, int cmd, struct
        char status[30];
        char cbuf[256];
        struct iax2_peer *peer;
-       struct ast_str *codec_buf = ast_str_alloca(256);
+       struct ast_str *codec_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
        struct ast_str *encmethods = ast_str_alloca(256);
        int load_realtime = 0;
 
@@ -5576,8 +5576,8 @@ static enum ast_bridge_result iax2_bridge(struct ast_channel *c0, struct ast_cha
                        return AST_BRIDGE_FAILED_NOWARN;
                }
                if (!(ast_format_cap_identical(ast_channel_nativeformats(c0), ast_channel_nativeformats(c1)))) {
-                       struct ast_str *c0_buf = ast_str_alloca(64);
-                       struct ast_str *c1_buf = ast_str_alloca(64);
+                       struct ast_str *c0_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
+                       struct ast_str *c1_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
 
                        ast_verb(3, "Operating with different codecs [%s] [%s] , can't native bridge...\n",
                                ast_format_cap_get_names(ast_channel_nativeformats(c0), &c0_buf),
@@ -10801,9 +10801,9 @@ static int socket_process_helper(struct iax2_thread *thread)
                                                                        break;
                                                                }
                                                                if (authdebug) {
-                                                                       struct ast_str *peer_buf = ast_str_alloca(64);
-                                                                       struct ast_str *cap_buf = ast_str_alloca(64);
-                                                                       struct ast_str *peer_form_buf = ast_str_alloca(64);
+                                                                       struct ast_str *peer_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
+                                                                       struct ast_str *cap_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
+                                                                       struct ast_str *peer_form_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
 
                                                                        if (ast_test_flag64(iaxs[fr->callno], IAX_CODEC_NOCAP)) {
                                                                                ast_log(LOG_NOTICE, "Rejected connect attempt from %s, requested '%s' incompatible with our capability '%s'.\n",
@@ -10848,9 +10848,9 @@ static int socket_process_helper(struct iax2_thread *thread)
                                                                }
 
                                                                if (!format) {
-                                                                       struct ast_str *peer_buf = ast_str_alloca(64);
-                                                                       struct ast_str *cap_buf = ast_str_alloca(64);
-                                                                       struct ast_str *peer_form_buf = ast_str_alloca(64);
+                                                                       struct ast_str *peer_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
+                                                                       struct ast_str *cap_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
+                                                                       struct ast_str *peer_form_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
 
                                                                        memset(&ied0, 0, sizeof(ied0));
                                                                        iax_ie_append_str(&ied0, IAX_IE_CAUSE, "Unable to negotiate codec");
@@ -11028,8 +11028,8 @@ static int socket_process_helper(struct iax2_thread *thread)
                                                break;
                                        }
                                        if (authdebug) {
-                                               struct ast_str *peer_buf = ast_str_alloca(64);
-                                               struct ast_str *cap_buf = ast_str_alloca(64);
+                                               struct ast_str *peer_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
+                                               struct ast_str *cap_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
 
                                                ast_log(LOG_NOTICE, "Rejected call to %s, format %s incompatible with our capability %s.\n",
                                                        ast_sockaddr_stringify(&addr),
@@ -11042,7 +11042,7 @@ static int socket_process_helper(struct iax2_thread *thread)
                                        ast_set_flag(&iaxs[fr->callno]->state, IAX_STATE_STARTED);
                                        iax2_lock_owner(fr->callno);
                                        if (iaxs[fr->callno] && iaxs[fr->callno]->owner && native) {
-                                               struct ast_str *cap_buf = ast_str_alloca(64);
+                                               struct ast_str *cap_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
 
                                                /* Switch us to use a compatible format */
                                                iax2_codec_pref_best_bitfield2cap(
@@ -11246,9 +11246,9 @@ static int socket_process_helper(struct iax2_thread *thread)
                                                iax2_codec_pref_string(&iaxs[fr->callno]->prefs, host_pref_buf, sizeof(host_pref_buf) - 1);
                                        }
                                        if (!format) {
-                                               struct ast_str *cap_buf = ast_str_alloca(64);
-                                               struct ast_str *peer_buf = ast_str_alloca(64);
-                                               struct ast_str *peer_form_buf = ast_str_alloca(64);
+                                               struct ast_str *cap_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
+                                               struct ast_str *peer_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
+                                               struct ast_str *peer_form_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
 
                                                if(!ast_test_flag64(iaxs[fr->callno], IAX_CODEC_NOCAP)) {
                                                        ast_debug(1, "We don't do requested format %s, falling back to peer capability '%s'\n",
@@ -11309,9 +11309,9 @@ static int socket_process_helper(struct iax2_thread *thread)
                                                                }
                                                        }
                                                        if (!format) {
-                                                               struct ast_str *cap_buf = ast_str_alloca(64);
-                                                               struct ast_str *peer_buf = ast_str_alloca(64);
-                                                               struct ast_str *peer_form_buf = ast_str_alloca(64);
+                                                               struct ast_str *cap_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
+                                                               struct ast_str *peer_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
+                                                               struct ast_str *peer_form_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
 
                                                                ast_log(LOG_ERROR, "No best format in %s???\n",
                                                                        iax2_getformatname_multiple(iaxs[fr->callno]->peercapability & iaxs[fr->callno]->capability, &cap_buf));
@@ -11435,7 +11435,7 @@ immediatedial:
                                                        break;
                                                }
                                        } else {
-                                               struct ast_str *cap_buf = ast_str_alloca(64);
+                                               struct ast_str *cap_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
                                                ast_set_flag(&iaxs[fr->callno]->state, IAX_STATE_STARTED);
                                                ast_verb(3, "Accepting DIAL from %s, formats = %s\n",
                                                                ast_sockaddr_stringify(&addr),
@@ -12514,8 +12514,8 @@ static struct ast_channel *iax2_request(const char *type, struct ast_format_cap
 
                        res = ast_translator_best_choice(cap, ast_channel_nativeformats(c), &best_fmt_cap, &best_fmt_native);
                        if (res < 0) {
-                               struct ast_str *native_cap_buf = ast_str_alloca(256);
-                               struct ast_str *cap_buf = ast_str_alloca(256);
+                               struct ast_str *native_cap_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
+                               struct ast_str *cap_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
 
                                ast_log(LOG_WARNING, "Unable to create translator path for %s to %s on %s\n",
                                        ast_format_cap_get_names(ast_channel_nativeformats(c), &native_cap_buf),
@@ -14374,7 +14374,7 @@ static int function_iaxpeer(struct ast_channel *chan, const char *cmd, char *dat
        } else  if (!strcasecmp(colname, "callerid_num")) {
                ast_copy_string(buf, peer->cid_num, len);
        } else  if (!strcasecmp(colname, "codecs")) {
-               struct ast_str *codec_buf = ast_str_alloca(256);
+               struct ast_str *codec_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
 
                iax2_getformatname_multiple(peer->capability, &codec_buf);
                ast_copy_string(buf, ast_str_buffer(codec_buf), len);
index 0210e8a..8714ddb 100644 (file)
@@ -1253,7 +1253,7 @@ static int mgcp_write(struct ast_channel *ast, struct ast_frame *frame)
                }
        } else {
                if (ast_format_cap_iscompatible_format(ast_channel_nativeformats(ast), frame->subclass.format) == AST_FORMAT_CMP_NOT_EQUAL) {
-                       struct ast_str *cap_buf = ast_str_alloca(64);
+                       struct ast_str *cap_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
 
                        ast_log(LOG_WARNING, "Asked to transmit frame type %s, while native formats is %s (read/write = %s/%s)\n",
                                ast_format_get_name(frame->subclass.format),
@@ -1986,9 +1986,9 @@ static int process_sdp(struct mgcp_subchannel *sub, struct mgcp_request *req)
        int codec, codec_count=0;
        int iterator;
        struct mgcp_endpoint *p = sub->parent;
-       struct ast_str *global_buf = ast_str_alloca(64);
-       struct ast_str *peer_buf = ast_str_alloca(64);
-       struct ast_str *pvt_buf = ast_str_alloca(64);
+       struct ast_str *global_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
+       struct ast_str *peer_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
+       struct ast_str *pvt_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
 
        /* Get codec and RTP info from SDP */
        m = get_sdp(req, "m");
@@ -3971,7 +3971,7 @@ static struct ast_channel *mgcp_request(const char *type, struct ast_format_cap
        char tmp[256];
 
        if (!(ast_format_cap_iscompatible(cap, global_capability))) {
-               struct ast_str *cap_buf = ast_str_alloca(64);
+               struct ast_str *cap_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
                ast_log(LOG_NOTICE, "Asked to get a channel of unsupported format '%s'\n",
                        ast_format_cap_get_names(cap, &cap_buf));
                /*return NULL;*/
index 0851bf0..15a7b4d 100644 (file)
@@ -1702,7 +1702,7 @@ static int jingle_write(struct ast_channel *ast, struct ast_frame *frame)
        switch (frame->frametype) {
        case AST_FRAME_VOICE:
                if (ast_format_cap_iscompatible_format(ast_channel_nativeformats(ast), frame->subclass.format) == AST_FORMAT_CMP_NOT_EQUAL) {
-                       struct ast_str *codec_buf = ast_str_alloca(64);
+                       struct ast_str *codec_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
 
                        ast_log(LOG_WARNING,
                                "Asked to transmit frame type %s, while native formats is %s (read/write = %s/%s)\n",
index c23eecd..d50defe 100644 (file)
@@ -232,7 +232,7 @@ static struct ast_channel *nbs_request(const char *type, struct ast_format_cap *
        struct ast_channel *tmp = NULL;
 
        if (ast_format_cap_iscompatible_format(cap, ast_format_slin) == AST_FORMAT_CMP_NOT_EQUAL) {
-               struct ast_str *cap_buf = ast_str_alloca(64);
+               struct ast_str *cap_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
 
                ast_log(LOG_NOTICE, "Asked to get a channel of unsupported format '%s'\n",
                        ast_format_cap_get_names(cap, &cap_buf));
index 0eb777a..94de58d 100644 (file)
@@ -863,7 +863,7 @@ static struct ast_channel *oss_request(const char *type, struct ast_format_cap *
                return NULL;
        }
        if (ast_format_cap_iscompatible_format(cap, ast_format_slin) == AST_FORMAT_CMP_NOT_EQUAL) {
-               struct ast_str *codec_buf = ast_str_alloca(64);
+               struct ast_str *codec_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
                ast_log(LOG_NOTICE, "Format %s unsupported\n", ast_format_cap_get_names(cap, &codec_buf));
                return NULL;
        }
index 6d790fe..b7f694f 100644 (file)
@@ -1282,7 +1282,7 @@ static struct ast_channel *phone_request(const char *type, struct ast_format_cap
        restart_monitor();
        if (tmp == NULL) {
                if (!(ast_format_cap_iscompatible(cap, phone_tech.capabilities))) {
-                       struct ast_str *codec_buf = ast_str_alloca(64);
+                       struct ast_str *codec_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
                        ast_log(LOG_NOTICE, "Asked to get a channel of unsupported format '%s'\n",
                                ast_format_cap_get_names(cap, &codec_buf));
                        return NULL;
index d72a25b..c98be35 100644 (file)
@@ -673,7 +673,7 @@ static int chan_pjsip_write(struct ast_channel *ast, struct ast_frame *frame)
                        return 0;
                }
                if (ast_format_cap_iscompatible_format(ast_channel_nativeformats(ast), frame->subclass.format) == AST_FORMAT_CMP_NOT_EQUAL) {
-                       struct ast_str *cap_buf = ast_str_alloca(128);
+                       struct ast_str *cap_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
                        struct ast_str *write_transpath = ast_str_alloca(256);
                        struct ast_str *read_transpath = ast_str_alloca(256);
 
index 0fd9f7d..5a88bb4 100644 (file)
@@ -7213,7 +7213,7 @@ static int sip_write(struct ast_channel *ast, struct ast_frame *frame)
        switch (frame->frametype) {
        case AST_FRAME_VOICE:
                if (ast_format_cap_iscompatible_format(ast_channel_nativeformats(ast), frame->subclass.format) == AST_FORMAT_CMP_NOT_EQUAL) {
-                       struct ast_str *codec_buf = ast_str_alloca(64);
+                       struct ast_str *codec_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
                        ast_log(LOG_WARNING, "Asked to transmit frame type %s, while native formats is %s read/write = %s/%s\n",
                                ast_format_get_name(frame->subclass.format),
                                ast_format_cap_get_names(ast_channel_nativeformats(ast), &codec_buf),
@@ -7850,7 +7850,7 @@ static struct ast_channel *sip_new(struct sip_pvt *i, int state, const char *tit
        struct ast_variable *v = NULL;
        struct ast_format *fmt;
        struct ast_format_cap *what = NULL; /* SHALLOW COPY DO NOT DESTROY! */
-       struct ast_str *codec_buf = ast_str_alloca(64);
+       struct ast_str *codec_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
        int needvideo = 0;
        int needtext = 0;
        char *exten;
@@ -9911,7 +9911,7 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action
        int debug = sip_debug_test_pvt(p);
 
        /* START UNKNOWN */
-       struct ast_str *codec_buf = ast_str_alloca(64);
+       struct ast_str *codec_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
        struct ast_format *tmp_fmt;
        /* END UNKNOWN */
 
@@ -10570,11 +10570,11 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action
 
        if (debug) {
                /* shame on whoever coded this.... */
-               struct ast_str *cap_buf = ast_str_alloca(64);
-               struct ast_str *peer_buf = ast_str_alloca(64);
-               struct ast_str *vpeer_buf = ast_str_alloca(64);
-               struct ast_str *tpeer_buf = ast_str_alloca(64);
-               struct ast_str *joint_buf = ast_str_alloca(64);
+               struct ast_str *cap_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
+               struct ast_str *peer_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
+               struct ast_str *vpeer_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
+               struct ast_str *tpeer_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
+               struct ast_str *joint_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
 
                ast_verbose("Capabilities: us - %s, peer - audio=%s/video=%s/text=%s, combined - %s\n",
                            ast_format_cap_get_names(p->caps, &cap_buf),
@@ -10781,8 +10781,8 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action
                unsigned int framing;
 
                if (debug) {
-                       struct ast_str *cap_buf = ast_str_alloca(64);
-                       struct ast_str *joint_buf = ast_str_alloca(64);
+                       struct ast_str *cap_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
+                       struct ast_str *joint_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
 
                        ast_debug(1, "Setting native formats after processing SDP. peer joint formats %s, old nativeformats %s\n",
                                ast_format_cap_get_names(p->jointcaps, &joint_buf),
@@ -13116,7 +13116,7 @@ static enum sip_result add_sdp(struct sip_request *resp, struct sip_pvt *p, int
        int min_video_packet_size = 0;
        int min_text_packet_size = 0;
 
-       struct ast_str *codec_buf = ast_str_alloca(64);
+       struct ast_str *codec_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
 
        /* Set the SDP session name */
        snprintf(subject, sizeof(subject), "s=%s\r\n", ast_strlen_zero(global_sdpsession) ? "-" : global_sdpsession);
@@ -20298,7 +20298,7 @@ static char *_sip_show_peer(int type, int fd, struct mansession *s, const struct
        char status[30] = "";
        char cbuf[256];
        struct sip_peer *peer;
-       struct ast_str *codec_buf = ast_str_alloca(64);
+       struct ast_str *codec_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
        struct ast_variable *v;
        int x = 0, load_realtime;
        int realtimepeers;
@@ -20944,7 +20944,7 @@ static char *sip_show_settings(struct ast_cli_entry *e, int cmd, struct ast_cli_
 {
        int realtimepeers;
        int realtimeregs;
-       struct ast_str *codec_buf = ast_str_alloca(64);
+       struct ast_str *codec_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
        const char *msg;        /* temporary msg pointer */
        struct sip_auth_container *credentials;
 
@@ -21265,7 +21265,7 @@ static int show_channels_cb(void *__cur, void *__arg, int flags)
        if (cur->subscribed == NONE && !arg->subscriptions) {
                /* set if SIP transfer in progress */
                const char *referstatus = cur->refer ? referstatus2str(cur->refer->status) : "";
-               struct ast_str *codec_buf = ast_str_alloca(64);
+               struct ast_str *codec_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
 
                ast_cli(arg->fd, FORMAT, ast_sockaddr_stringify_addr(dst),
                                S_OR(cur->username, S_OR(cur->cid_num, "(None)")),
@@ -21511,7 +21511,7 @@ static char *sip_show_channel(struct ast_cli_entry *e, int cmd, struct ast_cli_a
 
                if (!strncasecmp(cur->callid, a->argv[3], len)) {
                        struct ast_str *strbuf;
-                       struct ast_str *codec_buf = ast_str_alloca(64);
+                       struct ast_str *codec_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
 
                        ast_cli(a->fd, "\n");
                        if (cur->subscribed != NONE) {
@@ -22470,7 +22470,7 @@ static int function_sippeer(struct ast_channel *chan, const char *cmd, char *dat
        } else  if (!strcasecmp(colname, "callerid_num")) {
                ast_copy_string(buf, peer->cid_num, len);
        } else  if (!strcasecmp(colname, "codecs")) {
-               struct ast_str *codec_buf = ast_str_alloca(64);
+               struct ast_str *codec_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
                ast_format_cap_get_names(peer->caps, &codec_buf);
                ast_copy_string(buf, ast_str_buffer(codec_buf), len);
        } else if (!strcasecmp(colname, "encryption")) {
@@ -29614,8 +29614,8 @@ static struct ast_channel *sip_request_call(const char *type, struct ast_format_
        struct ast_channel *tmpc = NULL;
        char *ext = NULL, *host;
        char tmp[256];
-       struct ast_str *codec_buf = ast_str_alloca(64);
-       struct ast_str *cap_buf = ast_str_alloca(64);
+       struct ast_str *codec_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
+       struct ast_str *cap_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
        char *dnid;
        char *secret = NULL;
        char *md5secret = NULL;
index 6e59e01..6f56f73 100644 (file)
@@ -4176,7 +4176,7 @@ static char *_skinny_show_device(int type, int fd, struct mansession *s, const s
        struct skinny_speeddial *sd;
        struct skinny_addon *sa;
        struct skinny_serviceurl *surl;
-       struct ast_str *codec_buf = ast_str_alloca(64);
+       struct ast_str *codec_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
 
        if (argc < 4) {
                return CLI_SHOWUSAGE;
@@ -4425,7 +4425,7 @@ static char *_skinny_show_line(int type, int fd, struct mansession *s, const str
        struct skinny_device *d;
        struct skinny_line *l;
        struct skinny_subline *subline;
-       struct ast_str *codec_buf = ast_str_alloca(64);
+       struct ast_str *codec_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
        char group_buf[256];
        char cbuf[256];
 
@@ -5075,7 +5075,7 @@ static int skinny_write(struct ast_channel *ast, struct ast_frame *frame)
                }
        } else {
                if (ast_format_cap_iscompatible_format(ast_channel_nativeformats(ast), frame->subclass.format) == AST_FORMAT_CMP_NOT_EQUAL) {
-                       struct ast_str *codec_buf = ast_str_alloca(64);
+                       struct ast_str *codec_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
                        ast_log(LOG_WARNING, "Asked to transmit frame type %s, while native formats is %s (read/write = %s/%s)\n",
                                ast_format_get_name(frame->subclass.format),
                                ast_format_cap_get_names(ast_channel_nativeformats(ast), &codec_buf),
@@ -5351,7 +5351,7 @@ static struct ast_channel *skinny_new(struct skinny_line *l, struct skinny_subli
        struct ast_format *tmpfmt;
        struct ast_format_cap *caps;
 #ifdef AST_DEVMODE
-       struct ast_str *codec_buf = ast_str_alloca(64);
+       struct ast_str *codec_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
 #endif
 
        if (!l->device || !l->device->session) {
@@ -6638,7 +6638,7 @@ static int handle_capabilities_res_message(struct skinny_req *req, struct skinny
        struct ast_format_cap *codecs = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT);
        int i;
 #ifdef AST_DEVMODE
-       struct ast_str *codec_buf = ast_str_alloca(64);
+       struct ast_str *codec_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
 #endif
        
 
@@ -7681,7 +7681,7 @@ static struct ast_channel *skinny_request(const char *type, struct ast_format_ca
        char tmp[256];
 
        if (!(ast_format_cap_has_type(cap, AST_MEDIA_TYPE_AUDIO))) {
-               struct ast_str *codec_buf = ast_str_alloca(64);
+               struct ast_str *codec_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
                ast_log(LOG_NOTICE, "Asked to get a channel of unsupported format '%s'\n", ast_format_cap_get_names(cap, &codec_buf));
                return NULL;
        }
index 874f6b2..c96a9c0 100644 (file)
@@ -2890,7 +2890,7 @@ static void start_rtp(struct unistim_subchannel *sub)
        ast_rtp_instance_set_remote_address(sub->rtp, &sin_tmp);
        if (ast_format_cap_iscompatible_format(ast_channel_nativeformats(sub->owner), ast_channel_readformat(sub->owner)) == AST_FORMAT_CMP_NOT_EQUAL) {
                struct ast_format *tmpfmt;
-               struct ast_str *cap_buf = ast_str_alloca(64);
+               struct ast_str *cap_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
 
                tmpfmt = ast_format_cap_get_format(ast_channel_nativeformats(sub->owner), 0);
                ast_log(LOG_WARNING,
@@ -5143,7 +5143,7 @@ static struct ast_frame *unistim_rtp_read(const struct ast_channel *ast,
                /* We already hold the channel lock */
                if (f->frametype == AST_FRAME_VOICE) {
                        if (ast_format_cap_iscompatible_format(ast_channel_nativeformats(sub->owner), f->subclass.format) == AST_FORMAT_CMP_NOT_EQUAL) {
-                               struct ast_str *cap_buf = ast_str_alloca(64);
+                               struct ast_str *cap_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
                                struct ast_format_cap *caps;
 
                                ast_debug(1,
@@ -5193,7 +5193,7 @@ static int unistim_write(struct ast_channel *ast, struct ast_frame *frame)
                }
        } else {
                if (ast_format_cap_iscompatible_format(ast_channel_nativeformats(ast), frame->subclass.format) == AST_FORMAT_CMP_NOT_EQUAL) {
-                       struct ast_str *cap_buf = ast_str_alloca(64);
+                       struct ast_str *cap_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
 
                        ast_log(LOG_WARNING,
                                        "Asked to transmit frame type %s, while native formats is %s (read/write = (%s/%s)\n",
@@ -5724,9 +5724,9 @@ static struct ast_channel *unistim_new(struct unistim_subchannel *sub, int state
        tmpfmt = ast_format_cap_get_format(ast_channel_nativeformats(tmp), 0);
 
        if (unistimdebug) {
-               struct ast_str *native_buf = ast_str_alloca(64);
-               struct ast_str *cap_buf = ast_str_alloca(64);
-               struct ast_str *global_buf = ast_str_alloca(64);
+               struct ast_str *native_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
+               struct ast_str *cap_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
+               struct ast_str *global_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
 
                ast_verb(0, "Best codec = %s from nativeformats %s (line cap=%s global=%s)\n",
                        ast_format_get_name(tmpfmt),
@@ -5939,8 +5939,8 @@ static struct ast_channel *unistim_request(const char *type, struct ast_format_c
        char tmp[256];
 
        if (!(ast_format_cap_iscompatible(cap, global_cap))) {
-               struct ast_str *cap_buf = ast_str_alloca(64);
-               struct ast_str *global_buf = ast_str_alloca(64);
+               struct ast_str *cap_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
+               struct ast_str *global_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
                ast_log(LOG_NOTICE,
                                "Asked to get a channel of unsupported format %s while capability is %s\n",
                                ast_format_cap_get_names(cap, &cap_buf),
@@ -6015,7 +6015,7 @@ static char *unistim_show_info(struct ast_cli_entry *e, int cmd, struct ast_cli_
        struct unistim_line *line;
        struct unistim_subchannel *sub;
        struct unistimsession *s;
-       struct ast_str *cap_buf = ast_str_alloca(64);
+       struct ast_str *cap_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
 
        switch (cmd) {
        case CLI_INIT:
index 7cdcf30..1f4b861 100644 (file)
@@ -2510,7 +2510,7 @@ static struct ast_channel *vpb_request(const char *type, struct ast_format_cap *
        if (!(ast_format_cap_iscompatible_format(cap, ast_format_slin))) {
                struct ast_str *buf;
 
-               buf = ast_str_create(256);
+               buf = ast_str_create(AST_FORMAT_CAP_NAMES_LEN);
                if (!buf) {
                        return NULL;
                }
index 1599349..dee1977 100644 (file)
@@ -40,10 +40,11 @@ ASTERISK_REGISTER_FILE()
 #include "asterisk/callerid.h"
 
 /*
- * Do not document the CALLERID(pres) datatype.
- * The name and number now have their own presentation value.  The pres
- * option will simply live on as a historical relic with as best
- * as can be managed backward compatible meaning.
+ * The CALLERID(pres) datatype is shorthand for getting/setting the
+ * combined value of name-pres and num-pres.  Some channel drivers
+ * don't make a distinction, so it makes sense to only use one property
+ * to get/set it.  The same applies to CONNECTEDLINE(pres),
+ * REDIRECTING(orig-pres), REDIRECTING(from-pres) and REDIRECTING(to-pres).
  *
  * Do not document the CALLERID(ton) datatype.
  * It is an alias for num-plan.
@@ -55,11 +56,6 @@ ASTERISK_REGISTER_FILE()
  * It has turned out to not be needed.  The source value is really
  * only useful as a possible tracing aid.
  *
- * Do not document the CONNECTEDLINE(pres) datatype.
- * The name and number now have their own presentation value.  The pres
- * option will simply live on as a historical relic with as best
- * as can be managed backward compatible meaning.
- *
  * Do not document the CONNECTEDLINE(ton) datatype.
  * It is an alias for num-plan.
  *
@@ -69,12 +65,6 @@ ASTERISK_REGISTER_FILE()
  * they are active at the same time.  The plain pres option will simply
  * live on as a historical relic.
  *
- * Do not document the REDIRECTING(orig-pres), REDIRECTING(from-pres),
- * or REDIRECTING(to-pres) datatypes.
- * The name and number now have their own presentation value.  The orig-pres,
- * from-pres, and to-pres options will simply live on as a historical relic
- * with as best as can be managed backward compatible meaning.
- *
  * Do not document the REDIRECTING(orig-ton), REDIRECTING(from-ton),
  * or REDIRECTING(to-ton) datatypes.
  * They are aliases for orig-num-plan, from-num-plan, and to-num-plan
@@ -98,6 +88,7 @@ ASTERISK_REGISTER_FILE()
                                        <enum name = "num-valid" />
                                        <enum name = "num-plan" />
                                        <enum name = "num-pres" />
+                                       <enum name = "pres" />
                                        <enum name = "subaddr" />
                                        <enum name = "subaddr-valid" />
                                        <enum name = "subaddr-type" />
@@ -144,6 +135,9 @@ ASTERISK_REGISTER_FILE()
                <description>
                        <para>Gets or sets Caller*ID data on the channel. Uses channel callerid by
                        default or optional callerid, if specified.</para>
+                       <para>The <replaceable>pres</replaceable> field gets/sets a combined value
+                       for <replaceable>name-pres</replaceable> and
+                       <replaceable>num-pres</replaceable>.</para>
                        <para>The allowable values for the <replaceable>name-charset</replaceable>
                        field are the following:</para>
                        <enumlist>
@@ -168,7 +162,8 @@ ASTERISK_REGISTER_FILE()
                <description>
                        <para>Gets or sets Caller*ID presentation on the channel.
                        This function is deprecated in favor of CALLERID(num-pres)
-                       and CALLERID(name-pres).
+                       and CALLERID(name-pres) or CALLERID(pres) to get/set both
+                       at once.
                        The following values are valid:</para>
                        <enumlist>
                                <enum name="allowed_not_screened">
@@ -218,6 +213,7 @@ ASTERISK_REGISTER_FILE()
                                        <enum name = "num-valid" />
                                        <enum name = "num-plan" />
                                        <enum name = "num-pres" />
+                                       <enum name = "pres" />
                                        <enum name = "subaddr" />
                                        <enum name = "subaddr-valid" />
                                        <enum name = "subaddr-type" />
@@ -246,6 +242,9 @@ ASTERISK_REGISTER_FILE()
                </syntax>
                <description>
                        <para>Gets or sets Connected Line data on the channel.</para>
+                       <para>The <replaceable>pres</replaceable> field gets/sets a combined value
+                       for <replaceable>name-pres</replaceable> and
+                       <replaceable>num-pres</replaceable>.</para>
                        <para>The allowable values for the <replaceable>name-charset</replaceable>
                        field are the following:</para>
                        <enumlist>
@@ -279,6 +278,7 @@ ASTERISK_REGISTER_FILE()
                                        <enum name = "orig-num-valid" />
                                        <enum name = "orig-num-plan" />
                                        <enum name = "orig-num-pres" />
+                                       <enum name = "orig-pres" />
                                        <enum name = "orig-subaddr" />
                                        <enum name = "orig-subaddr-valid" />
                                        <enum name = "orig-subaddr-type" />
@@ -294,6 +294,7 @@ ASTERISK_REGISTER_FILE()
                                        <enum name = "from-num-valid" />
                                        <enum name = "from-num-plan" />
                                        <enum name = "from-num-pres" />
+                                       <enum name = "from-pres" />
                                        <enum name = "from-subaddr" />
                                        <enum name = "from-subaddr-valid" />
                                        <enum name = "from-subaddr-type" />
@@ -308,6 +309,7 @@ ASTERISK_REGISTER_FILE()
                                        <enum name = "to-num-valid" />
                                        <enum name = "to-num-plan" />
                                        <enum name = "to-num-pres" />
+                                       <enum name = "to-pres" />
                                        <enum name = "to-subaddr" />
                                        <enum name = "to-subaddr-valid" />
                                        <enum name = "to-subaddr-type" />
@@ -366,6 +368,11 @@ ASTERISK_REGISTER_FILE()
                </syntax>
                <description>
                        <para>Gets or sets Redirecting data on the channel.</para>
+                       <para>The <replaceable>orig-pres</replaceable>,
+                       <replaceable>from-pres</replaceable> and <replaceable>to-pres</replaceable>
+                       fields get/set a combined value for the corresponding
+                       <replaceable>...-name-pres</replaceable> and <replaceable>...-num-pres</replaceable>
+                       fields.</para>
                        <para>The allowable values for the <replaceable>reason</replaceable>
                        and <replaceable>orig-reason</replaceable> fields are the following:</para>
                        <enumlist>
index b051d89..afe9796 100644 (file)
@@ -446,7 +446,7 @@ static int func_channel_read(struct ast_channel *chan, const char *function,
        if (!strcasecmp(data, "audionativeformat")) {
                tmpcap = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT);
                if (tmpcap) {
-                       struct ast_str *codec_buf = ast_str_alloca(128);
+                       struct ast_str *codec_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
 
                        ast_channel_lock(chan);
                        ast_format_cap_append_from_cap(tmpcap, ast_channel_nativeformats(chan), AST_MEDIA_TYPE_AUDIO);
@@ -457,7 +457,7 @@ static int func_channel_read(struct ast_channel *chan, const char *function,
        } else if (!strcasecmp(data, "videonativeformat")) {
                tmpcap = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT);
                if (tmpcap) {
-                       struct ast_str *codec_buf = ast_str_alloca(128);
+                       struct ast_str *codec_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
 
                        ast_channel_lock(chan);
                        ast_format_cap_append_from_cap(tmpcap, ast_channel_nativeformats(chan), AST_MEDIA_TYPE_VIDEO);
index 51ff481..1ceac30 100644 (file)
@@ -41,4 +41,7 @@ const char *ast_get_version(void);
  */
 const char *ast_get_version_num(void);
 
+/*! Retreive the Asterisk build options */
+const char *ast_get_build_opts(void);
+
 #endif /* __AST_VERSION_H */
index e422cc6..8b69e08 100644 (file)
@@ -310,6 +310,11 @@ int ast_format_cap_has_type(const struct ast_format_cap *cap, enum ast_media_typ
  */
 const char *ast_format_cap_get_names(struct ast_format_cap *cap, struct ast_str **buf);
 
+#ifndef AST_FORMAT_CAP_NAMES_LEN
+/*! Buffer size for callers of ast_format_cap_get_names to allocate. */
+#define AST_FORMAT_CAP_NAMES_LEN 384
+#endif
+
 /*!
  * \brief Determine if a format cap has no formats in it.
  *
index 8e5e2f9..a04407f 100644 (file)
 /*!
  * \brief Send a stat to the configured statsd server.
  *
+ * This function uses a character argument for value instead of
+ * an intmax_t argument. This is designed to be simpler to use for
+ * updating a current value rather than resetting it.
+ *
+ * \param metric_name String (UTF-8) name of the metric.
+ * \param type_str Type of metric to send.
+ * \param value Value to send.
+ * \param sample_rate Percentage of samples to send.
+ * \since 13
+ */
+AST_OPTIONAL_API(void, ast_statsd_log_string, (const char *metric_name,
+       const char *metric_type, const char *value, double sample_rate), {});
+
+/*!
+ * \brief Send a stat to the configured statsd server.
+ *
  * The is the most flexible function for sending a message to the statsd server,
  * but also the least easy to use. See ast_statsd_log() or
  * ast_statsd_log_sample() for a slightly more convenient interface.
index 2046ac8..dabf15d 100644 (file)
@@ -2098,9 +2098,6 @@ int ast_app_group_list_unlock(void)
        return AST_RWLIST_UNLOCK(&groups);
 }
 
-#undef ast_app_separate_args
-unsigned int ast_app_separate_args(char *buf, char delim, char **array, int arraylen);
-
 unsigned int __ast_app_separate_args(char *buf, char delim, int remove_chars, char **array, int arraylen)
 {
        int argc;
@@ -2165,12 +2162,6 @@ unsigned int __ast_app_separate_args(char *buf, char delim, int remove_chars, ch
        return argc;
 }
 
-/* ABI compatible function */
-unsigned int ast_app_separate_args(char *buf, char delim, char **array, int arraylen)
-{
-       return __ast_app_separate_args(buf, delim, 1, array, arraylen);
-}
-
 static enum AST_LOCK_RESULT ast_lock_path_lockfile(const char *path)
 {
        char *s;
index 4660bf9..e0a87d6 100644 (file)
@@ -601,7 +601,7 @@ static char *handle_show_settings(struct ast_cli_entry *e, int cmd, struct ast_c
        ast_cli(a->fd, "\nPBX Core settings\n");
        ast_cli(a->fd, "-----------------\n");
        ast_cli(a->fd, "  Version:                     %s\n", ast_get_version());
-       ast_cli(a->fd, "  Build Options:               %s\n", S_OR(AST_BUILDOPTS, "(none)"));
+       ast_cli(a->fd, "  Build Options:               %s\n", S_OR(ast_get_build_opts(), "(none)"));
        if (ast_option_maxcalls)
                ast_cli(a->fd, "  Maximum calls:               %d (Current %d)\n", ast_option_maxcalls, ast_active_channels());
        else
index 3e2636f..013d2e2 100644 (file)
@@ -340,7 +340,7 @@ static char *complete_channeltypes(struct ast_cli_args *a)
 static char *handle_cli_core_show_channeltype(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
        struct chanlist *cl = NULL;
-       struct ast_str *codec_buf = ast_str_alloca(256);
+       struct ast_str *codec_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
 
        switch (cmd) {
        case CLI_INIT:
@@ -5094,7 +5094,7 @@ int ast_write(struct ast_channel *chan, struct ast_frame *fr)
                        f = fr;
                } else {
                        if (ast_format_cmp(ast_channel_writeformat(chan), fr->subclass.format) != AST_FORMAT_CMP_EQUAL) {
-                               struct ast_str *codec_buf = ast_str_alloca(256);
+                               struct ast_str *codec_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
 
                                /*
                                 * We are not setup to write this frame.  Things may have changed
@@ -5435,8 +5435,8 @@ static int set_format(struct ast_channel *chan, struct ast_format_cap *cap_set,
                res = ast_translator_best_choice(cap_native, cap_set, &best_native_fmt, &best_set_fmt);
        }
        if (res < 0) {
-               struct ast_str *codec_native = ast_str_alloca(256);
-               struct ast_str *codec_set = ast_str_alloca(256);
+               struct ast_str *codec_native = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
+               struct ast_str *codec_set = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
 
                ast_format_cap_get_names(cap_native, &codec_native);
                ast_channel_unlock(chan);
@@ -5978,8 +5978,8 @@ struct ast_channel *ast_request(const char *type, struct ast_format_cap *request
                        res = ast_translator_best_choice(tmp_cap, chan->tech->capabilities, &tmp_fmt, &best_audio_fmt);
                        ao2_ref(tmp_cap, -1);
                        if (res < 0) {
-                               struct ast_str *tech_codecs = ast_str_alloca(64);
-                               struct ast_str *request_codecs = ast_str_alloca(64);
+                               struct ast_str *tech_codecs = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
+                               struct ast_str *request_codecs = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
 
                                ast_log(LOG_WARNING, "No translator path exists for channel type %s (native %s) to %s\n", type,
                                        ast_format_cap_get_names(chan->tech->capabilities, &tech_codecs),
index e59a856..b3d4cac 100644 (file)
@@ -1528,7 +1528,7 @@ static char *handle_showchan(struct ast_cli_entry *e, int cmd, struct ast_cli_ar
        struct ast_var_t *var;
        struct ast_str *write_transpath = ast_str_alloca(256);
        struct ast_str *read_transpath = ast_str_alloca(256);
-       struct ast_str *codec_buf = ast_str_alloca(64);
+       struct ast_str *codec_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
        struct ast_bridge *bridge;
        ast_callid callid;
        char callid_buf[32];
index 34d2f70..127f327 100644 (file)
@@ -295,6 +295,7 @@ static int begin_dial_prerun(struct ast_dial_channel *channel, struct ast_channe
        char numsubst[AST_MAX_EXTENSION];
        struct ast_format_cap *cap_all_audio = NULL;
        struct ast_format_cap *cap_request;
+       struct ast_format_cap *requester_cap = NULL;
        struct ast_assigned_ids assignedids = {
                .uniqueid = channel->assignedid1,
                .uniqueid2 = channel->assignedid2,
@@ -305,6 +306,7 @@ static int begin_dial_prerun(struct ast_dial_channel *channel, struct ast_channe
 
                ast_channel_lock(chan);
                max_forwards = ast_max_forwards_get(chan);
+               requester_cap = ao2_bump(ast_channel_nativeformats(chan));
                ast_channel_unlock(chan);
 
                if (max_forwards <= 0) {
@@ -318,8 +320,8 @@ static int begin_dial_prerun(struct ast_dial_channel *channel, struct ast_channe
 
        if (cap && ast_format_cap_count(cap)) {
                cap_request = cap;
-       } else if (chan) {
-               cap_request = ast_channel_nativeformats(chan);
+       } else if (requester_cap) {
+               cap_request = requester_cap;
        } else {
                cap_all_audio = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT);
                ast_format_cap_append_by_type(cap_all_audio, AST_MEDIA_TYPE_AUDIO);
@@ -332,6 +334,7 @@ static int begin_dial_prerun(struct ast_dial_channel *channel, struct ast_channe
                return -1;
        }
        cap_request = NULL;
+       ao2_cleanup(requester_cap);
        ao2_cleanup(cap_all_audio);
 
        if (chan) {
index e1b7770..c3b352d 100644 (file)
@@ -475,7 +475,7 @@ static int dns_parse_answer_ex(void *context, int rr_class, int rr_type, unsigne
                /* Skip over the records that do not have the same resource record class and type we care about */
                if (ntohs(ans->class) == rr_class && ntohs(ans->rtype) == rr_type) {
                        /* Invoke the record handler callback to deliver the discovered record */
-                       record_handler(context, answer, ntohs(ans->size), ans->ttl);
+                       record_handler(context, answer, ntohs(ans->size), ntohl(ans->ttl));
                        /*At least one record was found */
                        ret = AST_DNS_SEARCH_SUCCESS;
                }
old mode 100755 (executable)
new mode 100644 (file)
index bfad6e0..f0f826a 100644 (file)
@@ -1091,7 +1091,7 @@ int ast_streamfile(struct ast_channel *chan, const char *filename, const char *p
 
        fs = ast_openstream(chan, filename, preflang);
        if (!fs) {
-               struct ast_str *codec_buf = ast_str_alloca(64);
+               struct ast_str *codec_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
                ast_log(LOG_WARNING, "Unable to open %s (format %s): %s\n",
                        filename, ast_format_cap_get_names(ast_channel_nativeformats(chan), &codec_buf), strerror(errno));
                return -1;
index d486d5d..2221c53 100644 (file)
@@ -230,7 +230,10 @@ int ast_format_cap_append_by_type(struct ast_format_cap *cap, enum ast_media_typ
                        continue;
                }
 
-               format = ast_format_create(codec);
+               format = ast_format_cache_get(codec->name);
+               if (!format || (codec != ast_format_get_codec(format))) {
+                       format = ast_format_create(codec);
+               }
                ao2_ref(codec, -1);
 
                if (!format) {
index a5925e4..73b8ee1 100644 (file)
@@ -2144,21 +2144,6 @@ void __ast_verbose_callid(const char *file, int line, const char *func, int leve
        va_end(ap);
 }
 
-/* No new code should use this directly, but we have the ABI for backwards compat */
-#undef ast_verbose
-void __attribute__((format(printf, 1,2))) ast_verbose(const char *fmt, ...);
-void ast_verbose(const char *fmt, ...)
-{
-       ast_callid callid;
-       va_list ap;
-
-       callid = ast_read_threadstorage_callid();
-
-       va_start(ap, fmt);
-       __ast_verbose_ap("", 0, "", 0, callid, fmt, ap);
-       va_end(ap);
-}
-
 /*! Console verbosity level node. */
 struct verb_console {
        /*! List node link */
index 6e9ae00..d6aadf4 100644 (file)
@@ -4343,7 +4343,7 @@ static void generate_status(struct mansession *s, struct ast_channel *chan, char
        RAII_VAR(struct ast_str *, variable_str, NULL, ast_free);
        struct ast_str *write_transpath = ast_str_alloca(256);
        struct ast_str *read_transpath = ast_str_alloca(256);
-       struct ast_str *codec_buf = ast_str_alloca(128);
+       struct ast_str *codec_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
        struct ast_party_id effective_id;
        int i;
        RAII_VAR(struct ast_channel_snapshot *, snapshot,
index f9f7c38..b751b9f 100644 (file)
@@ -307,7 +307,7 @@ 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)
 {
-       struct ast_str *codec_buf = ast_str_alloca(64);
+       struct ast_str *codec_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
        struct ast_format_cap **cap = (struct ast_format_cap **)(obj + args[0]);
        return !(*buf = ast_strdup(ast_format_cap_get_names(*cap, &codec_buf)));
 }
index 5c513ee..0719dee 100644 (file)
@@ -83,6 +83,8 @@ struct ast_taskprocessor {
        pthread_t thread;
        /*! Indicates if the taskprocessor is currently executing a task */
        unsigned int executing:1;
+       /*! Indicates that a high water warning has been issued on this task processor */
+       unsigned int high_water_warned:1;
 };
 
 /*!
@@ -714,6 +716,8 @@ void *ast_taskprocessor_unreference(struct ast_taskprocessor *tps)
        return NULL;
 }
 
+#define HIGH_WATER_LEVEL 100
+
 /* push the task into the taskprocessor queue */
 static int taskprocessor_push(struct ast_taskprocessor *tps, struct tps_task *t)
 {
@@ -733,6 +737,13 @@ static int taskprocessor_push(struct ast_taskprocessor *tps, struct tps_task *t)
        ao2_lock(tps);
        AST_LIST_INSERT_TAIL(&tps->tps_queue, t, list);
        previous_size = tps->tps_queue_size++;
+
+       if (previous_size >= HIGH_WATER_LEVEL && !tps->high_water_warned) {
+               ast_log(LOG_WARNING, "The '%s' task processor queue reached %d scheduled tasks.\n",
+                       tps->name, previous_size);
+               tps->high_water_warned = 1;
+       }
+
        /* The currently executing task counts as still in queue */
        was_empty = tps->executing ? 0 : previous_size == 0;
        ao2_unlock(tps);
index 86c3f65..1e3d368 100644 (file)
@@ -45,18 +45,9 @@ ASTERISK_REGISTER_FILE()
 /*! \brief Default documentation language. */
 static const char default_documentation_language[] = "en_US";
 
-/*!
- * \brief Number of columns to print when showing the XML documentation with a
- *         'core show application/function *' CLI command. Used in text wrapping.
- */
-static const int xmldoc_text_columns = 74;
-
-/*!
- * \brief This is a value that we will use to let the wrapping mechanism move the cursor
- *         backward and forward xmldoc_max_diff positions before cutting the middle of a
- *         word, trying to find a space or a \n.
- */
-static const int xmldoc_max_diff = 5;
+/*! \brief Number of columns to print when showing the XML documentation with a
+ *         'core show application/function *' CLI command. Used in text wrapping.*/
+static const int xmldoc_text_columns = 79;
 
 /*! \brief XML documentation language. */
 static char documentation_language[6];
@@ -176,100 +167,22 @@ static void xmldoc_setpostbr(char *postbr, size_t len, const char *text)
 
 /*!
  * \internal
- * \brief Try to find a space or a break in text starting at currentpost
- *         and moving at most maxdiff positions.
- *         Helper for xmldoc_string_wrap().
- *
- * \param text Input string where it will search.
- * \param currentpos Current position within text.
- * \param maxdiff Not move more than maxdiff inside text.
- *
- * \retval 1 if a space or break is found inside text while moving.
- * \retval 0 if no space or break is found.
- */
-static int xmldoc_wait_nextspace(const char *text, int currentpos, int maxdiff)
-{
-       int i, textlen;
-
-       if (!text) {
-               return 0;
-       }
-
-       textlen = strlen(text);
-       for (i = currentpos; i < textlen; i++) {
-               if (text[i] == ESC) {
-                       /* Move to the end of the escape sequence */
-                       while (i < textlen && text[i] != 'm') {
-                               i++;
-                       }
-               } else if (text[i] == ' ' || text[i] == '\n') {
-                       /* Found the next space or linefeed */
-                       return 1;
-               } else if (i - currentpos > maxdiff) {
-                       /* We have looked the max distance and didn't find it */
-                       return 0;
-               }
-       }
-
-       /* Reached the end and did not find it */
-
-       return 0;
-}
-
-/*!
- * \internal
- * \brief Helper function for xmldoc_string_wrap().
- *    Try to found a space or a break inside text moving backward
- *    not more than maxdiff positions.
- *
- * \param text The input string where to search for a space.
- * \param currentpos The current cursor position.
- * \param maxdiff The max number of positions to move within text.
- *
- * \retval 0 If no space is found (Notice that text[currentpos] is not a space or a break)
- * \retval > 0 If a space or a break is found, and the result is the position relative to
- *  currentpos.
- */
-static int xmldoc_foundspace_backward(const char *text, int currentpos, int maxdiff)
-{
-       int i;
-
-       for (i = currentpos; i > 0; i--) {
-               if (text[i] == ' ' || text[i] == '\n') {
-                       return (currentpos - i);
-               } else if (text[i] == 'm' && (text[i - 1] >= '0' || text[i - 1] <= '9')) {
-                       /* give up, we found the end of a possible ESC sequence. */
-                       return 0;
-               } else if (currentpos - i > maxdiff) {
-                       /* give up, we can't move anymore. */
-                       return 0;
-               }
-       }
-
-       /* we found the beginning of the text */
-
-       return 0;
-}
-
-/*!
- * \internal
  * \brief Justify a text to a number of columns.
  *
  * \param text Input text to be justified.
  * \param columns Number of columns to preserve in the text.
- * \param maxdiff Try to not cut a word when goinf down.
  *
  * \retval NULL on error.
  * \retval The wrapped text.
  */
-static char *xmldoc_string_wrap(const char *text, int columns, int maxdiff)
+static char *xmldoc_string_wrap(const char *text, int columns)
 {
        struct ast_str *tmp;
        char *ret, postbr[160];
-       int count = 1, i, backspace, needtobreak = 0, colmax, textlen;
+       int count, i, textlen, postbrlen, lastbreak;
 
        /* sanity check */
-       if (!text || columns <= 0 || maxdiff < 0) {
+       if (!text || columns <= 0) {
                ast_log(LOG_WARNING, "Passing wrong arguments while trying to wrap the text\n");
                return NULL;
        }
@@ -282,55 +195,44 @@ static char *xmldoc_string_wrap(const char *text, int columns, int maxdiff)
 
        /* Check for blanks and tabs and put them in postbr. */
        xmldoc_setpostbr(postbr, sizeof(postbr), text);
-       colmax = columns - xmldoc_postbrlen(postbr);
+       postbrlen = xmldoc_postbrlen(postbr);
+
+       count = 0;
+       lastbreak = 0;
 
        textlen = strlen(text);
        for (i = 0; i < textlen; i++) {
-               if (needtobreak || !(count % colmax)) {
-                       if (text[i] == ' ') {
-                               ast_str_append(&tmp, 0, "\n%s", postbr);
-                               needtobreak = 0;
-                               count = 1;
-                       } else if (text[i] != '\n') {
-                               needtobreak = 1;
-                               if (xmldoc_wait_nextspace(text, i, maxdiff)) {
-                                       /* wait for the next space */
-                                       ast_str_append(&tmp, 0, "%c", text[i]);
-                                       continue;
-                               }
-                               /* Try to look backwards */
-                               backspace = xmldoc_foundspace_backward(text, i, maxdiff);
-                               if (backspace) {
-                                       needtobreak = 1;
-                                       ast_str_truncate(tmp, -backspace);
-                                       i -= backspace + 1;
-                                       continue;
-                               }
-                               ast_str_append(&tmp, 0, "\n%s", postbr);
-                               needtobreak = 0;
-                               count = 1;
-                       }
-                       /* skip blanks after a \n */
-                       while (text[i] == ' ') {
-                               i++;
-                       }
-               }
                if (text[i] == '\n') {
                        xmldoc_setpostbr(postbr, sizeof(postbr), &text[i] + 1);
-                       colmax = columns - xmldoc_postbrlen(postbr);
-                       needtobreak = 0;
-                       count = 1;
-               }
-               if (text[i] == ESC) {
-                       /* Ignore Escape sequences. */
+                       postbrlen = xmldoc_postbrlen(postbr);
+                       count = 0;
+                       lastbreak = 0;
+               } else if (text[i] == ESC) {
+                       /* Walk over escape sequences without counting them. */
                        do {
                                ast_str_append(&tmp, 0, "%c", text[i]);
                                i++;
                        } while (i < textlen && text[i] != 'm');
                } else {
+                       if (text[i] == ' ') {
+                               lastbreak = i;
+                       }
                        count++;
                }
-               ast_str_append(&tmp, 0, "%c", text[i]);
+
+               if (count > columns) {
+                       /* Seek backwards if it was at most 30 characters ago. */
+                       int back = i - lastbreak;
+                       if (lastbreak && back > 0 && back < 30) {
+                               ast_str_truncate(tmp, -back);
+                               i = lastbreak; /* go back a bit */
+                       }
+                       ast_str_append(&tmp, 0, "\n%s", postbr);
+                       count = postbrlen;
+                       lastbreak = 0;
+               } else {
+                       ast_str_append(&tmp, 0, "%c", text[i]);
+               }
        }
 
        ret = ast_strdup(ast_str_buffer(tmp));
@@ -442,7 +344,7 @@ char *ast_xmldoc_printable(const char *bwinput, int withcolors)
        }
 
        /* Wrap the text, notice that string wrap will avoid cutting an ESC sequence. */
-       wrapped = xmldoc_string_wrap(ast_str_buffer(colorized), xmldoc_text_columns, xmldoc_max_diff);
+       wrapped = xmldoc_string_wrap(ast_str_buffer(colorized), xmldoc_text_columns);
 
        ast_free(colorized);
 
index b6f88d2..eef1d43 100644 (file)
@@ -59,17 +59,20 @@ static int destroy_contact(void *obj, void *arg, int flags)
 
 static void aor_deleted_observer(const void *object)
 {
+       const struct ast_sip_aor *aor = object;
        const char *aor_id = ast_sorcery_object_get_id(object);
        /* Give enough space for ^ at the beginning and ;@ at the end, since that is our object naming scheme */
        char regex[strlen(aor_id) + 4];
        struct ao2_container *contacts;
 
-       snprintf(regex, sizeof(regex), "^%s;@", aor_id);
+       if (aor->permanent_contacts) {
+               ao2_callback(aor->permanent_contacts, OBJ_NODATA | OBJ_MULTIPLE | OBJ_UNLINK, destroy_contact, NULL);
+       }
 
+       snprintf(regex, sizeof(regex), "^%s;@", aor_id);
        if (!(contacts = ast_sorcery_retrieve_by_regex(ast_sip_get_sorcery(), "contact", regex))) {
                return;
        }
-
        /* Destroy any contacts that may still exist that were made for this AoR */
        ao2_callback(contacts, OBJ_NODATA | OBJ_MULTIPLE | OBJ_UNLINK, destroy_contact, NULL);
 
@@ -302,6 +305,14 @@ int ast_sip_location_update_contact(struct ast_sip_contact *contact)
 
 int ast_sip_location_delete_contact(struct ast_sip_contact *contact)
 {
+       void *contact_status_obj;
+
+       contact_status_obj = ast_sorcery_retrieve_by_id(ast_sip_get_sorcery(), CONTACT_STATUS, ast_sorcery_object_get_id(contact));
+       if (contact_status_obj) {
+               ast_sorcery_delete(ast_sip_get_sorcery(), contact_status_obj);
+               ao2_ref(contact_status_obj, -1);
+       }
+
        return ast_sorcery_delete(ast_sip_get_sorcery(), contact);
 }
 
index aa753f4..3a6f9d7 100644 (file)
@@ -253,6 +253,17 @@ static const struct ast_sorcery_observer state_contact_status_observer = {
        .updated = persistent_endpoint_contact_status_observer,
 };
 
+static void endpoint_deleted_observer(const void *object)
+{
+       const struct ast_sip_endpoint *endpoint = object;
+
+       ao2_find(persistent_endpoints, ast_endpoint_get_resource(endpoint->persistent), OBJ_SEARCH_KEY | OBJ_UNLINK | OBJ_NODATA);
+}
+
+static const struct ast_sorcery_observer endpoint_observers = {
+       .deleted = endpoint_deleted_observer,
+};
+
 static int dtmf_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
 {
        struct ast_sip_endpoint *endpoint = obj;
@@ -1955,6 +1966,7 @@ int ast_res_pjsip_initialize_configuration(void)
                return -1;
        }
 
+       ast_sorcery_observer_add(sip_sorcery, "endpoint", &endpoint_observers);
        ast_sorcery_observer_add(sip_sorcery, "contact", &state_contact_observer);
        ast_sorcery_observer_add(sip_sorcery, CONTACT_STATUS, &state_contact_status_observer);
 
index a66aebb..1f2f21d 100644 (file)
@@ -323,8 +323,8 @@ static int set_caps(struct ast_sip_session *session,
        /* get the joint capabilities between peer and endpoint */
        ast_format_cap_get_compatible(caps, peer, joint);
        if (!ast_format_cap_count(joint)) {
-               struct ast_str *usbuf = ast_str_alloca(256);
-               struct ast_str *thembuf = ast_str_alloca(256);
+               struct ast_str *usbuf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
+               struct ast_str *thembuf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
 
                ast_rtp_codecs_payloads_destroy(&codecs);
                ast_log(LOG_NOTICE, "No joint capabilities for '%s' media stream between our configuration(%s) and incoming SDP(%s)\n",
@@ -396,8 +396,11 @@ static pjmedia_sdp_attr* generate_rtpmap_attr(struct ast_sip_session *session, p
        rtpmap.pt = media->desc.fmt[media->desc.fmt_count - 1];
        rtpmap.clock_rate = ast_rtp_lookup_sample_rate2(asterisk_format, format, code);
        pj_strdup2(pool, &rtpmap.enc_name, ast_rtp_lookup_mime_subtype2(asterisk_format, format, code, options));
-       rtpmap.param.slen = 0;
-       rtpmap.param.ptr = NULL;
+       if (!pj_stricmp2(&rtpmap.enc_name, "opus")) {
+               pj_cstr(&rtpmap.param, "2");
+       } else {
+               pj_cstr(&rtpmap.param, NULL);
+       }
 
        pjmedia_sdp_rtpmap_to_attr(pool, &rtpmap, &attr);
 
index fefe395..8bf74db 100644 (file)
@@ -97,11 +97,11 @@ static void conf_server(const struct conf *cfg, struct ast_sockaddr *addr)
        }
 }
 
-void AST_OPTIONAL_API_NAME(ast_statsd_log_full)(const char *metric_name,
-       const char *metric_type, intmax_t value, double sample_rate)
+void AST_OPTIONAL_API_NAME(ast_statsd_log_string)(const char *metric_name,
+       const char *metric_type, const char *value, double sample_rate)
 {
-       RAII_VAR(struct conf *, cfg, NULL, ao2_cleanup);
-       RAII_VAR(struct ast_str *, msg, NULL, ast_free);
+       struct conf *cfg;
+       struct ast_str *msg;
        size_t len;
        struct ast_sockaddr statsd_server;
 
@@ -109,9 +109,6 @@ void AST_OPTIONAL_API_NAME(ast_statsd_log_full)(const char *metric_name,
                return;
        }
 
-       cfg = ao2_global_obj_ref(confs);
-       conf_server(cfg, &statsd_server);
-
        /* Rates <= 0.0 never get logged.
         * Rates >= 1.0 always get logged.
         * All others leave it to chance.
@@ -122,9 +119,11 @@ void AST_OPTIONAL_API_NAME(ast_statsd_log_full)(const char *metric_name,
        }
 
        cfg = ao2_global_obj_ref(confs);
+       conf_server(cfg, &statsd_server);
 
        msg = ast_str_create(40);
        if (!msg) {
+               ao2_cleanup(cfg);
                return;
        }
 
@@ -132,7 +131,7 @@ void AST_OPTIONAL_API_NAME(ast_statsd_log_full)(const char *metric_name,
                ast_str_append(&msg, 0, "%s.", cfg->global->prefix);
        }
 
-       ast_str_append(&msg, 0, "%s:%jd|%s", metric_name, value, metric_type);
+       ast_str_append(&msg, 0, "%s:%s|%s", metric_name, value, metric_type);
 
        if (sample_rate < 1.0) {
                ast_str_append(&msg, 0, "|@%.2f", sample_rate);
@@ -144,20 +143,39 @@ void AST_OPTIONAL_API_NAME(ast_statsd_log_full)(const char *metric_name,
 
        len = ast_str_strlen(msg);
 
-       ast_debug(6, "send: %s\n", ast_str_buffer(msg));
+       ast_debug(6, "Sending statistic %s to StatsD server\n", ast_str_buffer(msg));
        ast_sendto(socket_fd, ast_str_buffer(msg), len, 0, &statsd_server);
+
+       ao2_cleanup(cfg);
+       ast_free(msg);
+}
+
+void AST_OPTIONAL_API_NAME(ast_statsd_log_full)(const char *metric_name,
+       const char *metric_type, intmax_t value, double sample_rate)
+{
+       char char_value[30];
+       snprintf(char_value, sizeof(char_value), "%jd", value);
+
+       ast_statsd_log_string(metric_name, metric_type, char_value, sample_rate);
+
 }
 
 void AST_OPTIONAL_API_NAME(ast_statsd_log)(const char *metric_name,
        const char *metric_type, intmax_t value)
 {
-       ast_statsd_log_full(metric_name, metric_type, value, 1.0);
+       char char_value[30];
+       snprintf(char_value, sizeof(char_value), "%jd", value);
+
+       ast_statsd_log_string(metric_name, metric_type, char_value, 1.0);
 }
 
 void AST_OPTIONAL_API_NAME(ast_statsd_log_sample)(const char *metric_name,
        intmax_t value, double sample_rate)
 {
-       ast_statsd_log_full(metric_name, AST_STATSD_COUNTER, value,
+       char char_value[30];
+       snprintf(char_value, sizeof(char_value), "%jd", value);
+
+       ast_statsd_log_string(metric_name, AST_STATSD_COUNTER, char_value,
                sample_rate);
 }
 
index 6f02b25..d4a79c1 100644 (file)
@@ -3,6 +3,7 @@
                LINKER_SYMBOL_PREFIX*ast_statsd_log;
                LINKER_SYMBOL_PREFIX*ast_statsd_log_full;
                LINKER_SYMBOL_PREFIX*ast_statsd_log_sample;
+               LINKER_SYMBOL_PREFIX*ast_statsd_log_string;
        local:
                *;
 };
index 12c75bf..bbfec0d 100644 (file)
@@ -1492,8 +1492,8 @@ AST_TEST_DEFINE(config_options_test)
                        res = AST_TEST_FAIL;
                }
                if (!ast_format_cap_identical(arr[x]->codeccapopt, control->codeccapopt)) {
-                       struct ast_str *codec_buf1 = ast_str_alloca(64);
-                       struct ast_str *codec_buf2 = ast_str_alloca(64);
+                       struct ast_str *codec_buf1 = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
+                       struct ast_str *codec_buf2 = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
 
                        ast_test_status_update(test, "format did not match: '%s' vs '%s' on loop %d\n",
                                ast_format_cap_get_names(arr[x]->codeccapopt, &codec_buf1),
index 4d810bf..b62f6e5 100644 (file)
@@ -1079,7 +1079,7 @@ AST_TEST_DEFINE(format_cap_get_names)
        RAII_VAR(struct ast_format *, ulaw_format, NULL, ao2_cleanup);
        RAII_VAR(struct ast_codec *, alaw, NULL, ao2_cleanup);
        RAII_VAR(struct ast_format *, alaw_format, NULL, ao2_cleanup);
-       struct ast_str *buffer = ast_str_alloca(128);
+       struct ast_str *buffer = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
 
        switch (cmd) {
        case TEST_INIT: