[asterisk-commits] kmoore: branch kmoore/bridge_construction-cel_channels r389723 - in /team/kmo...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri May 24 08:41:39 CDT 2013


Author: kmoore
Date: Fri May 24 08:41:29 2013
New Revision: 389723

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=389723
Log:
Multiple revisions 389594,389625,389642,389664,389681

........
  r389594 | root | 2013-05-23 15:17:20 -0500 (Thu, 23 May 2013) | 20 lines
  
  This patch implements the REST API's for POST /channels/{channelId}/play
  and GET /playback/{playbackId}.
  
  This allows an external application to initiate playback of a sound on a
  channel while the channel is in the Stasis application.
  
  /play commands are issued asynchronously, and return immediately with
  the URL of the associated /playback resource. Playback commands queue up,
  playing in succession. The /playback resource shows the state of a
  playback operation as enqueued, playing or complete. (Although the
  operation will only be in the 'complete' state for a very short time,
  since it is almost immediately freed up).
  
  (closes issue ASTERISK-21283)
  (closes issue ASTERISK-21586)
  Review: https://reviewboard.asterisk.org/r/2531/
  ........
  
  Merged revisions 389587 from file:///srv/subversion/repos/asterisk/trunk
........
  r389625 | root | 2013-05-23 16:17:20 -0500 (Thu, 23 May 2013) | 51 lines
  
  Multiple revisions 389603,389609,389618,389623
  
  ........
    r389603 | dlee | 2013-05-23 15:21:16 -0500 (Thu, 23 May 2013) | 18 lines
    
    This patch adds support for controlling a playback operation from the
    Asterisk REST interface.
    
    This adds the /playback/{playbackId}/control resource, which may be
    POSTed to to pause, unpause, reverse, forward or restart the media
    playback.
    
    Attempts to control a playback that is not currently playing will
    either return a 404 Not Found (because the playback object no longer
    exists) or a 409 Conflict (because the playback object is still in the
    queue to be played).
    
    This patch also adds skipms and offsetms parameters to the
    /channels/{channelId}/play resource.
    
    (closes issue ASTERISK-21587)
    Review: https://reviewboard.asterisk.org/r/2559
  ........
    r389609 | file | 2013-05-23 15:25:48 -0500 (Thu, 23 May 2013) | 8 lines
    
    Fix a crash due to the INVITE session being destroyed before the session.
    
    This change ensures that the INVITE session remains valid for the lifetime
    of the session object itself by increasing the session count on the dialog that
    the INVITE session is allocated from. Once this reaches zero (normally as a result
    of decrementing it within the session destructor) the dialog, and INVITE session,
    are destroyed.
  ........
    r389618 | jrose | 2013-05-23 15:48:41 -0500 (Thu, 23 May 2013) | 9 lines
    
    res_parking: Fix some simple bugs
    
    Both of them are covered in the dynamic parking review on
    https://reviewboard.asterisk.org/r/2550 - Remove unref against
    parking lot that the bridge did on dissolve since the reference
    wasn't taken in the first place. On a swap, reapply bridge roles
    in order to get music on hold and such playing on the channel that
    swaps into the bridge.
  ........
    r389623 | jrose | 2013-05-23 16:11:18 -0500 (Thu, 23 May 2013) | 2 lines
    
    res_parking: Add a verbose message when a channel is parked
  ........
  
  Merged revisions 389603,389609,389618,389623 from file:///srv/subversion/repos/asterisk/trunk
........
  r389642 | root | 2013-05-23 17:17:20 -0500 (Thu, 23 May 2013) | 5 lines
  
  stasis-http: Provide a response body for 201 created responses
  ........
  
  Merged revisions 389639 from file:///srv/subversion/repos/asterisk/trunk
........
  r389664 | root | 2013-05-24 06:17:44 -0500 (Fri, 24 May 2013) | 13 lines
  
  
  Fix several problems caused by multiple line usage with i2004 phones.
  Reported by: Daniel Bohling, MihaiMircea
  
  (closes issue ASTERISK-21061)
  (closes issue ASTERISK-21120)
  ........
  
  Merged revisions 389661 from http://svn.asterisk.org/svn/asterisk/branches/11
  ........
  
  Merged revisions 389663 from file:///srv/subversion/repos/asterisk/trunk
........
  r389681 | root | 2013-05-24 07:17:27 -0500 (Fri, 24 May 2013) | 21 lines
  
  Print all logger messages on shutdown
  
  When Asterisk shuts down and shuts down the loggin gsubsystem, any
  messages currently in flight will not get logged. This patch prevents the
  loop writing messages from breaking out prematurely, such that all of the
  messages are logged.
  
  (closes issue ASTERISK-21716)
  Reported by: Corey Farrell
  patches:
    logger-process-all-messages.patch uploaded by Corey Farrell (license 5909)
  ........
  
  Merged revisions 389676 from http://svn.asterisk.org/svn/asterisk/branches/1.8
  ........
  
  Merged revisions 389677 from http://svn.asterisk.org/svn/asterisk/branches/11
  ........
  
  Merged revisions 389680 from file:///srv/subversion/repos/asterisk/trunk
........

Merged revisions 389594,389625,389642,389664,389681 from http://svn.asterisk.org/svn/asterisk/team/group/bridge_construction

Added:
    team/kmoore/bridge_construction-cel_channels/include/asterisk/stasis_app_playback.h
      - copied unchanged from r389681, team/group/bridge_construction/include/asterisk/stasis_app_playback.h
    team/kmoore/bridge_construction-cel_channels/res/res_stasis_playback.c
      - copied unchanged from r389681, team/group/bridge_construction/res/res_stasis_playback.c
    team/kmoore/bridge_construction-cel_channels/res/res_stasis_playback.exports.in
      - copied unchanged from r389681, team/group/bridge_construction/res/res_stasis_playback.exports.in
