[asterisk-commits] kharwell: branch kharwell/pimp_sip_media_neg r386134 - in /team/kharwell/pimp...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Apr 19 11:41:21 CDT 2013


Author: kharwell
Date: Fri Apr 19 11:41:13 2013
New Revision: 386134

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=386134
Log:
Multiple revisions 385684,385721,385748,385790,385837,385864,385866,385890,385941,385967,386022,386056

........
  r385684 | file | 2013-04-15 09:40:11 -0500 (Mon, 15 Apr 2013) | 2 lines
  
  Fix a deadlock due to queueing a frame from a threadpool thread while holding the channel lock in another thread.
........
  r385721 | root | 2013-04-15 11:17:41 -0500 (Mon, 15 Apr 2013) | 15 lines
  
  Fix the svn:keywords property on several files.
  
  Normally I think keyword expansion is silly, but the one time it would have
  been good, it didn't work because the property had quotes in it. This patch
  fixes obviously busted svn:keywords properties.
  ........
  
  Merged revisions 385683 from http://svn.asterisk.org/svn/asterisk/branches/1.8
  ........
  
  Merged revisions 385689 from http://svn.asterisk.org/svn/asterisk/branches/11
  ........
  
  Merged revisions 385718 from file:///srv/subversion/repos/asterisk/trunk
........
  r385748 | root | 2013-04-15 12:17:45 -0500 (Mon, 15 Apr 2013) | 50 lines
  
  Multiple revisions 385734,385742-385743
  
  ........
    r385734 | dlee | 2013-04-15 11:22:03 -0500 (Mon, 15 Apr 2013) | 16 lines
    
    DTMF events are now published on a channel's stasis_topic. AMI was
    refactored to use these events rather than producing the events directly
    in channel.c. Finally, the code was added to app_stasis to produce
    DTMF events on the WebSocket.
    
    The AMI events are completely backward compatible, including sending
    events on transmitted DTMF, and sending DTMF start events.
    
    The Stasis-HTTP events are somewhat simplified. Since DTMF start and
    DTMF send events are generally less useful, Stasis-HTTP will only send
    events on received DTMF end.
    
    (closes issue ASTERISK-21282)
    (closes issue ASTERISK-21359)
    Review: https://reviewboard.asterisk.org/r/2439
  ........
    r385742 | dlee | 2013-04-15 11:43:47 -0500 (Mon, 15 Apr 2013) | 20 lines
    
    Moved core logic from app_stasis to res_stasis
    
    After some discussion on asterisk-dev, it was decided that the bulk of
    the logic in app_stasis actually belongs in a resource module instead
    of the application module.
    
    This patch does that, leaves the app specific stuff in app_stasis, and
    fixes up everything else to be consistent with that change.
    
     * Renamed test_app_stasis to test_res_stasis
     * Renamed app_stasis.h to stasis_app.h
       * This is still stasis application support, even though it's no
         longer in an app_ module. The name should never have been tied to
         the type of module, anyways.
     * Now that json isn't a resource module anymore, moved the
       ast_channel_snapshot_to_json function to main/stasis_channels.c,
       where it makes more sense.
    
    Review: https://reviewboard.asterisk.org/r/2430/
  ........
    r385743 | dlee | 2013-04-15 11:47:25 -0500 (Mon, 15 Apr 2013) | 1 line
    
    Avoid unused variable warning when not in devmode
  ........
  
  Merged revisions 385734,385742-385743 from file:///srv/subversion/repos/asterisk/trunk
........
  r385790 | root | 2013-04-15 13:17:38 -0500 (Mon, 15 Apr 2013) | 13 lines
  
  Don't unnecessarily rebuild things on every run of 'make'.
  
  Review: https://reviewboard.asterisk.org/r/2449/
  ........
  
  Merged revisions 385745 from http://svn.asterisk.org/svn/asterisk/branches/1.8
  ........
  
  Merged revisions 385768 from http://svn.asterisk.org/svn/asterisk/branches/11
  ........
  
  Merged revisions 385782 from file:///srv/subversion/repos/asterisk/trunk
........
  r385837 | root | 2013-04-16 09:17:55 -0500 (Tue, 16 Apr 2013) | 5 lines
  
  Fixed a typo
  ........
  
  Merged revisions 385835 from file:///srv/subversion/repos/asterisk/trunk
........
  r385864 | kharwell | 2013-04-16 10:53:45 -0500 (Tue, 16 Apr 2013) | 1 line
  
  Modified the fast fast picture update request handler to always send through the session (using ast_sip_session_send_request instead of ast_sip_send_request)
........
  r385866 | root | 2013-04-16 11:17:46 -0500 (Tue, 16 Apr 2013) | 31 lines
  
  Multiple revisions 385860,385862
  
  ........
    r385860 | kmoore | 2013-04-16 10:33:59 -0500 (Tue, 16 Apr 2013) | 12 lines
    
    Move device state distribution to Stasis-core
    
    In the move from Asterisk's event system to Stasis, this makes
    distributed device state aggregation always-on, removes unnecessary
    task processors where possible, and collapses aggregate and
    non-aggregate states into a single cache for ease of retrieval. This
    also removes an intermediary step in device state aggregation.
    
    Review: https://reviewboard.asterisk.org/r/2389/
    (closes issue ASTERISK-21101)
    Patch-by: Kinsey Moore <kmoore at digium.com>
  ........
    r385862 | kmoore | 2013-04-16 10:48:16 -0500 (Tue, 16 Apr 2013) | 9 lines
    
    Move presence state distribution to Stasis-core
    
    Convert presence state events to Stasis-core messages and remove
    redundant serializers where possible.
    
    Review: https://reviewboard.asterisk.org/r/2410/
    (closes issue ASTERISK-21102)
    Patch-by: Kinsey Moore <kmoore at digium.com>
  ........
  
  Merged revisions 385860,385862 from file:///srv/subversion/repos/asterisk/trunk
