[asterisk-commits] dlee: branch dlee/ari-event-remodel2 r393146 - in /team/dlee/ari-event-remode...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Jun 28 11:24:30 CDT 2013


Author: dlee
Date: Fri Jun 28 11:24:07 2013
New Revision: 393146

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=393146
Log:
Multiple revisions 392491,393131

........
  r392491 | dlee | 2013-06-21 17:07:08 -0500 (Fri, 21 Jun 2013) | 5 lines
  
  Addressed review feedback.
   * Used ao2_callback for much good
   * Formatting
   * Replaced 'int r' with 'int res'
........
  r393131 | dlee | 2013-06-28 10:56:51 -0500 (Fri, 28 Jun 2013) | 2 lines
  
  Merged revisions 392464-393130 from http://svn.asterisk.org/svn/asterisk/trunk
........

Merged revisions 392491,393131 from http://svn.asterisk.org/svn/asterisk/team/dlee/ari-url-shuffle

Added:
    team/dlee/ari-event-remodel2/include/asterisk/media_index.h
      - copied unchanged from r393131, team/dlee/ari-url-shuffle/include/asterisk/media_index.h
    team/dlee/ari-event-remodel2/include/asterisk/res_sip_exten_state.h
      - copied unchanged from r393131, team/dlee/ari-url-shuffle/include/asterisk/res_sip_exten_state.h
    team/dlee/ari-event-remodel2/include/asterisk/sdp_srtp.h
      - copied unchanged from r393131, team/dlee/ari-url-shuffle/include/asterisk/sdp_srtp.h
    team/dlee/ari-event-remodel2/include/asterisk/sounds_index.h
      - copied unchanged from r393131, team/dlee/ari-url-shuffle/include/asterisk/sounds_index.h
    team/dlee/ari-event-remodel2/main/manager_endpoints.c
      - copied unchanged from r393131, team/dlee/ari-url-shuffle/main/manager_endpoints.c
    team/dlee/ari-event-remodel2/main/media_index.c
      - copied unchanged from r393131, team/dlee/ari-url-shuffle/main/media_index.c
    team/dlee/ari-event-remodel2/main/sdp_srtp.c
      - copied unchanged from r393131, team/dlee/ari-url-shuffle/main/sdp_srtp.c
    team/dlee/ari-event-remodel2/main/sounds_index.c
      - copied unchanged from r393131, team/dlee/ari-url-shuffle/main/sounds_index.c
    team/dlee/ari-event-remodel2/res/res_sip/security_events.c
      - copied unchanged from r393131, team/dlee/ari-url-shuffle/res/res_sip/security_events.c
    team/dlee/ari-event-remodel2/res/res_sip_diversion.c
      - copied unchanged from r393131, team/dlee/ari-url-shuffle/res/res_sip_diversion.c
    team/dlee/ari-event-remodel2/res/res_sip_endpoint_identifier_anonymous.c
      - copied unchanged from r393131, team/dlee/ari-url-shuffle/res/res_sip_endpoint_identifier_anonymous.c
    team/dlee/ari-event-remodel2/res/res_sip_exten_state.c
      - copied unchanged from r393131, team/dlee/ari-url-shuffle/res/res_sip_exten_state.c
    team/dlee/ari-event-remodel2/res/res_sip_exten_state.exports.in
      - copied unchanged from r393131, team/dlee/ari-url-shuffle/res/res_sip_exten_state.exports.in
    team/dlee/ari-event-remodel2/res/res_sip_messaging.c
      - copied unchanged from r393131, team/dlee/ari-url-shuffle/res/res_sip_messaging.c
    team/dlee/ari-event-remodel2/res/res_sip_one_touch_record_info.c
      - copied unchanged from r393131, team/dlee/ari-url-shuffle/res/res_sip_one_touch_record_info.c
    team/dlee/ari-event-remodel2/res/res_sip_pidf.c
      - copied unchanged from r393131, team/dlee/ari-url-shuffle/res/res_sip_pidf.c
    team/dlee/ari-event-remodel2/res/res_sip_refer.c
      - copied unchanged from r393131, team/dlee/ari-url-shuffle/res/res_sip_refer.c
    team/dlee/ari-event-remodel2/res/res_sip_registrar_expire.c
      - copied unchanged from r393131, team/dlee/ari-url-shuffle/res/res_sip_registrar_expire.c
    team/dlee/ari-event-remodel2/res/res_sip_transport_websocket.c
      - copied unchanged from r393131, team/dlee/ari-url-shuffle/res/res_sip_transport_websocket.c
Removed:
    team/dlee/ari-event-remodel2/channels/sip/include/sdp_crypto.h
    team/dlee/ari-event-remodel2/channels/sip/include/srtp.h
    team/dlee/ari-event-remodel2/channels/sip/sdp_crypto.c
    team/dlee/ari-event-remodel2/channels/sip/srtp.c
