[asterisk-commits] kmoore: branch kmoore/stasis-http_sounds r389731 - in /team/kmoore/stasis-htt...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri May 24 13:57:37 CDT 2013
Author: kmoore
Date: Fri May 24 13:57:28 2013
New Revision: 389731
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=389731
Log:
Multiple revisions 389492,389505,389519,389551,389567-389569,389587,389603,389609,389618,389623,389639,389663,389680
........
r389492 | qwell | 2013-05-22 13:11:57 -0500 (Wed, 22 May 2013) | 9 lines
Add dial events to app_queue and app_followme.
Also fixes an issue in app_dial, where the channels were swapped on dial events.
(closes issue ASTERISK-21551)
(closes issue ASTERISK-21550)
Review: https://reviewboard.asterisk.org/r/2549/
........
r389505 | qwell | 2013-05-22 13:20:53 -0500 (Wed, 22 May 2013) | 1 line
Remove bad props, before anybody notices.
........
r389519 | dlee | 2013-05-22 14:15:16 -0500 (Wed, 22 May 2013) | 7 lines
Fixed startup race condition which caused occasional stasis_mwi_state_type assertions.
The caching topic (which refers to the message type) was created before the
message type. If the initial subscription message gets processed before
the type can be initialized, the assertion about using an uninitialized type
fires.
........
r389551 | file | 2013-05-23 10:51:05 -0500 (Thu, 23 May 2013) | 2 lines
Fix a bug where the codec order as configured was not being obeyed.
........
r389567 | file | 2013-05-23 13:19:27 -0500 (Thu, 23 May 2013) | 2 lines
Fix a bug with applying the end result of the codec negotiation to the Asterisk channel.
........
r389568 | file | 2013-05-23 13:39:05 -0500 (Thu, 23 May 2013) | 2 lines
Fix a bug where the DTMF mode was not set on newly created RTP instances in the res_sip_sdp_rtp module.
........
r389569 | rmudgett | 2013-05-23 13:40:50 -0500 (Thu, 23 May 2013) | 1 line
Fix inverted test preventing DTMF disconnect from working.
........
r389587 | dlee | 2013-05-23 15:11:35 -0500 (Thu, 23 May 2013) | 18 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/
........
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
........
r389639 | dlee | 2013-05-23 16:46:38 -0500 (Thu, 23 May 2013) | 1 line
stasis-http: Provide a response body for 201 created responses
........
r389663 | igorg | 2013-05-24 05:23:48 -0500 (Fri, 24 May 2013) | 10 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
........
r389680 | mjordan | 2013-05-24 06:57:48 -0500 (Fri, 24 May 2013) | 18 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 389492,389505,389519,389551,389567-389569,389587,389603,389609,389618,389623,389639,389663,389680 from http://svn.asterisk.org/svn/asterisk/trunk
Added:
team/kmoore/stasis-http_sounds/include/asterisk/stasis_app_playback.h
- copied unchanged from r389680, trunk/include/asterisk/stasis_app_playback.h
team/kmoore/stasis-http_sounds/res/res_stasis_playback.c
- copied unchanged from r389680, trunk/res/res_stasis_playback.c
team/kmoore/stasis-http_sounds/res/res_stasis_playback.exports.in
- copied unchanged from r389680, trunk/res/res_stasis_playback.exports.in
Modified:
team/kmoore/stasis-http_sounds/ (props changed)
team/kmoore/stasis-http_sounds/apps/app_dial.c
team/kmoore/stasis-http_sounds/apps/app_followme.c
team/kmoore/stasis-http_sounds/apps/app_queue.c
team/kmoore/stasis-http_sounds/channels/chan_unistim.c
team/kmoore/stasis-http_sounds/include/asterisk/app.h
team/kmoore/stasis-http_sounds/include/asterisk/channel.h
team/kmoore/stasis-http_sounds/include/asterisk/dial.h
team/kmoore/stasis-http_sounds/include/asterisk/stasis_app.h
team/kmoore/stasis-http_sounds/include/asterisk/stasis_channels.h
team/kmoore/stasis-http_sounds/include/asterisk/stasis_http.h
team/kmoore/stasis-http_sounds/main/app.c
team/kmoore/stasis-http_sounds/main/channel_internal_api.c
team/kmoore/stasis-http_sounds/main/dial.c
team/kmoore/stasis-http_sounds/main/features.c
team/kmoore/stasis-http_sounds/main/logger.c
team/kmoore/stasis-http_sounds/main/stasis_channels.c
team/kmoore/stasis-http_sounds/res/parking/parking_bridge.c
team/kmoore/stasis-http_sounds/res/res_sip_sdp_rtp.c
team/kmoore/stasis-http_sounds/res/res_sip_session.c
team/kmoore/stasis-http_sounds/res/res_stasis_http.c
team/kmoore/stasis-http_sounds/res/res_stasis_http_channels.c
team/kmoore/stasis-http_sounds/res/res_stasis_json_events.c
team/kmoore/stasis-http_sounds/res/res_stasis_json_events.exports.in
team/kmoore/stasis-http_sounds/res/stasis/control.c
team/kmoore/stasis-http_sounds/res/stasis_http/resource_channels.c
team/kmoore/stasis-http_sounds/res/stasis_http/resource_channels.h
team/kmoore/stasis-http_sounds/res/stasis_http/resource_playback.c
team/kmoore/stasis-http_sounds/res/stasis_json/resource_channels.h
team/kmoore/stasis-http_sounds/res/stasis_json/resource_events.h
team/kmoore/stasis-http_sounds/rest-api/api-docs/channels.json
team/kmoore/stasis-http_sounds/rest-api/api-docs/events.json
team/kmoore/stasis-http_sounds/rest-api/api-docs/playback.json
Propchange: team/kmoore/stasis-http_sounds/
------------------------------------------------------------------------------
automerge = *
Propchange: team/kmoore/stasis-http_sounds/
------------------------------------------------------------------------------
Binary property 'branch-11-merged' - no diff available.
Propchange: team/kmoore/stasis-http_sounds/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Fri May 24 13:57:28 2013
@@ -1,1 +1,1 @@
-/trunk:1-389461
+/trunk:1-389730
Modified: team/kmoore/stasis-http_sounds/apps/app_dial.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-http_sounds/apps/app_dial.c?view=diff&rev=389731&r1=389730&r2=389731
==============================================================================
--- team/kmoore/stasis-http_sounds/apps/app_dial.c (original)
+++ team/kmoore/stasis-http_sounds/apps/app_dial.c Fri May 24 13:57:28 2013
@@ -66,8 +66,9 @@
#include "asterisk/ccss.h"
#include "asterisk/indications.h"
#include "asterisk/framehook.h"
+#include "asterisk/dial.h"
+#include "asterisk/stasis_channels.h"
#include "asterisk/bridging.h"
-#include "asterisk/stasis_channels.h"
/*** DOCUMENTATION
<application name="Dial" language="en_US">
@@ -1014,9 +1015,15 @@
num->nochan++;
} else {
ast_channel_lock_both(c, in);
- ast_channel_publish_dial(c, in, stuff, NULL);
+ ast_channel_publish_dial(in, c, stuff, NULL);
ast_channel_unlock(in);
ast_channel_unlock(c);
+
+ ast_channel_lock_both(original, in);
+ ast_channel_publish_dial(in, original, NULL, "CANCEL");
+ ast_channel_unlock(in);
+ ast_channel_unlock(original);
+
/* Hangup the original channel now, in case we needed it */
ast_hangup(original);
}
@@ -1034,22 +1041,6 @@
char privintro[1024];
char status[256];
};
-
-static const char *hangup_cause_to_dial_status(int hangup_cause)
-{
- switch(hangup_cause) {
- case AST_CAUSE_BUSY:
- return "BUSY";
- case AST_CAUSE_CONGESTION:
- return "CONGESTION";
- case AST_CAUSE_NO_ROUTE_DESTINATION:
- case AST_CAUSE_UNREGISTERED:
- return "CHANUNAVAIL";
- case AST_CAUSE_NO_ANSWER:
- default:
- return "NOANSWER";
- }
-}
static void publish_dial_end_event(struct ast_channel *in, struct dial_head *out_chans, struct ast_channel *exception, const char *status)
{
@@ -1266,7 +1257,7 @@
#ifdef HAVE_EPOLL
ast_poll_channel_del(in, c);
#endif
- ast_channel_publish_dial(in, c, NULL, hangup_cause_to_dial_status(ast_channel_hangupcause(c)));
+ ast_channel_publish_dial(in, c, NULL, ast_hangup_cause_to_dial_status(ast_channel_hangupcause(c)));
ast_hangup(c);
c = o->chan = NULL;
ast_clear_flag64(o, DIAL_STILLGOING);
@@ -1334,7 +1325,7 @@
case AST_CONTROL_BUSY:
ast_verb(3, "%s is busy\n", ast_channel_name(c));
ast_channel_hangupcause_set(in, ast_channel_hangupcause(c));
- ast_channel_publish_dial(in, c, NULL, hangup_cause_to_dial_status(ast_channel_hangupcause(c)));
+ ast_channel_publish_dial(in, c, NULL, ast_hangup_cause_to_dial_status(ast_channel_hangupcause(c)));
ast_hangup(c);
c = o->chan = NULL;
ast_clear_flag64(o, DIAL_STILLGOING);
@@ -1343,7 +1334,7 @@
case AST_CONTROL_CONGESTION:
ast_verb(3, "%s is circuit-busy\n", ast_channel_name(c));
ast_channel_hangupcause_set(in, ast_channel_hangupcause(c));
- ast_channel_publish_dial(in, c, NULL, hangup_cause_to_dial_status(ast_channel_hangupcause(c)));
+ ast_channel_publish_dial(in, c, NULL, ast_hangup_cause_to_dial_status(ast_channel_hangupcause(c)));
ast_hangup(c);
c = o->chan = NULL;
ast_clear_flag64(o, DIAL_STILLGOING);
Modified: team/kmoore/stasis-http_sounds/apps/app_followme.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-http_sounds/apps/app_followme.c?view=diff&rev=389731&r1=389730&r2=389731
==============================================================================
--- team/kmoore/stasis-http_sounds/apps/app_followme.c (original)
+++ team/kmoore/stasis-http_sounds/apps/app_followme.c Fri May 24 13:57:28 2013
@@ -63,6 +63,7 @@
#include "asterisk/astdb.h"
#include "asterisk/dsp.h"
#include "asterisk/app.h"
+#include "asterisk/stasis_channels.h"
/*** DOCUMENTATION
<application name="FollowMe" language="en_US">
@@ -556,6 +557,17 @@
return 1;
}
+static void publish_dial_end_event(struct ast_channel *in, struct findme_user_listptr *findme_user_list, struct ast_channel *exception, const char *status)
+{
+ struct findme_user *tmpuser;
+
+ AST_LIST_TRAVERSE(findme_user_list, tmpuser, entry) {
+ if (tmpuser->ochan && tmpuser->ochan != exception) {
+ ast_channel_publish_dial(in, tmpuser->ochan, NULL, status);
+ }
+ }
+}
+
static void clear_caller(struct findme_user *tmpuser)
{
struct ast_channel *outbound;
@@ -777,6 +789,7 @@
}
if (!tmpuser) {
ast_verb(3, "The calling channel hungup. Need to drop everyone.\n");
+ publish_dial_end_event(caller, findme_user_list, NULL, "CANCEL");
ast_frfree(f);
return NULL;
}
@@ -788,6 +801,8 @@
break;
}
ast_verb(3, "%s answered %s\n", ast_channel_name(winner), ast_channel_name(caller));
+ ast_channel_publish_dial(caller, winner, NULL, "ANSWER");
+ publish_dial_end_event(caller, findme_user_list, winner, "CANCEL");
tmpuser->answered = 1;
/* If call has been answered, then the eventual hangup is likely to be normal hangup */
ast_channel_hangupcause_set(winner, AST_CAUSE_NORMAL_CLEARING);
@@ -815,6 +830,7 @@
ast_verb(3, "%s is busy\n", ast_channel_name(winner));
if (tmpuser) {
/* Outbound call was busy. Drop it. */
+ ast_channel_publish_dial(caller, winner, NULL, "BUSY");
clear_caller(tmpuser);
}
break;
@@ -822,6 +838,7 @@
ast_verb(3, "%s is circuit-busy\n", ast_channel_name(winner));
if (tmpuser) {
/* Outbound call was congested. Drop it. */
+ ast_channel_publish_dial(caller, winner, NULL, "CONGESTION");
clear_caller(tmpuser);
}
break;
@@ -970,6 +987,7 @@
return NULL;
}
/* Outgoing channel hung up. */
+ ast_channel_publish_dial(caller, winner, NULL, "NOANSWER");
clear_caller(tmpuser);
}
} else {
@@ -1141,7 +1159,10 @@
}
ast_channel_unlock(tmpuser->ochan);
destroy_calling_node(tmpuser);
- }
+ continue;
+ }
+
+ ast_channel_publish_dial(caller, tmpuser->ochan, tmpuser->dialarg, NULL);
}
AST_LIST_TRAVERSE_SAFE_END;
Modified: team/kmoore/stasis-http_sounds/apps/app_queue.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-http_sounds/apps/app_queue.c?view=diff&rev=389731&r1=389730&r2=389731
==============================================================================
--- team/kmoore/stasis-http_sounds/apps/app_queue.c (original)
+++ team/kmoore/stasis-http_sounds/apps/app_queue.c Fri May 24 13:57:28 2013
@@ -106,6 +106,8 @@
#include "asterisk/cel.h"
#include "asterisk/data.h"
#include "asterisk/term.h"
+#include "asterisk/dial.h"
+#include "asterisk/stasis_channels.h"
#include "asterisk/bridging.h"
/* Define, to debug reference counts on queues, without debugging reference counts on queue members */
@@ -3330,8 +3332,19 @@
ast_free(doomed);
}
+static void publish_dial_end_event(struct ast_channel *in, struct callattempt *outgoing, struct ast_channel *exception, const char *status)
+{
+ struct callattempt *cur;
+
+ for (cur = outgoing; cur; cur = cur->q_next) {
+ if (cur->chan && cur->chan != exception) {
+ ast_channel_publish_dial(in, cur->chan, NULL, status);
+ }
+ }
+}
+
/*! \brief Hang up a list of outgoing calls */
-static void hangupcalls(struct callattempt *outgoing, struct ast_channel *exception, int cancel_answered_elsewhere)
+static void hangupcalls(struct queue_ent *qe, struct callattempt *outgoing, struct ast_channel *exception, int cancel_answered_elsewhere)
{
struct callattempt *oo;
@@ -3342,6 +3355,7 @@
if (exception || cancel_answered_elsewhere) {
ast_channel_hangupcause_set(outgoing->chan, AST_CAUSE_ANSWERED_ELSEWHERE);
}
+ ast_channel_publish_dial(qe->chan, outgoing->chan, outgoing->interface, "CANCEL");
ast_hangup(outgoing->chan);
}
oo = outgoing;
@@ -3712,10 +3726,10 @@
return 0;
}
+ ast_channel_lock_both(tmp->chan, qe->chan);
+
if (qe->parent->eventwhencalled) {
char vars[2048];
-
- ast_channel_lock_both(tmp->chan, qe->chan);
/*** DOCUMENTATION
<managerEventInstance>
@@ -3761,12 +3775,14 @@
S_COR(ast_channel_connected(qe->chan)->id.name.valid, ast_channel_connected(qe->chan)->id.name.str, "unknown"),
ast_channel_context(qe->chan), ast_channel_exten(qe->chan), ast_channel_priority(qe->chan), ast_channel_uniqueid(qe->chan),
qe->parent->eventwhencalled == QUEUE_EVENT_VARIABLES ? vars2manager(qe->chan, vars, sizeof(vars)) : "");
-
- ast_channel_unlock(tmp->chan);
- ast_channel_unlock(qe->chan);
-
- ast_verb(3, "Called %s\n", tmp->interface);
- }
+ }
+
+ ast_channel_publish_dial(qe->chan, tmp->chan, tmp->interface, NULL);
+
+ ast_channel_unlock(tmp->chan);
+ ast_channel_unlock(qe->chan);
+
+ ast_verb(3, "Called %s\n", tmp->interface);
member_call_pending_clear(tmp->member);
return 1;
@@ -4334,6 +4350,15 @@
numnochan++;
}
}
+ ast_channel_lock_both(qe->chan, o->chan);
+ ast_channel_publish_dial(qe->chan, o->chan, stuff, NULL);
+ ast_channel_unlock(o->chan);
+ ast_channel_unlock(qe->chan);
+
+ ast_channel_lock_both(qe->chan, original);
+ ast_channel_publish_dial(qe->chan, original, NULL, "CANCEL");
+ ast_channel_unlock(original);
+ ast_channel_unlock(qe->chan);
/* Hangup the original channel now, in case we needed it */
ast_hangup(winner);
continue;
@@ -4346,6 +4371,8 @@
/* This is our guy if someone answered. */
if (!peer) {
ast_verb(3, "%s answered %s\n", ochan_name, inchan_name);
+ ast_channel_publish_dial(qe->chan, o->chan, on, "ANSWER");
+ publish_dial_end_event(qe->chan, outgoing, o->chan, "CANCEL");
if (!o->block_connected_update) {
if (o->pending_connected_update) {
if (ast_channel_connected_line_sub(o->chan, in, &o->connected, 0) &&
@@ -4380,6 +4407,7 @@
if (ast_channel_cdr(in)) {
ast_cdr_busy(ast_channel_cdr(in));
}
+ ast_channel_publish_dial(qe->chan, o->chan, on, "BUSY");
do_hang(o);
endtime = (long) time(NULL);
endtime -= starttime;
@@ -4401,6 +4429,7 @@
if (ast_channel_cdr(in)) {
ast_cdr_failed(ast_channel_cdr(in));
}
+ ast_channel_publish_dial(qe->chan, o->chan, on, "CONGESTION");
endtime = (long) time(NULL);
endtime -= starttime;
rna(endtime * 1000, qe, on, membername, qe->parent->autopauseunavail);
@@ -4498,6 +4527,7 @@
ast_frfree(f);
} else { /* ast_read() returned NULL */
endtime = (long) time(NULL) - starttime;
+ ast_channel_publish_dial(qe->chan, o->chan, on, "NOANSWER");
rna(endtime * 1000, qe, on, membername, 1);
do_hang(o);
if (qe->parent->strategy != QUEUE_STRATEGY_RINGALL) {
@@ -4519,6 +4549,7 @@
if (!f || ((f->frametype == AST_FRAME_CONTROL) && (f->subclass.integer == AST_CONTROL_HANGUP))) {
/* Got hung up */
*to = -1;
+ publish_dial_end_event(in, outgoing, NULL, "CANCEL");
if (f) {
if (f->data.uint32) {
ast_channel_hangupcause_set(in, f->data.uint32);
@@ -4531,6 +4562,7 @@
if ((f->frametype == AST_FRAME_DTMF) && caller_disconnect && (f->subclass.integer == '*')) {
ast_verb(3, "User hit %c to disconnect call.\n", f->subclass.integer);
*to = 0;
+ publish_dial_end_event(in, outgoing, NULL, "CANCEL");
ast_frfree(f);
if (ast_channel_cdr(in) && ast_channel_state(in) != AST_STATE_UP) {
ast_cdr_noanswer(ast_channel_cdr(in));
@@ -4540,6 +4572,7 @@
if ((f->frametype == AST_FRAME_DTMF) && valid_exit(qe, f->subclass.integer)) {
ast_verb(3, "User pressed digit: %c\n", f->subclass.integer);
*to = 0;
+ publish_dial_end_event(in, outgoing, NULL, "CANCEL");
*digit = f->subclass.integer;
ast_frfree(f);
if (ast_channel_cdr(in) && ast_channel_state(in) != AST_STATE_UP) {
@@ -4600,6 +4633,7 @@
rna(orig, qe, o->interface, o->member->membername, 1);
}
+ publish_dial_end_event(qe->chan, outgoing, NULL, "NOANSWER");
if (ast_channel_cdr(in)
&& ast_channel_state(in) != AST_STATE_UP
&& (!*to || ast_check_hangup(in))) {
@@ -5509,7 +5543,7 @@
member = lpeer->member;
/* Increment the refcount for this member, since we're going to be using it for awhile in here. */
ao2_ref(member, 1);
- hangupcalls(outgoing, peer, qe->cancel_answered_elsewhere);
+ hangupcalls(qe, outgoing, peer, qe->cancel_answered_elsewhere);
outgoing = NULL;
if (announce || qe->parent->reportholdtime || qe->parent->memberdelay) {
int res2;
@@ -5552,7 +5586,7 @@
/* Agent must have hung up */
ast_log(LOG_WARNING, "Agent on %s hungup on the customer.\n", ast_channel_name(peer));
ast_queue_log(queuename, ast_channel_uniqueid(qe->chan), member->membername, "AGENTDUMP", "%s", "");
- if (qe->parent->eventwhencalled)
+ if (qe->parent->eventwhencalled) {
/*** DOCUMENTATION
<managerEventInstance>
<synopsis>Raised when an agent hangs up on a member in the queue.</synopsis>
@@ -5577,6 +5611,8 @@
"%s",
queuename, ast_channel_uniqueid(qe->chan), ast_channel_name(peer), member->interface, member->membername,
qe->parent->eventwhencalled == QUEUE_EVENT_VARIABLES ? vars2manager(qe->chan, vars, sizeof(vars)) : "");
+ }
+ ast_channel_publish_dial(qe->chan, peer, member->interface, ast_hangup_cause_to_dial_status(ast_channel_hangupcause(peer)));
ast_autoservice_chan_hangup_peer(qe->chan, peer);
ao2_ref(member, -1);
goto out;
@@ -5585,6 +5621,7 @@
ast_log(LOG_NOTICE, "Caller was about to talk to agent on %s but the caller hungup.\n", ast_channel_name(peer));
ast_queue_log(queuename, ast_channel_uniqueid(qe->chan), member->membername, "ABANDON", "%d|%d|%ld", qe->pos, qe->opos, (long) time(NULL) - qe->start);
record_abandoned(qe);
+ ast_channel_publish_dial(qe->chan, peer, member->interface, ast_hangup_cause_to_dial_status(ast_channel_hangupcause(peer)));
ast_autoservice_chan_hangup_peer(qe->chan, peer);
ao2_ref(member, -1);
return -1;
@@ -5877,7 +5914,7 @@
}
}
- if (qe->parent->eventwhencalled)
+ if (qe->parent->eventwhencalled) {
/*** DOCUMENTATION
<managerEventInstance>
<synopsis>Raised when an agent answers and is bridged to a member in the queue.</synopsis>
@@ -5909,6 +5946,8 @@
queuename, ast_channel_uniqueid(qe->chan), ast_channel_name(peer), member->interface, member->membername,
(long) time(NULL) - qe->start, ast_channel_uniqueid(peer), (long)(orig - to > 0 ? (orig - to) / 1000 : 0),
qe->parent->eventwhencalled == QUEUE_EVENT_VARIABLES ? vars2manager(qe->chan, vars, sizeof(vars)) : "");
+ }
+
ast_copy_string(oldcontext, ast_channel_context(qe->chan), sizeof(oldcontext));
ast_copy_string(oldexten, ast_channel_exten(qe->chan), sizeof(oldexten));
@@ -5977,7 +6016,7 @@
ao2_ref(member, -1);
}
out:
- hangupcalls(outgoing, NULL, qe->cancel_answered_elsewhere);
+ hangupcalls(qe, outgoing, NULL, qe->cancel_answered_elsewhere);
return res;
}
Modified: team/kmoore/stasis-http_sounds/channels/chan_unistim.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-http_sounds/channels/chan_unistim.c?view=diff&rev=389731&r1=389730&r2=389731
==============================================================================
--- team/kmoore/stasis-http_sounds/channels/chan_unistim.c (original)
+++ team/kmoore/stasis-http_sounds/channels/chan_unistim.c Fri May 24 13:57:28 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/stasis-http_sounds/include/asterisk/app.h
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-http_sounds/include/asterisk/app.h?view=diff&rev=389731&r1=389730&r2=389731
==============================================================================
--- team/kmoore/stasis-http_sounds/include/asterisk/app.h (original)
+++ team/kmoore/stasis-http_sounds/include/asterisk/app.h Fri May 24 13:57:28 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/stasis-http_sounds/include/asterisk/channel.h
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-http_sounds/include/asterisk/channel.h?view=diff&rev=389731&r1=389730&r2=389731
==============================================================================
--- team/kmoore/stasis-http_sounds/include/asterisk/channel.h (original)
+++ team/kmoore/stasis-http_sounds/include/asterisk/channel.h Fri May 24 13:57:28 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/stasis-http_sounds/include/asterisk/dial.h
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-http_sounds/include/asterisk/dial.h?view=diff&rev=389731&r1=389730&r2=389731
==============================================================================
--- team/kmoore/stasis-http_sounds/include/asterisk/dial.h (original)
+++ team/kmoore/stasis-http_sounds/include/asterisk/dial.h Fri May 24 13:57:28 2013
@@ -206,6 +206,11 @@
*/
void ast_dial_set_timeout(struct ast_dial *dial, int num, int timeout);
+/*! \since 12
+ * \brief Convert a hangup cause to a publishable dial status
+ */
+const char *ast_hangup_cause_to_dial_status(int hangup_cause);
+
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif
Modified: team/kmoore/stasis-http_sounds/include/asterisk/stasis_app.h
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-http_sounds/include/asterisk/stasis_app.h?view=diff&rev=389731&r1=389730&r2=389731
==============================================================================
--- team/kmoore/stasis-http_sounds/include/asterisk/stasis_app.h (original)
+++ team/kmoore/stasis-http_sounds/include/asterisk/stasis_app.h Fri May 24 13:57:28 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/stasis-http_sounds/include/asterisk/stasis_channels.h
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-http_sounds/include/asterisk/stasis_channels.h?view=diff&rev=389731&r1=389730&r2=389731
==============================================================================
--- team/kmoore/stasis-http_sounds/include/asterisk/stasis_channels.h (original)
+++ team/kmoore/stasis-http_sounds/include/asterisk/stasis_channels.h Fri May 24 13:57:28 2013
@@ -54,6 +54,7 @@
AST_STRING_FIELD(caller_number); /*!< Caller ID 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 */
@@ -124,6 +125,17 @@
/*!
* \since 12
+ * \brief Get the most recent snapshot for channel with the given \a uniqueid.
+ *
+ * \param uniqueid Uniqueid of the snapshot to fetch.
+ * \return Most recent channel snapshot
+ * \return \c NULL on error
+ */
+struct ast_channel_snapshot *ast_channel_snapshot_get_latest(
+ const char *uniqueid);
+
+/*!
+ * \since 12
* \brief Creates a \ref ast_channel_blob message.
*
* The given \a blob should be treated as immutable and not modified after it is
@@ -139,6 +151,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
@@ -220,6 +249,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/stasis-http_sounds/include/asterisk/stasis_http.h
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-http_sounds/include/asterisk/stasis_http.h?view=diff&rev=389731&r1=389730&r2=389731
==============================================================================
--- team/kmoore/stasis-http_sounds/include/asterisk/stasis_http.h (original)
+++ team/kmoore/stasis-http_sounds/include/asterisk/stasis_http.h Fri May 24 13:57:28 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/stasis-http_sounds/main/app.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-http_sounds/main/app.c?view=diff&rev=389731&r1=389730&r2=389731
==============================================================================
--- team/kmoore/stasis-http_sounds/main/app.c (original)
+++ team/kmoore/stasis-http_sounds/main/app.c Fri May 24 13:57:28 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)
@@ -2735,6 +2746,9 @@
int app_init(void)
{
+ if (STASIS_MESSAGE_TYPE_INIT(stasis_mwi_state_type) != 0) {
+ return -1;
+ }
mwi_topic_all = stasis_topic_create("stasis_mwi_topic");
if (!mwi_topic_all) {
return -1;
@@ -2743,9 +2757,6 @@
if (!mwi_topic_cached) {
return -1;
}
- if (STASIS_MESSAGE_TYPE_INIT(stasis_mwi_state_type) != 0) {
- return -1;
- }
mwi_topic_pool = stasis_topic_pool_create(mwi_topic_all);
if (!mwi_topic_pool) {
return -1;
Modified: team/kmoore/stasis-http_sounds/main/channel_internal_api.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-http_sounds/main/channel_internal_api.c?view=diff&rev=389731&r1=389730&r2=389731
==============================================================================
--- team/kmoore/stasis-http_sounds/main/channel_internal_api.c (original)
+++ team/kmoore/stasis-http_sounds/main/channel_internal_api.c Fri May 24 13:57:28 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/stasis-http_sounds/main/dial.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-http_sounds/main/dial.c?view=diff&rev=389731&r1=389730&r2=389731
==============================================================================
--- team/kmoore/stasis-http_sounds/main/dial.c (original)
+++ team/kmoore/stasis-http_sounds/main/dial.c Fri May 24 13:57:28 2013
@@ -616,10 +616,7 @@
return new_timeout;
}
-/*! \since 12
- * \internal \brief Convert a hangup cause to a publishable dial status
- */
-static const char *hangup_cause_to_dial_status(int hangup_cause)
+const char *ast_hangup_cause_to_dial_status(int hangup_cause)
{
switch(hangup_cause) {
case AST_CAUSE_BUSY:
@@ -728,7 +725,7 @@
}
if (chan)
ast_poll_channel_del(chan, channel->owner);
- ast_channel_publish_dial(chan, who, channel->device, hangup_cause_to_dial_status(ast_channel_hangupcause(who)));
+ ast_channel_publish_dial(chan, who, channel->device, ast_hangup_cause_to_dial_status(ast_channel_hangupcause(who)));
ast_hangup(who);
channel->owner = NULL;
continue;
Modified: team/kmoore/stasis-http_sounds/main/features.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-http_sounds/main/features.c?view=diff&rev=389731&r1=389730&r2=389731
==============================================================================
[... 1760 lines stripped ...]
More information about the asterisk-commits
mailing list