[asterisk-commits] kmoore: branch kmoore/stasis-bridging-channel_events r386620 - in /team/kmoor...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Apr 26 13:26:01 CDT 2013


Author: kmoore
Date: Fri Apr 26 13:25:56 2013
New Revision: 386620

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=386620
Log:
Multiple revisions 386464,386482,386489,386544,386561,386589,386591

........
  r386464 | root | 2013-04-24 17:17:20 -0500 (Wed, 24 Apr 2013) | 14 lines
  
  Multiple revisions 386461-386462
  
  ........
    r386461 | dlee | 2013-04-24 16:43:16 -0500 (Wed, 24 Apr 2013) | 1 line
    
    Oops. Mustache doesn't like dictionaries
  ........
    r386462 | dlee | 2013-04-24 16:47:03 -0500 (Wed, 24 Apr 2013) | 1 line
    
    Document JSON models in resource_*.h
  ........
  
  Merged revisions 386461-386462 from file:///srv/subversion/repos/asterisk/trunk
........
  r386482 | rmudgett | 2013-04-24 21:30:27 -0500 (Wed, 24 Apr 2013) | 4 lines
  
  * Add ast_bridge_lock_both() macro.
  
  * Remove some unnecessary bridge->merge_inhibit changes.
........
  r386489 | root | 2013-04-24 22:17:38 -0500 (Wed, 24 Apr 2013) | 28 lines
  
  Multiple revisions 386485,386487
  
  ........
    r386485 | elguero | 2013-04-24 21:48:44 -0500 (Wed, 24 Apr 2013) | 10 lines
    
    Change Case On Forcerport For Consistency
    
    * Change "ForcerPort" to "Forcerport" to match everywhere else it is displayed
    ........
    
    Merged revisions 386483 from http://svn.asterisk.org/svn/asterisk/branches/1.8
    ........
    
    Merged revisions 386484 from http://svn.asterisk.org/svn/asterisk/branches/11
  ........
    r386487 | elguero | 2013-04-24 22:04:21 -0500 (Wed, 24 Apr 2013) | 8 lines
    
    Fix Displaying Symmetric RTP Global Setting
    
    * Use comedia_string() to display correctly the symmetric rtp setting when
      running "sip show settings"
    ........
    
    Merged revisions 386486 from http://svn.asterisk.org/svn/asterisk/branches/11
  ........
  
  Merged revisions 386485,386487 from file:///srv/subversion/repos/asterisk/trunk
........
  r386544 | root | 2013-04-25 14:17:24 -0500 (Thu, 25 Apr 2013) | 26 lines
  
  Multiple revisions 386540-386541
  
  ........
    r386540 | mmichelson | 2013-04-25 13:25:31 -0500 (Thu, 25 Apr 2013) | 15 lines
    
    Merge the pimp_my_sip branch into trunk.
    
    The pimp_my_sip branch is being merged at this point because
    it offers basic functionality, and from an API standpoint, things
    are complete.
    
    SIP work is *not* feature-complete; however, with the completion
    of the SUBSCRIBE/NOTIFY API, all APIs (except a PUBLISH API) have
    been created, and thus it is possible for developers to attempt
    to create new SIP work.
    
    API documentation can be found in the doxygen in the code, but
    usability documentation is still lacking.
  ........
    r386541 | mmichelson | 2013-04-25 13:28:37 -0500 (Thu, 25 Apr 2013) | 3 lines
    
    REmove automerge properties.
  ........
  
  Merged revisions 386540-386541 from file:///srv/subversion/repos/asterisk/trunk
........
  r386561 | jrose | 2013-04-25 14:29:16 -0500 (Thu, 25 Apr 2013) | 12 lines
  
  bridging/func_jitterbuffer: apply channel set jitterbuffers on bridge
  
  Channel-driver set jitterbuffers are now applied using functionality
  that was formerly provided exclusively through func_jitterbuffer.
  In order to accomodate this, func_jitterbuffer was stripped down to
  just parse the arguments and call new jitterbuffer application API
  which was pulled into abstract_jb core from func_jitterbuffer.
  
  (closes issue ASTERISK-21333)
  Review: https://reviewboard.asterisk.org/r/2459/
........
  r386589 | rmudgett | 2013-04-25 17:03:36 -0500 (Thu, 25 Apr 2013) | 23 lines
  
  Make local channel optimization also use the swap method.
  
  Added the additional way to optimize out local channels in more
  circumstances.  Swap the Local;2 channel in BridgeB with the only peer
  channel (A) in BridgeA.  This optimization strategy is needed for the
  parking and conference bridges to keep bridge channel information
  associated with the same call.
  
  A -- BridgeA -- Local;1-Local;2 -- BridgeB -- B
  
  * Extracted the ast_bridge_channel_peer() routine from the simple_bridge
  so local channel swap optimization can utilize it as well.
  
  * Implemented ast_bridge_move() as a side benefit to the swap
  optimization.
  
  * Refactored ast_bridge_local_optimized_out() to simplify its structure
  because the swap optimization needs to be checked before the merge
  optimization.
  
  (issue ASTERISK-21058)
  Review: https://reviewboard.asterisk.org/r/2474/
........
  r386591 | root | 2013-04-25 17:17:40 -0500 (Thu, 25 Apr 2013) | 5 lines
  
  Don't bind to anything in the sample configuration so we don't clash with chan_sip on a "make samples" right now.
  ........
  
  Merged revisions 386577 from file:///srv/subversion/repos/asterisk/trunk
........

Merged revisions 386464,386482,386489,386544,386561,386589,386591 from http://svn.asterisk.org/svn/asterisk/team/group/bridge_construction

