[asterisk-commits] dlee: branch dlee/stasis-http r386101 - in /team/dlee/stasis-http: res/ res/s...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Apr 19 10:04:08 CDT 2013


Author: dlee
Date: Fri Apr 19 10:04:04 2013
New Revision: 386101

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=386101
Log:
Updating REST API for sounds, recordings and playback

Added:
    team/dlee/stasis-http/res/res_stasis_http_playback.c   (with props)
    team/dlee/stasis-http/res/res_stasis_http_sounds.c   (with props)
    team/dlee/stasis-http/res/stasis_http/resource_playback.c   (with props)
    team/dlee/stasis-http/res/stasis_http/resource_playback.h   (with props)
    team/dlee/stasis-http/res/stasis_http/resource_sounds.c   (with props)
    team/dlee/stasis-http/res/stasis_http/resource_sounds.h   (with props)
    team/dlee/stasis-http/rest-api/api-docs/playback.json   (with props)
    team/dlee/stasis-http/rest-api/api-docs/sounds.json   (with props)
Modified:
    team/dlee/stasis-http/res/res_stasis_http_channels.c
    team/dlee/stasis-http/res/res_stasis_http_recordings.c
    team/dlee/stasis-http/res/stasis_http.make
    team/dlee/stasis-http/res/stasis_http/resource_channels.h
    team/dlee/stasis-http/res/stasis_http/resource_recordings.c
    team/dlee/stasis-http/res/stasis_http/resource_recordings.h
    team/dlee/stasis-http/rest-api-templates/asterisk_processor.py
    team/dlee/stasis-http/rest-api-templates/swagger_model.py
    team/dlee/stasis-http/rest-api/api-docs/channels.json
    team/dlee/stasis-http/rest-api/api-docs/recordings.json
    team/dlee/stasis-http/rest-api/resources.json

Modified: team/dlee/stasis-http/res/res_stasis_http_channels.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-http/res/res_stasis_http_channels.c?view=diff&rev=386101&r1=386100&r2=386101
==============================================================================
--- team/dlee/stasis-http/res/res_stasis_http_channels.c (original)
+++ team/dlee/stasis-http/res/res_stasis_http_channels.c Fri Apr 19 10:04:04 2013
@@ -286,6 +286,78 @@
 	stasis_http_unmute_channel(headers, &args, response);
 }
 /*!
+ * \brief Parameter parsing callback for /channels/{channelId}/hold.
+ * \param get_params GET parameters in the HTTP request.
+ * \param path_vars Path variables extracted from the request.
+ * \param headers HTTP headers.
+ * \param[out] response Response to the HTTP request.
+ */
+static void stasis_http_hold_channel_cb(
+    struct ast_variable *get_params, struct ast_variable *path_vars,
+    struct ast_variable *headers, struct stasis_http_response *response)
+{
+        struct ast_hold_channel_args args = {};
+        struct ast_variable *i;
+
+        for (i = path_vars; i; i = i->next) {
+		if (strcmp(i->name, "channelId") == 0) {
+			args.channel_id = (i->value);
+		} else
+                {}
+        }
+	stasis_http_hold_channel(headers, &args, response);
+}
+/*!
+ * \brief Parameter parsing callback for /channels/{channelId}/unhold.
+ * \param get_params GET parameters in the HTTP request.
+ * \param path_vars Path variables extracted from the request.
+ * \param headers HTTP headers.
+ * \param[out] response Response to the HTTP request.
+ */
+static void stasis_http_unhold_channel_cb(
+    struct ast_variable *get_params, struct ast_variable *path_vars,
+    struct ast_variable *headers, struct stasis_http_response *response)
+{
+        struct ast_unhold_channel_args args = {};
+        struct ast_variable *i;
+
+        for (i = path_vars; i; i = i->next) {
+		if (strcmp(i->name, "channelId") == 0) {
+			args.channel_id = (i->value);
+		} else
+                {}
+        }
+	stasis_http_unhold_channel(headers, &args, response);
+}
+/*!
+ * \brief Parameter parsing callback for /channels/{channelId}/play.
+ * \param get_params GET parameters in the HTTP request.
+ * \param path_vars Path variables extracted from the request.
+ * \param headers HTTP headers.
+ * \param[out] response Response to the HTTP request.
+ */
+static void stasis_http_play_on_channel_cb(
+    struct ast_variable *get_params, struct ast_variable *path_vars,
+    struct ast_variable *headers, struct stasis_http_response *response)
+{
+        struct ast_play_on_channel_args args = {};
+        struct ast_variable *i;
+
+        for (i = get_params; i; i = i->next) {
+		if (strcmp(i->name, "media") == 0) {
+			args.media = (i->value);
+		} else
+                {}
+        }
+        for (i = path_vars; i; i = i->next) {
+		if (strcmp(i->name, "channelId") == 0) {
+			args.channel_id = (i->value);
+		} else
+                {}
+        }
+	stasis_http_play_on_channel(headers, &args, response);
+}
+/*!
  * \brief Parameter parsing callback for /channels/{channelId}/record.
  * \param get_params GET parameters in the HTTP request.
  * \param path_vars Path variables extracted from the request.
@@ -384,6 +456,33 @@
 	.children = {  }
 };
 /*! \brief REST handler for /api-docs/channels.{format} */