Modified:
    team/dlee/ari-event-remodel2/   (props changed)
    team/dlee/ari-event-remodel2/CHANGES
    team/dlee/ari-event-remodel2/Makefile
    team/dlee/ari-event-remodel2/apps/app_celgenuserevent.c
    team/dlee/ari-event-remodel2/apps/app_dial.c
    team/dlee/ari-event-remodel2/apps/app_queue.c
    team/dlee/ari-event-remodel2/apps/app_stasis.c
    team/dlee/ari-event-remodel2/apps/confbridge/conf_chan_announce.c
    team/dlee/ari-event-remodel2/bridges/bridge_holding.c
    team/dlee/ari-event-remodel2/bridges/bridge_native_rtp.c
    team/dlee/ari-event-remodel2/bridges/bridge_simple.c
    team/dlee/ari-event-remodel2/bridges/bridge_softmix.c
    team/dlee/ari-event-remodel2/channels/chan_gulp.c
    team/dlee/ari-event-remodel2/channels/chan_iax2.c
    team/dlee/ari-event-remodel2/channels/chan_motif.c
    team/dlee/ari-event-remodel2/channels/chan_sip.c
    team/dlee/ari-event-remodel2/channels/chan_skinny.c
    team/dlee/ari-event-remodel2/channels/sip/include/sip.h
    team/dlee/ari-event-remodel2/configs/res_sip.conf.sample
    team/dlee/ari-event-remodel2/doc/appdocsxml.dtd
    team/dlee/ari-event-remodel2/funcs/func_channel.c
    team/dlee/ari-event-remodel2/include/asterisk/_private.h
    team/dlee/ari-event-remodel2/include/asterisk/bridging.h
    team/dlee/ari-event-remodel2/include/asterisk/bridging_technology.h
    team/dlee/ari-event-remodel2/include/asterisk/cdr.h
    team/dlee/ari-event-remodel2/include/asterisk/cel.h
    team/dlee/ari-event-remodel2/include/asterisk/config_options.h
    team/dlee/ari-event-remodel2/include/asterisk/features.h
    team/dlee/ari-event-remodel2/include/asterisk/file.h
    team/dlee/ari-event-remodel2/include/asterisk/format.h
    team/dlee/ari-event-remodel2/include/asterisk/http.h
    team/dlee/ari-event-remodel2/include/asterisk/manager.h
    team/dlee/ari-event-remodel2/include/asterisk/parking.h
    team/dlee/ari-event-remodel2/include/asterisk/res_sip.h
    team/dlee/ari-event-remodel2/include/asterisk/res_sip_pubsub.h
    team/dlee/ari-event-remodel2/include/asterisk/res_sip_session.h
    team/dlee/ari-event-remodel2/include/asterisk/sorcery.h
    team/dlee/ari-event-remodel2/include/asterisk/stasis_app.h
    team/dlee/ari-event-remodel2/include/asterisk/stasis_channels.h
    team/dlee/ari-event-remodel2/include/asterisk/stasis_endpoints.h
    team/dlee/ari-event-remodel2/main/asterisk.c
    team/dlee/ari-event-remodel2/main/bridging.c
    team/dlee/ari-event-remodel2/main/cdr.c
    team/dlee/ari-event-remodel2/main/cel.c
    team/dlee/ari-event-remodel2/main/config_options.c
    team/dlee/ari-event-remodel2/main/devicestate.c
    team/dlee/ari-event-remodel2/main/features.c
    team/dlee/ari-event-remodel2/main/features_config.c
    team/dlee/ari-event-remodel2/main/file.c
    team/dlee/ari-event-remodel2/main/http.c
    team/dlee/ari-event-remodel2/main/manager.c
    team/dlee/ari-event-remodel2/main/named_acl.c
    team/dlee/ari-event-remodel2/main/parking.c
    team/dlee/ari-event-remodel2/main/pbx.c
    team/dlee/ari-event-remodel2/main/presencestate.c
    team/dlee/ari-event-remodel2/main/sorcery.c
    team/dlee/ari-event-remodel2/main/stasis_channels.c
    team/dlee/ari-event-remodel2/main/stasis_endpoints.c
    team/dlee/ari-event-remodel2/res/parking/parking_applications.c
    team/dlee/ari-event-remodel2/res/parking/parking_bridge.c
    team/dlee/ari-event-remodel2/res/parking/parking_bridge_features.c
    team/dlee/ari-event-remodel2/res/parking/parking_controller.c
    team/dlee/ari-event-remodel2/res/parking/parking_manager.c
    team/dlee/ari-event-remodel2/res/parking/res_parking.h
    team/dlee/ari-event-remodel2/res/res_calendar.c
    team/dlee/ari-event-remodel2/res/res_chan_stats.c
    team/dlee/ari-event-remodel2/res/res_fax.c
    team/dlee/ari-event-remodel2/res/res_http_websocket.c
    team/dlee/ari-event-remodel2/res/res_parking.c
    team/dlee/ari-event-remodel2/res/res_sip.c
    team/dlee/ari-event-remodel2/res/res_sip.exports.in
    team/dlee/ari-event-remodel2/res/res_sip/config_auth.c
    team/dlee/ari-event-remodel2/res/res_sip/config_domain_aliases.c
    team/dlee/ari-event-remodel2/res/res_sip/config_transport.c
    team/dlee/ari-event-remodel2/res/res_sip/include/res_sip_private.h
    team/dlee/ari-event-remodel2/res/res_sip/location.c
    team/dlee/ari-event-remodel2/res/res_sip/sip_configuration.c
    team/dlee/ari-event-remodel2/res/res_sip/sip_distributor.c
    team/dlee/ari-event-remodel2/res/res_sip/sip_options.c
    team/dlee/ari-event-remodel2/res/res_sip_acl.c
    team/dlee/ari-event-remodel2/res/res_sip_caller_id.c
    team/dlee/ari-event-remodel2/res/res_sip_dtmf_info.c
    team/dlee/ari-event-remodel2/res/res_sip_endpoint_identifier_ip.c
    team/dlee/ari-event-remodel2/res/res_sip_outbound_registration.c
    team/dlee/ari-event-remodel2/res/res_sip_pubsub.c
    team/dlee/ari-event-remodel2/res/res_sip_pubsub.exports.in
    team/dlee/ari-event-remodel2/res/res_sip_registrar.c
    team/dlee/ari-event-remodel2/res/res_sip_sdp_rtp.c
    team/dlee/ari-event-remodel2/res/res_sip_session.c
    team/dlee/ari-event-remodel2/res/res_sip_session.exports.in
    team/dlee/ari-event-remodel2/res/res_stasis.c
    team/dlee/ari-event-remodel2/res/res_stasis_answer.c
    team/dlee/ari-event-remodel2/res/res_stasis_bridge_add.c
    team/dlee/ari-event-remodel2/res/res_stasis_http.c
    team/dlee/ari-event-remodel2/res/res_stasis_http_asterisk.c
    team/dlee/ari-event-remodel2/res/res_stasis_http_bridges.c
    team/dlee/ari-event-remodel2/res/res_stasis_http_channels.c
    team/dlee/ari-event-remodel2/res/res_stasis_http_endpoints.c
    team/dlee/ari-event-remodel2/res/res_stasis_http_events.c
    team/dlee/ari-event-remodel2/res/res_stasis_http_playback.c
    team/dlee/ari-event-remodel2/res/res_stasis_http_recordings.c
    team/dlee/ari-event-remodel2/res/res_stasis_http_sounds.c
    team/dlee/ari-event-remodel2/res/res_stasis_playback.c
    team/dlee/ari-event-remodel2/res/res_stasis_test.c
    team/dlee/ari-event-remodel2/res/res_statsd.c
    team/dlee/ari-event-remodel2/res/stasis/control.c
    team/dlee/ari-event-remodel2/res/stasis_http/ari_model.c
    team/dlee/ari-event-remodel2/res/stasis_http/ari_model.h
    team/dlee/ari-event-remodel2/res/stasis_http/resource_channels.c
    team/dlee/ari-event-remodel2/res/stasis_http/resource_channels.h
    team/dlee/ari-event-remodel2/res/stasis_http/resource_sounds.c
    team/dlee/ari-event-remodel2/rest-api-templates/res_stasis_http_resource.c.mustache
    team/dlee/ari-event-remodel2/rest-api/api-docs/channels.json
    team/dlee/ari-event-remodel2/rest-api/api-docs/sounds.json
    team/dlee/ari-event-remodel2/tests/test_endpoints.c
    team/dlee/ari-event-remodel2/tests/test_sorcery.c
    team/dlee/ari-event-remodel2/tests/test_sorcery_astdb.c
    team/dlee/ari-event-remodel2/tests/test_sorcery_realtime.c
    team/dlee/ari-event-remodel2/tests/test_stasis_endpoints.c