Modified:
    team/kmoore/bridge_construction-cel_channels/   (props changed)
    team/kmoore/bridge_construction-cel_channels/channels/chan_unistim.c
    team/kmoore/bridge_construction-cel_channels/include/asterisk/app.h
    team/kmoore/bridge_construction-cel_channels/include/asterisk/channel.h
    team/kmoore/bridge_construction-cel_channels/include/asterisk/stasis_app.h
    team/kmoore/bridge_construction-cel_channels/include/asterisk/stasis_channels.h
    team/kmoore/bridge_construction-cel_channels/include/asterisk/stasis_http.h
    team/kmoore/bridge_construction-cel_channels/main/app.c
    team/kmoore/bridge_construction-cel_channels/main/channel_internal_api.c
    team/kmoore/bridge_construction-cel_channels/main/logger.c
    team/kmoore/bridge_construction-cel_channels/main/stasis_channels.c
    team/kmoore/bridge_construction-cel_channels/res/parking/parking_bridge.c
    team/kmoore/bridge_construction-cel_channels/res/res_sip_session.c
    team/kmoore/bridge_construction-cel_channels/res/res_stasis_http.c
    team/kmoore/bridge_construction-cel_channels/res/res_stasis_http_channels.c
    team/kmoore/bridge_construction-cel_channels/res/res_stasis_json_events.c
    team/kmoore/bridge_construction-cel_channels/res/res_stasis_json_events.exports.in
    team/kmoore/bridge_construction-cel_channels/res/stasis/control.c
    team/kmoore/bridge_construction-cel_channels/res/stasis_http/resource_channels.c
    team/kmoore/bridge_construction-cel_channels/res/stasis_http/resource_channels.h
    team/kmoore/bridge_construction-cel_channels/res/stasis_http/resource_playback.c
    team/kmoore/bridge_construction-cel_channels/res/stasis_json/resource_channels.h
    team/kmoore/bridge_construction-cel_channels/res/stasis_json/resource_events.h
    team/kmoore/bridge_construction-cel_channels/rest-api/api-docs/channels.json
    team/kmoore/bridge_construction-cel_channels/rest-api/api-docs/events.json
    team/kmoore/bridge_construction-cel_channels/rest-api/api-docs/playback.json

Propchange: team/kmoore/bridge_construction-cel_channels/
------------------------------------------------------------------------------
    automerge = *

Propchange: team/kmoore/bridge_construction-cel_channels/
------------------------------------------------------------------------------
Binary property 'branch-11-merged' - no diff available.

Propchange: team/kmoore/bridge_construction-cel_channels/
------------------------------------------------------------------------------
--- bridge_construction-integrated (original)
+++ bridge_construction-integrated Fri May 24 08:41:29 2013
@@ -1,1 +1,1 @@
-/trunk:1-389571
+/trunk:1-389680

Propchange: team/kmoore/bridge_construction-cel_channels/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Fri May 24 08:41:29 2013
@@ -1,1 +1,1 @@
-/team/group/bridge_construction:1-389572
+/team/group/bridge_construction:1-389721

Modified: team/kmoore/bridge_construction-cel_channels/channels/chan_unistim.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/bridge_construction-cel_channels/channels/chan_unistim.c?view=diff&rev=389723&r1=389722&r2=389723
==============================================================================
--- team/kmoore/bridge_construction-cel_channels/channels/chan_unistim.c (original)
+++ team/kmoore/bridge_construction-cel_channels/channels/chan_unistim.c Fri May 24 08:41:29 2013
@@ -4840,7 +4840,7 @@
 			break;
 		}
 	}
-	refresh_all_favorite(s); /* Update favicons in case of DND keys */
+	/*refresh_all_favorite(s); */ /* TODO: Update favicons in case of DND keys */
 	if (s->state == STATE_RINGING && sub->subtype == SUB_RING) {
 		send_no_ring(s);
 		if (ast_channel_hangupcause(ast) != AST_CAUSE_ANSWERED_ELSEWHERE) {
@@ -4849,6 +4849,13 @@
 		}
 		if (!sub_real) {
 			show_main_page(s);
+		} else { /* hangup on a ringing line: reset status to reflect that we're still on an active call */
+				s->state = STATE_CALL;
+				send_callerid_screen(s, sub_real);
+				send_text(TEXT_LINE2, TEXT_NORMAL, s, ustmtext("is on-line", s));
+				send_text_status(s, ustmtext("       Transf        Hangup", s));
+				send_favorite_short(sub->softkey, FAV_ICON_OFFHOOK_BLACK, s);
+			
 		}
 	}
 	if (s->state == STATE_CALL && sub->subtype == SUB_REAL) {
@@ -5789,6 +5796,15 @@
 		*cause = AST_CAUSE_BUSY;
 		return NULL;
 	}