+static struct stasis_rest_handlers channels_channelId_hold = {
+	.path_segment = "hold",
+	.callbacks = {
+		[AST_HTTP_POST] = stasis_http_hold_channel_cb,
+	},
+	.num_children = 0,
+	.children = {  }
+};
+/*! \brief REST handler for /api-docs/channels.{format} */
+static struct stasis_rest_handlers channels_channelId_unhold = {
+	.path_segment = "unhold",
+	.callbacks = {
+		[AST_HTTP_POST] = stasis_http_unhold_channel_cb,
+	},
+	.num_children = 0,
+	.children = {  }
+};
+/*! \brief REST handler for /api-docs/channels.{format} */
+static struct stasis_rest_handlers channels_channelId_play = {
+	.path_segment = "play",
+	.callbacks = {
+		[AST_HTTP_POST] = stasis_http_play_on_channel_cb,
+	},
+	.num_children = 0,
+	.children = {  }
+};
+/*! \brief REST handler for /api-docs/channels.{format} */
 static struct stasis_rest_handlers channels_channelId_record = {
 	.path_segment = "record",
 	.callbacks = {
@@ -400,8 +499,8 @@
 		[AST_HTTP_GET] = stasis_http_get_channel_cb,
 		[AST_HTTP_DELETE] = stasis_http_delete_channel_cb,
 	},
-	.num_children = 7,
-	.children = { &channels_channelId_dial,&channels_channelId_continue,&channels_channelId_reject,&channels_channelId_answer,&channels_channelId_mute,&channels_channelId_unmute,&channels_channelId_record, }
+	.num_children = 10,
+	.children = { &channels_channelId_dial,&channels_channelId_continue,&channels_channelId_reject,&channels_channelId_answer,&channels_channelId_mute,&channels_channelId_unmute,&channels_channelId_hold,&channels_channelId_unhold,&channels_channelId_play,&channels_channelId_record, }
 };
 /*! \brief REST handler for /api-docs/channels.{format} */
 static struct stasis_rest_handlers channels = {

Added: team/dlee/stasis-http/res/res_stasis_http_playback.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-http/res/res_stasis_http_playback.c?view=auto&rev=386101
==============================================================================
--- team/dlee/stasis-http/res/res_stasis_http_playback.c (added)
+++ team/dlee/stasis-http/res/res_stasis_http_playback.c Fri Apr 19 10:04:04 2013
@@ -1,0 +1,164 @@
+/*
+ * Asterisk -- An open source telephony toolkit.
+ *
+ * Copyright (C) 2012 - 2013, Digium, Inc.
+ *
+ * David M. Lee, II <dlee at digium.com>
+ *
+ * See http://www.asterisk.org for more information about
+ * the Asterisk project. Please do not directly contact
+ * any of the maintainers of this project for assistance;
+ * the project provides a web site, mailing lists and IRC
+ * channels for your use.
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE file
+ * at the top of the source tree.
+ */
+
+/*
+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ * !!!!!                               DO NOT EDIT                        !!!!!
+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ * This file is generated by a mustache template. Please see the original
+ * template in rest-api-templates/res_stasis_http_resource.c.mustache
+ */
+
+/*! \file
+ *
+ * \brief Playback control resources
+ *
+ * \author David M. Lee, II <dlee at digium.com>
+ */
+
+/*** MODULEINFO
+        <depend type="module">res_stasis_http</depend>
+        <support_level>core</support_level>
+ ***/
+
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
+
+#include "asterisk/module.h"
+#include "stasis_http/resource_playback.h"
+
+/*!
+ * \brief Parameter parsing callback for /playback/{playbackId}.
+ * \param get_params GET parameters in the HTTP request.
+ * \param path_vars Path variables extracted from the request.
+ * \param headers HTTP headers.
+ * \param[out] response Response to the HTTP request.
+ */
+static void stasis_http_get_playback_cb(
+    struct ast_variable *get_params, struct ast_variable *path_vars,
+    struct ast_variable *headers, struct stasis_http_response *response)
+{
+        struct ast_get_playback_args args = {};
+        struct ast_variable *i;
+
+        for (i = path_vars; i; i = i->next) {
+		if (strcmp(i->name, "playbackId") == 0) {
+			args.playback_id = (i->value);
+		} else
+                {}
+        }
+	stasis_http_get_playback(headers, &args, response);
+}
+/*!
+ * \brief Parameter parsing callback for /playback/{playbackId}.
+ * \param get_params GET parameters in the HTTP request.
+ * \param path_vars Path variables extracted from the request.
+ * \param headers HTTP headers.
+ * \param[out] response Response to the HTTP request.
+ */
+static void stasis_http_stop_playback_cb(
+    struct ast_variable *get_params, struct ast_variable *path_vars,
+    struct ast_variable *headers, struct stasis_http_response *response)
+{
+        struct ast_stop_playback_args args = {};
+        struct ast_variable *i;
+
+        for (i = path_vars; i; i = i->next) {
+		if (strcmp(i->name, "playbackId") == 0) {
+			args.playback_id = (i->value);
+		} else
+                {}
+        }
+	stasis_http_stop_playback(headers, &args, response);
+}
+/*!
+ * \brief Parameter parsing callback for /playback/{playbackId}/control.
+ * \param get_params GET parameters in the HTTP request.
+ * \param path_vars Path variables extracted from the request.
+ * \param headers HTTP headers.
+ * \param[out] response Response to the HTTP request.
+ */
+static void stasis_http_control_playback_cb(
+    struct ast_variable *get_params, struct ast_variable *path_vars,
+    struct ast_variable *headers, struct stasis_http_response *response)
+{
+        struct ast_control_playback_args args = {};
+        struct ast_variable *i;
+
+        for (i = get_params; i; i = i->next) {
+		if (strcmp(i->name, "operation") == 0) {
+			args.operation = (i->value);
+		} else
+                {}
+        }
+        for (i = path_vars; i; i = i->next) {
+		if (strcmp(i->name, "playbackId") == 0) {
+			args.playback_id = (i->value);
+		} else
+                {}
+        }
+	stasis_http_control_playback(headers, &args, response);
+}
+
+/*! \brief REST handler for /api-docs/playback.{format} */
+static struct stasis_rest_handlers playback_playbackId_control = {
+	.path_segment = "control",
+	.callbacks = {
+		[AST_HTTP_POST] = stasis_http_control_playback_cb,
+	},
+	.num_children = 0,
+	.children = {  }
+};
+/*! \brief REST handler for /api-docs/playback.{format} */
+static struct stasis_rest_handlers playback_playbackId = {
+	.path_segment = "playbackId",
+	.is_wildcard = 1,
+	.callbacks = {
+		[AST_HTTP_GET] = stasis_http_get_playback_cb,
+		[AST_HTTP_DELETE] = stasis_http_stop_playback_cb,
+	},
+	.num_children = 1,
+	.children = { &playback_playbackId_control, }
+};
+/*! \brief REST handler for /api-docs/playback.{format} */
+static struct stasis_rest_handlers playback = {
+	.path_segment = "playback",
+	.callbacks = {
+	},
+	.num_children = 1,
+	.children = { &playback_playbackId, }
+};
+
+static int load_module(void)
+{
+	return stasis_http_add_handler(&playback);
+}
+
+static int unload_module(void)
+{
+	stasis_http_remove_handler(&playback);
+	return 0;
+}
+
+AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT,
+	"RESTful API module - Playback control resources",
+	.load = load_module,
+	.unload = unload_module,
+	.nonoptreq = "res_stasis_http",
+	);