Propchange: team/dlee/ari-event-remodel2/
------------------------------------------------------------------------------
Binary property 'branch-11-merged' - no diff available.

Propchange: team/dlee/ari-event-remodel2/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Fri Jun 28 11:24:07 2013
@@ -1,1 +1,1 @@
-/team/dlee/ari-url-shuffle:1-392465
+/team/dlee/ari-url-shuffle:1-393131

Modified: team/dlee/ari-event-remodel2/CHANGES
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ari-event-remodel2/CHANGES?view=diff&rev=393146&r1=393145&r2=393146
==============================================================================
--- team/dlee/ari-event-remodel2/CHANGES (original)
+++ team/dlee/ari-event-remodel2/CHANGES Fri Jun 28 11:24:07 2013
@@ -329,6 +329,11 @@
 
  * The AMI command 'ParkedCalls' will now accept a 'ParkingLot' argument which
    can be used to get a list of parked calls only for a specific parking lot.
+
+ * The AMI command 'Park' has had the argument 'Channel2' renamed to
+   'TimeoutChannel'. 'TimeoutChannel' is no longer a required argument.
+   'Channel2' can still be used as the argument name, but it is deprecated
+   and the 'TimeoutChannel' argument will be used if both are present.
 
  * The ParkAndAnnounce application is now provided through res_parking instead
    of through the separate app_parkandannounce module.

Modified: team/dlee/ari-event-remodel2/Makefile
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ari-event-remodel2/Makefile?view=diff&rev=393146&r1=393145&r2=393146
==============================================================================
--- team/dlee/ari-event-remodel2/Makefile (original)
+++ team/dlee/ari-event-remodel2/Makefile Fri Jun 28 11:24:07 2013
@@ -477,7 +477,7 @@
 	@echo "</docs>" >> $@
 
 ifneq ($(GREP),)
-  XMX_full_en_US = $(foreach dir,$(MOD_SUBDIRS),$(shell $(GREP) -l "language=\"en_US\"" $(dir)/*.c $(dir)/*.cc 2>/dev/null))
+  XML_full_en_US = $(foreach dir,$(MOD_SUBDIRS),$(shell $(GREP) -l "language=\"en_US\"" $(dir)/*.c $(dir)/*.cc 2>/dev/null))
 endif
 
 doc/full-en_US.xml: makeopts .lastclean $(XML_full_en_US)

Modified: team/dlee/ari-event-remodel2/apps/app_celgenuserevent.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ari-event-remodel2/apps/app_celgenuserevent.c?view=diff&rev=393146&r1=393145&r2=393146
==============================================================================
--- team/dlee/ari-event-remodel2/apps/app_celgenuserevent.c (original)
+++ team/dlee/ari-event-remodel2/apps/app_celgenuserevent.c Fri Jun 28 11:24:07 2013
@@ -62,6 +62,7 @@
 {
 	int res = 0;
 	char *parse;
+	RAII_VAR(struct ast_json *, blob, NULL, ast_json_unref);
 	AST_DECLARE_APP_ARGS(args,
 		AST_APP_ARG(event);
 		AST_APP_ARG(extra);
@@ -74,7 +75,13 @@
 	parse = ast_strdupa(data);
 	AST_STANDARD_APP_ARGS(args, parse);
 
-	ast_cel_report_event(chan, AST_CEL_USER_DEFINED, args.event, args.extra, NULL);
+	blob = ast_json_pack("{s: s, s: s}",
+		"event", args.event,
+		"extra", args.extra);
+	if (!blob) {
+		return res;
+	}
+	ast_cel_publish_event(chan, AST_CEL_USER_DEFINED, blob);
 	return res;
 }
 

Modified: team/dlee/ari-event-remodel2/apps/app_dial.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ari-event-remodel2/apps/app_dial.c?view=diff&rev=393146&r1=393145&r2=393146
==============================================================================
--- team/dlee/ari-event-remodel2/apps/app_dial.c (original)
+++ team/dlee/ari-event-remodel2/apps/app_dial.c Fri Jun 28 11:24:07 2013
@@ -859,8 +859,6 @@
 		ast_clear_flag64(o, OPT_IGNORE_CONNECTEDLINE);
 	}
 
-	ast_cel_report_event(in, AST_CEL_FORWARD, NULL, ast_channel_call_forward(c), NULL);
-
 	/* Before processing channel, go ahead and check for forwarding */
 	ast_verb(3, "Now forwarding %s to '%s/%s' (thanks to %s)\n", ast_channel_name(in), tech, stuff, ast_channel_name(c));
 	/* If we have been told to ignore forwards, just set this channel to null and continue processing extensions normally */
@@ -1004,7 +1002,8 @@
 			ast_channel_unlock(c);
 
 			ast_channel_lock_both(original, in);
-			ast_channel_publish_dial(in, original, NULL, "CANCEL");
+			ast_channel_publish_dial_forward(in, original, NULL, "CANCEL",
+				ast_channel_call_forward(c));
 			ast_channel_unlock(in);
 			ast_channel_unlock(original);
 

Modified: team/dlee/ari-event-remodel2/apps/app_queue.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ari-event-remodel2/apps/app_queue.c?view=diff&rev=393146&r1=393145&r2=393146
==============================================================================
--- team/dlee/ari-event-remodel2/apps/app_queue.c (original)
+++ team/dlee/ari-event-remodel2/apps/app_queue.c Fri Jun 28 11:24:07 2013
@@ -4449,8 +4449,6 @@
 						o->block_connected_update = 0;
 					}
 
-					ast_cel_report_event(in, AST_CEL_FORWARD, NULL, ast_channel_call_forward(o->chan), NULL);
-
 					ast_verb(3, "Now forwarding %s to '%s/%s' (thanks to %s)\n", inchan_name, tech, stuff, ochan_name);
 					/* Setup parameters */
 					o->chan = ast_request(tech, ast_channel_nativeformats(in), in, stuff, &status);
@@ -4544,7 +4542,8 @@
 					ast_channel_unlock(qe->chan);
 
 					ast_channel_lock_both(qe->chan, original);
-					ast_channel_publish_dial(qe->chan, original, NULL, "CANCEL");
+					ast_channel_publish_dial_forward(qe->chan, original, NULL, "CANCEL",
+						ast_channel_call_forward(original));
 					ast_channel_unlock(original);
 					ast_channel_unlock(qe->chan);
 					/* Hangup the original channel now, in case we needed it */

Modified: team/dlee/ari-event-remodel2/apps/app_stasis.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ari-event-remodel2/apps/app_stasis.c?view=diff&rev=393146&r1=393145&r2=393146
==============================================================================
--- team/dlee/ari-event-remodel2/apps/app_stasis.c (original)
+++ team/dlee/ari-event-remodel2/apps/app_stasis.c Fri Jun 28 11:24:07 2013
@@ -106,9 +106,7 @@
 	return r;
 }
 