+	if (d->session->state == STATE_DIALPAGE) {
+		if (unistimdebug) {
+			ast_verb(0, "Can't create channel, user on dialpage: Busy!\n");
+		}
+		unistim_unalloc_sub(d, sub);
+		*cause = AST_CAUSE_BUSY;
+		return NULL;
+	}
+
         if (get_avail_softkey(d->session, sub->parent->name) == -1) {
 		if (unistimdebug) {
 			ast_verb(0, "Can't create channel for line %s, all lines busy\n", sub->parent->name);

Modified: team/kmoore/bridge_construction-cel_channels/include/asterisk/app.h
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/bridge_construction-cel_channels/include/asterisk/app.h?view=diff&rev=389723&r1=389722&r2=389723
==============================================================================
--- team/kmoore/bridge_construction-cel_channels/include/asterisk/app.h (original)
+++ team/kmoore/bridge_construction-cel_channels/include/asterisk/app.h Fri May 24 08:41:29 2013
@@ -636,16 +636,32 @@
 
 /*!
  * \brief Stream a file with fast forward, pause, reverse, restart.
- * \param chan
- * \param file filename
- * \param fwd, rev, stop, pause, restart, skipms, offsetms
+ * \param chan Channel
+ * \param file File to play.
+ * \param fwd, rev, stop, pause, restart DTMF keys for media control
+ * \param skipms Number of milliseconds to skip for fwd/rev.
+ * \param offsetms Number of milliseconds to skip when starting the media.
  *
  * Before calling this function, set this to be the number
  * of ms to start from the beginning of the file.  When the function
  * returns, it will be the number of ms from the beginning where the
  * playback stopped.  Pass NULL if you don't care.
+ *
+ * \retval 0 on success
+ * \retval Non-zero on failure
  */
 int ast_control_streamfile(struct ast_channel *chan, const char *file, const char *fwd, const char *rev, const char *stop, const char *pause, const char *restart, int skipms, long *offsetms);
+
+/*!
+ * \brief Version of ast_control_streamfile() which allows the language of the
+ * media file to be specified.
+ *
+ * \retval 0 on success
+ * \retval Non-zero on failure
+ */
+int ast_control_streamfile_lang(struct ast_channel *chan, const char *file,
+	const char *fwd, const char *rev, const char *stop, const char *suspend,
+	const char *restart, int skipms, const char *lang, long *offsetms);
 
 /*!
  * \brief Stream a file with fast forward, pause, reverse, restart.

Modified: team/kmoore/bridge_construction-cel_channels/include/asterisk/channel.h
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/bridge_construction-cel_channels/include/asterisk/channel.h?view=diff&rev=389723&r1=389722&r2=389723
==============================================================================
--- team/kmoore/bridge_construction-cel_channels/include/asterisk/channel.h (original)
+++ team/kmoore/bridge_construction-cel_channels/include/asterisk/channel.h Fri May 24 08:41:29 2013
@@ -1203,7 +1203,7 @@
 int ast_queue_hangup_with_cause(struct ast_channel *chan, int cause);
 
 /*!
- * \brief Queue a control frame with payload
+ * \brief Queue a control frame without payload
  *
  * \param chan channel to queue frame onto
  * \param control type of control frame

Modified: team/kmoore/bridge_construction-cel_channels/include/asterisk/stasis_app.h
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/bridge_construction-cel_channels/include/asterisk/stasis_app.h?view=diff&rev=389723&r1=389722&r2=389723
==============================================================================
--- team/kmoore/bridge_construction-cel_channels/include/asterisk/stasis_app.h (original)
+++ team/kmoore/bridge_construction-cel_channels/include/asterisk/stasis_app.h Fri May 24 08:41:29 2013
@@ -175,6 +175,18 @@
 	struct stasis_app_control *control, struct stasis_message *message);
 
 /*!
+ * \brief Queue a control frame without payload.
+ *
+ * \param control Control to publish to.
+ * \param frame_type type of control frame.
+ *
+ * \return zero on success
+ * \return non-zero on failure
+ */
+int stasis_app_control_queue_control(struct stasis_app_control *control,
+	enum ast_control_frame_type frame_type);
+
+/*!
  * \brief Increment the res_stasis reference count.
  *
  * This ensures graceful shutdown happens in the proper order.

Modified: team/kmoore/bridge_construction-cel_channels/include/asterisk/stasis_channels.h
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/bridge_construction-cel_channels/include/asterisk/stasis_channels.h?view=diff&rev=389723&r1=389722&r2=389723
==============================================================================
--- team/kmoore/bridge_construction-cel_channels/include/asterisk/stasis_channels.h (original)
+++ team/kmoore/bridge_construction-cel_channels/include/asterisk/stasis_channels.h Fri May 24 08:41:29 2013
@@ -57,6 +57,7 @@
 		AST_STRING_FIELD(caller_dnid);		/*!< Caller ID DNID Number */
 		AST_STRING_FIELD(connected_name);	/*!< Connected Line Name */
 		AST_STRING_FIELD(connected_number);	/*!< Connected Line Number */
+		AST_STRING_FIELD(language);		/*!< The default spoken language for the channel */
 	);
 
 	struct timeval creationtime;	/*!< The time of channel creation */
@@ -127,7 +128,6 @@
 
 /*!
  * \since 12
- * \since 12
  * \brief Get the most recent snapshot for channel with the given \a uniqueid.
  *
  * \param uniqueid Uniqueid of the snapshot to fetch.
@@ -154,6 +154,23 @@
  */
 struct stasis_message *ast_channel_blob_create(struct ast_channel *chan,
 	struct stasis_message_type *type, struct ast_json *blob);
+
+/*!
+ * \since 12
+ * \brief Create a \ref ast_channel_blob message, pulling channel state from
+ *        the cache.
+ *
+ * \param uniqueid Uniqueid of the channel.
+ * \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_from_cache(
+	const char *uniqueid, struct stasis_message_type *type,
+	struct ast_json *blob);
 
 /*!
  * \since 12
@@ -235,6 +252,14 @@
  */
 void ast_multi_channel_blob_add_channel(struct ast_multi_channel_blob *obj,
 	const char *role, struct ast_channel_snapshot *snapshot);
+
+/*!
+ * \since 12
+ * \brief Publish a \ref ast_channel_snapshot for a channel.
+ *
+ * \param chan Channel to publish.
+ */
+void ast_channel_publish_snapshot(struct ast_channel *chan);
 
 /*!
  * \since 12

Modified: team/kmoore/bridge_construction-cel_channels/include/asterisk/stasis_http.h
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/bridge_construction-cel_channels/include/asterisk/stasis_http.h?view=diff&rev=389723&r1=389722&r2=389723
==============================================================================
--- team/kmoore/bridge_construction-cel_channels/include/asterisk/stasis_http.h (original)
+++ team/kmoore/bridge_construction-cel_channels/include/asterisk/stasis_http.h Fri May 24 08:41:29 2013
@@ -163,6 +163,12 @@
 void stasis_http_response_no_content(struct stasis_http_response *response);
 
 /*!
+ * \brief Fill in a <tt>Created</tt> (201) \a stasis_http_response.
+ */
+void stasis_http_response_created(struct stasis_http_response *response,
+	const char *url, struct ast_json *message);
+
+/*!
  * \brief Fill in \a response with a 500 message for allocation failures.
  * \param response Response to fill in.
  */

Modified: team/kmoore/bridge_construction-cel_channels/main/app.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/bridge_construction-cel_channels/main/app.c?view=diff&rev=389723&r1=389722&r2=389723
==============================================================================
--- team/kmoore/bridge_construction-cel_channels/main/app.c (original)
+++ team/kmoore/bridge_construction-cel_channels/main/app.c Fri May 24 08:41:29 2013
@@ -930,6 +930,7 @@
 	const char *restart,
 	int skipms,
 	long *offsetms,
+	const char *lang,
 	ast_waitstream_fr_cb cb)
 {
 	char *breaks = NULL;
@@ -945,6 +946,9 @@
 	if (offsetms) {
 		offset = *offsetms * 8; /* XXX Assumes 8kHz */
 	}
+	if (lang == NULL) {
+		lang = ast_channel_language(chan);
+	}
 
 	if (stop) {
 		blen += strlen(stop);
@@ -982,7 +986,7 @@
 
 	for (;;) {
 		ast_stopstream(chan);
-		res = ast_streamfile(chan, file, ast_channel_language(chan));
+		res = ast_streamfile(chan, file, lang);
 		if (!res) {
 			if (pause_restart_point) {
 				ast_seekstream(ast_channel_stream(chan), pause_restart_point, SEEK_SET);
@@ -1093,7 +1097,7 @@
 	long *offsetms,
 	ast_waitstream_fr_cb cb)
 {
-	return control_streamfile(chan, file, fwd, rev, stop, suspend, restart, skipms, offsetms, cb);
+	return control_streamfile(chan, file, fwd, rev, stop, suspend, restart, skipms, offsetms, NULL, cb);
 }
 
 int ast_control_streamfile(struct ast_channel *chan, const char *file,
@@ -1101,7 +1105,14 @@
 			   const char *stop, const char *suspend,
 			   const char *restart, int skipms, long *offsetms)
 {
-	return control_streamfile(chan, file, fwd, rev, stop, suspend, restart, skipms, offsetms, NULL);
+	return control_streamfile(chan, file, fwd, rev, stop, suspend, restart, skipms, offsetms, NULL, NULL);
+}
+
+int ast_control_streamfile_lang(struct ast_channel *chan, const char *file,
+	const char *fwd, const char *rev, const char *stop, const char *suspend,
+	const char *restart, int skipms, const char *lang, long *offsetms)
+{
+	return control_streamfile(chan, file, fwd, rev, stop, suspend, restart, skipms, offsetms, lang, NULL);
 }
 
 int ast_play_and_wait(struct ast_channel *chan, const char *fn)

Modified: team/kmoore/bridge_construction-cel_channels/main/channel_internal_api.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/bridge_construction-cel_channels/main/channel_internal_api.c?view=diff&rev=389723&r1=389722&r2=389723
==============================================================================
--- team/kmoore/bridge_construction-cel_channels/main/channel_internal_api.c (original)
+++ team/kmoore/bridge_construction-cel_channels/main/channel_internal_api.c Fri May 24 08:41:29 2013
@@ -414,15 +414,17 @@
 
 /* ACCESSORS */
 
-#define DEFINE_STRINGFIELD_SETTERS_FOR(field) \
+#define DEFINE_STRINGFIELD_SETTERS_FOR(field, publish)			\
 void ast_channel_##field##_set(struct ast_channel *chan, const char *value) \
 { \
 	ast_string_field_set(chan, field, value); \
+	if (publish) ast_channel_publish_snapshot(chan); \
 } \
   \
 void ast_channel_##field##_build_va(struct ast_channel *chan, const char *fmt, va_list ap) \
 { \
 	ast_string_field_build_va(chan, field, fmt, ap); \
+	if (publish) ast_channel_publish_snapshot(chan); \
 } \
 void ast_channel_##field##_build(struct ast_channel *chan, const char *fmt, ...) \
 { \
@@ -430,19 +432,20 @@
 	va_start(ap, fmt); \
 	ast_channel_##field##_build_va(chan, fmt, ap); \
 	va_end(ap); \
-}
-
-DEFINE_STRINGFIELD_SETTERS_FOR(name);
-DEFINE_STRINGFIELD_SETTERS_FOR(language);
-DEFINE_STRINGFIELD_SETTERS_FOR(musicclass);
-DEFINE_STRINGFIELD_SETTERS_FOR(accountcode);
-DEFINE_STRINGFIELD_SETTERS_FOR(peeraccount);
-DEFINE_STRINGFIELD_SETTERS_FOR(userfield);
-DEFINE_STRINGFIELD_SETTERS_FOR(call_forward);
-DEFINE_STRINGFIELD_SETTERS_FOR(uniqueid);
-DEFINE_STRINGFIELD_SETTERS_FOR(parkinglot);
-DEFINE_STRINGFIELD_SETTERS_FOR(hangupsource);
-DEFINE_STRINGFIELD_SETTERS_FOR(dialcontext);
+	if (publish) ast_channel_publish_snapshot(chan); \
+}
+
+DEFINE_STRINGFIELD_SETTERS_FOR(name, 0);
+DEFINE_STRINGFIELD_SETTERS_FOR(language, 1);
+DEFINE_STRINGFIELD_SETTERS_FOR(musicclass, 0);
+DEFINE_STRINGFIELD_SETTERS_FOR(accountcode, 0);
+DEFINE_STRINGFIELD_SETTERS_FOR(peeraccount, 0);
+DEFINE_STRINGFIELD_SETTERS_FOR(userfield, 0);
+DEFINE_STRINGFIELD_SETTERS_FOR(call_forward, 0);
+DEFINE_STRINGFIELD_SETTERS_FOR(uniqueid, 0);
+DEFINE_STRINGFIELD_SETTERS_FOR(parkinglot, 0);
+DEFINE_STRINGFIELD_SETTERS_FOR(hangupsource, 0);
+DEFINE_STRINGFIELD_SETTERS_FOR(dialcontext, 0);
 
 #define DEFINE_STRINGFIELD_GETTER_FOR(field) const char *ast_channel_##field(const struct ast_channel *chan) \
 { \

Modified: team/kmoore/bridge_construction-cel_channels/main/logger.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/bridge_construction-cel_channels/main/logger.c?view=diff&rev=389723&r1=389722&r2=389723
==============================================================================
--- team/kmoore/bridge_construction-cel_channels/main/logger.c (original)
+++ team/kmoore/bridge_construction-cel_channels/main/logger.c Fri May 24 08:41:29 2013
@@ -1190,10 +1190,6 @@
 			/* Free the data since we are done */
 			logmsg_free(msg);
 		}
-
-		/* If we should stop, then stop */
-		if (close_logger_thread)
-			break;
 	}
 
 	return NULL;

Modified: team/kmoore/bridge_construction-cel_channels/main/stasis_channels.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/bridge_construction-cel_channels/main/stasis_channels.c?view=diff&rev=389723&r1=389722&r2=389723
==============================================================================
--- team/kmoore/bridge_construction-cel_channels/main/stasis_channels.c (original)
+++ team/kmoore/bridge_construction-cel_channels/main/stasis_channels.c Fri May 24 08:41:29 2013
@@ -142,6 +142,7 @@
 		S_COR(ast_channel_connected(chan)->id.name.valid, ast_channel_connected(chan)->id.name.str, ""));
 	ast_string_field_set(snapshot, connected_number,
 		S_COR(ast_channel_connected(chan)->id.number.valid, ast_channel_connected(chan)->id.number.str, ""));
+	ast_string_field_set(snapshot, language, ast_channel_language(chan));
 
 	snapshot->creationtime = ast_channel_creationtime(chan);
 	snapshot->state = ast_channel_state(chan);
@@ -237,37 +238,65 @@
 	publish_message_for_channel_topics(msg, caller);
 }
 
