[asterisk-commits] qwell: branch qwell/fun_with_transports r388646 - in /team/qwell/fun_with_tra...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon May 13 16:30:29 CDT 2013


Author: qwell
Date: Mon May 13 16:30:15 2013
New Revision: 388646

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=388646
Log:
Multiple revisions 388019,388054,388082,388117,388171,388179,388257,388279,388326,388354,388384,388431,388472,388484,388524,388535

........
  r388019 | root | 2013-05-08 14:18:10 -0500 (Wed, 08 May 2013) | 46 lines
  
  Multiple revisions 388005,388008,388014
  
  ........
    r388005 | dlee | 2013-05-08 13:34:50 -0500 (Wed, 08 May 2013) | 21 lines
    
    Remove required type field from channel blobs
    
    When we first introduced the channel blob types, the JSON blobs were
    self identifying by a required "type" field in the JSON object
    itself. This, as it turns out, was a bad idea.
    
    When we introduced the message router, it was useless for routing based
    on the JSON type. And messages had two type fields to check: the
    stasis_message_type() of the message itself, plus the type field in the
    JSON blob (but only if it was a blob message).
    
    This patch corrects that mistake by removing the required type field
    from JSON blobs, and introducing first class stasis_message_type objects
    for the actual message type.
    
    Since we now will have a proliferation of message types, I introduced a
    few macros to help reduce the amount of boilerplate necessary to set
    them up.
    
    Review: https://reviewboard.asterisk.org/r/2509
  ........
    r388008 | mjordan | 2013-05-08 13:36:21 -0500 (Wed, 08 May 2013) | 10 lines
    
    Don't perform a realtime lookup with a NULL keyword
    
    Previously, a call to ast_load_realtime_multientry could get away with
    passing a NULL parameter to the function, even though it really isn't
    supposed to do that. After the change over to using ast_variable instead
    of variadic arguments, the realtime engine gets unhappy if you do this.
    
    This was always an unintended function call in app_directory anyway - now,
    we just don't call into the realtime function calls if we don't have anything
    to query on.
  ........
    r388014 | dlee | 2013-05-08 14:00:55 -0500 (Wed, 08 May 2013) | 1 line
    
    Fixed set-but-not-used warning caught by newer GCC
  ........
  
  Merged revisions 388005,388008,388014 from file:///srv/subversion/repos/asterisk/trunk
........
  r388054 | root | 2013-05-08 16:18:11 -0500 (Wed, 08 May 2013) | 33 lines
  
  Multiple revisions 388045-388046
  
  ........
    r388045 | dlee | 2013-05-08 15:25:28 -0500 (Wed, 08 May 2013) | 11 lines
    
    Removed #if checks for crazy old versions of OS X.
    
    The <arpa/nameser_compat.h> was introduced way back in OS X Panther, which
    itself was end-of-lifed back in 2007. We can assume that any OS X machine
    we build on will need that header file :-)
    
    Why bother removing it? The flag we're checking (__APPLE_CC__) is actually
    Apple's build number. Self-compiled versions of GCC (such as installing the
    latest version of GCC from homebrew) sets the value to 0, making it useless
    for this sort of compile flaggery.
  ........
    r388046 | dlee | 2013-05-08 16:01:33 -0500 (Wed, 08 May 2013) | 12 lines
    
    Add development flag to disable the inline API.
    
    A GCC bug[1] can, in some cases, pop up an unsuppressible pedwarn when
    using a static inline standard library function from a non-static
    inline function.
    
    This normally doesn't show up, but can occur if you're running an
    upgrade version of GCC (such as GCC 4.8 on OS X, which normally runs
    GCC 4.2).
    
     [1]: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47816
  ........
  
  Merged revisions 388045-388046 from file:///srv/subversion/repos/asterisk/trunk
........
  r388082 | root | 2013-05-08 17:18:25 -0500 (Wed, 08 May 2013) | 5 lines
  
  Fixed MODFLAG for res_stasis_websocket
  ........
  
  Merged revisions 388075 from file:///srv/subversion/repos/asterisk/trunk
