[asterisk-commits] dlee: branch dlee/endpoints r386350 - in /team/dlee/endpoints: include/asteri...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Apr 23 11:49:38 CDT 2013


Author: dlee
Date: Tue Apr 23 11:49:35 2013
New Revision: 386350

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=386350
Log:
Update

Added:
    team/dlee/endpoints/include/asterisk/endpoints.h   (with props)
    team/dlee/endpoints/main/endpoints.c   (with props)
    team/dlee/endpoints/main/stasis_endpoints.c   (with props)
Modified:
    team/dlee/endpoints/include/asterisk/stasis_endpoints.h
    team/dlee/endpoints/res/res_stasis_http_endpoints.c
    team/dlee/endpoints/res/stasis_http/resource_endpoints.c
    team/dlee/endpoints/res/stasis_http/resource_endpoints.h
    team/dlee/endpoints/rest-api/api-docs/endpoints.json

Added: team/dlee/endpoints/include/asterisk/endpoints.h
URL: http://svnview.digium.com/svn/asterisk/team/dlee/endpoints/include/asterisk/endpoints.h?view=auto&rev=386350
==============================================================================
--- team/dlee/endpoints/include/asterisk/endpoints.h (added)
+++ team/dlee/endpoints/include/asterisk/endpoints.h Tue Apr 23 11:49:35 2013
@@ -1,0 +1,72 @@
+/*
+ * Asterisk -- An open source telephony toolkit.
+ *
+ * Copyright (C) 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.
+ */
+
+#ifndef _ASTERISK_ENDPOINTS_H
+#define _ASTERISK_ENDPOINTS_H
+
+/*! \file
+ *
+ * \brief Endpoint abstractions.
+ *
+ * \author David M. Lee, II <dlee at digium.com>
+ * \since 12
+ */
+
+#include "asterisk/json.h"
+
+/*!
+ * \brief Opaque struct representing an endpoint.
+ *
+ * And an endpoint is an external device/system that may offer/accept channels
+ * to/from Asterisk.
+ *
+ * \since 12
+ */
+struct ast_endpoint;
+
+/*!
+ * \brief Create an endpoint struct.
+ *
+ * \param tech Technology for this endpoint.
+ * \param name Name of this endpoint.
+ * \return Newly created endpoint.
+ * \return \c NULL on error.
+ */
+struct ast_endpoint *ast_endpoint_create(const char *tech, const char *name);
+
+/*!
+ * \brief Gets the technology of the given endpoint.
+ *
+ * \param endpoint The endpoint.
+ * \return Tec of the endpoint.
+ * \return \c NULL if endpoint is \c NULL.
+ * \since 12
+ */
+const char *ast_endpoint_get_tech(struct ast_endpoint *endpoint);
+
+/*!
+ * \brief Gets the name of the given endpoint.
+ *
+ * \param endpoint The endpoint.
+ * \return Name of the endpoint.
+ * \return \c NULL if endpoint is \c NULL.
+ * \since 12
+ */
+const char *ast_endpoint_get_name(struct ast_endpoint *endpoint);
+
+#endif /* _ASTERISK_ENDPOINTS_H */

Propchange: team/dlee/endpoints/include/asterisk/endpoints.h
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: team/dlee/endpoints/include/asterisk/endpoints.h
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: team/dlee/endpoints/include/asterisk/endpoints.h
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: team/dlee/endpoints/include/asterisk/stasis_endpoints.h
URL: http://svnview.digium.com/svn/asterisk/team/dlee/endpoints/include/asterisk/stasis_endpoints.h?view=diff&rev=386350&r1=386349&r2=386350
==============================================================================
--- team/dlee/endpoints/include/asterisk/stasis_endpoints.h (original)
+++ team/dlee/endpoints/include/asterisk/stasis_endpoints.h Tue Apr 23 11:49:35 2013
@@ -27,35 +27,10 @@
  * \since 12
  */
 
+#include "asterisk/endpoints.h"
 #include "asterisk/json.h"
