[asterisk-commits] dlee: branch dlee/better-nicknames r401314 - in /team/dlee/better-nicknames: ...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Oct 21 12:08:39 CDT 2013
Author: dlee
Date: Mon Oct 21 12:08:37 2013
New Revision: 401314
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=401314
Log:
Merged revisions 401261-401291 from http://svn.asterisk.org/svn/asterisk/branches/12
Added:
team/dlee/better-nicknames/contrib/scripts/get_swagger_ui.sh
- copied unchanged from r401291, branches/12/contrib/scripts/get_swagger_ui.sh
Modified:
team/dlee/better-nicknames/ (props changed)
team/dlee/better-nicknames/Makefile
team/dlee/better-nicknames/channels/chan_iax2.c
team/dlee/better-nicknames/main/pbx.c
team/dlee/better-nicknames/res/ari/resource_channels.c
team/dlee/better-nicknames/res/ari/resource_channels.h
team/dlee/better-nicknames/res/parking/parking_controller.c
team/dlee/better-nicknames/res/res_ari_channels.c
team/dlee/better-nicknames/rest-api/api-docs/channels.json
team/dlee/better-nicknames/static-http/ (props changed)
Propchange: team/dlee/better-nicknames/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Mon Oct 21 12:08:37 2013
@@ -1,1 +1,1 @@
-/branches/12:1-401249
+/branches/12:1-401313
Modified: team/dlee/better-nicknames/Makefile
URL: http://svnview.digium.com/svn/asterisk/team/dlee/better-nicknames/Makefile?view=diff&rev=401314&r1=401313&r2=401314
==============================================================================
--- team/dlee/better-nicknames/Makefile (original)
+++ team/dlee/better-nicknames/Makefile Mon Oct 21 12:08:37 2013
@@ -437,12 +437,15 @@
datafiles: _all doc/core-en_US.xml
CFLAGS="$(_ASTCFLAGS) $(ASTCFLAGS)" build_tools/mkpkgconfig "$(DESTDIR)$(libdir)/pkgconfig";
-# Should static HTTP be installed during make samples or even with its own target ala
-# webvoicemail? There are portions here that *could* be customized but might also be
-# improved a lot. I'll put it here for now.
-
- for x in static-http/*; do \
- $(INSTALL) -m 644 $$x "$(DESTDIR)$(ASTDATADIR)/static-http" ; \
+
+# # Recursively install contents of the static-http directory, in case
+# # extra content is provided there. See contrib/scripts/get_swagger_ui.sh
+ find static-http | while read x; do \
+ if test -d $$x; then \
+ $(INSTALL) -m 755 -d "$(DESTDIR)$(ASTDATADIR)/$$x"; \
+ else \
+ $(INSTALL) -m 644 $$x "$(DESTDIR)$(ASTDATADIR)/$$x" ; \
+ fi \
done
$(INSTALL) -m 644 doc/core-en_US.xml "$(DESTDIR)$(ASTDATADIR)/static-http";
$(INSTALL) -m 644 doc/snapshots.xslt "$(DESTDIR)$(ASTDATADIR)/static-http";
Modified: team/dlee/better-nicknames/channels/chan_iax2.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/better-nicknames/channels/chan_iax2.c?view=diff&rev=401314&r1=401313&r2=401314
==============================================================================
--- team/dlee/better-nicknames/channels/chan_iax2.c (original)
+++ team/dlee/better-nicknames/channels/chan_iax2.c Mon Oct 21 12:08:37 2013
@@ -4491,6 +4491,7 @@
if (!(peer = find_peer(peername, 1))) {
struct ast_sockaddr peer_addr;
+ peer_addr.ss.ss_family = AST_AF_UNSPEC;
cai->found = 0;
if (ast_get_ip_or_srv(&peer_addr, peername, srvlookup ? "_iax._udp" : NULL)) {
ast_log(LOG_WARNING, "No such host: %s\n", peername);
Modified: team/dlee/better-nicknames/main/pbx.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/better-nicknames/main/pbx.c?view=diff&rev=401314&r1=401313&r2=401314
==============================================================================
--- team/dlee/better-nicknames/main/pbx.c (original)
+++ team/dlee/better-nicknames/main/pbx.c Mon Oct 21 12:08:37 2013
@@ -10115,7 +10115,7 @@
}
/* Wait for dialing to complete */
- if (channel || synchronous) {
+ if (synchronous) {
if (channel && *channel) {
ast_channel_unlock(*channel);
}
Modified: team/dlee/better-nicknames/res/ari/resource_channels.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/better-nicknames/res/ari/resource_channels.c?view=diff&rev=401314&r1=401313&r2=401314
==============================================================================
--- team/dlee/better-nicknames/res/ari/resource_channels.c (original)
+++ team/dlee/better-nicknames/res/ari/resource_channels.c Mon Oct 21 12:08:37 2013
@@ -599,6 +599,8 @@
int timeout = 30000;
char *stuff;
+ struct ast_channel *chan;
+ RAII_VAR(struct ast_channel_snapshot *, snapshot, NULL, ao2_cleanup);
if (ast_strlen_zero(args->endpoint)) {
ast_ari_response_error(response, 400, "Bad Request",
@@ -649,13 +651,13 @@
}
/* originate a channel, putting it into an application */
- if (ast_pbx_outgoing_app(dialtech, NULL, dialdevice, timeout, app, ast_str_buffer(appdata), NULL, 0, cid_num, cid_name, NULL, NULL, NULL)) {
+ if (ast_pbx_outgoing_app(dialtech, NULL, dialdevice, timeout, app, ast_str_buffer(appdata), NULL, 0, cid_num, cid_name, NULL, NULL, &chan)) {
ast_ari_response_alloc_failed(response);
return;
}
} else if (!ast_strlen_zero(args->extension)) {
/* originate a channel, sending it to an extension */
- if (ast_pbx_outgoing_exten(dialtech, NULL, dialdevice, timeout, S_OR(args->context, "default"), args->extension, args->priority ? args->priority : 1, NULL, 0, cid_num, cid_name, NULL, NULL, NULL, 0)) {
+ if (ast_pbx_outgoing_exten(dialtech, NULL, dialdevice, timeout, S_OR(args->context, "default"), args->extension, args->priority ? args->priority : 1, NULL, 0, cid_num, cid_name, NULL, NULL, &chan, 0)) {
ast_ari_response_alloc_failed(response);
return;
}
@@ -665,7 +667,20 @@
return;
}
- ast_ari_response_no_content(response);
+ if (!ast_strlen_zero(args->app)) {
+ /* channel: + channel ID + null terminator */
+ char uri[9 + strlen(ast_channel_uniqueid(chan))];
+ const char *uris[1] = { uri, };
+
+ sprintf(uri, "channel:%s", ast_channel_uniqueid(chan));
+ stasis_app_subscribe(args->app, uris, 1, NULL);
+ }
+
+ snapshot = ast_channel_snapshot_create(chan);
+ ast_ari_response_ok(response, ast_channel_snapshot_to_json(snapshot));
+
+ ast_channel_unlock(chan);
+ ast_channel_unref(chan);
}
void ast_ari_channels_get_channel_var(struct ast_variable *headers,
Modified: team/dlee/better-nicknames/res/ari/resource_channels.h
URL: http://svnview.digium.com/svn/asterisk/team/dlee/better-nicknames/res/ari/resource_channels.h?view=diff&rev=401314&r1=401313&r2=401314
==============================================================================
--- team/dlee/better-nicknames/res/ari/resource_channels.h (original)
+++ team/dlee/better-nicknames/res/ari/resource_channels.h Mon Oct 21 12:08:37 2013
@@ -60,7 +60,7 @@
const char *context;
/*! \brief The priority to dial after the endpoint answers. If omitted, uses 1 */
long priority;
- /*! \brief The application name to pass to the Stasis application. */
+ /*! \brief The application that is subscribed to the originated channel, and passed to the Stasis application. */
const char *app;
/*! \brief The application arguments to pass to the Stasis application. */
const char *app_args;
@@ -72,7 +72,7 @@
/*!
* \brief Create a new channel (originate).
*
- * The new channel is not created until the dialed party picks up. Not wanting to block this request indefinitely, this request returns immediately with a 204 No Content. When the channel is created, a StasisStart event is sent with the provided app and appArgs. In the event of a failure (timeout, busy, etc.), an OriginationFailed event is sent.
+ * The new channel is created immediately and a snapshot of it returned. If a Stasis application is provided it will be automatically subscribed to the originated channel for further events and updates.
*
* \param headers HTTP headers
* \param args Swagger parameters
Modified: team/dlee/better-nicknames/res/parking/parking_controller.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/better-nicknames/res/parking/parking_controller.c?view=diff&rev=401314&r1=401313&r2=401314
==============================================================================
--- team/dlee/better-nicknames/res/parking/parking_controller.c (original)
+++ team/dlee/better-nicknames/res/parking/parking_controller.c Mon Oct 21 12:08:37 2013
@@ -203,14 +203,12 @@
ast_channel_lock(chan);
existing_features = ast_bridge_features_ds_get(chan);
-
if (existing_features) {
feature_flags = *existing_features;
}
if (lot->cfg->parkedcalltransfers & recipient_mode) {
ast_set_flag(&feature_flags, AST_FEATURE_REDIRECT);
- ast_set_flag(&feature_flags, AST_FEATURE_ATXFER);
}
if (lot->cfg->parkedcallreparking & recipient_mode) {
Modified: team/dlee/better-nicknames/res/res_ari_channels.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/better-nicknames/res/res_ari_channels.c?view=diff&rev=401314&r1=401313&r2=401314
==============================================================================
--- team/dlee/better-nicknames/res/res_ari_channels.c (original)
+++ team/dlee/better-nicknames/res/res_ari_channels.c Mon Oct 21 12:08:37 2013
@@ -160,7 +160,7 @@
break;
default:
if (200 <= code && code <= 299) {
- is_valid = ast_ari_validate_void(
+ is_valid = ast_ari_validate_channel(
response->message);
} else {
ast_log(LOG_ERROR, "Invalid error response %d for /channels\n", code);
Modified: team/dlee/better-nicknames/rest-api/api-docs/channels.json
URL: http://svnview.digium.com/svn/asterisk/team/dlee/better-nicknames/rest-api/api-docs/channels.json?view=diff&rev=401314&r1=401313&r2=401314
==============================================================================
--- team/dlee/better-nicknames/rest-api/api-docs/channels.json (original)
+++ team/dlee/better-nicknames/rest-api/api-docs/channels.json Mon Oct 21 12:08:37 2013
@@ -20,9 +20,9 @@
{
"httpMethod": "POST",
"summary": "Create a new channel (originate).",
- "notes": "The new channel is not created until the dialed party picks up. Not wanting to block this request indefinitely, this request returns immediately with a 204 No Content. When the channel is created, a StasisStart event is sent with the provided app and appArgs. In the event of a failure (timeout, busy, etc.), an OriginationFailed event is sent.",
+ "notes": "The new channel is created immediately and a snapshot of it returned. If a Stasis application is provided it will be automatically subscribed to the originated channel for further events and updates.",
"nickname": "originate",
- "responseClass": "void",
+ "responseClass": "channel",
"parameters": [
{
"name": "endpoint",
@@ -58,7 +58,7 @@
},
{
"name": "app",
- "description": "The application name to pass to the Stasis application.",
+ "description": "The application that is subscribed to the originated channel, and passed to the Stasis application.",
"paramType": "query",
"required": false,
"allowMultiple": false,
Propchange: team/dlee/better-nicknames/static-http/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Oct 21 12:08:37 2013
@@ -1,0 +1,1 @@
+swagger-ui
More information about the asterisk-commits
mailing list