+static struct stasis_message *channel_blob_create(
+	struct ast_channel_snapshot *snapshot,
+	struct stasis_message_type *type, struct ast_json *blob)
+{
+	RAII_VAR(struct ast_channel_blob *, obj, NULL, ao2_cleanup);
+	RAII_VAR(struct stasis_message *, msg, NULL, ao2_cleanup);
+
+	if (blob == NULL) {
+		blob = ast_json_null();
+	}
+
+	obj = ao2_alloc(sizeof(*obj), channel_blob_dtor);
+	if (!obj) {
+		return NULL;
+	}
+
+	if (snapshot) {
+		ao2_ref(snapshot, +1);
+		obj->snapshot = snapshot;
+	}
+
+	obj->blob = ast_json_ref(blob);
+
+	msg = stasis_message_create(type, obj);
+	if (!msg) {
+		return NULL;
+	}
+
+	ao2_ref(msg, +1);
+	return msg;
+}
+
 struct stasis_message *ast_channel_blob_create(struct ast_channel *chan,
 	struct stasis_message_type *type, struct ast_json *blob)
 {
-	RAII_VAR(struct ast_channel_blob *, obj, NULL, ao2_cleanup);
-	RAII_VAR(struct stasis_message *, msg, NULL, ao2_cleanup);
-
-	if (blob == NULL) {
-		blob = ast_json_null();
-	}
-
-	obj = ao2_alloc(sizeof(*obj), channel_blob_dtor);
-	if (!obj) {
-		return NULL;
-	}
-
-	if (chan) {
-		obj->snapshot = ast_channel_snapshot_create(chan);
-		if (obj->snapshot == NULL) {
+	RAII_VAR(struct ast_channel_snapshot *, snapshot, NULL, ao2_cleanup);
+
+	if (chan != NULL) {
+		snapshot = ast_channel_snapshot_create(chan);
+		if (snapshot == NULL) {
 			return NULL;
 		}
 	}
 
-	obj->blob = ast_json_ref(blob);
-
-	msg = stasis_message_create(type, obj);
-	if (!msg) {
-		return NULL;
-	}
-
-	ao2_ref(msg, +1);
-	return msg;
+	return channel_blob_create(snapshot, type, blob);
+}
+
+struct stasis_message *ast_channel_blob_create_from_cache(
+	const char *uniqueid, struct stasis_message_type *type,
+	struct ast_json *blob)
+{
+	RAII_VAR(struct ast_channel_snapshot *, snapshot, NULL, ao2_cleanup);
+
+	snapshot = ast_channel_snapshot_get_latest(uniqueid);
+	if (snapshot == NULL) {
+		return NULL;
+	}
+
+	return channel_blob_create(snapshot, type, blob);
 }
 
 /*! \brief A channel snapshot wrapper object used in \ref ast_multi_channel_blob objects */
@@ -418,6 +447,26 @@
 	}
 	return obj->blob;
 }
