[asterisk-commits] file: branch file/mf-attributes r417804 - in /team/file/mf-attributes: ./ add...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jul 3 07:12:58 CDT 2014


Author: file
Date: Thu Jul  3 07:12:46 2014
New Revision: 417804

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=417804
Log:
Multiple revisions 417771,417784,417786,417801

........
  r417771 | coreyfarrell | 2014-07-02 14:14:25 -0700 (Wed, 02 Jul 2014) | 2 lines
  
  Merge /trunk at 417768
........
  r417784 | coreyfarrell | 2014-07-02 14:36:44 -0700 (Wed, 02 Jul 2014) | 3 lines
  
  Initialized merge tracking via "svnmerge" with revisions "1-417768" from 
  http://svn.asterisk.org/svn/asterisk/trunk
........
  r417786 | root | 2014-07-02 15:17:24 -0700 (Wed, 02 Jul 2014) | 10 lines
  
  ARI: Remove unnecessary \briefs from automatically generated documentation
  
  Review: https://reviewboard.asterisk.org/r/3440/
  ........
  
  Merged revisions 412653 from http://svn.asterisk.org/svn/asterisk/branches/12
  ........
  
  Merged revisions 417770 from file:///srv/subversion/repos/asterisk/trunk
........
  r417801 | mjordan | 2014-07-03 04:42:14 -0700 (Thu, 03 Jul 2014) | 53 lines
  
  Media formats: Rename certain functions in the API
  
  This patch performs the renaming discussed on the asterisk-dev list [1]. It
  also includes some parts of Corey Farrell's memory leak cleanups as well.
  
  [1] http://lists.digium.com/pipermail/asterisk-dev/2014-June/068133.html
  
  The great renaming:
  
   * ast_format_cap_add             => ast_format_cap_append
   * ast_format_cap_add_all_by_type => ast_format_cap_append_all_by_type
   * ast_parse_allow_disallow       => ast_format_cap_update_by_allow_disallow
   * ast_cap_remove_bytype          => ast_format_cap_remove_by_type
   * ast_getformatname_multiple     => ast_format_cap_get_names, and now uses an
                                       ast_str ** instead of a char *buf/size_t
                                       len
   * ast_format_sdp_generate        => ast_format_generate_sdp_fmtp
   * ast_format_sdp_parse           => ast_format_parse_sdp_fmtp
  
  Functions removed:
   * ast_format_compatibility_get_original_id - no longer used
  
  Note that chan_h323, chan_gtalk, and chan_jingle did not get all of the
  re-namings (particularly ast_getformatname_multiple =>
  ast_format_cap_get_names), and will not compile with this patch. These modules
  should be removed, per the discussion on the -dev list.
  
  Functions that support REF_DEBUG:
   * ast_format_cap_alloc
   * ast_format_cap_append
   * ast_format_cache_get
  
  Memory leak cleanups (many of which came from Corey's patches):
   * Channel technology struct capabilities leak their format capabilities on off
     nominal exit paths (chan_motif, chan_pjsip, chan_unistim, chan_skinny)
   * Format capabilities leak in chan_pjsip_new nominal path
   * Leak of nativeformats format_cap in nominal path of channel.c's
     ast_channel_alloc
   * Leak of format_cap in channel.c's set_format
   * Leak of format_cap in channel.c's ast_request
   * Usage of ao2_replace in translate.c to avoid overwriting a ref
   * Clean up of frame format cache in RTP instance in res_rtp_asterisk
     destructor
  
  Unit tests
   * Remove test for ast_getformatname_multiple, add test for
     ast_format_cap_get_names
  
  Review: https://reviewboard.asterisk.org/r/3689/
  
  ASTERISK-23715 #close
........

Merged revisions 417771,417784,417786,417801 from http://svn.asterisk.org/svn/asterisk/team/group/media_formats-reviewed-trunk

Added:
    team/file/mf-attributes/contrib/ast-db-manage/config/versions/51f8cb66540e_add_further_dtls_options.py
      - copied unchanged from r417801, team/group/media_formats-reviewed-trunk/contrib/ast-db-manage/config/versions/51f8cb66540e_add_further_dtls_options.py
    team/file/mf-attributes/tests/test_channel_feature_hooks.c
      - copied unchanged from r417801, team/group/media_formats-reviewed-trunk/tests/test_channel_feature_hooks.c
Modified:
    team/file/mf-attributes/   (props changed)
    team/file/mf-attributes/CHANGES
    team/file/mf-attributes/UPGRADE.txt
    team/file/mf-attributes/addons/chan_mobile.c
    team/file/mf-attributes/addons/chan_ooh323.c
    team/file/mf-attributes/apps/app_confbridge.c
    team/file/mf-attributes/apps/app_dumpchan.c
    team/file/mf-attributes/apps/app_jack.c
    team/file/mf-attributes/apps/app_meetme.c
    team/file/mf-attributes/apps/app_originate.c
    team/file/mf-attributes/apps/app_voicemail.c
    team/file/mf-attributes/apps/confbridge/conf_chan_record.c
    team/file/mf-attributes/bridges/bridge_holding.c
    team/file/mf-attributes/bridges/bridge_native_rtp.c
    team/file/mf-attributes/bridges/bridge_simple.c
    team/file/mf-attributes/bridges/bridge_softmix.c
    team/file/mf-attributes/channels/chan_alsa.c
    team/file/mf-attributes/channels/chan_bridge_media.c
    team/file/mf-attributes/channels/chan_console.c
    team/file/mf-attributes/channels/chan_dahdi.c
    team/file/mf-attributes/channels/chan_gtalk.c
    team/file/mf-attributes/channels/chan_h323.c
    team/file/mf-attributes/channels/chan_iax2.c
    team/file/mf-attributes/channels/chan_jingle.c
    team/file/mf-attributes/channels/chan_mgcp.c
    team/file/mf-attributes/channels/chan_misdn.c
    team/file/mf-attributes/channels/chan_motif.c
    team/file/mf-attributes/channels/chan_multicast_rtp.c
    team/file/mf-attributes/channels/chan_nbs.c
    team/file/mf-attributes/channels/chan_oss.c
    team/file/mf-attributes/channels/chan_phone.c
    team/file/mf-attributes/channels/chan_pjsip.c
    team/file/mf-attributes/channels/chan_sip.c
    team/file/mf-attributes/channels/chan_skinny.c
    team/file/mf-attributes/channels/chan_unistim.c
    team/file/mf-attributes/channels/dahdi/bridge_native_dahdi.c
    team/file/mf-attributes/channels/pjsip/dialplan_functions.c
    team/file/mf-attributes/channels/sig_pri.c
    team/file/mf-attributes/channels/sig_pri.h
    team/file/mf-attributes/channels/sip/include/sip.h
    team/file/mf-attributes/configs/ari.conf.sample
    team/file/mf-attributes/configs/pjsip.conf.sample
    team/file/mf-attributes/configs/sip.conf.sample
    team/file/mf-attributes/contrib/scripts/refcounter.py
    team/file/mf-attributes/funcs/func_channel.c
    team/file/mf-attributes/include/asterisk/bridge_features.h
    team/file/mf-attributes/include/asterisk/channel.h
    team/file/mf-attributes/include/asterisk/format.h
    team/file/mf-attributes/include/asterisk/format_cache.h
    team/file/mf-attributes/include/asterisk/format_cap.h
    team/file/mf-attributes/include/asterisk/format_compatibility.h
    team/file/mf-attributes/include/asterisk/http_websocket.h
    team/file/mf-attributes/include/asterisk/netsock.h
    team/file/mf-attributes/include/asterisk/res_pjsip.h
    team/file/mf-attributes/include/asterisk/res_pjsip_pubsub.h
    team/file/mf-attributes/include/asterisk/res_pjsip_session.h
    team/file/mf-attributes/include/asterisk/rtp_engine.h
    team/file/mf-attributes/include/asterisk/sdp_srtp.h
    team/file/mf-attributes/main/astobj2.c
    team/file/mf-attributes/main/astobj2_container.c
    team/file/mf-attributes/main/bridge.c
    team/file/mf-attributes/main/bridge_basic.c
    team/file/mf-attributes/main/bridge_channel.c
    team/file/mf-attributes/main/ccss.c
    team/file/mf-attributes/main/cel.c
    team/file/mf-attributes/main/channel.c
    team/file/mf-attributes/main/cli.c
    team/file/mf-attributes/main/config_options.c
    team/file/mf-attributes/main/core_local.c
    team/file/mf-attributes/main/core_unreal.c
    team/file/mf-attributes/main/dial.c
    team/file/mf-attributes/main/event.c
    team/file/mf-attributes/main/file.c
    team/file/mf-attributes/main/format.c
    team/file/mf-attributes/main/format_cache.c
    team/file/mf-attributes/main/format_cap.c
    team/file/mf-attributes/main/format_compatibility.c
    team/file/mf-attributes/main/manager.c
    team/file/mf-attributes/main/media_index.c
    team/file/mf-attributes/main/netsock.c
    team/file/mf-attributes/main/rtp_engine.c
    team/file/mf-attributes/main/say.c
    team/file/mf-attributes/main/sdp_srtp.c
    team/file/mf-attributes/main/sorcery.c
    team/file/mf-attributes/main/translate.c
    team/file/mf-attributes/main/udptl.c
    team/file/mf-attributes/main/utils.c
    team/file/mf-attributes/pbx/pbx_spool.c
    team/file/mf-attributes/res/ari/ari_websockets.c
    team/file/mf-attributes/res/ari/config.c
    team/file/mf-attributes/res/ari/internal.h
    team/file/mf-attributes/res/ari/resource_applications.h
    team/file/mf-attributes/res/ari/resource_asterisk.h
    team/file/mf-attributes/res/ari/resource_bridges.c
    team/file/mf-attributes/res/ari/resource_bridges.h
    team/file/mf-attributes/res/ari/resource_channels.c
    team/file/mf-attributes/res/ari/resource_channels.h
    team/file/mf-attributes/res/ari/resource_device_states.h
    team/file/mf-attributes/res/ari/resource_endpoints.h
    team/file/mf-attributes/res/ari/resource_events.h
    team/file/mf-attributes/res/ari/resource_mailboxes.h
    team/file/mf-attributes/res/ari/resource_playbacks.h
    team/file/mf-attributes/res/ari/resource_recordings.h
    team/file/mf-attributes/res/ari/resource_sounds.h
    team/file/mf-attributes/res/parking/parking_applications.c
    team/file/mf-attributes/res/res_agi.c
    team/file/mf-attributes/res/res_ari.c
    team/file/mf-attributes/res/res_calendar.c
    team/file/mf-attributes/res/res_clioriginate.c
    team/file/mf-attributes/res/res_format_attr_celt.c
    team/file/mf-attributes/res/res_format_attr_h263.c
    team/file/mf-attributes/res/res_format_attr_h264.c
    team/file/mf-attributes/res/res_format_attr_opus.c
    team/file/mf-attributes/res/res_format_attr_silk.c
    team/file/mf-attributes/res/res_http_websocket.c
    team/file/mf-attributes/res/res_http_websocket.exports.in
    team/file/mf-attributes/res/res_pjsip.c
    team/file/mf-attributes/res/res_pjsip/config_transport.c
    team/file/mf-attributes/res/res_pjsip/pjsip_configuration.c
    team/file/mf-attributes/res/res_pjsip_exten_state.c
    team/file/mf-attributes/res/res_pjsip_mwi.c
    team/file/mf-attributes/res/res_pjsip_outbound_registration.c
    team/file/mf-attributes/res/res_pjsip_pidf_body_generator.c
    team/file/mf-attributes/res/res_pjsip_pubsub.c
    team/file/mf-attributes/res/res_pjsip_pubsub.exports.in
    team/file/mf-attributes/res/res_pjsip_registrar.c
    team/file/mf-attributes/res/res_pjsip_sdp_rtp.c
    team/file/mf-attributes/res/res_pjsip_session.c
    team/file/mf-attributes/res/res_pjsip_transport_websocket.c
    team/file/mf-attributes/res/res_pjsip_xpidf_body_generator.c
    team/file/mf-attributes/res/res_rtp_asterisk.c
    team/file/mf-attributes/res/res_stasis.c
    team/file/mf-attributes/res/res_stasis_snoop.c
    team/file/mf-attributes/rest-api-templates/ari_resource.h.mustache
    team/file/mf-attributes/tests/test_cel.c
    team/file/mf-attributes/tests/test_config.c
    team/file/mf-attributes/tests/test_core_format.c
    team/file/mf-attributes/tests/test_format_api.c
    team/file/mf-attributes/tests/test_format_cap.c
    team/file/mf-attributes/tests/test_voicemail_api.c

Propchange: team/file/mf-attributes/
------------------------------------------------------------------------------
    automerge = *

Propchange: team/file/mf-attributes/
------------------------------------------------------------------------------
    automerge-email = git at cfware.com,jcolp at digium.com,mjordan at digium.com

Propchange: team/file/mf-attributes/
------------------------------------------------------------------------------
Binary property 'branch-12-merged' - no diff available.

Propchange: team/file/mf-attributes/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Thu Jul  3 07:12:46 2014
@@ -1,1 +1,1 @@
-/team/group/media_formats-reviewed-trunk:1-417753
+/team/group/media_formats-reviewed-trunk:1-417802

Modified: team/file/mf-attributes/CHANGES
URL: http://svnview.digium.com/svn/asterisk/team/file/mf-attributes/CHANGES?view=diff&rev=417804&r1=417803&r2=417804
==============================================================================
--- team/file/mf-attributes/CHANGES (original)
+++ team/file/mf-attributes/CHANGES Thu Jul  3 07:12:46 2014
@@ -23,6 +23,11 @@
  * New AMI action LoggerRotate reloads and rotates logger in the same manner
    as CLI command 'logger rotate'
 
+CEL
+------------------
+ * The "bridge_technology" extra field key has been added to BRIDGE_ENTER
+   and BRIDGE_EXIT events.
+
 chan_dahdi
 ------------------
  * SS7 support now requires libss7 v2.0 or later.
@@ -34,6 +39,41 @@
 
  * Added several SS7 config option parameters described in
    chan_dahdi.conf.sample.
+
+Features
+------------------
+ * The ast_channel_feature_hooks* functions have been added to allow features
+   such as DTMF hooks, interval hooks, and bridge event hooks to be made
+   available to a channel when the channel is bridged. Previously, these
+   features were provided exclusively by the caller of ast_bridge_join()
+   outside of "basic" type bridges.
+
+JACK_HOOK
+------------------
+ * The JACK_HOOK function now supports audio with a sample rate higher than
+   8kHz.
+
+Say
+------------------
+ * The 'say' family of dialplan applications now support the Japanese
+   language. The 'language' parameter in say.conf now recognizes a setting of
+   'ja', which will enable Japanese language specific mechanisms for playing
+   back numbers, dates, and other items.
+
+VoiceMail
+------------------
+ * VoiceMail and VoiceMailMain now support the Japanese language. The
+   'language' parameter in voicemail.conf now recognizes a setting of 'ja',
+   which will enable prompts to be played back using a Japanese grammatical
+   structure. Additional prompts are necessary for this functionality,
+   including:
+   - jb-arimasu: there is
+   - jb-arimasen: there is not
+   - jb-oshitekudasai: please press
+   - jb-ni: article ni
+   - jb-ga: article ga
+   - jb-wa: article wa
+   - jb-wo: article wo
 
 ------------------------------------------------------------------------------
 --- Functionality changes from Asterisk 12.3.0 to Asterisk 12.4.0 ------------

Modified: team/file/mf-attributes/UPGRADE.txt
URL: http://svnview.digium.com/svn/asterisk/team/file/mf-attributes/UPGRADE.txt?view=diff&rev=417804&r1=417803&r2=417804
==============================================================================
--- team/file/mf-attributes/UPGRADE.txt (original)
+++ team/file/mf-attributes/UPGRADE.txt Thu Jul  3 07:12:46 2014
@@ -225,5 +225,13 @@
  - The refcounter program has been removed in favor of the refcounter.py script
    in contrib/scripts.
 
-===========================================================
-===========================================================
+WebSockets:
+ - Added a compatibility option for ari, chan_sip, and chan_pjsip
+   'websocket_write_timeout'. When a websocket connection exists where Asterisk
+   writes a substantial amount of data to the connected client, and the connected
+   client is slow to process the received data, the socket may be disconnected.
+   In such cases, it may be necessary to adjust this value. Default is 100 ms.
+
+
+===========================================================
+===========================================================

Modified: team/file/mf-attributes/addons/chan_mobile.c
URL: http://svnview.digium.com/svn/asterisk/team/file/mf-attributes/addons/chan_mobile.c?view=diff&rev=417804&r1=417803&r2=417804
==============================================================================
--- team/file/mf-attributes/addons/chan_mobile.c (original)
+++ team/file/mf-attributes/addons/chan_mobile.c Thu Jul  3 07:12:46 2014
@@ -902,8 +902,8 @@
 	}
 
 	if (ast_format_cap_iscompatible_format(cap, DEVICE_FRAME_FORMAT) == AST_FORMAT_CMP_NOT_EQUAL) {
-		char tmp[256];
-		ast_log(LOG_WARNING, "Asked to get a channel of unsupported format '%s'\n", ast_getformatname_multiple(tmp, sizeof(tmp), cap));
+		struct ast_str *codec_buf = ast_str_alloca(64);
+		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;
 	}