Added:
    team/kmoore/stasis-bridging-channel_events/channels/chan_gulp.c
      - copied unchanged from r386591, team/group/bridge_construction/channels/chan_gulp.c
    team/kmoore/stasis-bridging-channel_events/configs/res_sip.conf.sample
      - copied unchanged from r386591, team/group/bridge_construction/configs/res_sip.conf.sample
    team/kmoore/stasis-bridging-channel_events/include/asterisk/res_sip.h
      - copied unchanged from r386591, team/group/bridge_construction/include/asterisk/res_sip.h
    team/kmoore/stasis-bridging-channel_events/include/asterisk/res_sip_pubsub.h
      - copied unchanged from r386591, team/group/bridge_construction/include/asterisk/res_sip_pubsub.h
    team/kmoore/stasis-bridging-channel_events/include/asterisk/res_sip_session.h
      - copied unchanged from r386591, team/group/bridge_construction/include/asterisk/res_sip_session.h
    team/kmoore/stasis-bridging-channel_events/res/res_sip/
      - copied from r386591, team/group/bridge_construction/res/res_sip/
    team/kmoore/stasis-bridging-channel_events/res/res_sip.c
      - copied unchanged from r386591, team/group/bridge_construction/res/res_sip.c
    team/kmoore/stasis-bridging-channel_events/res/res_sip.exports.in
      - copied unchanged from r386591, team/group/bridge_construction/res/res_sip.exports.in
    team/kmoore/stasis-bridging-channel_events/res/res_sip_acl.c
      - copied unchanged from r386591, team/group/bridge_construction/res/res_sip_acl.c
    team/kmoore/stasis-bridging-channel_events/res/res_sip_authenticator_digest.c
      - copied unchanged from r386591, team/group/bridge_construction/res/res_sip_authenticator_digest.c
    team/kmoore/stasis-bridging-channel_events/res/res_sip_caller_id.c
      - copied unchanged from r386591, team/group/bridge_construction/res/res_sip_caller_id.c
    team/kmoore/stasis-bridging-channel_events/res/res_sip_dtmf_info.c
      - copied unchanged from r386591, team/group/bridge_construction/res/res_sip_dtmf_info.c
    team/kmoore/stasis-bridging-channel_events/res/res_sip_endpoint_identifier_constant.c
      - copied unchanged from r386591, team/group/bridge_construction/res/res_sip_endpoint_identifier_constant.c
    team/kmoore/stasis-bridging-channel_events/res/res_sip_endpoint_identifier_ip.c
      - copied unchanged from r386591, team/group/bridge_construction/res/res_sip_endpoint_identifier_ip.c
    team/kmoore/stasis-bridging-channel_events/res/res_sip_endpoint_identifier_user.c
      - copied unchanged from r386591, team/group/bridge_construction/res/res_sip_endpoint_identifier_user.c
    team/kmoore/stasis-bridging-channel_events/res/res_sip_logger.c
      - copied unchanged from r386591, team/group/bridge_construction/res/res_sip_logger.c
    team/kmoore/stasis-bridging-channel_events/res/res_sip_mwi.c
      - copied unchanged from r386591, team/group/bridge_construction/res/res_sip_mwi.c
    team/kmoore/stasis-bridging-channel_events/res/res_sip_nat.c
      - copied unchanged from r386591, team/group/bridge_construction/res/res_sip_nat.c
    team/kmoore/stasis-bridging-channel_events/res/res_sip_outbound_authenticator_digest.c
      - copied unchanged from r386591, team/group/bridge_construction/res/res_sip_outbound_authenticator_digest.c
    team/kmoore/stasis-bridging-channel_events/res/res_sip_outbound_registration.c
      - copied unchanged from r386591, team/group/bridge_construction/res/res_sip_outbound_registration.c
    team/kmoore/stasis-bridging-channel_events/res/res_sip_pubsub.c
      - copied unchanged from r386591, team/group/bridge_construction/res/res_sip_pubsub.c
    team/kmoore/stasis-bridging-channel_events/res/res_sip_pubsub.exports.in
      - copied unchanged from r386591, team/group/bridge_construction/res/res_sip_pubsub.exports.in
    team/kmoore/stasis-bridging-channel_events/res/res_sip_registrar.c
      - copied unchanged from r386591, team/group/bridge_construction/res/res_sip_registrar.c
    team/kmoore/stasis-bridging-channel_events/res/res_sip_rfc3326.c
      - copied unchanged from r386591, team/group/bridge_construction/res/res_sip_rfc3326.c
    team/kmoore/stasis-bridging-channel_events/res/res_sip_sdp_rtp.c
      - copied unchanged from r386591, team/group/bridge_construction/res/res_sip_sdp_rtp.c
    team/kmoore/stasis-bridging-channel_events/res/res_sip_session.c
      - copied unchanged from r386591, team/group/bridge_construction/res/res_sip_session.c
    team/kmoore/stasis-bridging-channel_events/res/res_sip_session.exports.in
      - copied unchanged from r386591, team/group/bridge_construction/res/res_sip_session.exports.in