+
+void ast_channel_publish_snapshot(struct ast_channel *chan)
+{
+	RAII_VAR(struct ast_channel_snapshot *, snapshot, NULL, ao2_cleanup);
+	RAII_VAR(struct stasis_message *, message, NULL, ao2_cleanup);
+
+	snapshot = ast_channel_snapshot_create(chan);
+	if (!snapshot) {
+		return;
+	}
+
+	message = stasis_message_create(ast_channel_snapshot_type(), snapshot);
+	if (!message) {
+		return;
+	}
+
+	ast_assert(ast_channel_topic(chan) != NULL);
+	stasis_publish(ast_channel_topic(chan), message);
+}
+
 
 void ast_channel_publish_varset(struct ast_channel *chan, const char *name, const char *value)
 {

Modified: team/kmoore/bridge_construction-cel_channels/res/parking/parking_bridge.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/bridge_construction-cel_channels/res/parking/parking_bridge.c?view=diff&rev=389723&r1=389722&r2=389723
==============================================================================
--- team/kmoore/bridge_construction-cel_channels/res/parking/parking_bridge.c (original)
+++ team/kmoore/bridge_construction-cel_channels/res/parking/parking_bridge.c Fri May 24 08:41:29 2013
@@ -29,6 +29,7 @@
 #include "asterisk/astobj2.h"
 #include "asterisk/features.h"
 #include "asterisk/say.h"
+#include "asterisk/term.h"
 
 struct ast_bridge_parking
 {
@@ -56,15 +57,7 @@
 
 static void bridge_parking_dissolving(struct ast_bridge_parking *self)
 {
-	struct parking_lot *lot = self->lot;
-
-	/* Unlink the parking bridge from the parking lot that owns it */
-	lot->parking_bridge = NULL;
-	ao2_ref(lot, -1);
-
-	/* Disassociate the bridge from the parking lot as well. */
 	self->lot = NULL;
-
 	ast_bridge_base_v_table.dissolving(&self->base);
 }
 
@@ -199,6 +192,8 @@
 	RAII_VAR(char *, comeback_override, NULL, ast_free);
 
 	ast_bridge_base_v_table.push(&self->base, bridge_channel, swap);
+
+	ast_assert(self->lot != NULL);
 
 	/* Answer the channel if needed */
 	if (ast_channel_state(bridge_channel->chan) != AST_STATE_UP) {
@@ -227,6 +222,12 @@
 
 		parking_set_duration(bridge_channel->features, pu);
 
+		/* BUGBUG Adding back local channel swapping made us not hear music on hold for the channel that got swapped
+		 * into the parking lot. Setting the roels back up gets around that, but we still need to deal with the ringing option
+		 * to the park application here somehow.
+		 */
+		parking_channel_set_roles(bridge_channel->chan, self->lot, 0);
+
 		return 0;
 	}
 
@@ -283,6 +284,11 @@
 
 	/* Set this to the bridge pvt so that we don't have to refind the parked user associated with this bridge channel again. */
 	bridge_channel->bridge_pvt = pu;
+
+	ast_verb(3, "Parking '" COLORIZE_FMT "' in '" COLORIZE_FMT "' at space %d\n",
+		COLORIZE(COLOR_BRMAGENTA, 0, ast_channel_name(bridge_channel->chan)),
+		COLORIZE(COLOR_BRMAGENTA, 0, self->lot->name),
+		pu->parking_space);
 
 	return 0;
 }

Modified: team/kmoore/bridge_construction-cel_channels/res/res_sip_session.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/bridge_construction-cel_channels/res/res_sip_session.c?view=diff&rev=389723&r1=389722&r2=389723
==============================================================================
--- team/kmoore/bridge_construction-cel_channels/res/res_sip_session.c (original)
+++ team/kmoore/bridge_construction-cel_channels/res/res_sip_session.c Fri May 24 08:41:29 2013
@@ -887,6 +887,10 @@
 	ast_party_id_free(&session->id);
 	ao2_cleanup(session->endpoint);
 	ast_format_cap_destroy(session->req_caps);
+
+	if (session->inv_session) {
+		pjsip_dlg_dec_session(session->inv_session->dlg, &session_module);
+	}
 }
 
 static int add_supplements(struct ast_sip_session *session)