Propchange: team/dlee/stasis-http/res/res_stasis_http_playback.c
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: team/dlee/stasis-http/res/res_stasis_http_playback.c
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: team/dlee/stasis-http/res/res_stasis_http_playback.c
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: team/dlee/stasis-http/res/res_stasis_http_recordings.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-http/res/res_stasis_http_recordings.c?view=diff&rev=386101&r1=386100&r2=386101
==============================================================================
--- team/dlee/stasis-http/res/res_stasis_http_recordings.c (original)
+++ team/dlee/stasis-http/res/res_stasis_http_recordings.c Fri Apr 19 10:04:04 2013
@@ -58,51 +58,123 @@
 	stasis_http_get_recordings(headers, &args, response);
 }
 /*!
- * \brief Parameter parsing callback for /recordings/{recordingId}.
- * \param get_params GET parameters in the HTTP request.
- * \param path_vars Path variables extracted from the request.
- * \param headers HTTP headers.
- * \param[out] response Response to the HTTP request.
- */
-static void stasis_http_get_recording_cb(
-    struct ast_variable *get_params, struct ast_variable *path_vars,
-    struct ast_variable *headers, struct stasis_http_response *response)
-{
-        struct ast_get_recording_args args = {};
-        struct ast_variable *i;
-
-        for (i = path_vars; i; i = i->next) {
-		if (strcmp(i->name, "recordingId") == 0) {
-			args.recording_id = (i->value);
-		} else
-                {}
-        }
-	stasis_http_get_recording(headers, &args, response);
-}
-/*!
- * \brief Parameter parsing callback for /recordings/{recordingId}.
- * \param get_params GET parameters in the HTTP request.
- * \param path_vars Path variables extracted from the request.
- * \param headers HTTP headers.
- * \param[out] response Response to the HTTP request.
- */
-static void stasis_http_delete_recording_cb(
-    struct ast_variable *get_params, struct ast_variable *path_vars,
-    struct ast_variable *headers, struct stasis_http_response *response)
-{
-        struct ast_delete_recording_args args = {};
-        struct ast_variable *i;
-
-        for (i = path_vars; i; i = i->next) {
-		if (strcmp(i->name, "recordingId") == 0) {
-			args.recording_id = (i->value);
-		} else
-                {}
-        }
-	stasis_http_delete_recording(headers, &args, response);
-}
-/*!
- * \brief Parameter parsing callback for /recordings/{recordingId}/stop.
+ * \brief Parameter parsing callback for /recordings/stored.
+ * \param get_params GET parameters in the HTTP request.
+ * \param path_vars Path variables extracted from the request.
+ * \param headers HTTP headers.
+ * \param[out] response Response to the HTTP request.
+ */
+static void stasis_http_get_stored_recordings_cb(
+    struct ast_variable *get_params, struct ast_variable *path_vars,
+    struct ast_variable *headers, struct stasis_http_response *response)
+{
+        struct ast_get_stored_recordings_args args = {};
+	stasis_http_get_stored_recordings(headers, &args, response);
+}
+/*!
+ * \brief Parameter parsing callback for /recordings/stored/{recordingId}.
+ * \param get_params GET parameters in the HTTP request.
+ * \param path_vars Path variables extracted from the request.
+ * \param headers HTTP headers.
+ * \param[out] response Response to the HTTP request.
+ */
+static void stasis_http_get_stored_recording_cb(
+    struct ast_variable *get_params, struct ast_variable *path_vars,
+    struct ast_variable *headers, struct stasis_http_response *response)
+{
+        struct ast_get_stored_recording_args args = {};
+        struct ast_variable *i;
+
+        for (i = path_vars; i; i = i->next) {
+		if (strcmp(i->name, "recordingId") == 0) {
+			args.recording_id = (i->value);
+		} else
+                {}
+        }
+	stasis_http_get_stored_recording(headers, &args, response);
+}
+/*!
+ * \brief Parameter parsing callback for /recordings/stored/{recordingId}.
+ * \param get_params GET parameters in the HTTP request.
+ * \param path_vars Path variables extracted from the request.
+ * \param headers HTTP headers.
+ * \param[out] response Response to the HTTP request.
+ */
+static void stasis_http_delete_stored_recording_cb(
+    struct ast_variable *get_params, struct ast_variable *path_vars,
+    struct ast_variable *headers, struct stasis_http_response *response)
+{
+        struct ast_delete_stored_recording_args args = {};
+        struct ast_variable *i;
+
+        for (i = path_vars; i; i = i->next) {
+		if (strcmp(i->name, "recordingId") == 0) {
+			args.recording_id = (i->value);
+		} else
+                {}
+        }
+	stasis_http_delete_stored_recording(headers, &args, response);
+}
+/*!
+ * \brief Parameter parsing callback for /recordings/live.
+ * \param get_params GET parameters in the HTTP request.
+ * \param path_vars Path variables extracted from the request.
+ * \param headers HTTP headers.
+ * \param[out] response Response to the HTTP request.
+ */
+static void stasis_http_get_live_recordings_cb(
+    struct ast_variable *get_params, struct ast_variable *path_vars,
+    struct ast_variable *headers, struct stasis_http_response *response)
+{
+        struct ast_get_live_recordings_args args = {};
+	stasis_http_get_live_recordings(headers, &args, response);
+}
+/*!
+ * \brief Parameter parsing callback for /recordings/live/{recordingId}.
+ * \param get_params GET parameters in the HTTP request.
+ * \param path_vars Path variables extracted from the request.
+ * \param headers HTTP headers.
+ * \param[out] response Response to the HTTP request.
+ */
+static void stasis_http_get_live_recording_cb(
+    struct ast_variable *get_params, struct ast_variable *path_vars,
+    struct ast_variable *headers, struct stasis_http_response *response)
+{
+        struct ast_get_live_recording_args args = {};
+        struct ast_variable *i;
+
+        for (i = path_vars; i; i = i->next) {
+		if (strcmp(i->name, "recordingId") == 0) {
+			args.recording_id = (i->value);
+		} else
+                {}
+        }
+	stasis_http_get_live_recording(headers, &args, response);
+}
+/*!
+ * \brief Parameter parsing callback for /recordings/live/{recordingId}.
+ * \param get_params GET parameters in the HTTP request.
+ * \param path_vars Path variables extracted from the request.
+ * \param headers HTTP headers.
+ * \param[out] response Response to the HTTP request.
+ */
+static void stasis_http_cancel_recording_cb(
+    struct ast_variable *get_params, struct ast_variable *path_vars,
+    struct ast_variable *headers, struct stasis_http_response *response)
+{
+        struct ast_cancel_recording_args args = {};
+        struct ast_variable *i;
+
+        for (i = path_vars; i; i = i->next) {
+		if (strcmp(i->name, "recordingId") == 0) {
+			args.recording_id = (i->value);
+		} else
+                {}
+        }
+	stasis_http_cancel_recording(headers, &args, response);
+}
+/*!
+ * \brief Parameter parsing callback for /recordings/live/{recordingId}/stop.
  * \param get_params GET parameters in the HTTP request.
  * \param path_vars Path variables extracted from the request.
  * \param headers HTTP headers.
@@ -124,7 +196,7 @@
 	stasis_http_stop_recording(headers, &args, response);
 }
 /*!
- * \brief Parameter parsing callback for /recordings/{recordingId}/pause.
+ * \brief Parameter parsing callback for /recordings/live/{recordingId}/pause.
  * \param get_params GET parameters in the HTTP request.
  * \param path_vars Path variables extracted from the request.
  * \param headers HTTP headers.
@@ -146,7 +218,7 @@
 	stasis_http_pause_recording(headers, &args, response);
 }
 /*!
- * \brief Parameter parsing callback for /recordings/{recordingId}/unpause.
+ * \brief Parameter parsing callback for /recordings/live/{recordingId}/unpause.
  * \param get_params GET parameters in the HTTP request.
  * \param path_vars Path variables extracted from the request.
  * \param headers HTTP headers.
@@ -168,7 +240,7 @@
 	stasis_http_unpause_recording(headers, &args, response);
 }
 /*!
- * \brief Parameter parsing callback for /recordings/{recordingId}/mute.
+ * \brief Parameter parsing callback for /recordings/live/{recordingId}/mute.
  * \param get_params GET parameters in the HTTP request.
  * \param path_vars Path variables extracted from the request.
  * \param headers HTTP headers.
@@ -190,7 +262,7 @@
 	stasis_http_mute_recording(headers, &args, response);
 }
 /*!
- * \brief Parameter parsing callback for /recordings/{recordingId}/unmute.
+ * \brief Parameter parsing callback for /recordings/live/{recordingId}/unmute.
  * \param get_params GET parameters in the HTTP request.
  * \param path_vars Path variables extracted from the request.
  * \param headers HTTP headers.
@@ -213,60 +285,89 @@
 }
 
 /*! \brief REST handler for /api-docs/recordings.{format} */