@@ -4711,7 +4711,7 @@
 		return AST_MODULE_LOAD_DECLINE;
 	}
 
-	ast_format_cap_add(mbl_tech.capabilities, DEVICE_FRAME_FORMAT, 0);
+	ast_format_cap_append(mbl_tech.capabilities, DEVICE_FRAME_FORMAT, 0);
 	/* Check if we have Bluetooth, no point loading otherwise... */
 	dev_id = hci_get_route(NULL);
 	s = hci_open_dev(dev_id);

Modified: team/file/mf-attributes/addons/chan_ooh323.c
URL: http://svnview.digium.com/svn/asterisk/team/file/mf-attributes/addons/chan_ooh323.c?view=diff&rev=417804&r1=417803&r2=417804
==============================================================================
--- team/file/mf-attributes/addons/chan_ooh323.c (original)
+++ team/file/mf-attributes/addons/chan_ooh323.c Thu Jul  3 07:12:46 2014
@@ -392,7 +392,7 @@
 			tmpfmt = ast_format_cap_get_format(i->cap, 0);
 		}
 
-		ast_format_cap_add(caps, tmpfmt, 0);
+		ast_format_cap_append(caps, tmpfmt, 0);
 		ast_channel_nativeformats_set(ch, caps);
 		ao2_ref(caps, -1);
 