........
  r388117 | root | 2013-05-08 23:18:15 -0500 (Wed, 08 May 2013) | 69 lines
  
  Multiple revisions 388110,388113
  
  ........
    r388110 | elguero | 2013-05-08 22:35:25 -0500 (Wed, 08 May 2013) | 26 lines
    
    Fix Segfault In app_queue When "persistentmembers" Is Enabled And Using Realtime
    
    When the "ignorebusy" setting was deprecated, we added some code to allow us to
    be compatible with older setups that are still using the "ignorebusy" setting
    instead of "ringinuse".  We set a char *variable with the column name to use,
    which helps the realtime functions to use the correct column in their SQL
    queries.  When "persistentmembers" is enabled, we are not setting this variable
    before the realtime functions were called to load members.  This results in the
    variable being NULL and therefore causing a segfault when loading members during
    the module's process of loading.
    
    The solution was to move the code that sets that variable to be before these
    realtime functions are called during the loading of the module.
    
    (closes issue ASTERISK-21738)
    Reported by: JoshE
    Tested by: JoshE
    Patches:
        asterisk-21738-rt-ringinuse-field-not-set.diff
                                         uploaded by Michael L. Young (license 5026)
    
    Review: https://reviewboard.asterisk.org/r/2499/
    ........
    
    Merged revisions 388108 from http://svn.asterisk.org/svn/asterisk/branches/11
  ........
    r388113 | elguero | 2013-05-08 23:11:59 -0500 (Wed, 08 May 2013) | 33 lines
    
    Fix The Payload Being Set On CN Packets And Do Not Set Marker Bit
    
    When we send out a CN packet (for instance, in the case of using rtpkeepalives),
    we are not setting the payload code properly.  Also, we are setting the marker
    bit when we shouldn't be according to RFC 3389, section 4.
    
    AST_RTP_CN is not defined by AST_FORMAT codes.  Therefore, we should be using
    ast_rtp_codecs_payload_code() rather than ast_rtp_codecs_payload_lookup().
    
    11 and trunk already use the appropriate function.
    
    * In 1.8, use ast_rtp_codecs_payload_code()
    
    * Remove the setting of the marker bit
    
    * Fix the debug message by incrementing the seqno after the debug message is set
      in order to display the correct seqno that was sent out
    
    (closes issue ASTERISK-21246)
    Reported by: Peter Katzmann
    Tested by: Peter Katzmann, Michael L. Young
    Patches:
        asterisk-21246-rtp-cng-payload-error_1.8_v2.diff
                                         uploaded by Michael L. Young (license 5026)
    
    Review: https://reviewboard.asterisk.org/r/2500/
    ........
    
    Merged revisions 388111 from http://svn.asterisk.org/svn/asterisk/branches/1.8
    ........
    
    Merged revisions 388112 from http://svn.asterisk.org/svn/asterisk/branches/11
  ........
  
  Merged revisions 388110,388113 from file:///srv/subversion/repos/asterisk/trunk
........
  r388171 | kmoore | 2013-05-09 08:16:48 -0500 (Thu, 09 May 2013) | 9 lines
  
  Ensure res_sip SRTP support parses multiple crypto attributes properly
  
  During testing, it was discovered that res_sip_sdp_rtp would not handle
  crypto properly if the first offer was not acceptable and there were
  subsequent acceptable offers. This ensures that addtional offers are
  parsed and used if acceptable.
  
  Review: https://reviewboard.asterisk.org/r/2503/
........
  r388179 | root | 2013-05-09 10:17:56 -0500 (Thu, 09 May 2013) | 5 lines
  
  Don't expect to pack three tuples when you only have two
  ........
  
  Merged revisions 388175 from file:///srv/subversion/repos/asterisk/trunk
........
  r388257 | root | 2013-05-10 07:18:37 -0500 (Fri, 10 May 2013) | 8 lines
  
  Fix copy/paste error in one-touch-recording implementation.
  ........
  
  Merged revisions 388253 from http://svn.asterisk.org/svn/asterisk/branches/11
  ........
  
  Merged revisions 388254 from file:///srv/subversion/repos/asterisk/trunk
........
  r388279 | root | 2013-05-10 08:18:03 -0500 (Fri, 10 May 2013) | 21 lines
  
  Add channel events for res_stasis apps
  
  This change adds a framework in res_stasis for handling events from
  channel topics. JSON event generation and validation code is created
  from event documentation in rest-api/api-docs/events.json to assist in
  JSON event generation, ensure consistency, and ensure that accurate
  documentation is available for ALL events that are received by
  res_stasis applications.
  
  The userevent application has been refactored along with the code that
  handles userevent channel blob events to pass the headers as key/value
  pairs in the JSON blob. As a side-effect, app_userevent now handles
  duplicate keys by overwriting the previous value.
  
  Review: https://reviewboard.asterisk.org/r/2428/
  (closes issue ASTERISK-21180)
  Patch-By: Kinsey Moore <kmoore at digium.com>
  ........
  
  Merged revisions 388275 from file:///srv/subversion/repos/asterisk/trunk
........
  r388326 | root | 2013-05-10 11:17:54 -0500 (Fri, 10 May 2013) | 6 lines
  
  Avoided __ast names for the private variables created by the 
  STASIS_MESSAGE_TYPE_*() macros.
  ........
  
  Merged revisions 388318 from file:///srv/subversion/repos/asterisk/trunk
........
  r388354 | root | 2013-05-10 12:18:04 -0500 (Fri, 10 May 2013) | 16 lines
  
  Address unload order issues for res_stasis* modules
  
  I've noticed when doing a graceful shutdown that the res_stasis_http.so
  module gets unloaded before the modules that use it, which causes some
  asserts during their unload.
  
  While r386928 was a quick hack to get it to not assert and die, this
  patch increases the use counts on res_stasis.so and res_stasis_http.so
  properly. It's a bigger change than I expected, hence the review instead
  of just committing it.
  
  Review: https://reviewboard.asterisk.org/r/2489/
  ........
  
  Merged revisions 388350 from file:///srv/subversion/repos/asterisk/trunk