-static struct stasis_rest_handlers recordings_recordingId_stop = {
-	.path_segment = "stop",
-	.callbacks = {
-		[AST_HTTP_POST] = stasis_http_stop_recording_cb,
-	},
-	.num_children = 0,
-	.children = {  }
-};
-/*! \brief REST handler for /api-docs/recordings.{format} */
-static struct stasis_rest_handlers recordings_recordingId_pause = {
-	.path_segment = "pause",
-	.callbacks = {
-		[AST_HTTP_POST] = stasis_http_pause_recording_cb,
-	},
-	.num_children = 0,
-	.children = {  }
-};
-/*! \brief REST handler for /api-docs/recordings.{format} */
-static struct stasis_rest_handlers recordings_recordingId_unpause = {
-	.path_segment = "unpause",
-	.callbacks = {
-		[AST_HTTP_POST] = stasis_http_unpause_recording_cb,
-	},
-	.num_children = 0,
-	.children = {  }
-};
-/*! \brief REST handler for /api-docs/recordings.{format} */
-static struct stasis_rest_handlers recordings_recordingId_mute = {
-	.path_segment = "mute",
-	.callbacks = {
-		[AST_HTTP_POST] = stasis_http_mute_recording_cb,
-	},
-	.num_children = 0,
-	.children = {  }
-};
-/*! \brief REST handler for /api-docs/recordings.{format} */
-static struct stasis_rest_handlers recordings_recordingId_unmute = {
-	.path_segment = "unmute",
-	.callbacks = {
-		[AST_HTTP_POST] = stasis_http_unmute_recording_cb,
-	},
-	.num_children = 0,
-	.children = {  }
-};
-/*! \brief REST handler for /api-docs/recordings.{format} */
-static struct stasis_rest_handlers recordings_recordingId = {
+static struct stasis_rest_handlers recordings_stored_recordingId = {
 	.path_segment = "recordingId",
 	.is_wildcard = 1,
 	.callbacks = {
-		[AST_HTTP_GET] = stasis_http_get_recording_cb,
-		[AST_HTTP_DELETE] = stasis_http_delete_recording_cb,
+		[AST_HTTP_GET] = stasis_http_get_stored_recording_cb,
+		[AST_HTTP_DELETE] = stasis_http_delete_stored_recording_cb,
+	},
+	.num_children = 0,
+	.children = {  }
+};
+/*! \brief REST handler for /api-docs/recordings.{format} */
+static struct stasis_rest_handlers recordings_stored = {
+	.path_segment = "stored",
+	.callbacks = {
+		[AST_HTTP_GET] = stasis_http_get_stored_recordings_cb,
+	},
+	.num_children = 1,
+	.children = { &recordings_stored_recordingId, }
+};
+/*! \brief REST handler for /api-docs/recordings.{format} */
+static struct stasis_rest_handlers recordings_live_recordingId_stop = {
+	.path_segment = "stop",
+	.callbacks = {
+		[AST_HTTP_POST] = stasis_http_stop_recording_cb,
+	},
+	.num_children = 0,
+	.children = {  }
+};
+/*! \brief REST handler for /api-docs/recordings.{format} */
+static struct stasis_rest_handlers recordings_live_recordingId_pause = {
+	.path_segment = "pause",
+	.callbacks = {
+		[AST_HTTP_POST] = stasis_http_pause_recording_cb,
+	},
+	.num_children = 0,
+	.children = {  }
+};
+/*! \brief REST handler for /api-docs/recordings.{format} */
+static struct stasis_rest_handlers recordings_live_recordingId_unpause = {
+	.path_segment = "unpause",
+	.callbacks = {
+		[AST_HTTP_POST] = stasis_http_unpause_recording_cb,
+	},
+	.num_children = 0,
+	.children = {  }
+};
+/*! \brief REST handler for /api-docs/recordings.{format} */
+static struct stasis_rest_handlers recordings_live_recordingId_mute = {
+	.path_segment = "mute",
+	.callbacks = {
+		[AST_HTTP_POST] = stasis_http_mute_recording_cb,
+	},
+	.num_children = 0,
+	.children = {  }
+};
+/*! \brief REST handler for /api-docs/recordings.{format} */
+static struct stasis_rest_handlers recordings_live_recordingId_unmute = {
+	.path_segment = "unmute",
+	.callbacks = {
+		[AST_HTTP_POST] = stasis_http_unmute_recording_cb,
+	},
+	.num_children = 0,
+	.children = {  }
+};
+/*! \brief REST handler for /api-docs/recordings.{format} */
+static struct stasis_rest_handlers recordings_live_recordingId = {
+	.path_segment = "recordingId",
+	.is_wildcard = 1,
+	.callbacks = {
+		[AST_HTTP_GET] = stasis_http_get_live_recording_cb,
+		[AST_HTTP_DELETE] = stasis_http_cancel_recording_cb,
 	},
 	.num_children = 5,
-	.children = { &recordings_recordingId_stop,&recordings_recordingId_pause,&recordings_recordingId_unpause,&recordings_recordingId_mute,&recordings_recordingId_unmute, }
+	.children = { &recordings_live_recordingId_stop,&recordings_live_recordingId_pause,&recordings_live_recordingId_unpause,&recordings_live_recordingId_mute,&recordings_live_recordingId_unmute, }
+};
+/*! \brief REST handler for /api-docs/recordings.{format} */
+static struct stasis_rest_handlers recordings_live = {
+	.path_segment = "live",
+	.callbacks = {
+		[AST_HTTP_GET] = stasis_http_get_live_recordings_cb,
+	},
+	.num_children = 1,
+	.children = { &recordings_live_recordingId, }
 };
 /*! \brief REST handler for /api-docs/recordings.{format} */
 static struct stasis_rest_handlers recordings = {
@@ -274,8 +375,8 @@
 	.callbacks = {
 		[AST_HTTP_GET] = stasis_http_get_recordings_cb,
 	},
-	.num_children = 1,
-	.children = { &recordings_recordingId, }
+	.num_children = 2,
+	.children = { &recordings_stored,&recordings_live, }
 };
 
 static int load_module(void)

Added: team/dlee/stasis-http/res/res_stasis_http_sounds.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-http/res/res_stasis_http_sounds.c?view=auto&rev=386101
==============================================================================
--- team/dlee/stasis-http/res/res_stasis_http_sounds.c (added)
+++ team/dlee/stasis-http/res/res_stasis_http_sounds.c Fri Apr 19 10:04:04 2013
@@ -1,0 +1,119 @@
+/*
+ * Asterisk -- An open source telephony toolkit.
+ *
+ * Copyright (C) 2012 - 2013, Digium, Inc.
+ *
+ * David M. Lee, II <dlee at digium.com>
+ *
+ * See http://www.asterisk.org for more information about
+ * the Asterisk project. Please do not directly contact
+ * any of the maintainers of this project for assistance;
+ * the project provides a web site, mailing lists and IRC
+ * channels for your use.
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE file
+ * at the top of the source tree.
+ */
+
+/*
+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ * !!!!!                               DO NOT EDIT                        !!!!!
+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ * This file is generated by a mustache template. Please see the original
+ * template in rest-api-templates/res_stasis_http_resource.c.mustache
+ */
+
+/*! \file
+ *
+ * \brief Sound resources
+ *
+ * \author David M. Lee, II <dlee at digium.com>
+ */
+
+/*** MODULEINFO
+        <depend type="module">res_stasis_http</depend>
+        <support_level>core</support_level>
+ ***/
+
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
+
+#include "asterisk/module.h"
+#include "stasis_http/resource_sounds.h"
+
+/*!
+ * \brief Parameter parsing callback for /sounds.
+ * \param get_params GET parameters in the HTTP request.
+ * \param path_vars Path variables extracted from the request.
+ * \param headers HTTP headers.
+ * \param[out] response Response to the HTTP request.
+ */
+static void stasis_http_get_sounds_cb(
+    struct ast_variable *get_params, struct ast_variable *path_vars,
+    struct ast_variable *headers, struct stasis_http_response *response)
+{
+        struct ast_get_sounds_args args = {};
+	stasis_http_get_sounds(headers, &args, response);
+}
+/*!
+ * \brief Parameter parsing callback for /sounds/{soundId}.
+ * \param get_params GET parameters in the HTTP request.
+ * \param path_vars Path variables extracted from the request.
+ * \param headers HTTP headers.
+ * \param[out] response Response to the HTTP request.
+ */
+static void stasis_http_get_stored_sound_cb(
+    struct ast_variable *get_params, struct ast_variable *path_vars,
+    struct ast_variable *headers, struct stasis_http_response *response)
+{
+        struct ast_get_stored_sound_args args = {};
+        struct ast_variable *i;
+
+        for (i = path_vars; i; i = i->next) {
+		if (strcmp(i->name, "soundId") == 0) {
+			args.sound_id = (i->value);
+		} else
+                {}
+        }
+	stasis_http_get_stored_sound(headers, &args, response);
+}
+
+/*! \brief REST handler for /api-docs/sounds.{format} */
+static struct stasis_rest_handlers sounds_soundId = {
+	.path_segment = "soundId",
+	.is_wildcard = 1,
+	.callbacks = {
+		[AST_HTTP_GET] = stasis_http_get_stored_sound_cb,
+	},
+	.num_children = 0,
+	.children = {  }
+};
+/*! \brief REST handler for /api-docs/sounds.{format} */
+static struct stasis_rest_handlers sounds = {
+	.path_segment = "sounds",
+	.callbacks = {
+		[AST_HTTP_GET] = stasis_http_get_sounds_cb,
+	},
+	.num_children = 1,
+	.children = { &sounds_soundId, }
+};
+
+static int load_module(void)
+{
+	return stasis_http_add_handler(&sounds);
+}
+
+static int unload_module(void)
+{
+	stasis_http_remove_handler(&sounds);
+	return 0;
+}
+
+AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT,
+	"RESTful API module - Sound resources",
+	.load = load_module,
+	.unload = unload_module,
+	.nonoptreq = "res_stasis_http",
+	);