@@ -550,7 +550,7 @@
 	ast_copy_string(pvt->accountcode, gAccountcode, sizeof(pvt->accountcode));
 
 	pvt->amaflags = gAMAFLAGS;
-	ast_format_cap_append_by_type(pvt->cap, gCap, AST_MEDIA_TYPE_UNKNOWN);
+	ast_format_cap_append_from_cap(pvt->cap, gCap, AST_MEDIA_TYPE_UNKNOWN);
 
 	pvt->aniasdni = gANIasDNI;
 
@@ -576,21 +576,21 @@
 		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_channel *chan = NULL;
 	struct ooh323_pvt *p = NULL;
 	struct ooh323_peer *peer = NULL;
 	char *dest = NULL; 
 	char *ext = NULL;
 	char tmp[256];
-	char formats[FORMAT_STRING_SIZE];
 	int port = 0;
 
-	if (gH323Debug)
-		ast_verb(0, "---   ooh323_request - data %s format %s\n", data,
-										ast_getformatname_multiple(formats,FORMAT_STRING_SIZE,cap));
+	if (gH323Debug) {
+		ast_verb(0, "---   ooh323_request - data %s format %s\n", data, ast_format_cap_get_names(cap, &codec_buf));
+	}
 
 	if (!(ast_format_cap_has_type(cap, AST_MEDIA_TYPE_AUDIO))) {
-		ast_log(LOG_NOTICE, "Asked to get a channel of unsupported format '%s'\n", ast_getformatname_multiple(formats,FORMAT_STRING_SIZE,cap));
+		ast_log(LOG_NOTICE, "Asked to get a channel of unsupported format '%s'\n", ast_format_cap_get_names(cap, &codec_buf));
 		return NULL;
 	}
 