........
  r385890 | root | 2013-04-16 13:17:38 -0500 (Tue, 16 Apr 2013) | 8 lines
  
  Allow res_corosync to build
  
  ast_enable_distributed_devstate is no longer applicable to how the
  distributed device state system works and is no longer necessary.
  ........
  
  Merged revisions 385886 from file:///srv/subversion/repos/asterisk/trunk
........
  r385941 | root | 2013-04-16 19:17:37 -0500 (Tue, 16 Apr 2013) | 16 lines
  
  res_xmpp and res_jabber need to search 'cachable' in the attrib section of the received IE, not data.
  
  (issue ASTERISK-20175)
  (closes issue ASTERISK-21429)
  (closes issue ASTERISK-21069)
  (closes issue ASTERISK-21164)
  
  Reported by: alecdavis
  Tested by: alecdavis
  alecdavis (license 585)
  
  Review https://reviewboard.asterisk.org/r/2452/
  ........
  
  Merged revisions 385939 from file:///srv/subversion/repos/asterisk/trunk
........
  r385967 | mmichelson | 2013-04-17 10:32:57 -0500 (Wed, 17 Apr 2013) | 11 lines
  
  This adds support for outbound authentication for outbound registrations.
  
  In order to facilitate the change, the outbound authentication API had to
  be modified not to be dependent on endpoints but rather to be given the
  names of auth IDs in sorcery to use. This way, outbound registration
  can be configured to point to an auth section in the configuration the
  same way that endpoints do.
  
  Review: https://reviewboard.asterisk.org/r/2431
........
  r386022 | root | 2013-04-18 13:17:43 -0500 (Thu, 18 Apr 2013) | 39 lines
  
  Multiple revisions 386019-386020
  
  ........
    r386019 | dlee | 2013-04-18 12:26:29 -0500 (Thu, 18 Apr 2013) | 17 lines
    
    Fix lock errors on startup.
    
    In messages.c, there are several places in the code where we create a
    tmp_tech_holder and pass that into an ao2_find call. Unfortunately, we
    weren't initializing the rwlock on the tmp_tech_holder, which the hash
    function was locking. It's apparently harmless, but still not the best
    code.
    
    This patch extracts all that copy/pasted code into two functions,
    msg_find_by_tech and msg_find_by_tech_name, which properly initialize
    and destroy the rwlock on the tmp_tech_holder.
    
    Review: https://reviewboard.asterisk.org/r/2454/
    ........
    
    Merged revisions 386006 from http://svn.asterisk.org/svn/asterisk/branches/11
  ........
    r386020 | dlee | 2013-04-18 12:30:28 -0500 (Thu, 18 Apr 2013) | 12 lines
    
    Allow WebSocket connections on more URL's
    
    This patch adds the concept of ast_websocket_server to
    res_http_websocket, allowing WebSocket connections on URL's more more
    than /ws.
    
    The existing funcitons for managing the WebSocket subprotocols on /ws
    still work, so this patch should be completely backward compatible.
    
    (closes issue ASTERISK-21279)
    Review: https://reviewboard.asterisk.org/r/2453/
  ........
  
  Merged revisions 386019-386020 from file:///srv/subversion/repos/asterisk/trunk
........
  r386056 | root | 2013-04-19 01:17:38 -0500 (Fri, 19 Apr 2013) | 13 lines
  
  cli.c: Properly initialize debug_modules and verbose_modules.
  
  This avoids some lock errors on the core set {debug,verbose} commands.
  ........
  
  Merged revisions 386049 from http://svn.asterisk.org/svn/asterisk/branches/1.8
  ........
  
  Merged revisions 386051 from http://svn.asterisk.org/svn/asterisk/branches/11
  ........
  
  Merged revisions 386054 from file:///srv/subversion/repos/asterisk/trunk
........

Merged revisions 385684,385721,385748,385790,385837,385864,385866,385890,385941,385967,386022,386056 from http://svn.asterisk.org/svn/asterisk/team/group/pimp_my_sip

Added:
    team/kharwell/pimp_sip_media_neg/include/asterisk/stasis_app.h
      - copied unchanged from r386056, team/group/pimp_my_sip/include/asterisk/stasis_app.h
    team/kharwell/pimp_sip_media_neg/res/res_stasis.c
      - copied unchanged from r386056, team/group/pimp_my_sip/res/res_stasis.c
    team/kharwell/pimp_sip_media_neg/res/res_stasis.exports.in
      - copied unchanged from r386056, team/group/pimp_my_sip/res/res_stasis.exports.in
    team/kharwell/pimp_sip_media_neg/tests/test_res_stasis.c
      - copied unchanged from r386056, team/group/pimp_my_sip/tests/test_res_stasis.c
Removed:
    team/kharwell/pimp_sip_media_neg/apps/app_stasis.exports.in
    team/kharwell/pimp_sip_media_neg/apps/stasis_json.c
    team/kharwell/pimp_sip_media_neg/include/asterisk/app_stasis.h
    team/kharwell/pimp_sip_media_neg/tests/test_app_stasis.c