@@ -945,6 +949,7 @@
 	}
 	ast_sip_dialog_set_serializer(inv_session->dlg, session->serializer);
 	ast_sip_dialog_set_endpoint(inv_session->dlg, endpoint);
+	pjsip_dlg_inc_session(inv_session->dlg, &session_module);
 	ao2_ref(endpoint, +1);
 	inv_session->mod_data[session_module.id] = session;
 	session->endpoint = endpoint;

Modified: team/kmoore/bridge_construction-cel_channels/res/res_stasis_http.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/bridge_construction-cel_channels/res/res_stasis_http.c?view=diff&rev=389723&r1=389722&r2=389723
==============================================================================
--- team/kmoore/bridge_construction-cel_channels/res/res_stasis_http.c (original)
+++ team/kmoore/bridge_construction-cel_channels/res/res_stasis_http.c Fri May 24 08:41:29 2013
@@ -311,7 +311,7 @@
 void stasis_http_response_ok(struct stasis_http_response *response,
 			     struct ast_json *message)
 {
-	response->message = message;
+	response->message = ast_json_ref(message);
 	response->response_code = 200;
 	response->response_text = "OK";
 }
@@ -328,6 +328,15 @@
 	response->message = ast_json_ref(alloc_failed_message);
 	response->response_code = 500;
 	response->response_text = "Internal Server Error";