@@ -654,7 +654,7 @@
 		if (ext)
 			ast_copy_string(p->exten, ext, sizeof(p->exten));
 
-		ast_format_cap_append_by_type(p->cap, peer->cap, AST_MEDIA_TYPE_UNKNOWN);
+		ast_format_cap_append_from_cap(p->cap, peer->cap, AST_MEDIA_TYPE_UNKNOWN);
 		p->g729onlyA = peer->g729onlyA;
 		p->dtmfmode |= peer->dtmfmode;
 		p->dtmfcodec  = peer->dtmfcodec;
@@ -699,7 +699,7 @@
 		p->t38support = gT38Support;
 		p->rtptimeout = gRTPTimeout;
 		p->nat = gNat;
-		ast_format_cap_append_by_type(p->cap, gCap, AST_MEDIA_TYPE_UNKNOWN);
+		ast_format_cap_append_from_cap(p->cap, gCap, AST_MEDIA_TYPE_UNKNOWN);
 		p->rtdrinterval = gRTDRInterval;
 		p->rtdrcount = gRTDRCount;
 		p->faststart = gFastStart;
@@ -1165,7 +1165,6 @@
 {
 	struct ooh323_pvt *p = ast_channel_tech_pvt(ast);
 	int res = 0;
-	char buf[256];
 
 	if (p) {
 		ast_mutex_lock(&p->lock);
@@ -1193,10 +1192,11 @@
 
 			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);
 					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),
-							ast_getformatname_multiple(buf, sizeof(buf), ast_channel_nativeformats(ast)),
+							ast_format_cap_get_names(ast_channel_nativeformats(ast), &codec_buf),
 							ast_format_get_name(ast_channel_readformat(ast)),
 							ast_format_get_name(ast_channel_writeformat(ast)));
 