........
  r388384 | root | 2013-05-10 16:17:54 -0500 (Fri, 10 May 2013) | 38 lines
  
  Multiple revisions 388375,388380
  
  ........
    r388375 | elguero | 2013-05-10 15:28:18 -0500 (Fri, 10 May 2013) | 11 lines
    
    Fix Finding Extensions With Patterns Using ODBC Realtime
    
    After the merge of support for the realtime sorcery module, extensions that
    contained a pattern were not being found through odbc realtime.  It was tracked
    down to this one line that was advancing to the next variable list before it
    should have been.  The removal of this one line fixes this.
    
    Tested this fix on my machine.
    
    Received confirmation that this is the right fix from file on IRC.
  ........
    r388380 | mmichelson | 2013-05-10 15:50:53 -0500 (Fri, 10 May 2013) | 17 lines
    
    Fix memory leak in pbx_dundi
    
    pbx_dundi added an io context without removing
    it. This caused a memory leak when the module was
    unloaded.
    
    (closes ASTERISK-21718)
    Reported by Corey Farrell
    Patches:
    	pbx_dundi-ast_io_remove.patch uploaded by Corey Farrell (License #5909)
    ........
    
    Merged revisions 388376 from http://svn.asterisk.org/svn/asterisk/branches/1.8
    ........
    
    Merged revisions 388378 from http://svn.asterisk.org/svn/asterisk/branches/11
  ........
  
  Merged revisions 388375,388380 from file:///srv/subversion/repos/asterisk/trunk
........
  r388431 | root | 2013-05-10 17:17:53 -0500 (Fri, 10 May 2013) | 27 lines
  
  Allow mISDN to send PROGRESS messsage.
  
  * Made isdn_msg_parser.c build a progress message with the mandatory
  progress indicator IE.  (The mISDNuser NT state machine rejected sending
  the incomplete message.)
  
  Note: The associated mISDN and mISDNuser patches respectively are viewable
  here:
  http://svnview.digium.com/svn/thirdparty?view=rev&rev=200
  http://svnview.digium.com/svn/thirdparty?view=rev&rev=201
  
  (closes issue AST-1153)
  Reported by: Guenther Kelleter
  Patches:
        progress-chan_misdn.diff (license #6372) patch uploaded by Guenther Kelleter
        progress-misdn.diff (license #6372) mISDN patch uploaded by Guenther Kelleter
        progress-misdnuser.diff (license #6372) mISDNuser patch uploaded by Guenther Kelleter
  ........
  
  Merged revisions 388425 from http://svn.asterisk.org/svn/asterisk/branches/1.8
  ........
  
  Merged revisions 388426 from http://svn.asterisk.org/svn/asterisk/branches/11
  ........
  
  Merged revisions 388427 from file:///srv/subversion/repos/asterisk/trunk
........
  r388472 | file | 2013-05-10 17:56:55 -0500 (Fri, 10 May 2013) | 4 lines
  
  Add inband DTMF detection for inbound media.
  
  Review: https://reviewboard.asterisk.org/r/2527/
........
  r388484 | root | 2013-05-13 10:18:39 -0500 (Mon, 13 May 2013) | 17 lines
  
  Fix SendText AMI action to never return non-zero.
  
  AMI actions must never return non-zero unless they intend to close the AMI
  connection.  (Which is almost never.)
  
  (closes issue ASTERISK-21779)
  Reported by: Paul Goldbaum
  ........
  
  Merged revisions 388477 from http://svn.asterisk.org/svn/asterisk/branches/1.8
  ........
  
  Merged revisions 388478 from http://svn.asterisk.org/svn/asterisk/branches/11
  ........
  
  Merged revisions 388479 from file:///srv/subversion/repos/asterisk/trunk
........
  r388524 | kmoore | 2013-05-13 11:43:17 -0500 (Mon, 13 May 2013) | 1 line
  
  Convert ast_log DEBUG messages to ast_debug
........
  r388535 | root | 2013-05-13 13:18:00 -0500 (Mon, 13 May 2013) | 1 line
  
  automerge cancel
........

Merged revisions 388019,388054,388082,388117,388171,388179,388257,388279,388326,388354,388384,388431,388472,388484,388524,388535 from http://svn.asterisk.org/svn/asterisk/team/group/pimp_my_sip

Added:
    team/qwell/fun_with_transports/rest-api-templates/event_function_decl.mustache
      - copied unchanged from r388535, team/group/pimp_my_sip/rest-api-templates/event_function_decl.mustache
Modified:
    team/qwell/fun_with_transports/   (props changed)
    team/qwell/fun_with_transports/CHANGES
    team/qwell/fun_with_transports/apps/app_directory.c
    team/qwell/fun_with_transports/apps/app_queue.c
    team/qwell/fun_with_transports/apps/app_stasis.c
    team/qwell/fun_with_transports/apps/app_userevent.c
    team/qwell/fun_with_transports/build_tools/cflags.xml
    team/qwell/fun_with_transports/channels/chan_gulp.c
    team/qwell/fun_with_transports/channels/chan_sip.c
    team/qwell/fun_with_transports/channels/misdn/isdn_msg_parser.c
    team/qwell/fun_with_transports/include/asterisk/inline_api.h
    team/qwell/fun_with_transports/include/asterisk/res_sip_session.h
    team/qwell/fun_with_transports/include/asterisk/stasis.h
    team/qwell/fun_with_transports/include/asterisk/stasis_app.h
    team/qwell/fun_with_transports/include/asterisk/stasis_channels.h
    team/qwell/fun_with_transports/main/channel.c
    team/qwell/fun_with_transports/main/enum.c
    team/qwell/fun_with_transports/main/loader.c
    team/qwell/fun_with_transports/main/manager.c
    team/qwell/fun_with_transports/main/manager_channels.c
    team/qwell/fun_with_transports/main/sdp_srtp.c
    team/qwell/fun_with_transports/main/srv.c
    team/qwell/fun_with_transports/main/stasis_channels.c
    team/qwell/fun_with_transports/pbx/pbx_dundi.c
    team/qwell/fun_with_transports/res/res_config_odbc.c
    team/qwell/fun_with_transports/res/res_rtp_asterisk.c
    team/qwell/fun_with_transports/res/res_sip_sdp_rtp.c
    team/qwell/fun_with_transports/res/res_sip_session.c
    team/qwell/fun_with_transports/res/res_stasis.c
    team/qwell/fun_with_transports/res/res_stasis_http.c
    team/qwell/fun_with_transports/res/res_stasis_http_asterisk.c
    team/qwell/fun_with_transports/res/res_stasis_http_bridges.c
    team/qwell/fun_with_transports/res/res_stasis_http_channels.c
    team/qwell/fun_with_transports/res/res_stasis_http_endpoints.c
    team/qwell/fun_with_transports/res/res_stasis_http_events.c
    team/qwell/fun_with_transports/res/res_stasis_http_playback.c
    team/qwell/fun_with_transports/res/res_stasis_http_recordings.c
    team/qwell/fun_with_transports/res/res_stasis_http_sounds.c
    team/qwell/fun_with_transports/res/res_stasis_websocket.c
    team/qwell/fun_with_transports/res/stasis_http/resource_endpoints.h
    team/qwell/fun_with_transports/res/stasis_http/resource_events.h
    team/qwell/fun_with_transports/res/stasis_http/resource_recordings.h
    team/qwell/fun_with_transports/res/stasis_http/resource_sounds.h
    team/qwell/fun_with_transports/rest-api-templates/asterisk_processor.py
    team/qwell/fun_with_transports/rest-api-templates/res_stasis_http_resource.c.mustache
    team/qwell/fun_with_transports/rest-api-templates/stasis_http_resource.h.mustache
    team/qwell/fun_with_transports/rest-api-templates/swagger_model.py
    team/qwell/fun_with_transports/rest-api/api-docs/events.json
    team/qwell/fun_with_transports/tests/test_res_stasis.c
    team/qwell/fun_with_transports/tests/test_stasis_channels.c
    team/qwell/fun_with_transports/tests/test_stasis_endpoints.c

Propchange: team/qwell/fun_with_transports/
------------------------------------------------------------------------------
Binary property 'branch-11-merged' - no diff available.

Propchange: team/qwell/fun_with_transports/
------------------------------------------------------------------------------
--- pimp_my_sip-integrated (original)
+++ pimp_my_sip-integrated Mon May 13 16:30:15 2013
@@ -1,1 +1,1 @@
-/team/group/pimp_my_sip:1-387997
+/team/group/pimp_my_sip:1-388639

Propchange: team/qwell/fun_with_transports/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Mon May 13 16:30:15 2013
@@ -1,1 +1,1 @@
-/trunk:1-387938
+/trunk:1-388483

Modified: team/qwell/fun_with_transports/CHANGES
URL: http://svnview.digium.com/svn/asterisk/team/qwell/fun_with_transports/CHANGES?view=diff&rev=388646&r1=388645&r2=388646
==============================================================================
--- team/qwell/fun_with_transports/CHANGES (original)
+++ team/qwell/fun_with_transports/CHANGES Mon May 13 16:30:15 2013
@@ -152,6 +152,12 @@
  * All future modules which utilize Sorcery for object persistence must have a
    column named "id" within their schema when using the Sorcery realtime module.
    This column must be able to contain a string of up to 128 characters in length.
+
+app_userevent
+------------------
+ * UserEvent will now handle duplicate keys by overwriting the previous value
+   assigned to the key. UserEvent invocations will also be distributed to any
+   interested res_stasis applications.
 
 ------------------------------------------------------------------------------
 --- Functionality changes from Asterisk 10 to Asterisk 11 --------------------

Modified: team/qwell/fun_with_transports/apps/app_directory.c
URL: http://svnview.digium.com/svn/asterisk/team/qwell/fun_with_transports/apps/app_directory.c?view=diff&rev=388646&r1=388645&r2=388646
==============================================================================
--- team/qwell/fun_with_transports/apps/app_directory.c (original)
+++ team/qwell/fun_with_transports/apps/app_directory.c Mon May 13 16:30:15 2013
@@ -440,7 +440,7 @@
 static struct ast_config *realtime_directory(char *context)
 {
 	struct ast_config *cfg;
-	struct ast_config *rtdata;
+	struct ast_config *rtdata = NULL;
 	struct ast_category *cat;
 	struct ast_variable *var;
 	char *mailbox;
@@ -475,7 +475,7 @@
 			rtdata = ast_load_realtime_multientry("voicemail", "mailbox LIKE", "%", "context", "default", SENTINEL);
 			context = "default";
 		}
-	} else {
+	} else if (!ast_strlen_zero(context)) {
 		rtdata = ast_load_realtime_multientry("voicemail", "mailbox LIKE", "%", "context", context, SENTINEL);
 	}
 

Modified: team/qwell/fun_with_transports/apps/app_queue.c
URL: http://svnview.digium.com/svn/asterisk/team/qwell/fun_with_transports/apps/app_queue.c?view=diff&rev=388646&r1=388645&r2=388646
==============================================================================
--- team/qwell/fun_with_transports/apps/app_queue.c (original)
+++ team/qwell/fun_with_transports/apps/app_queue.c Mon May 13 16:30:15 2013
@@ -9906,6 +9906,31 @@
 	if (reload_handler(0, &mask, NULL))
 		return AST_MODULE_LOAD_DECLINE;
 
+	ast_realtime_require_field("queue_members", "paused", RQ_INTEGER1, 1, "uniqueid", RQ_UINTEGER2, 5, SENTINEL);
+
+	/*
+	 * This section is used to determine which name for 'ringinuse' to use in realtime members
+	 * Necessary for supporting older setups.
+	 */
+	member_config = ast_load_realtime_multientry("queue_members", "interface LIKE", "%", "queue_name LIKE", "%", SENTINEL);
+	if (!member_config) {
+		realtime_ringinuse_field = "ringinuse";
+	} else {
+		const char *config_val;
+		if ((config_val = ast_variable_retrieve(member_config, NULL, "ringinuse"))) {
+			ast_log(LOG_NOTICE, "ringinuse field entries found in queue_members table. Using 'ringinuse'\n");
+			realtime_ringinuse_field = "ringinuse";
+		} else if ((config_val = ast_variable_retrieve(member_config, NULL, "ignorebusy"))) {
+			ast_log(LOG_NOTICE, "ignorebusy field found in queue_members table with no ringinuse field. Using 'ignorebusy'\n");
+			realtime_ringinuse_field = "ignorebusy";
+		} else {
+			ast_log(LOG_NOTICE, "No entries were found for ringinuse/ignorebusy in queue_members table. Using 'ringinuse'\n");
+			realtime_ringinuse_field = "ringinuse";
+		}
+	}
+
+	ast_config_destroy(member_config);
+
 	if (queue_persistent_members)
 		reload_queue_members();
 
@@ -9945,31 +9970,6 @@
 
 	ast_extension_state_add(NULL, NULL, extension_state_cb, NULL);
 
-	ast_realtime_require_field("queue_members", "paused", RQ_INTEGER1, 1, "uniqueid", RQ_UINTEGER2, 5, SENTINEL);
-
-	/*
-	 * This section is used to determine which name for 'ringinuse' to use in realtime members
-	 * Necessary for supporting older setups.
-	 */
-	member_config = ast_load_realtime_multientry("queue_members", "interface LIKE", "%", "queue_name LIKE", "%", SENTINEL);
-	if (!member_config) {
-		realtime_ringinuse_field = "ringinuse";
-	} else {
-		const char *config_val;
-		if ((config_val = ast_variable_retrieve(member_config, NULL, "ringinuse"))) {
-			ast_log(LOG_NOTICE, "ringinuse field entries found in queue_members table. Using 'ringinuse'\n");
-			realtime_ringinuse_field = "ringinuse";
-		} else if ((config_val = ast_variable_retrieve(member_config, NULL, "ignorebusy"))) {
-			ast_log(LOG_NOTICE, "ignorebusy field found in queue_members table with no ringinuse field. Using 'ignorebusy'\n");
-			realtime_ringinuse_field = "ignorebusy";
-		} else {
-			ast_log(LOG_NOTICE, "No entries were found for ringinuse/ignorebusy in queue_members table. Using 'ringinuse'\n");
-			realtime_ringinuse_field = "ringinuse";
-		}
-	}
-
-	ast_config_destroy(member_config);
-
 	return res ? AST_MODULE_LOAD_DECLINE : 0;
 }
 

Modified: team/qwell/fun_with_transports/apps/app_stasis.c
URL: http://svnview.digium.com/svn/asterisk/team/qwell/fun_with_transports/apps/app_stasis.c?view=diff&rev=388646&r1=388645&r2=388646
==============================================================================
--- team/qwell/fun_with_transports/apps/app_stasis.c (original)
+++ team/qwell/fun_with_transports/apps/app_stasis.c Mon May 13 16:30:15 2013
@@ -93,6 +93,7 @@
 {
 	int r = 0;
 
+	stasis_app_ref();
 	r |= ast_register_application_xml(stasis, app_exec);
 	return r;
 }
@@ -100,12 +101,15 @@
 static int unload_module(void)
 {
 	int r = 0;
-
 	r |= ast_unregister_application(stasis);
+	stasis_app_unref();
 	return r;
 }
 
-AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS,
-		"Stasis dialplan application",
-		.load = load_module,
-		.unload = unload_module);
+AST_MODULE_INFO(ASTERISK_GPL_KEY,
+	AST_MODFLAG_DEFAULT,
+	"Stasis dialplan application",
+	.load = load_module,
+	.unload = unload_module,
+	.nonoptreq = "res_stasis",
+	);

Modified: team/qwell/fun_with_transports/apps/app_userevent.c
URL: http://svnview.digium.com/svn/asterisk/team/qwell/fun_with_transports/apps/app_userevent.c?view=diff&rev=388646&r1=388645&r2=388646
==============================================================================
--- team/qwell/fun_with_transports/apps/app_userevent.c (original)
+++ team/qwell/fun_with_transports/apps/app_userevent.c Mon May 13 16:30:15 2013
@@ -39,23 +39,28 @@
 /*** DOCUMENTATION
 	<application name="UserEvent" language="en_US">
 		<synopsis>
-			Send an arbitrary event to the manager interface.
+			Send an arbitrary user-defined event to parties interested in a channel (AMI users and relevant res_stasis applications).
 		</synopsis>
 		<syntax>
 			<parameter name="eventname" required="true" />
 			<parameter name="body" />
 		</syntax>
 		<description>
-			<para>Sends an arbitrary event to the manager interface, with an optional
+			<para>Sends an arbitrary event to interested parties, with an optional
 			<replaceable>body</replaceable> representing additional arguments. The
 			<replaceable>body</replaceable> may be specified as
-			a <literal>,</literal> delimited list of headers. Each additional
-			argument will be placed on a new line in the event. The format of the
-			event will be:</para>
+			a <literal>,</literal> delimited list of key:value pairs.</para>
+			<para>For AMI, each additional argument will be placed on a new line in
+			the event and the format of the event will be:</para>
 			<para>    Event: UserEvent</para>
 			<para>    UserEvent: &lt;specified event name&gt;</para>
 			<para>    [body]</para>
-			<para>If no <replaceable>body</replaceable> is specified, only Event and UserEvent headers will be present.</para>
+			<para>If no <replaceable>body</replaceable> is specified, only Event and
+			UserEvent headers will be present.</para>
+			<para>For res_stasis applications, the event will be provided as a JSON
+			blob with additional arguments appearing as keys in the object and the
+			<replaceable>eventname</replaceable> under the
+			<literal>eventname</literal> key.</para>
 		</description>
 	</application>
  ***/
@@ -70,7 +75,6 @@
 		AST_APP_ARG(eventname);
 		AST_APP_ARG(extra)[100];
 	);