Modified:
    team/kharwell/pimp_sip_media_neg/   (props changed)
    team/kharwell/pimp_sip_media_neg/BSDmakefile   (props changed)
    team/kharwell/pimp_sip_media_neg/Makefile
    team/kharwell/pimp_sip_media_neg/apps/Makefile
    team/kharwell/pimp_sip_media_neg/apps/app_queue.c
    team/kharwell/pimp_sip_media_neg/apps/app_saycounted.c   (props changed)
    team/kharwell/pimp_sip_media_neg/apps/app_stasis.c
    team/kharwell/pimp_sip_media_neg/build_tools/sha1sum-sh   (props changed)
    team/kharwell/pimp_sip_media_neg/channels/chan_gulp.c
    team/kharwell/pimp_sip_media_neg/channels/chan_multicast_rtp.c   (props changed)
    team/kharwell/pimp_sip_media_neg/channels/sig_ss7.c   (props changed)
    team/kharwell/pimp_sip_media_neg/channels/sig_ss7.h   (props changed)
    team/kharwell/pimp_sip_media_neg/channels/sip/include/security_events.h   (props changed)
    team/kharwell/pimp_sip_media_neg/channels/sip/security_events.c   (props changed)
    team/kharwell/pimp_sip_media_neg/configs/res_curl.conf.sample   (props changed)
    team/kharwell/pimp_sip_media_neg/contrib/realtime/mysql/musiconhold.sql   (props changed)
    team/kharwell/pimp_sip_media_neg/contrib/realtime/mysql/queue_log.sql   (props changed)
    team/kharwell/pimp_sip_media_neg/contrib/realtime/mysql/voicemail_data.sql   (props changed)
    team/kharwell/pimp_sip_media_neg/contrib/realtime/mysql/voicemail_messages.sql   (props changed)
    team/kharwell/pimp_sip_media_neg/doc/Makefile   (props changed)
    team/kharwell/pimp_sip_media_neg/funcs/func_presencestate.c
    team/kharwell/pimp_sip_media_neg/include/asterisk/bridging_features.h   (props changed)
    team/kharwell/pimp_sip_media_neg/include/asterisk/bridging_technology.h   (props changed)
    team/kharwell/pimp_sip_media_neg/include/asterisk/cli.h
    team/kharwell/pimp_sip_media_neg/include/asterisk/devicestate.h
    team/kharwell/pimp_sip_media_neg/include/asterisk/http_websocket.h
    team/kharwell/pimp_sip_media_neg/include/asterisk/json.h
    team/kharwell/pimp_sip_media_neg/include/asterisk/presencestate.h
    team/kharwell/pimp_sip_media_neg/include/asterisk/res_sip.h
    team/kharwell/pimp_sip_media_neg/include/asterisk/select.h   (props changed)
    team/kharwell/pimp_sip_media_neg/include/asterisk/stasis_channels.h
    team/kharwell/pimp_sip_media_neg/include/asterisk/strings.h
    team/kharwell/pimp_sip_media_neg/include/asterisk/xmpp.h
    team/kharwell/pimp_sip_media_neg/main/asterisk.c
    team/kharwell/pimp_sip_media_neg/main/ccss.c
    team/kharwell/pimp_sip_media_neg/main/channel.c
    team/kharwell/pimp_sip_media_neg/main/cli.c
    team/kharwell/pimp_sip_media_neg/main/devicestate.c
    team/kharwell/pimp_sip_media_neg/main/json.c
    team/kharwell/pimp_sip_media_neg/main/manager_channels.c
    team/kharwell/pimp_sip_media_neg/main/message.c
    team/kharwell/pimp_sip_media_neg/main/pbx.c
    team/kharwell/pimp_sip_media_neg/main/presencestate.c
    team/kharwell/pimp_sip_media_neg/main/stasis_channels.c
    team/kharwell/pimp_sip_media_neg/res/res_corosync.c
    team/kharwell/pimp_sip_media_neg/res/res_http_websocket.c
    team/kharwell/pimp_sip_media_neg/res/res_jabber.c
    team/kharwell/pimp_sip_media_neg/res/res_mutestream.c   (contents, props changed)
    team/kharwell/pimp_sip_media_neg/res/res_rtp_multicast.c   (props changed)
    team/kharwell/pimp_sip_media_neg/res/res_sip.c
    team/kharwell/pimp_sip_media_neg/res/res_sip.exports.in
    team/kharwell/pimp_sip_media_neg/res/res_sip/sip_outbound_auth.c
    team/kharwell/pimp_sip_media_neg/res/res_sip_outbound_authenticator_digest.c
    team/kharwell/pimp_sip_media_neg/res/res_sip_outbound_registration.c
    team/kharwell/pimp_sip_media_neg/res/res_stasis_websocket.c
    team/kharwell/pimp_sip_media_neg/res/res_timing_kqueue.c   (props changed)
    team/kharwell/pimp_sip_media_neg/res/res_xmpp.c
    team/kharwell/pimp_sip_media_neg/tests/test_devicestate.c
    team/kharwell/pimp_sip_media_neg/tests/test_expr.c   (props changed)
    team/kharwell/pimp_sip_media_neg/tests/test_func_file.c   (props changed)
    team/kharwell/pimp_sip_media_neg/tests/test_json.c
    team/kharwell/pimp_sip_media_neg/tests/test_locale.c   (props changed)
    team/kharwell/pimp_sip_media_neg/tests/test_poll.c   (props changed)
    team/kharwell/pimp_sip_media_neg/tests/test_stasis_channels.c

Propchange: team/kharwell/pimp_sip_media_neg/
------------------------------------------------------------------------------
    automerge = *

Propchange: team/kharwell/pimp_sip_media_neg/
------------------------------------------------------------------------------
Binary property 'branch-11-merged' - no diff available.

Propchange: team/kharwell/pimp_sip_media_neg/
------------------------------------------------------------------------------
--- pimp_sip_media_neg-integrated (original)
+++ pimp_sip_media_neg-integrated Fri Apr 19 11:41:13 2013
@@ -1,1 +1,1 @@
-/team/group/pimp_my_sip:1-385642
+/team/group/pimp_my_sip:1-386129

Propchange: team/kharwell/pimp_sip_media_neg/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Fri Apr 19 11:41:13 2013
@@ -1,1 +1,1 @@
-/trunk:1-385639
+/trunk:1-386055

Propchange: team/kharwell/pimp_sip_media_neg/BSDmakefile
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Fri Apr 19 11:41:13 2013
@@ -1,1 +1,1 @@
-'Date Author Id Revision Yoyo'
+Author Date Id Revision

Modified: team/kharwell/pimp_sip_media_neg/Makefile
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/pimp_sip_media_neg/Makefile?view=diff&rev=386134&r1=386133&r2=386134
==============================================================================
--- team/kharwell/pimp_sip_media_neg/Makefile (original)
+++ team/kharwell/pimp_sip_media_neg/Makefile Fri Apr 19 11:41:13 2013
@@ -356,7 +356,7 @@
 	+@$(SUBMAKE) $(MOD_SUBDIRS_EMBED_LDFLAGS)
 	+@$(SUBMAKE) $(MOD_SUBDIRS_EMBED_LIBS)
 