@@ -1509,7 +1509,6 @@
 void ooh323_set_write_format(ooCallData *call, struct ast_format *fmt, int txframes)
 {
 	struct ooh323_pvt *p = NULL;
-	char formats[FORMAT_STRING_SIZE];
 
 	if (gH323Debug)
 		ast_verb(0, "---   ooh323_update_writeformat %s/%d\n", 
@@ -1544,10 +1543,12 @@
 			ao2_ref(caps, -1);
 			return;
 		}
-		if (gH323Debug)
-	  		ast_verb(0, "Writeformat before update %s/%s\n", 
+		if (gH323Debug) {
+			struct ast_str *codec_buf = ast_str_alloca(64);
+			ast_verb(0, "Writeformat before update %s/%s\n", 
 			  ast_format_get_name(ast_channel_writeformat(p->owner)),
-			  ast_getformatname_multiple(formats, sizeof(formats), ast_channel_nativeformats(p->owner)));
+			  ast_format_cap_get_names(ast_channel_nativeformats(p->owner), &codec_buf));
+		}
 
 		if (p->dtmfmode & H323_DTMF_RFC2833 && p->dtmfcodec) {
 			ast_rtp_codecs_payloads_set_rtpmap_type(ast_rtp_instance_get_codecs(p->rtp),
@@ -1561,7 +1562,7 @@
 		if (txframes) {
 			ast_format_cap_set_framing(caps, txframes);
 		}
-		ast_format_cap_add(caps, fmt, 0);
+		ast_format_cap_append(caps, fmt, 0);
 		ast_channel_nativeformats_set(p->owner, caps);
 		ao2_ref(caps, -1);
 	  	ast_set_write_format(p->owner, ast_channel_writeformat(p->owner));
@@ -1615,13 +1616,14 @@
 			return;
 		}
 
-		if (gH323Debug)
-	  		ast_verb(0, "Readformat before update %s\n", 
-				  ast_format_get_name(ast_channel_readformat(p->owner)));
-	  	ast_format_cap_add(caps, fmt, 0);
-	  	ast_channel_nativeformats_set(p->owner, caps);
-	  	ao2_ref(caps, -1);
-	  	ast_set_read_format(p->owner, ast_channel_readformat(p->owner));
+		if (gH323Debug) {
+			ast_verb(0, "Readformat before update %s\n", 
+			  ast_format_get_name(ast_channel_readformat(p->owner)));
+		}
+		ast_format_cap_append(caps, fmt, 0);
+		ast_channel_nativeformats_set(p->owner, caps);
+		ao2_ref(caps, -1);
+		ast_set_read_format(p->owner, ast_channel_readformat(p->owner));
 		ast_channel_unlock(p->owner);
    	} else
 		ast_log(LOG_ERROR, "No owner found\n");
@@ -1878,7 +1880,7 @@
 		ast_copy_string(p->context, user->context, sizeof(p->context));
 		ast_copy_string(p->accountcode, user->accountcode, sizeof(p->accountcode));
 		p->amaflags = user->amaflags;
-		ast_format_cap_append_by_type(p->cap, user->cap, AST_MEDIA_TYPE_UNKNOWN);
+		ast_format_cap_append_from_cap(p->cap, user->cap, AST_MEDIA_TYPE_UNKNOWN);
 		p->g729onlyA = user->g729onlyA;
 		p->dtmfmode |= user->dtmfmode;
 		p->dtmfcodec = user->dtmfcodec;
@@ -2111,11 +2113,11 @@
 		}
 
 		if (gH323Debug) {
-			char formats[FORMAT_STRING_SIZE];
+			struct ast_str *codec_buf = ast_str_alloca(64);
 
 			ast_verb(0, " Outgoing call %s(%s) - Codec prefs - %s\n", 
 				p->username?p->username:"NULL", call->callToken,
-				ast_getformatname_multiple(formats,FORMAT_STRING_SIZE,p->cap));
+				ast_format_cap_get_names(p->cap, &codec_buf));
 		}
 
       		ooh323c_set_capability_for_call(call, p->cap,
@@ -2335,7 +2337,7 @@
 		}
 		ast_mutex_init(&user->lock);
 		ast_copy_string(user->name, name, sizeof(user->name));
-		ast_format_cap_append_by_type(user->cap, gCap, AST_MEDIA_TYPE_UNKNOWN);
+		ast_format_cap_append_from_cap(user->cap, gCap, AST_MEDIA_TYPE_UNKNOWN);
 		user->rtptimeout = gRTPTimeout;
 		user->nat = gNat;
 		user->dtmfmode = gDTMFMode;
@@ -2390,13 +2392,13 @@
 								sizeof(user->rtpmaskstr));
 				} else user->rtpmask = NULL;
 			} else if (!strcasecmp(v->name, "disallow")) {
-				ast_parse_allow_disallow(user->cap,  v->value, 0);
+				ast_format_cap_update_by_allow_disallow(user->cap,  v->value, 0);
 			} else if (!strcasecmp(v->name, "allow")) {
 				const char* tcodecs = v->value;
 				if (!strcasecmp(v->value, "all")) {
 					tcodecs = "ulaw,alaw,g729,g723,gsm";
 				}
-				ast_parse_allow_disallow(user->cap,  tcodecs, 1);
+				ast_format_cap_update_by_allow_disallow(user->cap,  tcodecs, 1);
 			} else if (!strcasecmp(v->name, "amaflags")) {
 				user->amaflags = ast_channel_string2amaflag(v->value);
          		} else if (!strcasecmp(v->name, "ip") || !strcasecmp(v->name, "host")) {
@@ -2482,7 +2484,7 @@
 		}
 		ast_mutex_init(&peer->lock);
 		ast_copy_string(peer->name, name, sizeof(peer->name));
-		ast_format_cap_append_by_type(peer->cap, gCap, AST_MEDIA_TYPE_UNKNOWN);
+		ast_format_cap_append_from_cap(peer->cap, gCap, AST_MEDIA_TYPE_UNKNOWN);
 		peer->rtptimeout = gRTPTimeout;
 		peer->nat = gNat;
 		ast_copy_string(peer->accountcode, gAccountcode, sizeof(peer->accountcode));