-AST_MODULE_INFO(ASTERISK_GPL_KEY,
-	AST_MODFLAG_DEFAULT,
-	"Stasis dialplan application",
+AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "Stasis dialplan application",
 	.load = load_module,
 	.unload = unload_module,
 	.nonoptreq = "res_stasis",

Modified: team/dlee/ari-event-remodel2/apps/confbridge/conf_chan_announce.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ari-event-remodel2/apps/confbridge/conf_chan_announce.c?view=diff&rev=393146&r1=393145&r2=393146
==============================================================================
--- team/dlee/ari-event-remodel2/apps/confbridge/conf_chan_announce.c (original)
+++ team/dlee/ari-event-remodel2/apps/confbridge/conf_chan_announce.c Fri Jun 28 11:24:07 2013
@@ -172,8 +172,8 @@
 int conf_announce_channel_push(struct ast_channel *ast)
 {
 	struct ast_bridge_features *features;
+	struct ast_channel *chan;
 	RAII_VAR(struct announce_pvt *, p, NULL, ao2_cleanup);
-	RAII_VAR(struct ast_channel *, chan, NULL, ast_channel_unref);
 
 	{
 		SCOPED_CHANNELLOCK(lock, ast);
@@ -192,12 +192,15 @@
 
 	features = ast_bridge_features_new();
 	if (!features) {
+		ast_channel_unref(chan);
 		return -1;
 	}
 	ast_set_flag(&features->feature_flags, AST_BRIDGE_CHANNEL_FLAG_IMMOVABLE);
 
 	/* Impart the output channel into the bridge */
 	if (ast_bridge_impart(p->bridge, chan, NULL, features, 0)) {
+		ast_bridge_features_destroy(features);
+		ast_channel_unref(chan);
 		return -1;
 	}
 	ao2_lock(p);

Modified: team/dlee/ari-event-remodel2/bridges/bridge_holding.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ari-event-remodel2/bridges/bridge_holding.c?view=diff&rev=393146&r1=393145&r2=393146
==============================================================================
--- team/dlee/ari-event-remodel2/bridges/bridge_holding.c (original)
+++ team/dlee/ari-event-remodel2/bridges/bridge_holding.c Fri Jun 28 11:24:07 2013
@@ -255,27 +255,25 @@
 
 static int holding_bridge_write(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, struct ast_frame *frame)
 {
-	struct ast_bridge_channel *cur;
-	struct holding_channel *hc = bridge_channel->tech_pvt;
+	struct holding_channel *hc = bridge_channel ? bridge_channel->tech_pvt : NULL;
 
 	/* If there is no tech_pvt, then the channel failed to allocate one when it joined and is borked. Don't listen to him. */
 	if (!hc) {
-		return -1;
+		/* "Accept" the frame and discard it. */
+		return 0;
 	}
 
 	/* If we aren't an announcer, we never have any business writing anything. */
 	if (!ast_test_flag(&hc->holding_roles, HOLDING_ROLE_ANNOUNCER)) {
-		return -1;
-	}
-
-	/* Ok, so we are the announcer and there are one or more people available to receive our writes. Let's do it. */
-	AST_LIST_TRAVERSE(&bridge->channels, cur, entry) {
-		if (bridge_channel == cur || !cur->tech_pvt) {
-			continue;
-		}
-
-		ast_bridge_channel_queue_frame(cur, frame);
-	}
+		/* "Accept" the frame and discard it. */
+		return 0;
+	}
+
+	/*
+	 * Ok, so we are the announcer.  Write the frame to all other
+	 * channels if any.
+	 */
+	ast_bridge_queue_everyone_else(bridge, bridge_channel, frame);
 
 	return 0;
 }

Modified: team/dlee/ari-event-remodel2/bridges/bridge_native_rtp.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ari-event-remodel2/bridges/bridge_native_rtp.c?view=diff&rev=393146&r1=393145&r2=393146
==============================================================================
--- team/dlee/ari-event-remodel2/bridges/bridge_native_rtp.c (original)
+++ team/dlee/ari-event-remodel2/bridges/bridge_native_rtp.c Fri Jun 28 11:24:07 2013
@@ -389,16 +389,7 @@
 
 static int native_rtp_bridge_write(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, struct ast_frame *frame)
 {
-	struct ast_bridge_channel *other = ast_bridge_channel_peer(bridge_channel);
-
-	if (!other) {
-		return -1;
-	}
-
-	/* The bridging core takes care of freeing the passed in frame. */
-	ast_bridge_channel_queue_frame(other, frame);
-
-	return 0;
+	return ast_bridge_queue_everyone_else(bridge, bridge_channel, frame);
 }
 
 static struct ast_bridge_technology native_rtp_bridge = {

Modified: team/dlee/ari-event-remodel2/bridges/bridge_simple.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ari-event-remodel2/bridges/bridge_simple.c?view=diff&rev=393146&r1=393145&r2=393146
==============================================================================
--- team/dlee/ari-event-remodel2/bridges/bridge_simple.c (original)
+++ team/dlee/ari-event-remodel2/bridges/bridge_simple.c Fri Jun 28 11:24:07 2013
@@ -68,18 +68,7 @@
 
 static int simple_bridge_write(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, struct ast_frame *frame)
 {
-	struct ast_bridge_channel *other;
-
-	/* Find the channel we actually want to write to */
-	other = ast_bridge_channel_peer(bridge_channel);
-	if (!other) {
-		return -1;
-	}
-
-	/* The bridging core takes care of freeing the passed in frame. */
-	ast_bridge_channel_queue_frame(other, frame);
-
-	return 0;
+	return ast_bridge_queue_everyone_else(bridge, bridge_channel, frame);
 }
 
 static struct ast_bridge_technology simple_bridge = {

Modified: team/dlee/ari-event-remodel2/bridges/bridge_softmix.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ari-event-remodel2/bridges/bridge_softmix.c?view=diff&rev=393146&r1=393145&r2=393146
==============================================================================
--- team/dlee/ari-event-remodel2/bridges/bridge_softmix.c (original)
+++ team/dlee/ari-event-remodel2/bridges/bridge_softmix.c Fri Jun 28 11:24:07 2013
@@ -445,29 +445,6 @@
 	ast_free(sc);
 }
 
-/*!
- * \internal
- * \brief Pass the given frame to everyone else.
- * \since 12.0.0
- *
- * \param bridge What bridge to distribute frame.
- * \param bridge_channel Channel to optionally not pass frame to. (NULL to pass to everyone)
- * \param frame Frame to pass.
- *
- * \return Nothing
- */
-static void softmix_pass_everyone_else(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, struct ast_frame *frame)
-{
-	struct ast_bridge_channel *cur;
-
-	AST_LIST_TRAVERSE(&bridge->channels, cur, entry) {
-		if (cur == bridge_channel) {
-			continue;
-		}
-		ast_bridge_channel_queue_frame(cur, frame);
-	}
-}
-
 static void softmix_pass_video_top_priority(struct ast_bridge *bridge, struct ast_frame *frame)
 {
 	struct ast_bridge_channel *cur;
@@ -507,7 +484,7 @@
 		video_src_priority = ast_bridge_is_video_src(bridge, bridge_channel->chan);
 		if (video_src_priority == 1) {
 			/* Pass to me and everyone else. */
-			softmix_pass_everyone_else(bridge, NULL, frame);
+			ast_bridge_queue_everyone_else(bridge, NULL, frame);
 		}
 		break;
 	case AST_BRIDGE_VIDEO_MODE_TALKER_SRC:
@@ -522,7 +499,7 @@
 			int num_src = ast_bridge_number_video_src(bridge);
 			int echo = num_src > 1 ? 0 : 1;
 
-			softmix_pass_everyone_else(bridge, echo ? NULL : bridge_channel, frame);
+			ast_bridge_queue_everyone_else(bridge, echo ? NULL : bridge_channel, frame);
 		} else if (video_src_priority == 2) {
 			softmix_pass_video_top_priority(bridge, frame);
 		}
@@ -612,12 +589,14 @@
  * \param bridge_channel Which channel is writing the frame.
  * \param frame What is being written.
  *
- * \return Nothing
- */
-static void softmix_bridge_write_control(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, struct ast_frame *frame)
+ * \retval 0 Frame accepted into the bridge.
+ * \retval -1 Frame needs to be deferred.
+ */
+static int softmix_bridge_write_control(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, struct ast_frame *frame)
 {
 /* BUGBUG need to look at channel roles to determine what to do with control frame. */
 	/*! \todo BUGBUG softmix_bridge_write_control() not written */
+	return 0;
 }
 
 /*!
@@ -629,8 +608,8 @@
  * \param bridge_channel Which channel is writing the frame.
  * \param frame What is being written.
  *
- * \retval 0 on success
- * \retval -1 on failure
+ * \retval 0 Frame accepted into the bridge.
+ * \retval -1 Frame needs to be deferred.
  *
  * \note On entry, bridge is already locked.
  */
@@ -638,30 +617,35 @@
 {
 	int res = 0;
 
-	if (!bridge->tech_pvt || !bridge_channel->tech_pvt) {
-		return -1;
+	if (!bridge->tech_pvt || (bridge_channel && !bridge_channel->tech_pvt)) {
+		/* "Accept" the frame and discard it. */
+		return 0;
 	}
 
 	switch (frame->frametype) {
 	case AST_FRAME_DTMF_BEGIN:
 	case AST_FRAME_DTMF_END:
-		softmix_pass_everyone_else(bridge, bridge_channel, frame);
+		res = ast_bridge_queue_everyone_else(bridge, bridge_channel, frame);
 		break;
 	case AST_FRAME_VOICE:
-		softmix_bridge_write_voice(bridge, bridge_channel, frame);
+		if (bridge_channel) {
+			softmix_bridge_write_voice(bridge, bridge_channel, frame);
+		}
 		break;
 	case AST_FRAME_VIDEO:
-		softmix_bridge_write_video(bridge, bridge_channel, frame);
+		if (bridge_channel) {
+			softmix_bridge_write_video(bridge, bridge_channel, frame);
+		}
 		break;
 	case AST_FRAME_CONTROL:
-		softmix_bridge_write_control(bridge, bridge_channel, frame);
+		res = softmix_bridge_write_control(bridge, bridge_channel, frame);
 		break;
 	case AST_FRAME_BRIDGE_ACTION:
-		softmix_pass_everyone_else(bridge, bridge_channel, frame);
+		res = ast_bridge_queue_everyone_else(bridge, bridge_channel, frame);
 		break;
 	default:
 		ast_debug(3, "Frame type %d unsupported\n", frame->frametype);
-		res = -1;
+		/* "Accept" the frame and discard it. */
 		break;
 	}
 

Modified: team/dlee/ari-event-remodel2/channels/chan_gulp.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ari-event-remodel2/channels/chan_gulp.c?view=diff&rev=393146&r1=393145&r2=393146
==============================================================================
--- team/dlee/ari-event-remodel2/channels/chan_gulp.c (original)
+++ team/dlee/ari-event-remodel2/channels/chan_gulp.c Fri Jun 28 11:24:07 2013
@@ -53,6 +53,9 @@
 #include "asterisk/musiconhold.h"
 #include "asterisk/causes.h"
 #include "asterisk/taskprocessor.h"
+#include "asterisk/dsp.h"
+#include "asterisk/stasis_endpoints.h"
+#include "asterisk/stasis_channels.h"
 
 #include "asterisk/res_sip.h"
 #include "asterisk/res_sip_session.h"
@@ -77,10 +80,25 @@
 			<para>Returns a properly formatted dial string for dialing all contacts on an AOR.</para>
 		</description>
 	</function>
+	<function name="GULP_MEDIA_OFFER" language="en_US">
+		<synopsis>
+			Media and codec offerings to be set on an outbound SIP channel prior to dialing.
+		</synopsis>
+		<syntax>
+			<parameter name="media" required="true">
+				<para>types of media offered</para>
+			</parameter>
+		</syntax>
+		<description>
+			<para>Returns the codecs offered based upon the media choice</para>
+		</description>
+	</function>
  ***/
 
 static const char desc[] = "Gulp SIP Channel";
 static const char channel_type[] = "Gulp";
+
+static unsigned int chan_idx;
 
 /*!
  * \brief Positions of various media
@@ -124,7 +142,9 @@
 static struct ast_frame *gulp_read(struct ast_channel *ast);
 static int gulp_write(struct ast_channel *ast, struct ast_frame *f);
 static int gulp_indicate(struct ast_channel *ast, int condition, const void *data, size_t datalen);
+static int gulp_transfer(struct ast_channel *ast, const char *target);
 static int gulp_fixup(struct ast_channel *oldchan, struct ast_channel *newchan);
+static int gulp_devicestate(const char *data);
 
 /*! \brief PBX interface structure for channel registration */
 static struct ast_channel_tech gulp_tech = {
@@ -142,7 +162,9 @@
 	.write_video = gulp_write,
 	.exception = gulp_read,
 	.indicate = gulp_indicate,
+	.transfer = gulp_transfer,
 	.fixup = gulp_fixup,
+	.devicestate = gulp_devicestate,
 	.properties = AST_CHAN_TP_WANTSJITTER | AST_CHAN_TP_CREATESJITTER
 };
 
@@ -249,6 +271,105 @@
 	.read = gulp_dial_contacts,
 };
 
+static int media_offer_read_av(struct ast_sip_session *session, char *buf,
+			       size_t len, enum ast_format_type media_type)
+{
+	int i, size = 0;
+	struct ast_format fmt;
+	const char *name;
+
+	for (i = 0; ast_codec_pref_index(&session->override_prefs, i, &fmt); ++i) {
+		if (AST_FORMAT_GET_TYPE(fmt.id) != media_type) {
+			continue;
+		}
+
+		name = ast_getformatname(&fmt);
+
+		if (ast_strlen_zero(name)) {
+			ast_log(LOG_WARNING, "GULP_MEDIA_OFFER unrecognized format %s\n", name);
+			continue;
+		}
+
+		/* add one since we'll include a comma */
+		size = strlen(name) + 1;
+		len -= size;
+		if ((len) < 0) {
+			break;
+		}
+
+		/* no reason to use strncat here since we have already ensured buf has
+                   enough space, so strcat can be safely used */
+		strcat(buf, name);
+		strcat(buf, ",");
+	}
+
+	if (size) {
+		/* remove the extra comma */
+		buf[strlen(buf) - 1] = '\0';
+	}
+	return 0;
+}
+
+struct media_offer_data {
+	struct ast_sip_session *session;
+	enum ast_format_type media_type;
+	const char *value;
+};
+
+static int media_offer_write_av(void *obj)
+{
+	struct media_offer_data *data = obj;
+	int i;
+	struct ast_format fmt;
+	/* remove all of the given media type first */
+	for (i = 0; ast_codec_pref_index(&data->session->override_prefs, i, &fmt); ++i) {
+		if (AST_FORMAT_GET_TYPE(fmt.id) == data->media_type) {
+			ast_codec_pref_remove(&data->session->override_prefs, &fmt);
+		}
+	}
+	ast_format_cap_remove_bytype(data->session->req_caps, data->media_type);
+	ast_parse_allow_disallow(&data->session->override_prefs, data->session->req_caps, data->value, 1);
+
+	return 0;
+}
+
+static int media_offer_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
+{
+	struct gulp_pvt *pvt = ast_channel_tech_pvt(chan);
+
+	if (!strcmp(data, "audio")) {
+		return media_offer_read_av(pvt->session, buf, len, AST_FORMAT_TYPE_AUDIO);
+	} else if (!strcmp(data, "video")) {
+		return media_offer_read_av(pvt->session, buf, len, AST_FORMAT_TYPE_VIDEO);
+	}
+
+	return 0;
+}
+
+static int media_offer_write(struct ast_channel *chan, const char *cmd, char *data, const char *value)
+{
+	struct gulp_pvt *pvt = ast_channel_tech_pvt(chan);
+
+	struct media_offer_data mdata = {
+		.session = pvt->session,
+		.value = value
+	};
+
+	if (!strcmp(data, "audio")) {
+		mdata.media_type = AST_FORMAT_TYPE_AUDIO;
+	} else if (!strcmp(data, "video")) {
+		mdata.media_type = AST_FORMAT_TYPE_VIDEO;
+	}
+
+	return ast_sip_push_task_synchronous(pvt->session->serializer, media_offer_write_av, &mdata);
+}
+
+static struct ast_custom_function media_offer_function = {
+	.name = "GULP_MEDIA_OFFER",
+	.read = media_offer_read,
+	.write = media_offer_write
+};
+
 /*! \brief Function called by RTP engine to get local audio RTP peer */
 static enum ast_rtp_glue_result gulp_get_rtp_peer(struct ast_channel *chan, struct ast_rtp_instance **instance)
 {
@@ -368,6 +489,7 @@
 	struct ast_sip_session *session = pvt->session;
 	int changed = 0;
 
+	/* BUGBUG - ast_bridged_channel will always return NULL, meaning direct media will never occur */
 	/* Don't try to do any direct media shenanigans on early bridges */
 	if ((rtp || vrtp || tpeer) && !ast_bridged_channel(chan)) {
 		return 0;
@@ -395,7 +517,11 @@
 
 	if (changed) {
 		ao2_ref(session, +1);
-		ast_sip_push_task(session->serializer, send_direct_media_request, session);
+
+
+		if (ast_sip_push_task(session->serializer, send_direct_media_request, session)) {
+			ao2_cleanup(session);
+		}
 	}
 
 	return 0;
@@ -421,8 +547,8 @@
 		return NULL;
 	}
 
-	if (!(chan = ast_channel_alloc(1, state, S_OR(session->id.number.str, ""), S_OR(session->id.name.str, ""), "", "", "", linkedid, 0, "Gulp/%s-%.*s", ast_sorcery_object_get_id(session->endpoint),
-		(int)session->inv_session->dlg->call_id->id.slen, session->inv_session->dlg->call_id->id.ptr))) {
+	if (!(chan = ast_channel_alloc(1, state, S_OR(session->id.number.str, ""), S_OR(session->id.name.str, ""), "", "", "", linkedid, 0, "Gulp/%s-%08x", ast_sorcery_object_get_id(session->endpoint),
+		ast_atomic_fetchadd_int((int *)&chan_idx, +1)))) {
 		ao2_cleanup(pvt);
 		return NULL;
 	}
@@ -460,6 +586,14 @@
 	ast_channel_exten_set(chan, S_OR(exten, "s"));
 	ast_channel_priority_set(chan, 1);
 
+	ast_channel_callgroup_set(chan, session->endpoint->callgroup);
+	ast_channel_pickupgroup_set(chan, session->endpoint->pickupgroup);
+
+	ast_channel_named_callgroups_set(chan, session->endpoint->named_callgroups);
+	ast_channel_named_pickupgroups_set(chan, session->endpoint->named_pickupgroups);
+
+	ast_endpoint_add_channel(session->endpoint->persistent, chan);
+
 	return chan;
 }
 
@@ -504,6 +638,7 @@
 static struct ast_frame *gulp_read(struct ast_channel *ast)
 {
 	struct gulp_pvt *pvt = ast_channel_tech_pvt(ast);
+	struct ast_sip_session *session = pvt->session;
 	struct ast_frame *f;
 	struct ast_sip_session_media *media = NULL;
 	int rtcp = 0;
@@ -530,14 +665,27 @@
 		return &ast_null_frame;
 	}
 
-	f = ast_rtp_instance_read(media->rtp, rtcp);
-
-	if (f && f->frametype == AST_FRAME_VOICE) {
-		if (!(ast_format_cap_iscompatible(ast_channel_nativeformats(ast), &f->subclass.format))) {
-			ast_debug(1, "Oooh, format changed to %s\n", ast_getformatname(&f->subclass.format));
-			ast_format_cap_set(ast_channel_nativeformats(ast), &f->subclass.format);
-			ast_set_read_format(ast, ast_channel_readformat(ast));
-			ast_set_write_format(ast, ast_channel_writeformat(ast));
+	if (!(f = ast_rtp_instance_read(media->rtp, rtcp))) {
+		return f;
+	}
+
+	if (f->frametype != AST_FRAME_VOICE) {
+		return f;
+	}
+
+	if (!(ast_format_cap_iscompatible(ast_channel_nativeformats(ast), &f->subclass.format))) {
+		ast_debug(1, "Oooh, format changed to %s\n", ast_getformatname(&f->subclass.format));
+		ast_format_cap_set(ast_channel_nativeformats(ast), &f->subclass.format);
+		ast_set_read_format(ast, ast_channel_readformat(ast));
+		ast_set_write_format(ast, ast_channel_writeformat(ast));
+	}
+
+	if (session->dsp) {
+		f = ast_dsp_process(ast, session->dsp, f);
+
+		if (f && (f->frametype == AST_FRAME_DTMF)) {
+			ast_debug(3, "* Detected inband DTMF '%c' on '%s'\n", f->subclass.integer,
+				ast_channel_name(ast));
 		}
 	}
 
@@ -620,6 +768,68 @@
 	}
 
 	return 0;
+}
+
+/*! \brief Function called to get the device state of an endpoint */
+static int gulp_devicestate(const char *data)
+{
+	RAII_VAR(struct ast_sip_endpoint *, endpoint, ast_sorcery_retrieve_by_id(ast_sip_get_sorcery(), "endpoint", data), ao2_cleanup);
+	enum ast_device_state state = AST_DEVICE_UNKNOWN;
+	RAII_VAR(struct ast_endpoint_snapshot *, endpoint_snapshot, NULL, ao2_cleanup);
+	RAII_VAR(struct stasis_caching_topic *, caching_topic, NULL, ao2_cleanup);
+	struct ast_devstate_aggregate aggregate;
+	int num, inuse = 0;
+
+	if (!endpoint) {
+		return AST_DEVICE_INVALID;
+	}
+
+	endpoint_snapshot = ast_endpoint_latest_snapshot(ast_endpoint_get_tech(endpoint->persistent),
+		ast_endpoint_get_resource(endpoint->persistent), 1);
+
+	if (endpoint_snapshot->state == AST_ENDPOINT_OFFLINE) {
+		state = AST_DEVICE_UNAVAILABLE;
+	} else if (endpoint_snapshot->state == AST_ENDPOINT_ONLINE) {
+		state = AST_DEVICE_NOT_INUSE;
+	}
+
+	if (!endpoint_snapshot->num_channels || !(caching_topic = ast_channel_topic_all_cached())) {
+		return state;
+	}
+
+	ast_devstate_aggregate_init(&aggregate);
+
+	ao2_ref(caching_topic, +1);
+
+	for (num = 0; num < endpoint_snapshot->num_channels; num++) {
+		RAII_VAR(struct stasis_message *, msg, stasis_cache_get_extended(caching_topic, ast_channel_snapshot_type(),
+			endpoint_snapshot->channel_ids[num], 1), ao2_cleanup);
+		struct ast_channel_snapshot *snapshot;
+
+		if (!msg) {
+			continue;
+		}
+
+		snapshot = stasis_message_data(msg);
+
+		if (snapshot->state == AST_STATE_DOWN) {
+			ast_devstate_aggregate_add(&aggregate, AST_DEVICE_NOT_INUSE);
+		} else if (snapshot->state == AST_STATE_RINGING) {
+			ast_devstate_aggregate_add(&aggregate, AST_DEVICE_RINGING);
+		} else if ((snapshot->state == AST_STATE_UP) || (snapshot->state == AST_STATE_RING) ||
+			(snapshot->state == AST_STATE_BUSY)) {
+			ast_devstate_aggregate_add(&aggregate, AST_DEVICE_INUSE);
+			inuse++;
+		}
+	}
+
+	if (endpoint->devicestate_busy_at && (inuse == endpoint->devicestate_busy_at)) {
+		state = AST_DEVICE_BUSY;
+	} else if (ast_devstate_aggregate_result(&aggregate) != AST_DEVICE_INVALID) {
+		state = ast_devstate_aggregate_result(&aggregate);
+	}
+
+	return state;
 }
 
 struct indicate_data {
@@ -698,7 +908,7 @@
 		.body_text = xml
 	};
 
-	struct ast_sip_session *session = data;
+	RAII_VAR(struct ast_sip_session *, session, data, ao2_cleanup);
 	struct pjsip_tx_data *tdata;
 
 	if (ast_sip_create_request("INFO", session->inv_session->dlg, session->endpoint, NULL, &tdata)) {
@@ -710,6 +920,40 @@
 		return -1;
 	}
 	ast_sip_session_send_request(session, tdata);
+
+	return 0;
+}
+
+/*! \brief Update connected line information */
+static int update_connected_line_information(void *data)
+{
+	RAII_VAR(struct ast_sip_session *, session, data, ao2_cleanup);
+
+	if ((ast_channel_state(session->channel) != AST_STATE_UP) && (session->inv_session->role == PJSIP_UAS_ROLE)) {
+		int response_code = 0;
+
+		if (ast_channel_state(session->channel) == AST_STATE_RING) {
+			response_code = !session->endpoint->inband_progress ? 180 : 183;
+		} else if (ast_channel_state(session->channel) == AST_STATE_RINGING) {
+			response_code = 183;
+		}
+
+		if (response_code) {
+			struct pjsip_tx_data *packet = NULL;
+
+			if (pjsip_inv_answer(session->inv_session, response_code, NULL, NULL, &packet) == PJ_SUCCESS) {
+				ast_sip_session_send_response(session, packet);
+			}
+		}
+	} else {
+		enum ast_sip_session_refresh_method method = session->endpoint->connected_line_method;
+
+		if (session->inv_session->invite_tsx && (session->inv_session->options & PJSIP_INV_SUPPORT_UPDATE)) {
+			method = AST_SIP_SESSION_REFRESH_METHOD_UPDATE;
+		}
+
+		ast_sip_session_refresh(session, NULL, NULL, method, 0);
+	}
 
 	return 0;
 }
@@ -726,10 +970,16 @@
 	switch (condition) {
 	case AST_CONTROL_RINGING:
 		if (ast_channel_state(ast) == AST_STATE_RING) {
-			response_code = 180;
+			if (session->endpoint->inband_progress) {
+				response_code = 183;
+				res = -1;
+			} else {
+				response_code = 180;
+			}
 		} else {
 			res = -1;
 		}
+		ast_devstate_changed(AST_DEVICE_UNKNOWN, AST_DEVSTATE_CACHABLE, "Gulp/%s", ast_sorcery_object_get_id(session->endpoint));
 		break;
 	case AST_CONTROL_BUSY:
 		if (ast_channel_state(ast) != AST_STATE_UP) {
@@ -769,9 +1019,20 @@
 	case AST_CONTROL_VIDUPDATE:
 		media = pvt->media[SIP_MEDIA_VIDEO];
 		if (media && media->rtp) {
-			ast_sip_push_task(session->serializer, transmit_info_with_vidupdate, session);
-		} else
+			ao2_ref(session, +1);
+
+			if (ast_sip_push_task(session->serializer, transmit_info_with_vidupdate, session)) {
+				ao2_cleanup(session);
+			}
+		} else {
 			res = -1;
+		}
+		break;
+	case AST_CONTROL_CONNECTED_LINE:
+		ao2_ref(session, +1);
+		if (ast_sip_push_task(session->serializer, update_connected_line_information, session)) {
+			ao2_cleanup(session);
+		}
 		break;
 	case AST_CONTROL_UPDATE_RTP_PEER:
 	case AST_CONTROL_PVT_CAUSE_CODE:
@@ -785,6 +1046,13 @@
 	case AST_CONTROL_SRCUPDATE:
 		break;
 	case AST_CONTROL_SRCCHANGE:
+		break;

[... 9952 lines stripped ...]



More information about the asterisk-commits mailing list