Propchange: team/dlee/stasis-http/res/res_stasis_http_sounds.c
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: team/dlee/stasis-http/res/res_stasis_http_sounds.c
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: team/dlee/stasis-http/res/res_stasis_http_sounds.c
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: team/dlee/stasis-http/res/stasis_http.make
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-http/res/stasis_http.make?view=diff&rev=386101&r1=386100&r2=386101
==============================================================================
--- team/dlee/stasis-http/res/stasis_http.make (original)
+++ team/dlee/stasis-http/res/stasis_http.make Fri Apr 19 10:04:04 2013
@@ -37,6 +37,14 @@
 
 stasis_http/resource_recordings.o: _ASTCFLAGS+=$(call MOD_ASTCFLAGS,res_stasis_http_recordings)
 
+res_stasis_http_sounds.so: stasis_http/resource_sounds.o
+
+stasis_http/resource_sounds.o: _ASTCFLAGS+=$(call MOD_ASTCFLAGS,res_stasis_http_sounds)
+
+res_stasis_http_playback.so: stasis_http/resource_playback.o
+
+stasis_http/resource_playback.o: _ASTCFLAGS+=$(call MOD_ASTCFLAGS,res_stasis_http_playback)
+
 res_stasis_http_events.so: stasis_http/resource_events.o
 
 stasis_http/resource_events.o: _ASTCFLAGS+=$(call MOD_ASTCFLAGS,res_stasis_http_events)