@@ -2585,13 +2587,13 @@
 								sizeof(peer->rtpmaskstr));
 				} else peer->rtpmask = NULL;
 			} else if (!strcasecmp(v->name, "disallow")) {
-				ast_parse_allow_disallow(peer->cap, v->value, 0); 
+				ast_format_cap_update_by_allow_disallow(peer->cap, v->value, 0);
 			} else if (!strcasecmp(v->name, "allow")) {
 				const char* tcodecs = v->value;
 				if (!strcasecmp(v->value, "all")) {
 					tcodecs = "ulaw,alaw,g729,g723,gsm";
 				}
-				ast_parse_allow_disallow(peer->cap, tcodecs, 1);				 
+				ast_format_cap_update_by_allow_disallow(peer->cap, tcodecs, 1);
 			} else if (!strcasecmp(v->name,  "amaflags")) {
 				peer->amaflags = ast_channel_string2amaflag(v->value);
 			} else if (!strcasecmp(v->name, "roundtrip")) {
@@ -2807,8 +2809,8 @@
 	gPort = 1720;
 	gIP[0] = '\0';
 	strcpy(gCallerID, DEFAULT_H323ID);
-	ast_format_cap_remove_bytype(gCap, AST_MEDIA_TYPE_UNKNOWN);
-	ast_format_cap_add(gCap, ast_format_ulaw, 0);
+	ast_format_cap_remove_by_type(gCap, AST_MEDIA_TYPE_UNKNOWN);
+	ast_format_cap_append(gCap, ast_format_ulaw, 0);
 	gDTMFMode = H323_DTMF_RFC2833;
 	gDTMFCodec = 101;
 	gFAXdetect = FAXDETECT_CNG;
@@ -3009,13 +3011,13 @@
 		} else if (!strcasecmp(v->name, "accountcode")) {
          ast_copy_string(gAccountcode, v->value, sizeof(gAccountcode));
 		} else if (!strcasecmp(v->name, "disallow")) {
-			ast_parse_allow_disallow(gCap, v->value, 0);
+			ast_format_cap_update_by_allow_disallow(gCap, v->value, 0);
 		} else if (!strcasecmp(v->name, "allow")) {
 			const char* tcodecs = v->value;
 			if (!strcasecmp(v->value, "all")) {
 				tcodecs = "ulaw,alaw,g729,g723,gsm";
 			}
-			ast_parse_allow_disallow(gCap, tcodecs, 1);
+			ast_format_cap_update_by_allow_disallow(gCap, tcodecs, 1);
 		} else if (!strcasecmp(v->name, "dtmfmode")) {
 			if (!strcasecmp(v->value, "inband"))
 				gDTMFMode = H323_DTMF_INBAND;
@@ -3228,7 +3230,7 @@
 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;
-   char formats[FORMAT_STRING_SIZE];
+	struct ast_str *codec_buf = ast_str_alloca(64);
    char ip_port[30];
 #define FORMAT  "%-15.15s  %-15.15s  %-23.23s  %-s\n"
 
@@ -3253,10 +3255,10 @@
 	while (peer) {
 		ast_mutex_lock(&peer->lock);
 		snprintf(ip_port, sizeof(ip_port), "%s:%d", peer->ip, peer->port);
-     ast_cli(a->fd, FORMAT, peer->name, 
+		ast_cli(a->fd, FORMAT, peer->name, 
 					peer->accountcode,
 					ip_port,
-                 ast_getformatname_multiple(formats,FORMAT_STRING_SIZE,peer->cap));
+					ast_format_cap_get_names(peer->cap, &codec_buf));
 		prev = peer;
 		peer = peer->next;
 		ast_mutex_unlock(&prev->lock);
@@ -3367,7 +3369,7 @@
 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;
-   char formats[FORMAT_STRING_SIZE];
+	struct ast_str *codec_buf = ast_str_alloca(64);
 #define FORMAT1  "%-15.15s  %-15.15s  %-15.15s  %-s\n"
 
 	switch (cmd) {
@@ -3394,7 +3396,7 @@
 		ast_mutex_lock(&user->lock);
      		ast_cli(a->fd, FORMAT1, user->name, 
 					user->accountcode, user->context,
-					ast_getformatname_multiple(formats, FORMAT_STRING_SIZE, user->cap));
+					ast_format_cap_get_names(user->cap, &codec_buf));
 		prev = user;
 		user = user->next;
 		ast_mutex_unlock(&prev->lock);
@@ -3501,6 +3503,7 @@
 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);
 	ooAliases *pAlias = NULL, *pAliasNext = NULL;;
 
 	switch (cmd) {
@@ -3549,7 +3552,7 @@
 	ast_cli(a->fd,  "%-20s%s\n", "H.323 LogFile:", gLogFile);
 	ast_cli(a->fd,  "%-20s%s\n", "Context:", gContext);
 	ast_cli(a->fd,  "%-20s%s\n", "Capability:",
-		ast_getformatname_multiple(value,FORMAT_STRING_SIZE,gCap));
+		ast_format_cap_get_names(gCap, &codec_buf));
 	ast_cli(a->fd, "%-20s", "DTMF Mode: ");
 	if (gDTMFMode & H323_DTMF_CISCO) {
 		ast_cli(a->fd, "%s\n", "cisco");
@@ -3753,8 +3756,8 @@
 		gCap = NULL;
 		return AST_MODULE_LOAD_FAILURE;
 	}
-	ast_format_cap_add(gCap, ast_format_ulaw, 0);
-	ast_format_cap_add_all_by_type(ooh323_tech.capabilities, AST_MEDIA_TYPE_UNKNOWN);
+	ast_format_cap_append(gCap, ast_format_ulaw, 0);
+	ast_format_cap_append_by_type(ooh323_tech.capabilities, AST_MEDIA_TYPE_UNKNOWN);
 
 	myself = ast_module_info->self;
 
@@ -4367,9 +4370,9 @@
 
 	if (p) {
 		if (ast_format_cap_count(ast_channel_nativeformats(chan))) {
-			ast_format_cap_append_by_type(result, ast_channel_nativeformats(chan), AST_MEDIA_TYPE_UNKNOWN);
+			ast_format_cap_append_from_cap(result, ast_channel_nativeformats(chan), AST_MEDIA_TYPE_UNKNOWN);
 		} else if (ast_format_cap_count(p->cap)) {
-			ast_format_cap_append_by_type(result, p->cap, AST_MEDIA_TYPE_UNKNOWN);
+			ast_format_cap_append_from_cap(result, p->cap, AST_MEDIA_TYPE_UNKNOWN);
 		}
 	}
 
@@ -4959,7 +4962,7 @@
 
 			caps = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT);
 			if (caps) {
-				ast_format_cap_add(caps, f->subclass.format, 0);
+				ast_format_cap_append(caps, f->subclass.format, 0);
 				ast_channel_nativeformats_set(p->owner, caps);
 				ao2_ref(caps, -1);
 			}

Modified: team/file/mf-attributes/apps/app_confbridge.c
URL: http://svnview.digium.com/svn/asterisk/team/file/mf-attributes/apps/app_confbridge.c?view=diff&rev=417804&r1=417803&r2=417804
==============================================================================
--- team/file/mf-attributes/apps/app_confbridge.c (original)
+++ team/file/mf-attributes/apps/app_confbridge.c Thu Jul  3 07:12:46 2014
@@ -692,7 +692,7 @@
 		return -1;
 	}
 
-	ast_format_cap_add(cap, ast_format_slin, 0);
+	ast_format_cap_append(cap, ast_format_slin, 0);
 
 	conference->record_chan = ast_request("CBRec", cap, NULL, NULL,
 		conference->name, NULL);
@@ -1379,7 +1379,7 @@
 	if (!cap) {
 		return -1;
 	}
-	ast_format_cap_add(cap, ast_format_slin, 0);
+	ast_format_cap_append(cap, ast_format_slin, 0);
 	conference->playback_chan = ast_request("CBAnn", cap, NULL, NULL,
 		conference->name, NULL);
 	ao2_ref(cap, -1);