Modified:
    team/kmoore/stasis-bridging-channel_events/   (props changed)
    team/kmoore/stasis-bridging-channel_events/CHANGES
    team/kmoore/stasis-bridging-channel_events/apps/app_bridgewait.c
    team/kmoore/stasis-bridging-channel_events/apps/confbridge/conf_config_parser.c
    team/kmoore/stasis-bridging-channel_events/bridges/bridge_simple.c
    team/kmoore/stasis-bridging-channel_events/channels/Makefile
    team/kmoore/stasis-bridging-channel_events/channels/chan_sip.c
    team/kmoore/stasis-bridging-channel_events/configure
    team/kmoore/stasis-bridging-channel_events/funcs/func_jitterbuffer.c
    team/kmoore/stasis-bridging-channel_events/include/asterisk/abstract_jb.h
    team/kmoore/stasis-bridging-channel_events/include/asterisk/autoconfig.h.in
    team/kmoore/stasis-bridging-channel_events/include/asterisk/bridging.h
    team/kmoore/stasis-bridging-channel_events/include/asterisk/bridging_features.h
    team/kmoore/stasis-bridging-channel_events/include/asterisk/sorcery.h
    team/kmoore/stasis-bridging-channel_events/include/asterisk/threadpool.h
    team/kmoore/stasis-bridging-channel_events/main/abstract_jb.c
    team/kmoore/stasis-bridging-channel_events/main/astobj2.c
    team/kmoore/stasis-bridging-channel_events/main/bridging.c
    team/kmoore/stasis-bridging-channel_events/main/loader.c
    team/kmoore/stasis-bridging-channel_events/main/sorcery.c
    team/kmoore/stasis-bridging-channel_events/main/taskprocessor.c
    team/kmoore/stasis-bridging-channel_events/main/threadpool.c
    team/kmoore/stasis-bridging-channel_events/res/Makefile
    team/kmoore/stasis-bridging-channel_events/res/res_sorcery_config.c
    team/kmoore/stasis-bridging-channel_events/res/stasis_http/resource_asterisk.h
    team/kmoore/stasis-bridging-channel_events/res/stasis_http/resource_bridges.h
    team/kmoore/stasis-bridging-channel_events/res/stasis_http/resource_channels.h
    team/kmoore/stasis-bridging-channel_events/res/stasis_http/resource_endpoints.h
    team/kmoore/stasis-bridging-channel_events/res/stasis_http/resource_events.h
    team/kmoore/stasis-bridging-channel_events/res/stasis_http/resource_playback.h
    team/kmoore/stasis-bridging-channel_events/res/stasis_http/resource_recordings.h
    team/kmoore/stasis-bridging-channel_events/res/stasis_http/resource_sounds.h
    team/kmoore/stasis-bridging-channel_events/rest-api-templates/stasis_http_resource.h.mustache
    team/kmoore/stasis-bridging-channel_events/rest-api-templates/swagger_model.py
    team/kmoore/stasis-bridging-channel_events/tests/test_sorcery.c

Propchange: team/kmoore/stasis-bridging-channel_events/
------------------------------------------------------------------------------
Binary property 'branch-11-merged' - no diff available.

Propchange: team/kmoore/stasis-bridging-channel_events/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Fri Apr 26 13:25:56 2013
@@ -1,1 +1,1 @@
-/team/group/bridge_construction:1-386451
+/team/group/bridge_construction:1-386618

Modified: team/kmoore/stasis-bridging-channel_events/CHANGES
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-bridging-channel_events/CHANGES?view=diff&rev=386620&r1=386619&r2=386620
==============================================================================
--- team/kmoore/stasis-bridging-channel_events/CHANGES (original)
+++ team/kmoore/stasis-bridging-channel_events/CHANGES Fri Apr 26 13:25:56 2013
@@ -61,6 +61,11 @@
 
 Channel Drivers
 ------------------
+ * When a channel driver is configured to enable jiterbuffers, they are now
+   applied unconditionally when a channel joins a bridge. If a jitterbuffer
+   is already set for that channel when it enters, such as by the JITTERBUFFER
+   function, then the existing jitterbuffer will be used and the one set by
+   the channel driver will not be applied.
 
 chan_local
 ------------------
@@ -96,6 +101,12 @@
  * You can now have the settings for a channel updated using the FEATURE()
    and FEATUREMAP() functions inherited to child channels by setting
    FEATURE(inherit)=yes.
+
+Functions
+------------------
+ * JITTERBUFFER now accepts an argument of 'disabled' which can be used
+   to remove jitterbuffers previously set on a channel with JITTERBUFFER.
+   The value of this setting is ignored when disabled is used for the argument.
 
 Logging
 -------------------

Modified: team/kmoore/stasis-bridging-channel_events/apps/app_bridgewait.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-bridging-channel_events/apps/app_bridgewait.c?view=diff&rev=386620&r1=386619&r2=386620
==============================================================================
--- team/kmoore/stasis-bridging-channel_events/apps/app_bridgewait.c (original)
+++ team/kmoore/stasis-bridging-channel_events/apps/app_bridgewait.c Fri Apr 26 13:25:56 2013
@@ -196,7 +196,8 @@
 	ast_mutex_lock(&bridgewait_lock);
 	if (!holding_bridge) {
 		holding_bridge = ast_bridge_base_new(AST_BRIDGE_CAPABILITY_HOLDING,
-			AST_BRIDGE_FLAG_MERGE_INHIBIT_TO | AST_BRIDGE_FLAG_MERGE_INHIBIT_FROM);
+			AST_BRIDGE_FLAG_MERGE_INHIBIT_TO | AST_BRIDGE_FLAG_MERGE_INHIBIT_FROM
+				| AST_BRIDGE_FLAG_SWAP_INHIBIT_FROM);
 	}
 	ast_mutex_unlock(&bridgewait_lock);
 	if (!holding_bridge) {

Modified: team/kmoore/stasis-bridging-channel_events/apps/confbridge/conf_config_parser.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-bridging-channel_events/apps/confbridge/conf_config_parser.c?view=diff&rev=386620&r1=386619&r2=386620
==============================================================================
--- team/kmoore/stasis-bridging-channel_events/apps/confbridge/conf_config_parser.c (original)
+++ team/kmoore/stasis-bridging-channel_events/apps/confbridge/conf_config_parser.c Fri Apr 26 13:25:56 2013
@@ -1915,6 +1915,7 @@
 	/* This option should only be used with the CONFBRIDGE dialplan function */
 	aco_option_register_custom(&cfg_info, "template", ACO_EXACT, user_types, NULL, user_template_handler, 0);
 
+/* BUGBUG need a user supplied bridge merge_priority to merge ConfBridges (default = 1, range 1-INT_MAX) */
 	/* Bridge options */
 	aco_option_register(&cfg_info, "type", ACO_EXACT, bridge_types, NULL, OPT_NOOP_T, 0, 0);
 	aco_option_register(&cfg_info, "jitterbuffer", ACO_EXACT, bridge_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct bridge_profile, flags), USER_OPT_JITTERBUFFER);