Modified: team/dlee/stasis-http/res/stasis_http/resource_channels.h
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-http/res/stasis_http/resource_channels.h?view=diff&rev=386101&r1=386100&r2=386101
==============================================================================
--- team/dlee/stasis-http/res/stasis_http/resource_channels.h (original)
+++ team/dlee/stasis-http/res/stasis_http/resource_channels.h Fri Apr 19 10:04:04 2013
@@ -147,7 +147,7 @@
 struct ast_mute_channel_args {
 	/*! \brief Channel's id */
 	const char *channel_id;
-	/*! \brief Direction in which to unmute audio */
+	/*! \brief Direction in which to mute audio */
 	const char *direction;
 };
 /*!
@@ -171,6 +171,47 @@
  * \param[out] response HTTP response
  */
 void stasis_http_unmute_channel(struct ast_variable *headers, struct ast_unmute_channel_args *args, struct stasis_http_response *response);
+/*! \brief Argument struct for stasis_http_hold_channel() */
+struct ast_hold_channel_args {
+	/*! \brief Channel's id */
+	const char *channel_id;
+};
+/*!
+ * \brief Hold a channel
+ * \param headers HTTP headers
+ * \param args Swagger parameters
+ * \param[out] response HTTP response
+ */
+void stasis_http_hold_channel(struct ast_variable *headers, struct ast_hold_channel_args *args, struct stasis_http_response *response);
+/*! \brief Argument struct for stasis_http_unhold_channel() */
+struct ast_unhold_channel_args {
+	/*! \brief Channel's id */
+	const char *channel_id;
+};
+/*!
+ * \brief Remove a channel from hold
+ * \param headers HTTP headers
+ * \param args Swagger parameters
+ * \param[out] response HTTP response
+ */
+void stasis_http_unhold_channel(struct ast_variable *headers, struct ast_unhold_channel_args *args, struct stasis_http_response *response);
+/*! \brief Argument struct for stasis_http_play_on_channel() */
+struct ast_play_on_channel_args {
+	/*! \brief Channel's id */
+	const char *channel_id;
+	/*! \brief Media's URI to play. */
+	const char *media;
+};
+/*!
+ * \brief Start playback of media.
+ *
+ * The media URI may be any of a number of URI's. You may use http: and https: URI's, as well as sound: and recording: URI's. This operation creates a playback resource that can be used to control the playback of media (pause, rewind, fast forward, etc.)
+ *
+ * \param headers HTTP headers
+ * \param args Swagger parameters
+ * \param[out] response HTTP response
+ */
+void stasis_http_play_on_channel(struct ast_variable *headers, struct ast_play_on_channel_args *args, struct stasis_http_response *response);
 /*! \brief Argument struct for stasis_http_record_channel() */
 struct ast_record_channel_args {
 	/*! \brief Channel's id */

Added: team/dlee/stasis-http/res/stasis_http/resource_playback.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-http/res/stasis_http/resource_playback.c?view=auto&rev=386101
==============================================================================
--- team/dlee/stasis-http/res/stasis_http/resource_playback.c (added)
+++ team/dlee/stasis-http/res/stasis_http/resource_playback.c Fri Apr 19 10:04:04 2013
@@ -1,0 +1,43 @@
+/*
+ * Asterisk -- An open source telephony toolkit.
+ *
+ * Copyright (C) 2012 - 2013, Digium, Inc.
+ *
+ * David M. Lee, II <dlee at digium.com>
+ *
+ * See http://www.asterisk.org for more information about
+ * the Asterisk project. Please do not directly contact
+ * any of the maintainers of this project for assistance;
+ * the project provides a web site, mailing lists and IRC
+ * channels for your use.
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE file
+ * at the top of the source tree.
+ */
+
+/*! \file
+ *
+ * \brief /api-docs/playback.{format} implementation- Playback control resources
+ *
+ * \author David M. Lee, II <dlee at digium.com>
+ */
+
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
+
+#include "resource_playback.h"
+
+void stasis_http_get_playback(struct ast_variable *headers, struct ast_get_playback_args *args, struct stasis_http_response *response)
+{
+	ast_log(LOG_ERROR, "TODO: stasis_http_get_playback\n");
+}
+void stasis_http_stop_playback(struct ast_variable *headers, struct ast_stop_playback_args *args, struct stasis_http_response *response)
+{
+	ast_log(LOG_ERROR, "TODO: stasis_http_stop_playback\n");
+}
+void stasis_http_control_playback(struct ast_variable *headers, struct ast_control_playback_args *args, struct stasis_http_response *response)
+{
+	ast_log(LOG_ERROR, "TODO: stasis_http_control_playback\n");
+}

Propchange: team/dlee/stasis-http/res/stasis_http/resource_playback.c
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: team/dlee/stasis-http/res/stasis_http/resource_playback.c
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: team/dlee/stasis-http/res/stasis_http/resource_playback.c
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: team/dlee/stasis-http/res/stasis_http/resource_playback.h
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-http/res/stasis_http/resource_playback.h?view=auto&rev=386101
==============================================================================
--- team/dlee/stasis-http/res/stasis_http/resource_playback.h (added)
+++ team/dlee/stasis-http/res/stasis_http/resource_playback.h Fri Apr 19 10:04:04 2013
@@ -1,0 +1,81 @@
+/*
+ * Asterisk -- An open source telephony toolkit.
+ *
+ * Copyright (C) 2012 - 2013, Digium, Inc.
+ *
+ * David M. Lee, II <dlee at digium.com>
+ *
+ * See http://www.asterisk.org for more information about
+ * the Asterisk project. Please do not directly contact
+ * any of the maintainers of this project for assistance;
+ * the project provides a web site, mailing lists and IRC
+ * channels for your use.
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE file
+ * at the top of the source tree.
+ */
+
+/*! \file
+ *
+ * \brief Generated file - declares stubs to be implemented in
+ * res/stasis_http/resource_playback.c
+ *
+ * Playback control resources
+ *
+ * \author David M. Lee, II <dlee at digium.com>
+ */
+
+/*
+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ * !!!!!                               DO NOT EDIT                        !!!!!
+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ * This file is generated by a mustache template. Please see the original
+ * template in rest-api-templates/stasis_http_resource.h.mustache
+ */
+
+#ifndef _ASTERISK_RESOURCE_PLAYBACK_H
+#define _ASTERISK_RESOURCE_PLAYBACK_H
+
+#include "asterisk/stasis_http.h"
+
+/*! \brief Argument struct for stasis_http_get_playback() */
+struct ast_get_playback_args {
+	/*! \brief Playback's id */
+	const char *playback_id;
+};
+/*!
+ * \brief Get a playback's details
+ * \param headers HTTP headers
+ * \param args Swagger parameters
+ * \param[out] response HTTP response
+ */
+void stasis_http_get_playback(struct ast_variable *headers, struct ast_get_playback_args *args, struct stasis_http_response *response);
+/*! \brief Argument struct for stasis_http_stop_playback() */
+struct ast_stop_playback_args {
+	/*! \brief Playback's id */
+	const char *playback_id;
+};
+/*!
+ * \brief Stop a playback
+ * \param headers HTTP headers
+ * \param args Swagger parameters
+ * \param[out] response HTTP response
+ */
+void stasis_http_stop_playback(struct ast_variable *headers, struct ast_stop_playback_args *args, struct stasis_http_response *response);
+/*! \brief Argument struct for stasis_http_control_playback() */
+struct ast_control_playback_args {
+	/*! \brief Playback's id */
+	const char *playback_id;
+	/*! \brief Operation to perform on the playback. */
+	const char *operation;
+};
+/*!
+ * \brief Get a playback's details
+ * \param headers HTTP headers
+ * \param args Swagger parameters
+ * \param[out] response HTTP response
+ */
+void stasis_http_control_playback(struct ast_variable *headers, struct ast_control_playback_args *args, struct stasis_http_response *response);
+

[... 982 lines stripped ...]



More information about the asterisk-commits mailing list