@@ -3256,7 +3256,7 @@
 	if (!tech->capabilities) {
 		return -1;
 	}
-	ast_format_cap_add_all_by_type(tech->capabilities, AST_MEDIA_TYPE_UNKNOWN);
+	ast_format_cap_append_by_type(tech->capabilities, AST_MEDIA_TYPE_UNKNOWN);
 	if (ast_channel_register(tech)) {
 		ast_log(LOG_ERROR, "Unable to register channel technology %s(%s).\n",
 			tech->type, tech->description);

Modified: team/file/mf-attributes/apps/app_dumpchan.c
URL: http://svnview.digium.com/svn/asterisk/team/file/mf-attributes/apps/app_dumpchan.c?view=diff&rev=417804&r1=417803&r2=417804
==============================================================================
--- team/file/mf-attributes/apps/app_dumpchan.c (original)
+++ team/file/mf-attributes/apps/app_dumpchan.c Thu Jul  3 07:12:46 2014
@@ -72,7 +72,7 @@
 {
 	long elapsed_seconds = 0;
 	int hour = 0, min = 0, sec = 0;
-	char nf[256];
+	struct ast_str *format_buf = ast_str_alloca(64);
 	char cgrp[256];
 	char pgrp[256];
 	struct ast_str *write_transpath = ast_str_alloca(256);
@@ -143,7 +143,7 @@
 		ast_state2str(ast_channel_state(c)),
 		ast_channel_state(c),
 		ast_channel_rings(c),
-		ast_getformatname_multiple(nf, sizeof(nf), ast_channel_nativeformats(c)),
+		ast_format_cap_get_names(ast_channel_nativeformats(c), &format_buf),
 		ast_format_get_name(ast_channel_writeformat(c)),
 		ast_format_get_name(ast_channel_readformat(c)),
 		ast_format_get_name(ast_channel_rawwriteformat(c)),

Modified: team/file/mf-attributes/apps/app_jack.c
URL: http://svnview.digium.com/svn/asterisk/team/file/mf-attributes/apps/app_jack.c?view=diff&rev=417804&r1=417803&r2=417804
==============================================================================
--- team/file/mf-attributes/apps/app_jack.c (original)
+++ team/file/mf-attributes/apps/app_jack.c Thu Jul  3 07:12:46 2014
@@ -62,7 +62,8 @@
 
 #define RESAMPLE_QUALITY 1
 
-#define RINGBUFFER_SIZE 16384
+/* The number of frames the ringbuffers can store. The actual size is RINGBUFFER_FRAME_CAPACITY * jack_data->frame_datalen */
+#define RINGBUFFER_FRAME_CAPACITY 100
 
 /*! \brief Common options between the Jack() app and JACK_HOOK() function */
 #define COMMON_OPTIONS \
@@ -129,6 +130,9 @@
 	jack_port_t *output_port;
 	jack_ringbuffer_t *input_rb;
 	jack_ringbuffer_t *output_rb;
+	struct ast_format *audiohook_format;
+	unsigned int audiohook_rate;
+	unsigned int frame_datalen;
 	void *output_resampler;
 	double output_resample_factor;
 	void *input_resampler;
@@ -202,10 +206,8 @@
 
 	jack_srate = jack_get_sample_rate(jack_data->client);
 
-	/* XXX Hard coded 8 kHz */
-
-	to_srate = input ? 8000.0 : jack_srate;
-	from_srate = input ? jack_srate : 8000.0;
+	to_srate = input ? jack_data->audiohook_rate : jack_srate;
+	from_srate = input ? jack_srate : jack_data->audiohook_rate;
 
 	resample_factor = input ? &jack_data->input_resample_factor :
 		&jack_data->output_resample_factor;
@@ -290,7 +292,7 @@
 
 	res = jack_ringbuffer_write(jack_data->input_rb, (const char *) s_buf, write_len);
 	if (res != write_len) {
-		ast_debug(2, "Tried to write %d bytes to the ringbuffer, but only wrote %d\n",
+		ast_log(LOG_WARNING, "Tried to write %d bytes to the ringbuffer, but only wrote %d\n",
 			(int) sizeof(s_buf), (int) res);
 	}
 }
@@ -392,6 +394,28 @@
 	const char *client_name;
 	jack_status_t status = 0;
 	jack_options_t jack_options = JackNullOption;
+
+	struct ast_format *format_slin;
+	unsigned int channel_rate;
+
+	unsigned int ringbuffer_size;
+
+	/* Deducing audiohook sample rate from channel format
+	   ATTENTION: Might be problematic, if channel has different sampling than used by audiohook!
+	*/
+	channel_rate = ast_format_get_sample_rate(ast_channel_readformat(chan));
+	jack_data->audiohook_format = ast_format_cache_get_slin_by_rate(channel_rate);
+
+	format_slin = ao2_bump(jack_data->audiohook_format_id);
+	jack_data->audiohook_rate = ast_format_get_sample_rate(&format_slin);
+
+	/* Guessing frame->datalen assuming a ptime of 20ms */
+	jack_data->frame_datalen = jack_data->audiohook_rate / 50;
+
+	ringbuffer_size = jack_data->frame_datalen * RINGBUFFER_FRAME_CAPACITY;
+
+	ast_debug(1, "Audiohook parameters: slin-format:%s, rate:%d, frame-len:%d, ringbuffer_size: %d\n",
+	    ast_format_get_name(format_slin), jack_data->audiohook_rate, jack_data->frame_datalen, ringbuffer_size);
 
 	if (!ast_strlen_zero(jack_data->client_name)) {
 		client_name = jack_data->client_name;
@@ -401,10 +425,10 @@
 		ast_channel_unlock(chan);
 	}
 
-	if (!(jack_data->output_rb = jack_ringbuffer_create(RINGBUFFER_SIZE)))
-		return -1;
-
-	if (!(jack_data->input_rb = jack_ringbuffer_create(RINGBUFFER_SIZE)))
+	if (!(jack_data->output_rb = jack_ringbuffer_create(ringbuffer_size)))
+		return -1;
+
+	if (!(jack_data->input_rb = jack_ringbuffer_create(ringbuffer_size)))
 		return -1;
 
 	if (jack_data->no_start_server)
@@ -574,10 +598,9 @@
 
 	res = jack_ringbuffer_write(jack_data->output_rb, (const char *) f_buf, f_buf_used * sizeof(float));
 	if (res != (f_buf_used * sizeof(float))) {
-		ast_debug(2, "Tried to write %d bytes to the ringbuffer, but only wrote %d\n",
+		ast_log(LOG_WARNING, "Tried to write %d bytes to the ringbuffer, but only wrote %d\n",
 			(int) (f_buf_used * sizeof(float)), (int) res);
 	}
-
 	return 0;
 }
 
@@ -603,10 +626,10 @@
 static void handle_jack_audio(struct ast_channel *chan, struct jack_data *jack_data,
 	struct ast_frame *out_frame)
 {
-	short buf[160];
+	short buf[jack_data->frame_datalen];
 	struct ast_frame f = {
 		.frametype = AST_FRAME_VOICE,
-		.subclass.format = ast_format_slin,
+		.subclass.format = jack_data->audiohook_format,
 		.src = "JACK",
 		.data.ptr = buf,
 		.datalen = sizeof(buf),
@@ -756,12 +779,12 @@
 		return -1;
 	}
 
-	if (ast_set_read_format(chan, ast_format_slin)) {
+	if (ast_set_read_format(chan, jack_data->audiohook_format)) {
 		destroy_jack_data(jack_data);
 		return -1;
 	}
 
-	if (ast_set_write_format(chan, ast_format_slin)) {
+	if (ast_set_write_format(chan, jack_data->audiohook_format)) {
 		destroy_jack_data(jack_data);
 		return -1;
 	}
@@ -827,12 +850,6 @@
 	if (frame->frametype != AST_FRAME_VOICE)
 		return 0;
 
-	if (ast_format_cmp(frame->subclass.format, ast_format_slin) != AST_FORMAT_CMP_EQUAL) {
-		ast_log(LOG_WARNING, "Expected frame in SLINEAR for the audiohook, but got format %s\n",
-			ast_format_get_name(frame->subclass.format));
-		return 0;
-	}
-
 	ast_channel_lock(chan);
 
 	if (!(datastore = ast_channel_datastore_find(chan, &jack_hook_ds_info, NULL))) {
@@ -842,6 +859,13 @@
 	}
 
 	jack_data = datastore->data;
+
+	if (ast_format_cmp(frame->subclass.format, jack_data->audiohook_format) == AST_FORMAT_CMP_NOT_EQUAL) {
+		ast_log(LOG_WARNING, "Expected frame in %s for the audiohook, but got format %s\n",
+		    ast_format_get_name(jack_data->audiohook_format), ast_format_get_name(&frame->subclass.format));
+		ast_channel_unlock(chan);
+		return 0;
+	}
 
 	queue_voice_frame(jack_data, frame);
 
@@ -889,7 +913,7 @@
 		goto return_error;
 
 	jack_data->has_audiohook = 1;
-	ast_audiohook_init(&jack_data->audiohook, AST_AUDIOHOOK_TYPE_MANIPULATE, "JACK_HOOK", 0);
+	ast_audiohook_init(&jack_data->audiohook, AST_AUDIOHOOK_TYPE_MANIPULATE, "JACK_HOOK", AST_AUDIOHOOK_MANIPULATE_ALL_RATES);
 	jack_data->audiohook.manipulate_callback = jack_hook_callback;
 
 	datastore->data = jack_data;

Modified: team/file/mf-attributes/apps/app_meetme.c
URL: http://svnview.digium.com/svn/asterisk/team/file/mf-attributes/apps/app_meetme.c?view=diff&rev=417804&r1=417803&r2=417804
==============================================================================
--- team/file/mf-attributes/apps/app_meetme.c (original)
+++ team/file/mf-attributes/apps/app_meetme.c Thu Jul  3 07:12:46 2014
@@ -1619,7 +1619,7 @@
 	if (cnf || (!make && !dynamic) || !cap_slin)
 		goto cnfout;
 
-	ast_format_cap_add(cap_slin, ast_format_slin, 0);
+	ast_format_cap_append(cap_slin, ast_format_slin, 0);
 	/* Make a new one */
 	if (!(cnf = ast_calloc(1, sizeof(*cnf))) ||
 		!(cnf->usercontainer = ao2_container_alloc(1, NULL, user_no_cmp))) {
@@ -3222,7 +3222,7 @@
 	if (!cap_slin) {
 		goto conf_run_cleanup;
 	}
-	ast_format_cap_add(cap_slin, ast_format_slin, 0);
+	ast_format_cap_append(cap_slin, ast_format_slin, 0);
 
 	if (!(user = ao2_alloc(sizeof(*user), NULL))) {
 		goto conf_run_cleanup;

Modified: team/file/mf-attributes/apps/app_originate.c
URL: http://svnview.digium.com/svn/asterisk/team/file/mf-attributes/apps/app_originate.c?view=diff&rev=417804&r1=417803&r2=417804
==============================================================================
--- team/file/mf-attributes/apps/app_originate.c (original)
+++ team/file/mf-attributes/apps/app_originate.c Thu Jul  3 07:12:46 2014
@@ -120,15 +120,15 @@
 		goto return_cleanup;
 	}
 
-	ast_format_cap_add(cap_slin, ast_format_slin, 0);
-	ast_format_cap_add(cap_slin, ast_format_slin12, 0);
-	ast_format_cap_add(cap_slin, ast_format_slin16, 0);
-	ast_format_cap_add(cap_slin, ast_format_slin24, 0);
-	ast_format_cap_add(cap_slin, ast_format_slin32, 0);
-	ast_format_cap_add(cap_slin, ast_format_slin44, 0);
-	ast_format_cap_add(cap_slin, ast_format_slin48, 0);
-	ast_format_cap_add(cap_slin, ast_format_slin96, 0);
-	ast_format_cap_add(cap_slin, ast_format_slin192, 0);
+	ast_format_cap_append(cap_slin, ast_format_slin, 0);

[... 12953 lines stripped ...]



More information about the asterisk-commits mailing list