+}
+
+void stasis_http_response_created(struct stasis_http_response *response,
+	const char *url, struct ast_json *message)
+{
+	response->message = ast_json_ref(message);
+	response->response_code = 201;
+	response->response_text = "Created";
+	ast_str_append(&response->headers, 0, "Location: %s\r\n", url);
 }
 
 static void add_allow_header(struct stasis_rest_handlers *handler,

Modified: team/kmoore/bridge_construction-cel_channels/res/res_stasis_http_channels.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/bridge_construction-cel_channels/res/res_stasis_http_channels.c?view=diff&rev=389723&r1=389722&r2=389723
==============================================================================
--- team/kmoore/bridge_construction-cel_channels/res/res_stasis_http_channels.c (original)
+++ team/kmoore/bridge_construction-cel_channels/res/res_stasis_http_channels.c Fri May 24 08:41:29 2013
@@ -327,6 +327,15 @@
 		if (strcmp(i->name, "media") == 0) {
 			args.media = (i->value);
 		} else
+		if (strcmp(i->name, "lang") == 0) {
+			args.lang = (i->value);
+		} else
+		if (strcmp(i->name, "offsetms") == 0) {
+			args.offsetms = atoi(i->value);
+		} else
+		if (strcmp(i->name, "skipms") == 0) {
+			args.skipms = atoi(i->value);
+		} else
 		{}
 	}
 	for (i = path_vars; i; i = i->next) {

Modified: team/kmoore/bridge_construction-cel_channels/res/res_stasis_json_events.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/bridge_construction-cel_channels/res/res_stasis_json_events.c?view=diff&rev=389723&r1=389722&r2=389723
==============================================================================
--- team/kmoore/bridge_construction-cel_channels/res/res_stasis_json_events.c (original)
+++ team/kmoore/bridge_construction-cel_channels/res/res_stasis_json_events.c Fri May 24 08:41:29 2013
@@ -116,6 +116,210 @@
 	return ast_json_ref(message);
 }
 
+struct ast_json *stasis_json_event_playback_finished_create(
+	struct ast_json *blob
+	)
+{
+	RAII_VAR(struct ast_json *, message, NULL, ast_json_unref);
+	RAII_VAR(struct ast_json *, event, NULL, ast_json_unref);
+	struct ast_json *validator;
+
+	ast_assert(blob != NULL);
+	ast_assert(ast_json_object_get(blob, "type") == NULL);
+
+	validator = ast_json_object_get(blob, "playback");
+	if (validator) {
+		/* do validation? XXX */
+	} else {
+		/* fail message generation if the required parameter doesn't exist */
+		return NULL;
+	}
+
+	event = ast_json_deep_copy(blob);
+	if (!event) {
+		return NULL;
+	}
+
+	message = ast_json_pack("{s: o}", "playback_finished", ast_json_ref(event));
+	if (!message) {
+		return NULL;
+	}
+
+	return ast_json_ref(message);
+}
+
+struct ast_json *stasis_json_event_channel_snapshot_create(
+	struct ast_channel_snapshot *channel_snapshot
+	)
+{
+	RAII_VAR(struct ast_json *, message, NULL, ast_json_unref);
+	RAII_VAR(struct ast_json *, event, NULL, ast_json_unref);
+	int ret;
+
+	ast_assert(channel_snapshot != NULL);
+
+	event = ast_json_object_create();
+	if (!event) {
+		return NULL;
+	}
+
+	ret = ast_json_object_set(event,
+		"channel", ast_channel_snapshot_to_json(channel_snapshot));
+	if (ret) {
+		return NULL;
+	}
+
+	message = ast_json_pack("{s: o}", "channel_snapshot", ast_json_ref(event));
+	if (!message) {
+		return NULL;
+	}
+
+	return ast_json_ref(message);
+}
+
+struct ast_json *stasis_json_event_channel_caller_id_create(
+	struct ast_channel_snapshot *channel_snapshot,
+	struct ast_json *blob
+	)
+{
+	RAII_VAR(struct ast_json *, message, NULL, ast_json_unref);
+	RAII_VAR(struct ast_json *, event, NULL, ast_json_unref);
+	struct ast_json *validator;
+	int ret;
+
+	ast_assert(channel_snapshot != NULL);
+	ast_assert(blob != NULL);
+	ast_assert(ast_json_object_get(blob, "channel") == NULL);
+	ast_assert(ast_json_object_get(blob, "type") == NULL);
+
+	validator = ast_json_object_get(blob, "caller_presentation_txt");
+	if (validator) {
+		/* do validation? XXX */
+	} else {
+		/* fail message generation if the required parameter doesn't exist */
+		return NULL;
+	}
+
+	validator = ast_json_object_get(blob, "caller_presentation");
+	if (validator) {
+		/* do validation? XXX */
+	} else {
+		/* fail message generation if the required parameter doesn't exist */
+		return NULL;
+	}
+
+	event = ast_json_deep_copy(blob);
+	if (!event) {
+		return NULL;
+	}
+
+	ret = ast_json_object_set(event,
+		"channel", ast_channel_snapshot_to_json(channel_snapshot));
+	if (ret) {
+		return NULL;
+	}
+
+	message = ast_json_pack("{s: o}", "channel_caller_id", ast_json_ref(event));
+	if (!message) {
+		return NULL;
+	}
+
+	return ast_json_ref(message);
+}
+
+struct ast_json *stasis_json_event_playback_started_create(
+	struct ast_json *blob
+	)
+{
+	RAII_VAR(struct ast_json *, message, NULL, ast_json_unref);
+	RAII_VAR(struct ast_json *, event, NULL, ast_json_unref);
+	struct ast_json *validator;
+
+	ast_assert(blob != NULL);
+	ast_assert(ast_json_object_get(blob, "type") == NULL);
+
+	validator = ast_json_object_get(blob, "playback");
+	if (validator) {
+		/* do validation? XXX */
+	} else {
+		/* fail message generation if the required parameter doesn't exist */
+		return NULL;
+	}
+
+	event = ast_json_deep_copy(blob);
+	if (!event) {
+		return NULL;
+	}
+
+	message = ast_json_pack("{s: o}", "playback_started", ast_json_ref(event));
+	if (!message) {
+		return NULL;
+	}
+
+	return ast_json_ref(message);
+}
+
+struct ast_json *stasis_json_event_bridge_destroyed_create(
+	struct ast_bridge_snapshot *bridge_snapshot
+	)
+{
+	RAII_VAR(struct ast_json *, message, NULL, ast_json_unref);
+	RAII_VAR(struct ast_json *, event, NULL, ast_json_unref);
+	int ret;
+
+	ast_assert(bridge_snapshot != NULL);
+
+	event = ast_json_object_create();
+	if (!event) {
+		return NULL;
+	}
+
+	ret = ast_json_object_set(event,
+		"bridge", ast_bridge_snapshot_to_json(bridge_snapshot));
+	if (ret) {
+		return NULL;
+	}
+
+	message = ast_json_pack("{s: o}", "bridge_destroyed", ast_json_ref(event));
+	if (!message) {
+		return NULL;
+	}
+
+	return ast_json_ref(message);
+}
+
+struct ast_json *stasis_json_event_application_replaced_create(
+	struct ast_json *blob
+	)
+{
+	RAII_VAR(struct ast_json *, message, NULL, ast_json_unref);
+	RAII_VAR(struct ast_json *, event, NULL, ast_json_unref);
+	struct ast_json *validator;
+
+	ast_assert(blob != NULL);
+	ast_assert(ast_json_object_get(blob, "type") == NULL);
+
+	validator = ast_json_object_get(blob, "application");
+	if (validator) {
+		/* do validation? XXX */
+	} else {
+		/* fail message generation if the required parameter doesn't exist */
+		return NULL;
+	}
+
+	event = ast_json_deep_copy(blob);
+	if (!event) {
+		return NULL;
+	}
+
+	message = ast_json_pack("{s: o}", "application_replaced", ast_json_ref(event));
+	if (!message) {
+		return NULL;
+	}
+
+	return ast_json_ref(message);
+}
+
 struct ast_json *stasis_json_event_channel_destroyed_create(
 	struct ast_channel_snapshot *channel_snapshot,
 	struct ast_json *blob
@@ -159,190 +363,6 @@
 	}
 
 	message = ast_json_pack("{s: o}", "channel_destroyed", ast_json_ref(event));