-	RAII_VAR(struct ast_str *, body, ast_str_create(16), ast_free);
 	RAII_VAR(struct ast_json *, blob, NULL, ast_json_unref);
 	RAII_VAR(struct stasis_message *, msg, NULL, ao2_cleanup);
 
@@ -79,29 +83,41 @@
 		return -1;
 	}
 
-	if (!body) {
-		ast_log(LOG_WARNING, "Unable to allocate buffer\n");
-		return -1;
-	}
-
 	parse = ast_strdupa(data);
 
 	AST_STANDARD_APP_ARGS(args, parse);
 
-	for (x = 0; x < args.argc - 1; x++) {
-		ast_str_append(&body, 0, "%s\r\n", args.extra[x]);
-	}
-
-	blob = ast_json_pack("{s: s, s: s, s: s}",
+	blob = ast_json_pack("{s: s, s: s}",
 			     "type", "userevent",
-			     "eventname", args.eventname,
-			     "body", ast_str_buffer(body));
+			     "eventname", args.eventname);
 	if (!blob) {
-		ast_log(LOG_WARNING, "Unable to create message buffer\n");
 		return -1;
 	}
 
-	msg = ast_channel_blob_create(chan, blob);
+	for (x = 0; x < args.argc - 1; x++) {
+		char *key, *value = args.extra[x];
+		struct ast_json *json_value;
+
+		key = strsep(&value, ":");
+		if (!value) {
+			/* no ':' in string? */
+			continue;
+		}
+
+		value = ast_strip(value);
+		json_value = ast_json_string_create(value);
+		if (!json_value) {
+			return -1;
+		}
+
+		/* ref stolen by ast_json_object_set */
+		if (ast_json_object_set(blob, key, json_value)) {
+			return -1;
+		}
+	}
+
+	msg = ast_channel_blob_create(
+		chan, ast_channel_user_event_type(), blob);
 	if (!msg) {
 		return -1;
 	}