-
-/*!
- * \brief Opaque struct representing an endpoint.
- *
- * And an endpoint is an external device/system that may offer/accept channels
- * to/from Asterisk.
- *
- * \since 12
- */
-struct ast_endpoint;
-
-/*!
- * \brief Gets the name of the given endpoint.
- * \param endpoint The endpoint.
- * \return Name of the endpoint.
- * \return \c NULL if endpoint is \c NULL.
- * \since 12
- */
-const char *ast_endpoint_get_name(struct ast_endpoint *endpoint);
-
-/*!
- * \brief Finds the endpoint with the given name.
- * \param name Name of the endpoint.
- * \return \ref ast_endpoint with the given name.
- * \return \c NULL if endpoint is not found.
- * \since 12
- */
-struct ast_endpoint *ast_find_endpoint_by_name(const char *name);
+#include "asterisk/stasis.h"
+#include "asterisk/stringfields.h"
 
 /*! \addtogroup StasisTopicsAndMessages
  * @{
@@ -66,23 +41,23 @@
  * \since 12
  */
 enum ast_endpoint_state {
-	/*! The endpoint cannot offer or accept channels due to configuration. */
+	/*! The endpoint cannot offer/accept channels due to configuration. */
 	AST_ENDPOINT_DISABLED,
-	/*! The endpoint is currently not in use (no channels). */
-	AST_ENDPOINT_IDLE,
-	/*! The endpoint has one or more channels. */
+	/*! The endpoint is available. */
 	AST_ENDPOINT_ACTIVE,
-	/*! The endpoint cannot offer or accept channels due to an error condition. */
+	/*! The endpoint cannot offer or accept channels due to an error
+	 *  condition. */
 	AST_ENDPOINT_ERROR,
 };
 
 /*!
  * \brief A snapshot of an endpoint's state.
+ *
  * \since 12
  */
 struct ast_endpoint_snapshot {
 	AST_DECLARE_STRING_FIELDS(
-		AST_STRING_FIELD(name);	/*!< Name of the endpoint. */
+		AST_STRING_FIELD(id);	/*!< id for this endpoint. */
 		);
 
 	/*! Endpoint state */
@@ -121,7 +96,7 @@
  * \return Topic for this endpoint.
  * \return ast_endpoint_topic_all() if \a endpoint is \c NULL.
  */
-struct stasis_topic *ast_endpoint_topic(ast_endpoint *endpoint);
+struct stasis_topic *ast_endpoint_topic(struct ast_endpoint *endpoint);
 
 /*!
  * \brief Topic for all endpoint releated messages.
@@ -138,13 +113,24 @@
 /*!
  * \brief Retrieve the most recent snapshot for the endpoint with the given
  * name.
+ *
+ * \param tech Name of the endpoint's technology.
  * \param name Name of the endpoint.
  * \return Snapshot of the endpoint with the given name.
  * \return \c NULL if endpoint is not found, or on error.
  * \since 12
  */
-struct ast_endpoint_snapshot *ast_endpoint_latest_snapshot(const char *name);
+struct ast_endpoint_snapshot *ast_endpoint_latest_snapshot(const char *tech,
+	const char *name);
 
 /*! @} */
 
+/*!
+ * \brief Initialization function for endpoint stasis support.
+ *
+ * \return 0 on success.
+ * \return non-zero on error.
+ */
+int ast_endpoints_stasis_init(void);
+
 #endif /* _ASTERISK_STASIS_ENDPOINTS_H */

Added: team/dlee/endpoints/main/endpoints.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/endpoints/main/endpoints.c?view=auto&rev=386350
==============================================================================
--- team/dlee/endpoints/main/endpoints.c (added)
+++ team/dlee/endpoints/main/endpoints.c Tue Apr 23 11:49:35 2013
@@ -1,0 +1,108 @@
+/*
+ * Asterisk -- An open source telephony toolkit.
+ *
+ * Copyright (C) 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 Asterisk endpoint API.
+ *
+ * \author David M. Lee, II <dlee at digium.com>
+ */
+
+/*** MODULEINFO
+	<support_level>core</support_level>
+ ***/
+
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
+
+#include "asterisk/astobj2.h"
+#include "asterisk/endpoints.h"
+#include "asterisk/stasis.h"
+#include "asterisk/stasis_endpoints.h"
+#include "asterisk/stringfields.h"
+
+struct ast_endpoint {
+	AST_DECLARE_STRING_FIELDS(
+		AST_STRING_FIELD(tech);	/*!< Technology for the endpoint. */
+		AST_STRING_FIELD(name);	/*!< Name of the endpoint. */
+		);
+	struct stasis_topic *topic;
+	struct stasis_subscription *forward;
+};
+
+static void endpoint_dtor(void *obj)
+{
+	struct ast_endpoint *endpoint = obj;
+
+	stasis_unsubscribe(endpoint->forward);
+	endpoint->forward = NULL;
+
+	ao2_cleanup(endpoint->topic);
+	endpoint->topic = NULL;
+
+	ast_string_field_free_memory(endpoint);
+}
+
+struct ast_endpoint *ast_endpoint_create(const char *tech, const char *name)
+{
+	RAII_VAR(struct ast_endpoint *, endpoint, NULL, ao2_cleanup);
+	RAII_VAR(struct ast_str *, full_name, NULL, ast_free);
+
+	endpoint = ao2_alloc(sizeof(*endpoint), endpoint_dtor);
+	if (!endpoint) {
+		return NULL;
+	}
+
+	if (ast_string_field_init(endpoint, 80) != 0) {
+		return NULL;
+	}
+
+	ast_string_field_set(endpoint, tech, tech);
+	ast_string_field_set(endpoint, name, name);
+
+	ast_str_set(&full_name, 0, "endpoint:%s/%s", tech, name);
+	endpoint->topic = stasis_topic_create(ast_str_buffer(full_name));
+	if (!endpoint->topic) {
+		return NULL;
+	}
+
+	endpoint->forward =
+		stasis_forward_all(endpoint->topic, ast_endpoint_topic_all());
+	if (!endpoint->forward) {
+		return NULL;
+	}
+
+	return endpoint;
+}
+
+const char *ast_endpoint_get_tech(struct ast_endpoint *endpoint)
+{
+	return endpoint->tech;
+}
+
+const char *ast_endpoint_get_name(struct ast_endpoint *endpoint)
+{
+	return endpoint->name;
+}
+
+struct stasis_topic *ast_endpoint_topic(struct ast_endpoint *endpoint)
+{
+	return endpoint->topic;
+}
+

Propchange: team/dlee/endpoints/main/endpoints.c
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: team/dlee/endpoints/main/endpoints.c
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: team/dlee/endpoints/main/endpoints.c
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: team/dlee/endpoints/main/stasis_endpoints.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/endpoints/main/stasis_endpoints.c?view=auto&rev=386350
==============================================================================
--- team/dlee/endpoints/main/stasis_endpoints.c (added)
+++ team/dlee/endpoints/main/stasis_endpoints.c Tue Apr 23 11:49:35 2013
@@ -1,0 +1,115 @@
+/*
+ * Asterisk -- An open source telephony toolkit.
+ *
+ * Copyright (C) 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 Stasis endpoint API.
+ *
+ * \author David M. Lee, II <dlee at digium.com>
+ */
+
+/*** MODULEINFO
+	<support_level>core</support_level>
+ ***/
+
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
+
+#include "asterisk/astobj2.h"
+#include "asterisk/stasis.h"
+#include "asterisk/stasis_endpoints.h"
+
+static struct stasis_topic *endpoint_topic_all;
+
+static struct stasis_caching_topic *endpoint_topic_all_cached;
+
+struct stasis_topic *ast_endpoint_topic_all(void)
+{
+	return endpoint_topic_all;
+}
+
+struct stasis_caching_topic *ast_endpoint_topic_all_cached(void)
+{
+	return endpoint_topic_all_cached;
+}
+
+struct ast_endpoint_snapshot *ast_endpoint_latest_snapshot(const char *tech,
+	const char *name)
+{
+	ast_assert(0); // TODO
+	return NULL;
+}
+
+/*!
+ * \brief Callback extract a unique identity from a snapshot message.
+ *
+ * This identity is unique to the underlying object of the snapshot, such as the
+ * UniqueId field of a channel.
+ *
+ * \param message Message to extract id from.
+ * \return String representing the snapshot's id.
+ * \return \c NULL if the message_type of the message isn't a handled snapshot.
+ * \since 12
+ */
+static const char *endpoint_snapshot_get_id(struct stasis_message *message)
+{
+	struct ast_endpoint_snapshot *snapshot;
+
+	if (ast_endpoint_snapshot_type() != stasis_message_type(message)) {
+		return NULL;
+	}
+
+	snapshot = stasis_message_data(message);
+
+	return snapshot->id;
+}
+
+
+static void endpoints_stasis_shutdown(void)
+{
+	ao2_cleanup(endpoint_topic_all);
+	endpoint_topic_all = NULL;
+
+	stasis_caching_unsubscribe(endpoint_topic_all_cached);
+	endpoint_topic_all_cached = NULL;
+}
+
+int ast_endpoints_stasis_init(void)
+{
+	ast_register_atexit(endpoints_stasis_shutdown);
+
+	if (!endpoint_topic_all) {
+		endpoint_topic_all = stasis_topic_create("endpoint_topic_all");
+	}
+
+	if (!endpoint_topic_all) {
+		return -1;
+	}
+
+	if (!endpoint_topic_all_cached) {
+		stasis_caching_topic_create(
+			endpoint_topic_all, endpoint_snapshot_get_id);
+	}
+
+	if (!endpoint_topic_all_cached) {
+		return -1;
+	}
+
+	return 0;
+}

Propchange: team/dlee/endpoints/main/stasis_endpoints.c
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: team/dlee/endpoints/main/stasis_endpoints.c
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: team/dlee/endpoints/main/stasis_endpoints.c
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: team/dlee/endpoints/res/res_stasis_http_endpoints.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/endpoints/res/res_stasis_http_endpoints.c?view=diff&rev=386350&r1=386349&r2=386350
==============================================================================
--- team/dlee/endpoints/res/res_stasis_http_endpoints.c (original)
+++ team/dlee/endpoints/res/res_stasis_http_endpoints.c Tue Apr 23 11:49:35 2013
@@ -55,18 +55,32 @@
     struct ast_variable *headers, struct stasis_http_response *response)
 {
 	struct ast_get_endpoints_args args = {};
+	stasis_http_get_endpoints(headers, &args, response);
+}
+/*!
+ * \brief Parameter parsing callback for /endpoints/{tech}.
+ * \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_endpoints_by_tech_cb(
+    struct ast_variable *get_params, struct ast_variable *path_vars,
+    struct ast_variable *headers, struct stasis_http_response *response)
+{
+	struct ast_get_endpoints_by_tech_args args = {};
 	struct ast_variable *i;
 
-	for (i = get_params; i; i = i->next) {
-		if (strcmp(i->name, "withType") == 0) {
-			args.with_type = (i->value);
+	for (i = path_vars; i; i = i->next) {
+		if (strcmp(i->name, "tech") == 0) {
+			args.tech = (i->value);
 		} else
 		{}
 	}
-	stasis_http_get_endpoints(headers, &args, response);
+	stasis_http_get_endpoints_by_tech(headers, &args, response);
 }
 /*!
- * \brief Parameter parsing callback for /endpoints/{endpointId}.
+ * \brief Parameter parsing callback for /endpoints/{tech}/{resource}.
  * \param get_params GET parameters in the HTTP request.
  * \param path_vars Path variables extracted from the request.
  * \param headers HTTP headers.
@@ -80,8 +94,11 @@
 	struct ast_variable *i;
 
 	for (i = path_vars; i; i = i->next) {
-		if (strcmp(i->name, "endpointId") == 0) {
-			args.endpoint_id = (i->value);
+		if (strcmp(i->name, "tech") == 0) {
+			args.tech = (i->value);
+		} else
+		if (strcmp(i->name, "resource") == 0) {
+			args.resource = (i->value);
 		} else
 		{}
 	}
@@ -89,8 +106,8 @@
 }
 
 /*! \brief REST handler for /api-docs/endpoints.{format} */