-$(SUBDIRS): makeopts cleantest main/version.c include/asterisk/build.h include/asterisk/buildopts.h defaults.h makeopts.embed_rules
+$(SUBDIRS): makeopts .lastclean main/version.c include/asterisk/build.h include/asterisk/buildopts.h defaults.h makeopts.embed_rules
 
 ifeq ($(findstring $(OSARCH), mingw32 cygwin ),)
     # Non-windows:
@@ -382,26 +382,25 @@
 $(OTHER_SUBDIRS): makeopts
 	+ at _ASTCFLAGS="$(OTHER_SUBDIR_CFLAGS) $(_ASTCFLAGS)" ASTCFLAGS="$(ASTCFLAGS)" _ASTLDFLAGS="$(_ASTLDFLAGS)" ASTLDFLAGS="$(ASTLDFLAGS)" $(SUBMAKE) --no-builtin-rules -C $@ SUBDIR=$@ all
 
-defaults.h: makeopts cleantest build_tools/make_defaults_h
+defaults.h: makeopts .lastclean build_tools/make_defaults_h
 	@build_tools/make_defaults_h > $@.tmp
 	@cmp -s $@.tmp $@ || mv $@.tmp $@
 	@rm -f $@.tmp
 
-main/version.c: FORCE cleantest
+main/version.c: FORCE .lastclean
 	@build_tools/make_version_c > $@.tmp
 	@cmp -s $@.tmp $@ || mv $@.tmp $@
 	@rm -f $@.tmp
 
-include/asterisk/buildopts.h: menuselect.makeopts cleantest
+include/asterisk/buildopts.h: menuselect.makeopts .lastclean
 	@build_tools/make_buildopts_h > $@.tmp
 	@cmp -s $@.tmp $@ || mv $@.tmp $@
 	@rm -f $@.tmp
 
-# build.h must depend on cleantest, or parallel make may wipe it out after it's
-# been created. But since build.h contains a timestamp, the cmp trick used above
-# won't work. Just testing for existence is good enough.
-include/asterisk/build.h: cleantest
-	@test -f $@ || build_tools/make_build_h > $@
+# build.h must depend on .lastclean, or parallel make may wipe it out after it's
+# been created.
+include/asterisk/build.h: .lastclean
+	@build_tools/make_build_h > $@
 
 $(SUBDIRS_CLEAN):
 	+@$(SUBMAKE) -C $(@:-clean=) clean