Modified: team/qwell/fun_with_transports/build_tools/cflags.xml
URL: http://svnview.digium.com/svn/asterisk/team/qwell/fun_with_transports/build_tools/cflags.xml?view=diff&rev=388646&r1=388645&r2=388646
==============================================================================
--- team/qwell/fun_with_transports/build_tools/cflags.xml (original)
+++ team/qwell/fun_with_transports/build_tools/cflags.xml Mon May 13 16:30:15 2013
@@ -22,6 +22,12 @@
 			<support_level>extended</support_level>
 		</member>
 		<member name="LOW_MEMORY" displayname="Optimize for Low Memory Usage">
+			<support_level>extended</support_level>
+		</member>
+		<member name="DISABLE_INLINE" displayname="Disable the inline API">
+			<!-- Added to work around GCC bug
+			     See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47816
+			  -->
 			<support_level>extended</support_level>
 		</member>
 		<member name="BETTER_BACKTRACES" displayname="Use libbfd (GPL) to generate better inline backtraces">

Modified: team/qwell/fun_with_transports/channels/chan_gulp.c
URL: http://svnview.digium.com/svn/asterisk/team/qwell/fun_with_transports/channels/chan_gulp.c?view=diff&rev=388646&r1=388645&r2=388646
==============================================================================
--- team/qwell/fun_with_transports/channels/chan_gulp.c (original)
+++ team/qwell/fun_with_transports/channels/chan_gulp.c Mon May 13 16:30:15 2013
@@ -53,6 +53,7 @@
 #include "asterisk/musiconhold.h"
 #include "asterisk/causes.h"
 #include "asterisk/taskprocessor.h"