-static struct stasis_rest_handlers endpoints_endpointId = {
-	.path_segment = "endpointId",
+static struct stasis_rest_handlers endpoints_tech_resource = {
+	.path_segment = "resource",
 	.is_wildcard = 1,
 	.callbacks = {
 		[AST_HTTP_GET] = stasis_http_get_endpoint_cb,
@@ -99,13 +116,23 @@
 	.children = {  }
 };
 /*! \brief REST handler for /api-docs/endpoints.{format} */
+static struct stasis_rest_handlers endpoints_tech = {
+	.path_segment = "tech",
+	.is_wildcard = 1,
+	.callbacks = {
+		[AST_HTTP_GET] = stasis_http_get_endpoints_by_tech_cb,
+	},
+	.num_children = 1,
+	.children = { &endpoints_tech_resource, }
+};
+/*! \brief REST handler for /api-docs/endpoints.{format} */
 static struct stasis_rest_handlers endpoints = {
 	.path_segment = "endpoints",
 	.callbacks = {
 		[AST_HTTP_GET] = stasis_http_get_endpoints_cb,
 	},
 	.num_children = 1,
-	.children = { &endpoints_endpointId, }
+	.children = { &endpoints_tech, }
 };
 
 static int load_module(void)

Modified: team/dlee/endpoints/res/stasis_http/resource_endpoints.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/endpoints/res/stasis_http/resource_endpoints.c?view=diff&rev=386350&r1=386349&r2=386350
==============================================================================
--- team/dlee/endpoints/res/stasis_http/resource_endpoints.c (original)
+++ team/dlee/endpoints/res/stasis_http/resource_endpoints.c Tue Apr 23 11:49:35 2013
@@ -1,4 +1,4 @@
-/* -*- C -*-
+/*
  * Asterisk -- An open source telephony toolkit.
  *
  * Copyright (C) 2012 - 2013, Digium, Inc.
@@ -18,14 +18,10 @@
 
 /*! \file
  *
- * \brief Implementation for stasis-http stubs.
+ * \brief /api-docs/endpoints.{format} implementation- Endpoint resources
  *
  * \author David M. Lee, II <dlee at digium.com>
  */
-
-/*** MODULEINFO
-	<support_level>core</support_level>
- ***/
 
 #include "asterisk.h"
 
@@ -33,11 +29,15 @@
 
 #include "resource_endpoints.h"
 
+void stasis_http_get_endpoints(struct ast_variable *headers, struct ast_get_endpoints_args *args, struct stasis_http_response *response)
+{
+	ast_log(LOG_ERROR, "TODO: stasis_http_get_endpoints\n");
+}
+void stasis_http_get_endpoints_by_tech(struct ast_variable *headers, struct ast_get_endpoints_by_tech_args *args, struct stasis_http_response *response)
+{
+	ast_log(LOG_ERROR, "TODO: stasis_http_get_endpoints_by_tech\n");
+}
 void stasis_http_get_endpoint(struct ast_variable *headers, struct ast_get_endpoint_args *args, struct stasis_http_response *response)
 {
 	ast_log(LOG_ERROR, "TODO: stasis_http_get_endpoint\n");
 }
-void stasis_http_get_endpoints(struct ast_variable *headers, struct ast_get_endpoints_args *args, struct stasis_http_response *response)
-{
-	ast_log(LOG_ERROR, "TODO: stasis_http_get_endpoints\n");
-}

Modified: team/dlee/endpoints/res/stasis_http/resource_endpoints.h
URL: http://svnview.digium.com/svn/asterisk/team/dlee/endpoints/res/stasis_http/resource_endpoints.h?view=diff&rev=386350&r1=386349&r2=386350
==============================================================================
--- team/dlee/endpoints/res/stasis_http/resource_endpoints.h (original)
+++ team/dlee/endpoints/res/stasis_http/resource_endpoints.h Tue Apr 23 11:49:35 2013
@@ -41,21 +41,34 @@
 
 /*! \brief Argument struct for stasis_http_get_endpoints() */
 struct ast_get_endpoints_args {
-	/*! \brief Filter endpoints by type (sip,iax2,dhadi,...) */
-	const char *with_type;
 };
 /*!
- * \brief List available endoints.
+ * \brief List all endoints.
  *
  * \param headers HTTP headers
  * \param args Swagger parameters
  * \param[out] response HTTP response
  */
 void stasis_http_get_endpoints(struct ast_variable *headers, struct ast_get_endpoints_args *args, struct stasis_http_response *response);
+/*! \brief Argument struct for stasis_http_get_endpoints_by_tech() */
+struct ast_get_endpoints_by_tech_args {
+	/*! \brief Technology of the endpoints (sip,iax2,...) */
+	const char *tech;
+};
+/*!
+ * \brief List available endoints for a given endpoint technology.
+ *
+ * \param headers HTTP headers
+ * \param args Swagger parameters
+ * \param[out] response HTTP response
+ */
+void stasis_http_get_endpoints_by_tech(struct ast_variable *headers, struct ast_get_endpoints_by_tech_args *args, struct stasis_http_response *response);
 /*! \brief Argument struct for stasis_http_get_endpoint() */
 struct ast_get_endpoint_args {
+	/*! \brief Technology of the endpoint */
+	const char *tech;
 	/*! \brief ID of the endpoint */
-	const char *endpoint_id;
+	const char *resource;
 };
 /*!
  * \brief Details for an endpoint.

Modified: team/dlee/endpoints/rest-api/api-docs/endpoints.json
URL: http://svnview.digium.com/svn/asterisk/team/dlee/endpoints/rest-api/api-docs/endpoints.json?view=diff&rev=386350&r1=386349&r2=386350
==============================================================================
--- team/dlee/endpoints/rest-api/api-docs/endpoints.json (original)
+++ team/dlee/endpoints/rest-api/api-docs/endpoints.json Tue Apr 23 11:49:35 2013
@@ -13,16 +13,26 @@
 			"operations": [
 				{
 					"httpMethod": "GET",
-					"summary": "List available endoints.",
+					"summary": "List all endoints.",
 					"nickname": "getEndpoints",
+					"responseClass": "List[Endpoint]"
+				}
+			]
+		},
+		{
+			"path": "/endpoints/{tech}",
+			"description": "Asterisk endpoints",
+			"operations": [
+				{
+					"httpMethod": "GET",
+					"summary": "List available endoints for a given endpoint technology.",
+					"nickname": "getEndpointsByTech",
 					"responseClass": "List[Endpoint]",
 					"parameters": [
 						{
-							"name": "withType",
-							"description": "Filter endpoints by type (sip,iax2,dhadi,...)",
-							"paramType": "query",
-							"required": false,
-							"allowMultiple": true,
+							"name": "tech",
+							"description": "Technology of the endpoints (sip,iax2,...)",
+							"paramType": "path",
 							"dataType": "string"
 						}
 					]
@@ -30,7 +40,7 @@
 			]
 		},
 		{
-			"path": "/endpoints/{endpointId}",
+			"path": "/endpoints/{tech}/{resource}",
 			"description": "Single endpoint",
 			"operations": [
 				{
@@ -40,7 +50,13 @@
 					"responseClass": "Endpoint",
 					"parameters": [
 						{
-							"name": "endpointId",
+							"name": "tech",
+							"description": "Technology of the endpoint",
+							"paramType": "path",
+							"dataType": "string"
+						},
+						{
+							"name": "resource",
 							"description": "ID of the endpoint",
 							"paramType": "path",
 							"dataType": "string"
@@ -53,13 +69,16 @@
 	"models": {
 		"Endpoint": {
 			"id": "Endpoint",
+			"description": "A snapshot of an endpoint. Unlike most resources, which have a single unique identifier, an endpoint is uniquely identified by the technology/resource pair.",
 			"properties": {
 				"technology": {
 					"type": "string",
+					"description": "Technology of the endpoint",
 					"required": true
 				},
-				"name": {
+				"resource": {
 					"type": "string",
+					"description": "Identifier of the endpoint, specific to the given technology.",
 					"required": true
 				}
 			}




More information about the asterisk-commits mailing list