@@ -459,7 +458,7 @@
   XML_core_en_US = $(foreach dir,$(MOD_SUBDIRS),$(shell $(GREP) -l "language=\"en_US\"" $(dir)/*.c $(dir)/*.cc 2>/dev/null))
 endif
 
-doc/core-en_US.xml: makeopts cleantest $(XML_core_en_US)
+doc/core-en_US.xml: makeopts .lastclean $(XML_core_en_US)
 	@printf "Building Documentation For: "
 	@echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" > $@
 	@echo "<!DOCTYPE docs SYSTEM \"appdocsxml.dtd\">" >> $@
@@ -477,7 +476,7 @@
   XMX_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 cleantest $(XML_full_en_US)
+doc/full-en_US.xml: makeopts .lastclean $(XML_full_en_US)
 ifeq ($(PYTHON),:)
 	@echo "--------------------------------------------------------------------------"
 	@echo "---        Please install python to build full documentation           ---"
@@ -848,8 +847,8 @@
 # .cleancount is the global clean count, and .lastclean is the
 # last clean count we had
 
-cleantest:
-	@cmp -s .cleancount .lastclean || $(MAKE) clean
+.lastclean: .cleancount
+	@$(MAKE) clean
 	@[ -f "$(DESTDIR)$(ASTDBDIR)/astdb.sqlite3" ] || [ ! -f "$(DESTDIR)$(ASTDBDIR)/astdb" ] || [ ! -f menuselect.makeopts ] || grep -q MENUSELECT_UTILS=.*astdb2sqlite3 menuselect.makeopts || (sed -i.orig -e's/MENUSELECT_UTILS=\(.*\)/MENUSELECT_UTILS=\1 astdb2sqlite3/' menuselect.makeopts && echo "Updating menuselect.makeopts to include astdb2sqlite3" && echo "Original version backed up to menuselect.makeopts.orig")
 
 $(SUBDIRS_UNINSTALL):
@@ -927,19 +926,19 @@
 		CFLAGS="$(BUILD_CFLAGS)" LDFLAGS="$(BUILD_LDFLAGS)" \
 		$(MAKE) -C menuselect CONFIGURE_SILENT="--silent"
 
-menuselect/menuselect: menuselect/makeopts cleantest
+menuselect/menuselect: menuselect/makeopts .lastclean
 	+$(MAKE_MENUSELECT) menuselect
 
-menuselect/cmenuselect: menuselect/makeopts cleantest
+menuselect/cmenuselect: menuselect/makeopts .lastclean
 	+$(MAKE_MENUSELECT) cmenuselect
 
-menuselect/gmenuselect: menuselect/makeopts cleantest
+menuselect/gmenuselect: menuselect/makeopts .lastclean
 	+$(MAKE_MENUSELECT) gmenuselect
 
-menuselect/nmenuselect: menuselect/makeopts cleantest
+menuselect/nmenuselect: menuselect/makeopts .lastclean
 	+$(MAKE_MENUSELECT) nmenuselect
 
-menuselect/makeopts: makeopts cleantest
+menuselect/makeopts: makeopts .lastclean
 	+$(MAKE_MENUSELECT) makeopts
 
 menuselect-tree: $(foreach dir,$(filter-out main,$(MOD_SUBDIRS)),$(wildcard $(dir)/*.c) $(wildcard $(dir)/*.cc)) build_tools/cflags.xml build_tools/cflags-devmode.xml sounds/sounds.xml build_tools/embed_modules.xml utils/utils.xml agi/agi.xml configure makeopts
@@ -970,7 +969,6 @@
 .PHONY: full
 .PHONY: _full
 .PHONY: prereqs
-.PHONY: cleantest
 .PHONY: uninstall
 .PHONY: _uninstall
 .PHONY: uninstall-all

Modified: team/kharwell/pimp_sip_media_neg/apps/Makefile
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/pimp_sip_media_neg/apps/Makefile?view=diff&rev=386134&r1=386133&r2=386134
==============================================================================
--- team/kharwell/pimp_sip_media_neg/apps/Makefile (original)
+++ team/kharwell/pimp_sip_media_neg/apps/Makefile Fri Apr 19 11:41:13 2013
@@ -37,5 +37,3 @@
   LIBS+= -lres_features.so -lres_ael_share.so -lres_monitor.so -lres_speech.so
   LIBS+= -lres_smdi.so
 endif
-
-app_stasis.so: stasis_json.o

Modified: team/kharwell/pimp_sip_media_neg/apps/app_queue.c
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/pimp_sip_media_neg/apps/app_queue.c?view=diff&rev=386134&r1=386133&r2=386134
==============================================================================
--- team/kharwell/pimp_sip_media_neg/apps/app_queue.c (original)
+++ team/kharwell/pimp_sip_media_neg/apps/app_queue.c Fri Apr 19 11:41:13 2013
@@ -990,9 +990,6 @@
 	{ QUEUE_AUTOPAUSE_ALL,"all" },
 };
 
-
-static struct ast_taskprocessor *devicestate_tps;
-
 #define DEFAULT_RETRY		5
 #define DEFAULT_TIMEOUT		15
 #define RECHECK			1		/*!< Recheck every second to see we we're at the top yet */
@@ -1037,8 +1034,8 @@
 /*! \brief queues.conf [general] option */
 static int shared_lastcall = 1;
 
-/*! \brief Subscription to device state change events */
-static struct ast_event_sub *device_state_sub;
+/*! \brief Subscription to device state change messages */
+static struct stasis_subscription *device_state_sub;
 
 /*! \brief queues.conf [general] option */
 static int update_cdr = 0;
@@ -1618,12 +1615,6 @@
 	return -1;
 }
 
-struct statechange {
-	AST_LIST_ENTRY(statechange) entry;
-	int state;
-	char dev[0];
-};
-
 /*! \brief set a member's status based on device state of that member's state_interface.
  *
  * Lock interface list find sc, iterate through each queues queue_member list for member to
@@ -1742,10 +1733,10 @@
 }
 
 /*! \brief set a member's status based on device state of that member's interface*/
-static int handle_statechange(void *datap)
-{
-	struct statechange *sc = datap;
+static void device_state_cb(void *unused, struct stasis_subscription *sub, struct stasis_topic *topic, struct stasis_message *msg)
+{
 	struct ao2_iterator miter, qiter;
+	struct ast_device_state_message *dev_state;
 	struct member *m;
 	struct call_queue *q;
 	char interface[80], *slash_pos;
@@ -1753,6 +1744,16 @@
 	int found_member;		/* Found this member in this queue */
 	int avail = 0;			/* Found an available member in this queue */
 
+	if (ast_device_state_message_type() != stasis_message_type(msg)) {
+		return;
+	}
+
+	dev_state = stasis_message_data(msg);
+	if (dev_state->eid) {
+		/* ignore non-aggregate states */
+		return;
+	}
+
 	qiter = ao2_iterator_init(queues, 0);
 	while ((q = ao2_t_iterator_next(&qiter, "Iterate over queues"))) {
 		ao2_lock(q);
@@ -1770,9 +1771,9 @@
 					}
 				}
 
-				if (!strcasecmp(interface, sc->dev)) {
+				if (!strcasecmp(interface, dev_state->device)) {
 					found_member = 1;
-					update_status(q, m, sc->state);
+					update_status(q, m, dev_state->state);
 				}
 			}
 
@@ -1804,39 +1805,18 @@
 	ao2_iterator_destroy(&qiter);
 
 	if (found) {
-		ast_debug(1, "Device '%s' changed to state '%d' (%s)\n", sc->dev, sc->state, ast_devstate2str(sc->state));
+		ast_debug(1, "Device '%s' changed to state '%d' (%s)\n",
+			dev_state->device,
+			dev_state->state,
+			ast_devstate2str(dev_state->state));
 	} else {
-		ast_debug(3, "Device '%s' changed to state '%d' (%s) but we don't care because they're not a member of any queue.\n", sc->dev, sc->state, ast_devstate2str(sc->state));
-	}
-
-	ast_free(sc);
-	return 0;
-}
-
-static void device_state_cb(const struct ast_event *event, void *unused)
-{
-	enum ast_device_state state;
-	const char *device;
-	struct statechange *sc;
-	size_t datapsize;
-
-	state = ast_event_get_ie_uint(event, AST_EVENT_IE_STATE);
-	device = ast_event_get_ie_str(event, AST_EVENT_IE_DEVICE);
-
-	if (ast_strlen_zero(device)) {
-		ast_log(LOG_ERROR, "Received invalid event that had no device IE\n");
-		return;
-	}
-	datapsize = sizeof(*sc) + strlen(device) + 1;
-	if (!(sc = ast_calloc(1, datapsize))) {
-		ast_log(LOG_ERROR, "failed to calloc a state change struct\n");
-		return;
-	}
-	sc->state = state;
-	strcpy(sc->dev, device);
-	if (ast_taskprocessor_push(devicestate_tps, handle_statechange, sc) < 0) {
-		ast_free(sc);
-	}
+		ast_debug(3, "Device '%s' changed to state '%d' (%s) but we don't care because they're not a member of any queue.\n",
+			dev_state->device,
+			dev_state->state,
+			ast_devstate2str(dev_state->state));
+	}
+
+	return;
 }
 
 /*! \brief Helper function which converts from extension state to device state values */
@@ -9876,8 +9856,9 @@
 
 	res |= ast_data_unregister(NULL);
 
-	if (device_state_sub)
-		ast_event_unsubscribe(device_state_sub);
+	if (device_state_sub) {
+		device_state_sub = stasis_unsubscribe(device_state_sub);
+	}
 
 	ast_extension_state_del(0, extension_state_cb);
 