+#include "asterisk/dsp.h"
 
 #include "asterisk/res_sip.h"
 #include "asterisk/res_sip_session.h"
@@ -610,6 +611,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;
@@ -636,14 +638,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));
 		}
 	}
 

Modified: team/qwell/fun_with_transports/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/qwell/fun_with_transports/channels/chan_sip.c?view=diff&rev=388646&r1=388645&r2=388646
==============================================================================
--- team/qwell/fun_with_transports/channels/chan_sip.c (original)
+++ team/qwell/fun_with_transports/channels/chan_sip.c Mon May 13 16:30:15 2013
@@ -21695,7 +21695,7 @@
 					feat = ast_find_call_feature(p->relatedpeer->record_on_feature);
 				}
 			} else if (!strcasecmp(c, "off")) {
-				if (ast_strlen_zero(p->relatedpeer->record_on_feature)) {
+				if (ast_strlen_zero(p->relatedpeer->record_off_feature)) {
 					suppress_warning = 1;
 				} else {
 					feat = ast_find_call_feature(p->relatedpeer->record_off_feature);

Modified: team/qwell/fun_with_transports/channels/misdn/isdn_msg_parser.c
URL: http://svnview.digium.com/svn/asterisk/team/qwell/fun_with_transports/channels/misdn/isdn_msg_parser.c?view=diff&rev=388646&r1=388645&r2=388646
==============================================================================
--- team/qwell/fun_with_transports/channels/misdn/isdn_msg_parser.c (original)
+++ team/qwell/fun_with_transports/channels/misdn/isdn_msg_parser.c Mon May 13 16:30:15 2013
@@ -282,6 +282,8 @@
 	msg_t *msg =(msg_t*)create_l3msg(CC_PROGRESS | REQUEST, MT_PROGRESS,  bc?bc->l3_id:-1, sizeof(PROGRESS_t) ,nt);
 
 	progress=(PROGRESS_t*)((msg->data+HEADER_LEN));
+
+	enc_ie_progress(&progress->PROGRESS, msg, 0, nt ? 1 : 5, 8, nt, bc);
 
 	if (bc->fac_out.Function != Fac_None) {
 		enc_ie_facility(&progress->FACILITY, msg, &bc->fac_out, nt);

Modified: team/qwell/fun_with_transports/include/asterisk/inline_api.h
URL: http://svnview.digium.com/svn/asterisk/team/qwell/fun_with_transports/include/asterisk/inline_api.h?view=diff&rev=388646&r1=388645&r2=388646
==============================================================================
--- team/qwell/fun_with_transports/include/asterisk/inline_api.h (original)
+++ team/qwell/fun_with_transports/include/asterisk/inline_api.h Mon May 13 16:30:15 2013
@@ -43,7 +43,7 @@
   including the header file
  */
 
-#if !defined(LOW_MEMORY)
+#if !defined(LOW_MEMORY) && !defined(DISABLE_INLINE)
 
 #if !defined(AST_API_MODULE)
 #define AST_INLINE_API(hdr, body) hdr; extern inline hdr body

Modified: team/qwell/fun_with_transports/include/asterisk/res_sip_session.h
URL: http://svnview.digium.com/svn/asterisk/team/qwell/fun_with_transports/include/asterisk/res_sip_session.h?view=diff&rev=388646&r1=388645&r2=388646
==============================================================================
--- team/qwell/fun_with_transports/include/asterisk/res_sip_session.h (original)
+++ team/qwell/fun_with_transports/include/asterisk/res_sip_session.h Mon May 13 16:30:15 2013
@@ -43,6 +43,7 @@
 struct pjmedia_sdp_media;
 struct pjmedia_sdp_session;
 struct ast_rtp_instance;
+struct ast_dsp;
 
 struct ast_sip_session_sdp_handler;
 
@@ -107,6 +108,8 @@
 	struct ast_format_cap *req_caps;
 	/* Codecs overriden by dialplan on an outgoing request */
 	struct ast_codec_pref override_prefs;
+	/* Optional DSP, used only for inband DTMF detection if configured */
+	struct ast_dsp *dsp;
 };
 
 typedef int (*ast_sip_session_request_creation_cb)(struct ast_sip_session *session, pjsip_tx_data *tdata);

Modified: team/qwell/fun_with_transports/include/asterisk/stasis.h
URL: http://svnview.digium.com/svn/asterisk/team/qwell/fun_with_transports/include/asterisk/stasis.h?view=diff&rev=388646&r1=388645&r2=388646
==============================================================================
--- team/qwell/fun_with_transports/include/asterisk/stasis.h (original)
+++ team/qwell/fun_with_transports/include/asterisk/stasis.h Mon May 13 16:30:15 2013
@@ -543,6 +543,43 @@
 /*! @{ */
 
 /*!
+ * \brief Boiler-plate removing macro for defining message types.
+ *
+ * \param name Name of message type.
+ * \since 12
+ */
+#define STASIS_MESSAGE_TYPE_DEFN(name)				\
+	static struct stasis_message_type *_priv_ ## name;	\
+	struct stasis_message_type *name(void) {		\
+		ast_assert(_priv_ ## name != NULL);		\
+		return _priv_ ## name;				\
+	}
+
+/*!
+ * \brief Boiler-plate removing macro for initializing message types.
+ *
+ * \param name Name of message type.
+ * \return 0 if initialization is successful.
+ * \return Non-zero on failure.
+ * \since 12
+ */
+#define STASIS_MESSAGE_TYPE_INIT(name)					\
+	({								\
+		_priv_ ## name = stasis_message_type_create(#name);	\
+			_priv_ ## name ? 0 : -1;			\
+	})
+
+#define STASIS_MESSAGE_TYPE_CLEANUP(name)	\
+	({					\
+		ao2_cleanup(_priv_ ## name);	\
+		_priv_ ## name = NULL;		\
+	})
+
+/*! @} */
+
+/*! @{ */
+
+/*!
  * \brief Initialize the Stasis subsystem
  * \return 0 on success.
  * \return Non-zero on error.

Modified: team/qwell/fun_with_transports/include/asterisk/stasis_app.h
URL: http://svnview.digium.com/svn/asterisk/team/qwell/fun_with_transports/include/asterisk/stasis_app.h?view=diff&rev=388646&r1=388645&r2=388646
==============================================================================
--- team/qwell/fun_with_transports/include/asterisk/stasis_app.h (original)
+++ team/qwell/fun_with_transports/include/asterisk/stasis_app.h Mon May 13 16:30:15 2013
@@ -44,6 +44,10 @@
  * Finally, Stasis apps control channels through the use of the \ref
  * stasis_app_control object, and the family of \c stasis_app_control_*
  * functions.
+ *
+ * Since module unload order is based on reference counting, any module that
+ * uses the API defined in this file must call stasis_app_ref() when loaded,
+ * and stasis_app_unref() when unloaded.
  */
 
 #include "asterisk/channel.h"
@@ -171,6 +175,20 @@
  */
 struct ast_json *ast_channel_snapshot_to_json(const struct ast_channel_snapshot *snapshot);
 
+/*!
+ * \brief Increment the res_stasis reference count.
+ *
+ * This ensures graceful shutdown happens in the proper order.
+ */
+void stasis_app_ref(void);
+
+/*!
+ * \brief Decrement the res_stasis reference count.
+ *
+ * This ensures graceful shutdown happens in the proper order.
+ */
+void stasis_app_unref(void);
+
 /*! @} */
 
 #endif /* _ASTERISK_STASIS_APP_H */

Modified: team/qwell/fun_with_transports/include/asterisk/stasis_channels.h
URL: http://svnview.digium.com/svn/asterisk/team/qwell/fun_with_transports/include/asterisk/stasis_channels.h?view=diff&rev=388646&r1=388645&r2=388646
==============================================================================
--- team/qwell/fun_with_transports/include/asterisk/stasis_channels.h (original)
+++ team/qwell/fun_with_transports/include/asterisk/stasis_channels.h Mon May 13 16:30:15 2013
@@ -70,8 +70,7 @@
  * \since 12
  * \brief Blob of data associated with a channel.
  *
- * The \c blob is actually a JSON object of structured data. It has a "type" field
- * which contains the type string describing this blob.
+ * This blob is actually shared amongst several \ref stasis_message_type's.
  */
 struct ast_channel_blob {
 	/*! Channel blob is associated with (or NULL for global/all channels) */
@@ -112,14 +111,6 @@
 
 /*!
  * \since 12
- * \brief Message type for \ref ast_channel_blob messages.
- *
- * \retval Message type for \ref ast_channel_blob messages.
- */
-struct stasis_message_type *ast_channel_blob_type(void);
-
-/*!
- * \since 12
  * \brief Generate a snapshot of the channel state. This is an ao2 object, so
  * ao2_cleanup() to deallocate.
  *
@@ -128,44 +119,35 @@
  * \retval pointer on success (must be ast_freed)
  * \retval NULL on error
  */
-struct ast_channel_snapshot *ast_channel_snapshot_create(struct ast_channel *chan);
+struct ast_channel_snapshot *ast_channel_snapshot_create(
+	struct ast_channel *chan);
 
 /*!
  * \since 12
  * \brief Creates a \ref ast_channel_blob message.
  *
- * The \a blob JSON object requires a \c "type" field describing the blob. It
- * should also be treated as immutable and not modified after it is put into the
- * message.
- *
- * \param chan Channel blob is associated with, or NULL for global/all channels.
- * \param blob JSON object representing the data.
+ * The given \a blob should be treated as immutable and not modified after it is
+ * put into the message.
+ *
+ * \param chan Channel blob is associated with, or \c NULL for global/all channels.
+ * \param type Message type for this blob.
+ * \param blob JSON object representing the data, or \c NULL for no data. If
+ *             \c NULL, ast_json_null() is put into the object.
+ *
  * \return \ref ast_channel_blob message.
  * \return \c NULL on error
  */
 struct stasis_message *ast_channel_blob_create(struct ast_channel *chan,
-					       struct ast_json *blob);
-
-/*!
- * \since 12
- * \brief Extracts the type field from a \ref ast_channel_blob.
- * Returned \c char* is still owned by \a obj
- * \param obj Channel blob object.
- * \return Type field value from the blob.
- * \return \c NULL on error.
- */
-const char *ast_channel_blob_json_type(struct ast_channel_blob *obj);
-
-/*!
- * \since 12
- * \brief Create a \ref ast_multi_channel_blob suitable for a \ref stasis_message
- *

[... 3816 lines stripped ...]



More information about the asterisk-commits mailing list