-	if (!message) {
-		return NULL;
-	}
-
-	return ast_json_ref(message);
-}
-
-struct ast_json *stasis_json_event_channel_snapshot_create(
-	struct ast_channel_snapshot *channel_snapshot
-	)
-{
-	RAII_VAR(struct ast_json *, message, NULL, ast_json_unref);
-	RAII_VAR(struct ast_json *, event, NULL, ast_json_unref);
-	int ret;
-
-	ast_assert(channel_snapshot != NULL);
-
-	event = ast_json_object_create();
-	if (!event) {
-		return NULL;
-	}
-
-	ret = ast_json_object_set(event,
-		"channel", ast_channel_snapshot_to_json(channel_snapshot));
-	if (ret) {
-		return NULL;
-	}
-
-	message = ast_json_pack("{s: o}", "channel_snapshot", ast_json_ref(event));
-	if (!message) {
-		return NULL;
-	}
-
-	return ast_json_ref(message);
-}
-
-struct ast_json *stasis_json_event_channel_caller_id_create(
-	struct ast_channel_snapshot *channel_snapshot,
-	struct ast_json *blob
-	)
-{
-	RAII_VAR(struct ast_json *, message, NULL, ast_json_unref);
-	RAII_VAR(struct ast_json *, event, NULL, ast_json_unref);
-	struct ast_json *validator;
-	int ret;
-
-	ast_assert(channel_snapshot != NULL);
-	ast_assert(blob != NULL);
-	ast_assert(ast_json_object_get(blob, "channel") == NULL);
-	ast_assert(ast_json_object_get(blob, "type") == NULL);
-
-	validator = ast_json_object_get(blob, "caller_presentation_txt");
-	if (validator) {
-		/* do validation? XXX */
-	} else {
-		/* fail message generation if the required parameter doesn't exist */
-		return NULL;
-	}
-
-	validator = ast_json_object_get(blob, "caller_presentation");
-	if (validator) {
-		/* do validation? XXX */
-	} else {
-		/* fail message generation if the required parameter doesn't exist */
-		return NULL;
-	}
-
-	event = ast_json_deep_copy(blob);
-	if (!event) {
-		return NULL;
-	}
-
-	ret = ast_json_object_set(event,
-		"channel", ast_channel_snapshot_to_json(channel_snapshot));
-	if (ret) {
-		return NULL;
-	}
-
-	message = ast_json_pack("{s: o}", "channel_caller_id", ast_json_ref(event));
-	if (!message) {
-		return NULL;
-	}
-
-	return ast_json_ref(message);
-}
-
-struct ast_json *stasis_json_event_channel_hangup_request_create(
-	struct ast_channel_snapshot *channel_snapshot,
-	struct ast_json *blob
-	)
-{
-	RAII_VAR(struct ast_json *, message, NULL, ast_json_unref);

[... 1067 lines stripped ...]



More information about the asterisk-commits mailing list