Modified: team/kmoore/stasis-bridging-channel_events/bridges/bridge_simple.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-bridging-channel_events/bridges/bridge_simple.c?view=diff&rev=386620&r1=386619&r2=386620
==============================================================================
--- team/kmoore/stasis-bridging-channel_events/bridges/bridge_simple.c (original)
+++ team/kmoore/stasis-bridging-channel_events/bridges/bridge_simple.c Fri Apr 26 13:25:56 2013
@@ -70,15 +70,10 @@
 {
 	struct ast_bridge_channel *other;
 
-	/* If this is the only channel in this bridge then immediately exit */
-	if (AST_LIST_FIRST(&bridge->channels) == AST_LIST_LAST(&bridge->channels)) {
+	/* Find the channel we actually want to write to */
+	other = ast_bridge_channel_peer(bridge_channel);
+	if (!other) {
 		return -1;
-	}
-
-	/* Find the channel we actually want to write to */
-	other = AST_LIST_FIRST(&bridge->channels);
-	if (other == bridge_channel) {
-		other = AST_LIST_LAST(&bridge->channels);
 	}
 
 	/* The bridging core takes care of freeing the passed in frame. */

Modified: team/kmoore/stasis-bridging-channel_events/channels/Makefile
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-bridging-channel_events/channels/Makefile?view=diff&rev=386620&r1=386619&r2=386620
==============================================================================
--- team/kmoore/stasis-bridging-channel_events/channels/Makefile (original)
+++ team/kmoore/stasis-bridging-channel_events/channels/Makefile Fri Apr 26 13:25:56 2013
@@ -113,3 +113,4 @@
 
 h323/libchanh323.a: h323/Makefile.ast
 	$(CMD_PREFIX) $(MAKE) -C h323 libchanh323.a
+

Modified: team/kmoore/stasis-bridging-channel_events/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-bridging-channel_events/channels/chan_sip.c?view=diff&rev=386620&r1=386619&r2=386620
==============================================================================
--- team/kmoore/stasis-bridging-channel_events/channels/chan_sip.c (original)
+++ team/kmoore/stasis-bridging-channel_events/channels/chan_sip.c Fri Apr 26 13:25:56 2013
@@ -19078,7 +19078,7 @@
 		return CLI_SHOWUSAGE;
 	}
 
-	ast_cli(a->fd, FORMAT, "Username", "Secret", "Accountcode", "Def.Context", "ACL", "ForcerPort");
+	ast_cli(a->fd, FORMAT, "Username", "Secret", "Accountcode", "Def.Context", "ACL", "Forcerport");
 
 	user_iter = ao2_iterator_init(peers, 0);
 	while ((user = ao2_t_iterator_next(&user_iter, "iterate thru peers table"))) {
@@ -20927,7 +20927,7 @@
 	ast_cli(a->fd, "\n");
 	ast_cli(a->fd, "  Relax DTMF:             %s\n", AST_CLI_YESNO(global_relaxdtmf));
 	ast_cli(a->fd, "  RFC2833 Compensation:   %s\n", AST_CLI_YESNO(ast_test_flag(&global_flags[1], SIP_PAGE2_RFC2833_COMPENSATE)));
-	ast_cli(a->fd, "  Symmetric RTP:          %s\n", AST_CLI_YESNO(ast_test_flag(&global_flags[1], SIP_PAGE2_SYMMETRICRTP)));
+	ast_cli(a->fd, "  Symmetric RTP:          %s\n", comedia_string(global_flags));
 	ast_cli(a->fd, "  Compact SIP headers:    %s\n", AST_CLI_YESNO(sip_cfg.compactheaders));
 	ast_cli(a->fd, "  RTP Keepalive:          %d %s\n", global_rtpkeepalive, global_rtpkeepalive ? "" : "(Disabled)" );
 	ast_cli(a->fd, "  RTP Timeout:            %d %s\n", global_rtptimeout, global_rtptimeout ? "" : "(Disabled)" );

Modified: team/kmoore/stasis-bridging-channel_events/funcs/func_jitterbuffer.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-bridging-channel_events/funcs/func_jitterbuffer.c?view=diff&rev=386620&r1=386619&r2=386620
==============================================================================
--- team/kmoore/stasis-bridging-channel_events/funcs/func_jitterbuffer.c (original)
+++ team/kmoore/stasis-bridging-channel_events/funcs/func_jitterbuffer.c Fri Apr 26 13:25:56 2013
@@ -36,6 +36,7 @@
 #include "asterisk/module.h"
 #include "asterisk/channel.h"
 #include "asterisk/framehook.h"
+#include "asterisk/frame.h"
 #include "asterisk/pbx.h"
 #include "asterisk/abstract_jb.h"
 #include "asterisk/timing.h"
@@ -48,7 +49,8 @@
 		</synopsis>
 		<syntax>
 			<parameter name="jitterbuffer type" required="true">
-				<para>Jitterbuffer type can be either <literal>fixed</literal> or <literal>adaptive</literal>.</para>
+				<para>Jitterbuffer type can be <literal>fixed</literal>, <literal>adaptive</literal>, or
+					<literal>disabled</literal>.</para>
 				<para>Used as follows. </para>
 				<para>Set(JITTERBUFFER(type)=max_size[,resync_threshold[,target_extra]])</para>
 				<para>Set(JITTERBUFFER(type)=default) </para>
@@ -70,85 +72,31 @@
 			<para>exten => 1,1,Set(JITTERBUFFER(fixed)=200,1500);Fixed with max size 200ms resync threshold 1500. </para>
 			<para>exten => 1,1,Set(JITTERBUFFER(adaptive)=default);Adaptive with defaults. </para>
 			<para>exten => 1,1,Set(JITTERBUFFER(adaptive)=200,,60);Adaptive with max size 200ms, default resync threshold and 40ms target extra. </para>
+			<para>exten => 1,n,Set(JITTERBUFFER(disabled)=);Remove previously applied jitterbuffer </para>
+			<note><para>If a channel specifies a jitterbuffer due to channel driver configuration and
+			the JITTERBUFFER function has set a jitterbuffer for that channel, the jitterbuffer set by
+			the JITTERBUFFER function will take priority and the jitterbuffer set by the channel
+			configuration will not be applied.</para></note>
 		</description>
 	</function>
  ***/
 
-#define DEFAULT_TIMER_INTERVAL 20
-#define DEFAULT_SIZE  200
-#define DEFAULT_TARGET_EXTRA  40
-#define DEFAULT_RESYNC  1000
-#define DEFAULT_TYPE AST_JB_FIXED
+static int jb_helper(struct ast_channel *chan, const char *cmd, char *data, const char *value)
+{
+	struct ast_jb_conf jb_conf;
 
-struct jb_framedata {
-	const struct ast_jb_impl *jb_impl;
-	struct ast_jb_conf jb_conf;
-	struct timeval start_tv;
-	struct ast_format last_format;
-	struct ast_timer *timer;
-	int timer_interval; /* ms between deliveries */
-	int timer_fd;
-	int first;
-	void *jb_obj;
-};
-
-static void jb_framedata_destroy(struct jb_framedata *framedata)
-{
-	if (framedata->timer) {
-		ast_timer_close(framedata->timer);
-		framedata->timer = NULL;
-	}
-	if (framedata->jb_impl && framedata->jb_obj) {
-		struct ast_frame *f;
-		while (framedata->jb_impl->remove(framedata->jb_obj, &f) == AST_JB_IMPL_OK) {
-			ast_frfree(f);
-		}
-		framedata->jb_impl->destroy(framedata->jb_obj);
-		framedata->jb_obj = NULL;
-	}
-	ast_free(framedata);
-}
-
-static void jb_conf_default(struct ast_jb_conf *conf)
-{
-	conf->max_size = DEFAULT_SIZE;
-	conf->resync_threshold = DEFAULT_RESYNC;
-	ast_copy_string(conf->impl, "fixed", sizeof(conf->impl));
-	conf->target_extra = DEFAULT_TARGET_EXTRA;
-}
-
-/* set defaults */
-static int jb_framedata_init(struct jb_framedata *framedata, const char *data, const char *value)
-{
-	int jb_impl_type = DEFAULT_TYPE;
-
-	/* Initialize defaults */
-	framedata->timer_fd = -1;
-	jb_conf_default(&framedata->jb_conf);
-	if (!(framedata->jb_impl = ast_jb_get_impl(jb_impl_type))) {
-		return -1;
-	}
-	if (!(framedata->timer = ast_timer_open())) {
-		return -1;
-	}
-	framedata->timer_fd = ast_timer_fd(framedata->timer);
-	framedata->timer_interval = DEFAULT_TIMER_INTERVAL;
-	ast_timer_set_rate(framedata->timer, 1000 / framedata->timer_interval);
-	framedata->start_tv = ast_tvnow();
-
-
+	/* Initialize and set jb_conf */
+	ast_jb_conf_default(&jb_conf);
 
 	/* Now check user options to see if any of the defaults need to change. */
 	if (!ast_strlen_zero(data)) {
-		if (!strcasecmp(data, "fixed")) {
-			jb_impl_type = AST_JB_FIXED;
-		} else if (!strcasecmp(data, "adaptive")) {
-			jb_impl_type = AST_JB_ADAPTIVE;
-		} else {
+		if (strcasecmp(data, "fixed") &&
+				strcasecmp(data, "adaptive") &&
+				strcasecmp(data, "disabled")) {
 			ast_log(LOG_WARNING, "Unknown Jitterbuffer type %s. Failed to create jitterbuffer.\n", data);
 			return -1;
 		}
-		ast_copy_string(framedata->jb_conf.impl, data, sizeof(framedata->jb_conf.impl));
+		ast_copy_string(jb_conf.impl, data, sizeof(jb_conf.impl));
 	}
 
 	if (!ast_strlen_zero(value) && strcasecmp(value, "default")) {
@@ -162,17 +110,17 @@
 
 		AST_STANDARD_APP_ARGS(args, parse);
 		if (!ast_strlen_zero(args.max_size)) {
-			res |= ast_jb_read_conf(&framedata->jb_conf,
+			res |= ast_jb_read_conf(&jb_conf,
 				"jbmaxsize",
 				args.max_size);
 		}
 		if (!ast_strlen_zero(args.resync_threshold)) {
-			res |= ast_jb_read_conf(&framedata->jb_conf,
+			res |= ast_jb_read_conf(&jb_conf,
 				"jbresyncthreshold",
 				args.resync_threshold);
 		}
 		if (!ast_strlen_zero(args.target_extra)) {
-			res |= ast_jb_read_conf(&framedata->jb_conf,
+			res |= ast_jb_read_conf(&jb_conf,
 				"jbtargetextra",
 				args.target_extra);
 		}
@@ -181,197 +129,11 @@
 		}
 	}
 
-	/* now that all the user parsing is done and nothing will change, create the jb obj */
-	framedata->jb_obj = framedata->jb_impl->create(&framedata->jb_conf);
+	ast_jb_create_framehook(chan, &jb_conf, 0);
+
 	return 0;
 }
 
-static void datastore_destroy_cb(void *data) {
-	ast_free(data);
-	ast_debug(1, "JITTERBUFFER datastore destroyed\n");
-}
-
-static const struct ast_datastore_info jb_datastore = {
-	.type = "jitterbuffer",
-	.destroy = datastore_destroy_cb
-};
-
-static void hook_destroy_cb(void *framedata)
-{
-	ast_debug(1, "JITTERBUFFER hook destroyed\n");
-	jb_framedata_destroy((struct jb_framedata *) framedata);
-}
-
-static struct ast_frame *hook_event_cb(struct ast_channel *chan, struct ast_frame *frame, enum ast_framehook_event event, void *data)
-{
-	struct jb_framedata *framedata = data;
-	struct timeval now_tv;
-	unsigned long now;
-	int putframe = 0; /* signifies if audio frame was placed into the buffer or not */
-
-	switch (event) {
-	case AST_FRAMEHOOK_EVENT_READ:
-		break;
-	case AST_FRAMEHOOK_EVENT_ATTACHED:
-	case AST_FRAMEHOOK_EVENT_DETACHED:
-	case AST_FRAMEHOOK_EVENT_WRITE:
-		return frame;
-	}
-
-	if (ast_channel_fdno(chan) == AST_JITTERBUFFER_FD && framedata->timer) {
-		if (ast_timer_ack(framedata->timer, 1) < 0) {
-			ast_log(LOG_ERROR, "Failed to acknowledge timer in jitter buffer\n");
-			return frame;
-		}
-	}
-
-	if (!frame) {
-		return frame;
-	}
-
-	now_tv = ast_tvnow();
-	now = ast_tvdiff_ms(now_tv, framedata->start_tv);
-
-	if (frame->frametype == AST_FRAME_VOICE) {
-		int res;
-		struct ast_frame *jbframe;
-
-		if (!ast_test_flag(frame, AST_FRFLAG_HAS_TIMING_INFO) || frame->len < 2 || frame->ts < 0) {
-			/* only frames with timing info can enter the jitterbuffer */
-			return frame;
-		}
-
-		jbframe = ast_frisolate(frame);
-		ast_format_copy(&framedata->last_format, &frame->subclass.format);
-
-		if (frame->len && (frame->len != framedata->timer_interval)) {
-			framedata->timer_interval = frame->len;
-			ast_timer_set_rate(framedata->timer, 1000 / framedata->timer_interval);
-		}
-		if (!framedata->first) {
-			framedata->first = 1;
-			res = framedata->jb_impl->put_first(framedata->jb_obj, jbframe, now);
-		} else {
-			res = framedata->jb_impl->put(framedata->jb_obj, jbframe, now);
-		}
-		if (res == AST_JB_IMPL_OK) {
-			frame = &ast_null_frame;
-		}
-		putframe = 1;
-	}
-
-	if (frame->frametype == AST_FRAME_NULL) {
-		int res;
-		long next = framedata->jb_impl->next(framedata->jb_obj);
-
-		/* If now is earlier than the next expected output frame
-		 * from the jitterbuffer we may choose to pass on retrieving
-		 * a frame during this read iteration.  The only exception
-		 * to this rule is when an audio frame is placed into the buffer
-		 * and the time for the next frame to come out of the buffer is
-		 * at least within the timer_interval of the next output frame. By
-		 * doing this we are able to feed off the timing of the input frames
-		 * and only rely on our jitterbuffer timer when frames are dropped.
-		 * During testing, this hybrid form of timing gave more reliable results. */
-		if (now < next) {
-			long int diff = next - now;
-			if (!putframe) {
-				return frame;
-			} else if (diff >= framedata->timer_interval) {
-				return frame;
-			}
-		}
-
-		res = framedata->jb_impl->get(framedata->jb_obj, &frame, now, framedata->timer_interval);
-		switch (res) {
-		case AST_JB_IMPL_OK:
-			/* got it, and pass it through */
-			break;
-		case AST_JB_IMPL_DROP:
-			ast_frfree(frame);
-			frame = &ast_null_frame;
-			break;
-		case AST_JB_IMPL_INTERP:
-			if (framedata->last_format.id) {
-				struct ast_frame tmp = { 0, };
-				tmp.frametype = AST_FRAME_VOICE;
-				ast_format_copy(&tmp.subclass.format, &framedata->last_format);
-				/* example: 8000hz / (1000 / 20ms) = 160 samples */
-				tmp.samples = ast_format_rate(&framedata->last_format) / (1000 / framedata->timer_interval);
-				tmp.delivery = ast_tvadd(framedata->start_tv, ast_samp2tv(next, 1000));
-				tmp.offset = AST_FRIENDLY_OFFSET;
-				tmp.src  = "func_jitterbuffer interpolation";
-				frame = ast_frdup(&tmp);
-				break;
-			}
-			/* else fall through */
-		case AST_JB_IMPL_NOFRAME:
-			frame = &ast_null_frame;
-			break;
-		}
-	}
-
-	return frame;
-}
-
-static int jb_helper(struct ast_channel *chan, const char *cmd, char *data, const char *value)
-{
-	struct jb_framedata *framedata;
-	struct ast_datastore *datastore = NULL;
-	struct ast_framehook_interface interface = {
-		.version = AST_FRAMEHOOK_INTERFACE_VERSION,
-		.event_cb = hook_event_cb,
-		.destroy_cb = hook_destroy_cb,
-	};
-	int i = 0;
-
-	if (!(framedata = ast_calloc(1, sizeof(*framedata)))) {
-		return 0;
-	}
-
-	if (jb_framedata_init(framedata, data, value)) {
-		jb_framedata_destroy(framedata);
-		return 0;
-	}
-
-	interface.data = framedata;
-
-	ast_channel_lock(chan);
-	i = ast_framehook_attach(chan, &interface);
-	if (i >= 0) {
-		int *id;
-		if ((datastore = ast_channel_datastore_find(chan, &jb_datastore, NULL))) {
-			id = datastore->data;
-			ast_framehook_detach(chan, *id);
-			ast_channel_datastore_remove(chan, datastore);
-		}
-
-		if (!(datastore = ast_datastore_alloc(&jb_datastore, NULL))) {
-			ast_framehook_detach(chan, i);
-			ast_channel_unlock(chan);
-			return 0;
-		}
-
-		if (!(id = ast_calloc(1, sizeof(int)))) {
-			ast_datastore_free(datastore);
-			ast_framehook_detach(chan, i);
-			ast_channel_unlock(chan);
-			return 0;
-		}
-
-		*id = i; /* Store off the id. The channel is still locked so it is safe to access this ptr. */
-		datastore->data = id;
-		ast_channel_datastore_add(chan, datastore);
-
-		ast_channel_set_fd(chan, AST_JITTERBUFFER_FD, framedata->timer_fd);
-	} else {
-		jb_framedata_destroy(framedata);
-		framedata = NULL;
-	}
-	ast_channel_unlock(chan);
-
-	return 0;
-}
 
 static struct ast_custom_function jb_function = {
 	.name = "JITTERBUFFER",

Modified: team/kmoore/stasis-bridging-channel_events/include/asterisk/abstract_jb.h
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-bridging-channel_events/include/asterisk/abstract_jb.h?view=diff&rev=386620&r1=386619&r2=386620
==============================================================================
--- team/kmoore/stasis-bridging-channel_events/include/asterisk/abstract_jb.h (original)
+++ team/kmoore/stasis-bridging-channel_events/include/asterisk/abstract_jb.h Fri Apr 26 13:25:56 2013
@@ -246,6 +246,14 @@
  */
 int ast_jb_read_conf(struct ast_jb_conf *conf, const char *varname, const char *value);
 
+/*!
+ * \since 12.0
+ * \brief Sets a jitterbuffer frame hook on the channel based on the channel's stored
+ *        jitterbuffer configuration
+ *
+ * \param chan Which channel is being set up
+ */
+void ast_jb_enable_for_channel(struct ast_channel *chan);
 
 /*!
  * \brief Configures a jitterbuffer on a channel.
@@ -257,7 +265,6 @@
  */
 void ast_jb_configure(struct ast_channel *chan, const struct ast_jb_conf *conf);
 
-
 /*!
  * \brief Copies a channel's jitterbuffer configuration.
  * \param chan channel.
@@ -274,6 +281,25 @@
 
 const struct ast_jb_impl *ast_jb_get_impl(enum ast_jb_type type);
 
+/*!
+ * \since 12
+ * \brief Sets the contents of an ast_jb_conf struct to the default jitterbuffer settings
+ *
+ * \param conf Which jitterbuffer is being set
+ */
+void ast_jb_conf_default(struct ast_jb_conf *conf);
+
+/*!
+ * \since 12
+ * \brief Applies a jitterbuffer framehook to a channel based on a provided jitterbuffer config
+ *
+ * \param chan Which channel the jitterbuffer is being set on
+ * \param jb_conf Configuration to use for the jitterbuffer
+ * \param prefer_existing If this is true and a jitterbuffer already exists for the channel,
+ *        use the existing jitterbuffer
+ */
+void ast_jb_create_framehook(struct ast_channel *chan, struct ast_jb_conf *jb_conf, int prefer_existing);
+
 #if defined(__cplusplus) || defined(c_plusplus)
 }
 #endif

Modified: team/kmoore/stasis-bridging-channel_events/include/asterisk/autoconfig.h.in
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-bridging-channel_events/include/asterisk/autoconfig.h.in?view=diff&rev=386620&r1=386619&r2=386620
==============================================================================
--- team/kmoore/stasis-bridging-channel_events/include/asterisk/autoconfig.h.in (original)
+++ team/kmoore/stasis-bridging-channel_events/include/asterisk/autoconfig.h.in Fri Apr 26 13:25:56 2013
@@ -294,7 +294,7 @@
 /* Define if your system has the GLOB_NOMAGIC headers. */
 #undef HAVE_GLOB_NOMAGIC
 
-/* Define if your system has the GMIME libraries. */
+/* Define to 1 if you have the GMime library. */
 #undef HAVE_GMIME
 
 /* Define to indicate the GSM library */
@@ -306,7 +306,7 @@
 /* Define to indicate that gsm.h has no prefix for its location */
 #undef HAVE_GSM_HEADER
 
-/* Define if your system has the GTK2 libraries. */
+/* Define to 1 if you have the gtk2 library. */
 #undef HAVE_GTK2
 
 /* Define to 1 if you have the Hoard Memory Allocator library. */
@@ -324,7 +324,7 @@
 /* Define to 1 if you have the Iksemel Jabber library. */
 #undef HAVE_IKSEMEL
 
-/* Define if your system has the ILBC libraries. */
+/* Define to 1 if you have the System iLBC library. */
 #undef HAVE_ILBC
 
 /* Define if your system has the UW IMAP Toolkit c-client library. */
@@ -376,7 +376,7 @@
 /* Define to 1 if you have the OpenLDAP library. */
 #undef HAVE_LDAP
 
-/* Define if your system has the LIBEDIT libraries. */
+/* Define to 1 if you have the NetBSD Editline library library. */
 #undef HAVE_LIBEDIT
 
 /* Define to 1 if you have the <libintl.h> header file. */
@@ -551,7 +551,7 @@
 /* Define to indicate presence of the pg_encoding_to_char API. */
 #undef HAVE_PGSQL_pg_encoding_to_char
 
-/* Define if your system has the PJPROJECT libraries. */
+/* Define to 1 if you have the PJPROJECT library. */
 #undef HAVE_PJPROJECT
 
 /* Define to 1 if your system defines IP_PKTINFO. */
@@ -854,19 +854,19 @@
 /* Define to 1 if you have the `strtoq' function. */
 #undef HAVE_STRTOQ
 
-/* Define to 1 if `ifr_ifru.ifru_hwaddr' is a member of `struct ifreq'. */
+/* Define to 1 if `ifr_ifru.ifru_hwaddr' is member of `struct ifreq'. */
 #undef HAVE_STRUCT_IFREQ_IFR_IFRU_IFRU_HWADDR
 
-/* Define to 1 if `uid' is a member of `struct sockpeercred'. */
+/* Define to 1 if `uid' is member of `struct sockpeercred'. */
 #undef HAVE_STRUCT_SOCKPEERCRED_UID
 
-/* Define to 1 if `st_blksize' is a member of `struct stat'. */
+/* Define to 1 if `st_blksize' is member of `struct stat'. */
 #undef HAVE_STRUCT_STAT_ST_BLKSIZE
 
-/* Define to 1 if `cr_uid' is a member of `struct ucred'. */
+/* Define to 1 if `cr_uid' is member of `struct ucred'. */
 #undef HAVE_STRUCT_UCRED_CR_UID
 
-/* Define to 1 if `uid' is a member of `struct ucred'. */
+/* Define to 1 if `uid' is member of `struct ucred'. */
 #undef HAVE_STRUCT_UCRED_UID
 
 /* Define to 1 if you have the mISDN Supplemental Services library. */
@@ -1144,11 +1144,11 @@
 /* Define to the one symbol short name of this package. */
 #undef PACKAGE_TARNAME
 
-/* Define to the home page for this package. */
-#undef PACKAGE_URL
-
 /* Define to the version of this package. */
 #undef PACKAGE_VERSION
+
+/* Define to 1 if the C compiler supports function prototypes. */
+#undef PROTOTYPES
 
 /* Define to necessary symbol if this constant uses a non-standard name on
    your system. */
@@ -1168,6 +1168,11 @@
 
 /* Define to the type of arg 5 for `select'. */
 #undef SELECT_TYPE_ARG5
+
+/* Define to 1 if the `setvbuf' function takes the buffering type as its
+   second argument and the buffer pointer as the third, as on System V before
+   release 3. */
+#undef SETVBUF_REVERSED
 
 /* The size of `char *', as computed by sizeof. */
 #undef SIZEOF_CHAR_P
@@ -1204,54 +1209,53 @@
 /* Define to a type of the same size as fd_set.fds_bits[[0]] */
 #undef TYPEOF_FD_SET_FDS_BITS
 
-/* Enable extensions on AIX 3, Interix.  */
+/* Define to 1 if on AIX 3.
+   System headers sometimes define this.
+   We just want to avoid a redefinition error message.  */
 #ifndef _ALL_SOURCE
 # undef _ALL_SOURCE
 #endif
+
+/* Define to 1 if running on Darwin. */
+#undef _DARWIN_UNLIMITED_SELECT
+
+/* Number of bits in a file offset, on hosts where this is settable. */
+#undef _FILE_OFFSET_BITS
+
 /* Enable GNU extensions on systems that have them.  */
 #ifndef _GNU_SOURCE
 # undef _GNU_SOURCE
 #endif
-/* Enable threading extensions on Solaris.  */
+
+/* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */
+#undef _LARGEFILE_SOURCE
+
+/* Define for large files, on AIX-style hosts. */
+#undef _LARGE_FILES
+
+/* Define to 1 if on MINIX. */
+#undef _MINIX
+
+/* Define to 2 if the system does not provide POSIX.1 features except with
+   this defined. */
+#undef _POSIX_1_SOURCE
+
+/* Define to 1 if you need to in order for `stat' and other things to work. */
+#undef _POSIX_SOURCE
+
+/* Enable extensions on Solaris.  */
+#ifndef __EXTENSIONS__
+# undef __EXTENSIONS__
+#endif
 #ifndef _POSIX_PTHREAD_SEMANTICS
 # undef _POSIX_PTHREAD_SEMANTICS
 #endif
-/* Enable extensions on HP NonStop.  */
 #ifndef _TANDEM_SOURCE
 # undef _TANDEM_SOURCE
 #endif
-/* Enable general extensions on Solaris.  */
-#ifndef __EXTENSIONS__
-# undef __EXTENSIONS__
-#endif
-
-
-/* Define to 1 if running on Darwin. */
-#undef _DARWIN_UNLIMITED_SELECT
-
-/* Enable large inode numbers on Mac OS X 10.5.  */
-#ifndef _DARWIN_USE_64_BIT_INODE
-# define _DARWIN_USE_64_BIT_INODE 1
-#endif
-
-/* Number of bits in a file offset, on hosts where this is settable. */
-#undef _FILE_OFFSET_BITS
-
-/* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */
-#undef _LARGEFILE_SOURCE
-
-/* Define for large files, on AIX-style hosts. */
-#undef _LARGE_FILES
-
-/* Define to 1 if on MINIX. */
-#undef _MINIX
-
-/* Define to 2 if the system does not provide POSIX.1 features except with
-   this defined. */
-#undef _POSIX_1_SOURCE
-
-/* Define to 1 if you need to in order for `stat' and other things to work. */
-#undef _POSIX_SOURCE
+
+/* Define like PROTOTYPES; this can be used by system headers. */
+#undef __PROTOTYPES
 
 /* Define to empty if `const' does not conform to ANSI C. */
 #undef const

Modified: team/kmoore/stasis-bridging-channel_events/include/asterisk/bridging.h
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-bridging-channel_events/include/asterisk/bridging.h?view=diff&rev=386620&r1=386619&r2=386620
==============================================================================
--- team/kmoore/stasis-bridging-channel_events/include/asterisk/bridging.h (original)
+++ team/kmoore/stasis-bridging-channel_events/include/asterisk/bridging.h Fri Apr 26 13:25:56 2013
@@ -349,6 +349,17 @@
 typedef void (*ast_bridge_notify_masquerade_fn)(struct ast_bridge *self, struct ast_bridge_channel *bridge_channel);
 
 /*!
+ * \brief Get the merge priority of this bridge.
+ *
+ * \param self Bridge to operate upon.
+ *
+ * \note On entry, self is already locked.
+ *
+ * \return Merge priority
+ */
+typedef int (*ast_bridge_merge_priority_fn)(struct ast_bridge *self);
+
+/*!
  * \brief Bridge virtual methods table definition.
  *
  * \note Any changes to this struct must be reflected in
@@ -367,6 +378,8 @@
 	ast_bridge_pull_channel_fn pull;

[... 1374 lines stripped ...]



More information about the asterisk-commits mailing list