@@ -9887,7 +9868,6 @@
 		queue_t_unref(q, "Done with iterator");
 	}
 	ao2_iterator_destroy(&q_iter);
-	devicestate_tps = ast_taskprocessor_unreference(devicestate_tps);
 	ao2_ref(queues, -1);
 	ast_unload_realtime("queue_members");
 	return res;
@@ -9948,12 +9928,8 @@
 	res |= ast_custom_function_register(&queuewaitingcount_function);
 	res |= ast_custom_function_register(&queuememberpenalty_function);
 
-	if (!(devicestate_tps = ast_taskprocessor_get("app_queue", 0))) {
-		ast_log(LOG_WARNING, "devicestate taskprocessor reference failed - devicestate notifications will not occur\n");
-	}
-
 	/* in the following subscribe call, do I use DEVICE_STATE, or DEVICE_STATE_CHANGE? */
-	if (!(device_state_sub = ast_event_subscribe(AST_EVENT_DEVICE_STATE, device_state_cb, "AppQueue Device state", NULL, AST_EVENT_IE_END))) {
+	if (!(device_state_sub = stasis_subscribe(ast_device_state_topic_all(), device_state_cb, NULL))) {
 		res = -1;
 	}
 

Propchange: team/kharwell/pimp_sip_media_neg/apps/app_saycounted.c
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Fri Apr 19 11:41:13 2013
@@ -1,1 +1,1 @@
-'Date Author Id Revision Yoyo'
+Author Date Id Revision

Modified: team/kharwell/pimp_sip_media_neg/apps/app_stasis.c
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/pimp_sip_media_neg/apps/app_stasis.c?view=diff&rev=386134&r1=386133&r2=386134
==============================================================================
--- team/kharwell/pimp_sip_media_neg/apps/app_stasis.c (original)
+++ team/kharwell/pimp_sip_media_neg/apps/app_stasis.c Fri Apr 19 11:41:13 2013
@@ -24,6 +24,7 @@
  */
 
 /*** MODULEINFO
+	<depend>res_stasis</depend>
 	<support_level>core</support_level>
  ***/
 
@@ -32,14 +33,9 @@
 ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
 #include "asterisk/app.h"
-#include "asterisk/app_stasis.h"
-#include "asterisk/astobj2.h"
-#include "asterisk/channel.h"
-#include "asterisk/lock.h"
 #include "asterisk/module.h"
 #include "asterisk/stasis.h"
-#include "asterisk/strings.h"
-#include "asterisk/stasis_channels.h"
+#include "asterisk/stasis_app.h"
 
 /*** DOCUMENTATION
 	<application name="Stasis" language="en_US">
@@ -67,347 +63,10 @@
 /*! \brief Dialplan application name */
 static const char *stasis = "Stasis";
 
-/*!
- * \brief Number of buckets for the Stasis application hash table.  Remember to
- * keep it a prime number!
- */
-#define APPS_NUM_BUCKETS 127
-
-/*!
- * \brief Number of buckets for the Stasis application hash table.  Remember to
- * keep it a prime number!
- */
-#define CONTROLS_NUM_BUCKETS 127
-
-/*!
- * \brief Stasis application container. Please call apps_registry() instead of
- * directly accessing.
- */
-struct ao2_container *__apps_registry;
-
-struct ao2_container *__app_controls;
-
-/*! Ref-counting accessor for the stasis applications container */
-static struct ao2_container *apps_registry(void)
+/*! /brief Stasis dialplan application callback */
+static int app_exec(struct ast_channel *chan, const char *data)
 {
-	ao2_ref(__apps_registry, +1);
-	return __apps_registry;
-}
-
-static struct ao2_container *app_controls(void)
-{
-	ao2_ref(__app_controls, +1);
-	return __app_controls;
-}
-
-struct app {
-	/*! Callback function for this application. */
-	stasis_app_cb handler;
-	/*! Opaque data to hand to callback function. */
-	void *data;
-	/*! Name of the Stasis application */
-	char name[];
-};
-
-static void app_dtor(void *obj)
-{
-	struct app *app = obj;
-
-	ao2_cleanup(app->data);
-	app->data = NULL;
-}
-
-/*! Constructor for \ref app. */
-static struct app *app_create(const char *name, stasis_app_cb handler, void *data)
-{
-	struct app *app;
-	size_t size;
-
-	ast_assert(name != NULL);
-	ast_assert(handler != NULL);
-
-	size = sizeof(*app) + strlen(name) + 1;
-	app = ao2_alloc_options(size, app_dtor, AO2_ALLOC_OPT_LOCK_MUTEX);
-
-	if (!app) {
-		return NULL;
-	}
-
-	strncpy(app->name, name, size - sizeof(*app));
-	app->handler = handler;
-	ao2_ref(data, +1);
-	app->data = data;
-
-	return app;
-}
-
-/*! AO2 hash function for \ref app */
-static int app_hash(const void *obj, const int flags)
-{
-	const struct app *app = obj;
-	const char *name = flags & OBJ_KEY ? obj : app->name;
-
-	return ast_str_hash(name);
-}
-
-/*! AO2 comparison function for \ref app */
-static int app_compare(void *lhs, void *rhs, int flags)
-{
-	const struct app *lhs_app = lhs;
-	const struct app *rhs_app = rhs;
-	const char *rhs_name = flags & OBJ_KEY ? rhs : rhs_app->name;
-
-	if (strcmp(lhs_app->name, rhs_name) == 0) {
-		return CMP_MATCH | CMP_STOP;
-	} else {
-		return 0;
-	}
-}
-
-/*!
- * \brief Send a message to the given application.
- * \param app App to send the message to.
- * \param message Message to send.
- */
-static void app_send(struct app *app, struct ast_json *message)
-{
-	app->handler(app->data, app->name, message);
-}
-
-struct stasis_app_control {
-	/*!
-	 * When set, /c app_stasis should exit and continue in the dialplan.
-	 */
-	int continue_to_dialplan:1;
-	/*! Uniqueid of the associated channel */
-	char channel_id[];
-};
-
-static struct stasis_app_control *control_create(const char *uniqueid)
-{
-	struct stasis_app_control *control;
-	size_t size;
-
-	size = sizeof(*control) + strlen(uniqueid) + 1;
-	control = ao2_alloc(size, NULL);
-	if (!control) {
-		return NULL;
-	}
-
-	strncpy(control->channel_id, uniqueid, size - sizeof(*control));
-
-	return control;
-}
-
-/*! AO2 hash function for \ref stasis_app_control */
-static int control_hash(const void *obj, const int flags)
-{
-	const struct stasis_app_control *control = obj;
-	const char *id = flags & OBJ_KEY ? obj : control->channel_id;
-
-	return ast_str_hash(id);
-}
-
-/*! AO2 comparison function for \ref stasis_app_control */
-static int control_compare(void *lhs, void *rhs, int flags)
-{
-	const struct stasis_app_control *lhs_control = lhs;
-	const struct stasis_app_control *rhs_control = rhs;
-	const char *rhs_name =
-		flags & OBJ_KEY ? rhs : rhs_control->channel_id;
-
-	if (strcmp(lhs_control->channel_id, rhs_name) == 0) {
-		return CMP_MATCH | CMP_STOP;
-	} else {
-		return 0;
-	}
-}
-
-struct stasis_app_control *stasis_app_control_find_by_channel(
-	const struct ast_channel *chan)
-{
-	RAII_VAR(struct ao2_container *, controls, NULL, ao2_cleanup);
-	if (chan == NULL) {
-		return NULL;
-	}
-
-	controls = app_controls();
-	return ao2_find(controls, ast_channel_uniqueid(chan), OBJ_KEY);
-}
-
-/*!
- * \brief Test the \c continue_to_dialplan bit for the given \a app.
- *
- * The bit is also reset for the next call.
- *
- * \param app Application to check the \c continue_to_dialplan bit.
- * \return Zero to remain in \c Stasis
- * \return Non-zero to continue in the dialplan
- */
-static int control_continue_test_and_reset(struct stasis_app_control *control)
-{
-        int r;
-        SCOPED_AO2LOCK(lock, control);
-
-        r = control->continue_to_dialplan;
-        control->continue_to_dialplan = 0;
-        return r;
-}
-
-void stasis_app_control_continue(struct stasis_app_control *control)
-{
-	SCOPED_AO2LOCK(lock, control);
-	control->continue_to_dialplan = 1;
-}
-
-static struct ast_json *app_event_create(
-	const char *event_name,
-	const struct ast_channel_snapshot *snapshot,
-	const struct ast_json *extra_info)
-{
-	RAII_VAR(struct ast_json *, message, NULL, ast_json_unref);
-	RAII_VAR(struct ast_json *, event, NULL, ast_json_unref);
-
-	if (extra_info) {
-		event = ast_json_deep_copy(extra_info);
-	} else {
-		event = ast_json_object_create();
-	}
-
-	if (snapshot) {
-		int ret;
-
-		/* Mustn't already have a channel field */
-		ast_assert(ast_json_object_get(event, "channel") == NULL);
-
-		ret = ast_json_object_set(
-			event,
-			"channel", ast_channel_snapshot_to_json(snapshot));
-		if (ret != 0) {
-			return NULL;
-		}
-	}
-
-	message = ast_json_pack("{s: o}", event_name, ast_json_ref(event));
-
-	return ast_json_ref(message);
-}
-
-static int send_start_msg(struct app *app, struct ast_channel *chan,
-			  int argc, char *argv[])
-{
-	RAII_VAR(struct ast_json *, msg, NULL, ast_json_unref);
-	RAII_VAR(struct ast_channel_snapshot *, snapshot, NULL, ao2_cleanup);
-
-	struct ast_json *json_args;
-	int i;
-
-	ast_assert(chan != NULL);
-
-	/* Set channel info */
-	snapshot = ast_channel_snapshot_create(chan);
-	if (!snapshot) {
-		return -1;
-	}
-
-	msg = ast_json_pack("{s: {s: [], s: o}}",
-			    "stasis-start",
-			    "args",
-			    "channel", ast_channel_snapshot_to_json(snapshot));
-
-	if (!msg) {
-		return -1;
-	}
-
-	/* Append arguments to args array */
-	json_args = ast_json_object_get(
-		ast_json_object_get(msg, "stasis-start"),
-		"args");
-	ast_assert(json_args != NULL);
-	for (i = 0; i < argc; ++i) {
-		int r = ast_json_array_append(json_args,
-					      ast_json_string_create(argv[i]));
-		if (r != 0) {
-			ast_log(LOG_ERROR, "Error appending start message\n");
-			return -1;
-		}
-	}
-
-	app_send(app, msg);
-	return 0;
-}
-
-static int send_end_msg(struct app *app, struct ast_channel *chan)
-{
-	RAII_VAR(struct ast_json *, msg, NULL, ast_json_unref);
-	RAII_VAR(struct ast_channel_snapshot *, snapshot, NULL, ao2_cleanup);
-
-	ast_assert(chan != NULL);
-
-	/* Set channel info */
-	snapshot = ast_channel_snapshot_create(chan);
-	if (snapshot == NULL) {
-		return -1;
-	}
-	msg = app_event_create("stasis-end", snapshot, NULL);
-	if (!msg) {
-		return -1;
-	}
-
-	app_send(app, msg);
-	return 0;
-}
-
-static void sub_handler(void *data, struct stasis_subscription *sub,
-			struct stasis_topic *topic,
-			struct stasis_message *message)
-{
-	struct app *app = data;
-	if (ast_channel_snapshot_type() == stasis_message_type(message)) {
-		RAII_VAR(struct ast_json *, msg, NULL, ast_json_unref);
-		struct ast_channel_snapshot *snapshot =
-			stasis_message_data(message);
-
-		msg = app_event_create("channel-state-change", snapshot, NULL);
-		if (!msg) {
-			return;
-		}
-		app_send(app, msg);
-	}
-	if (stasis_subscription_final_message(sub, message)) {
-		ao2_cleanup(data);
-	}
-}
-
-/*!
- * \brief In addition to running ao2_cleanup(), this function also removes the
- * object from the app_controls() container.
- */
-static void control_unlink(struct stasis_app_control *control)
-{
-	RAII_VAR(struct ao2_container *, controls, NULL, ao2_cleanup);
-
-	if (!control) {
-		return;
-	}
-
-	controls = app_controls();
-	ao2_unlink_flags(controls, control,
-			 OBJ_POINTER | OBJ_UNLINK | OBJ_NODATA);
-	ao2_cleanup(control);
-}
-
-/*! /brief Stasis dialplan application callback */
-static int app_stasis_exec(struct ast_channel *chan, const char *data)
-{
-	RAII_VAR(struct ao2_container *, apps, apps_registry(), ao2_cleanup);
-	RAII_VAR(struct app *, app, NULL, ao2_cleanup);
-	RAII_VAR(struct stasis_app_control *, control, NULL, control_unlink);
-	RAII_VAR(struct stasis_subscription *, subscription, NULL,
-		 stasis_unsubscribe);
-	int res = 0;
 	char *parse = NULL;
-	int hungup = 0;
 
 	AST_DECLARE_APP_ARGS(args,
 		AST_APP_ARG(app_name);
@@ -426,164 +85,21 @@
 		return -1;
 	}
 
-	app = ao2_find(apps, args.app_name, OBJ_KEY);
-	if (!app) {
-		ast_log(LOG_ERROR,
-			"Stasis app '%s' not registered\n", args.app_name);
-		return -1;
-	}
-
-	{
-		RAII_VAR(struct ao2_container *, controls, NULL, ao2_cleanup);
-
-		controls = app_controls();
-		control = control_create(ast_channel_uniqueid(chan));
-		if (!control) {
-			ast_log(LOG_ERROR, "Allocated failed\n");
-			return -1;
-		}
-		ao2_link(controls, control);
-	}
-
-	subscription =
-		stasis_subscribe(ast_channel_topic(chan), sub_handler, app);
-	if (subscription == NULL) {
-		ast_log(LOG_ERROR, "Error subscribing app %s to channel %s\n",
-			args.app_name, ast_channel_name(chan));
-		return -1;
-	}
-	ao2_ref(app, +1); /* subscription now has a reference */
-
-	res = send_start_msg(app, chan, args.argc - 1, args.app_argv);
-	if (res != 0) {
-		ast_log(LOG_ERROR,
-			"Error sending start message to %s\n", args.app_name);
-		return res;
-	}
-
-	while (!hungup && !control_continue_test_and_reset(control) && ast_waitfor(chan, -1) > -1) {
-		RAII_VAR(struct ast_frame *, f, ast_read(chan), ast_frame_dtor);
-		if (!f) {
-			ast_debug(3, "%s: No more frames. Must be done, I guess.\n",
-				  ast_channel_uniqueid(chan));
-			break;
-		}
-
-		switch (f->frametype) {
-		case AST_FRAME_CONTROL:
-			if (f->subclass.integer == AST_CONTROL_HANGUP) {
-				ast_debug(3, "%s: Received hangup\n",
-					  ast_channel_uniqueid(chan));
-				hungup = 1;
-			}
-			break;
-		default:
-			/* Not handled; discard */
-			break;
-		}
-	}
-
-	res = send_end_msg(app, chan);
-	if (res != 0) {
-		ast_log(LOG_ERROR,
-			"Error sending end message to %s\n", args.app_name);
-		return res;
-	}
-
-	return res;
-}
-
-int stasis_app_send(const char *app_name, struct ast_json *message)
-{
-	RAII_VAR(struct ao2_container *, apps, apps_registry(), ao2_cleanup);
-	RAII_VAR(struct app *, app, NULL, ao2_cleanup);
-
-	app = ao2_find(apps, app_name, OBJ_KEY);
-
-	if (!app) {
-		/* XXX We can do a better job handling late binding, queueing up
-		 * the call for a few seconds to wait for the app to register.
-		 */
-		ast_log(LOG_WARNING,
-			"Stasis app '%s' not registered\n", app_name);
-		return -1;
-	}
-
-	app_send(app, message);
-	return 0;
-}
-
-int stasis_app_register(const char *app_name, stasis_app_cb handler, void *data)
-{
-	RAII_VAR(struct ao2_container *, apps, apps_registry(), ao2_cleanup);
-	RAII_VAR(struct app *, app, NULL, ao2_cleanup);
-
-	SCOPED_LOCK(apps_lock, apps, ao2_lock, ao2_unlock);
-
-	app = ao2_find(apps, app_name, OBJ_KEY | OBJ_NOLOCK);
-
-	if (app) {
-		RAII_VAR(struct ast_json *, msg, NULL, ast_json_unref);
-		SCOPED_LOCK(app_lock, app, ao2_lock, ao2_unlock);
-
-		msg = app_event_create("application-replaced", NULL, NULL);
-		app->handler(app->data, app_name, msg);
-
-		app->handler = handler;
-		ao2_cleanup(app->data);
-		ao2_ref(data, +1);
-		app->data = data;
-	} else {
-		app = app_create(app_name, handler, data);
-		if (app) {
-			ao2_link_flags(apps, app, OBJ_NOLOCK);
-		} else {
-			return -1;
-		}
-	}
-
-	return 0;
-}
-
-void stasis_app_unregister(const char *app_name)
-{
-	RAII_VAR(struct ao2_container *, apps, NULL, ao2_cleanup);
-
-	if (app_name) {
-		apps = apps_registry();
-		ao2_cleanup(ao2_find(apps, app_name, OBJ_KEY | OBJ_UNLINK));
-	}
+	return stasis_app_exec(
+		chan, args.app_name, args.argc - 1, args.app_argv);
 }
 
 static int load_module(void)
 {
 	int r = 0;
 
-	__apps_registry =

[... 4043 lines stripped ...]



More information about the asterisk-commits mailing list