[asterisk-commits] qwell: branch qwell/dial_events r388987 - /team/qwell/dial_events/apps/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri May 17 13:21:45 CDT 2013
Author: qwell
Date: Fri May 17 13:21:41 2013
New Revision: 388987
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=388987
Log:
Add dial events to app_followme.
Modified:
team/qwell/dial_events/apps/app_followme.c
Modified: team/qwell/dial_events/apps/app_followme.c
URL: http://svnview.digium.com/svn/asterisk/team/qwell/dial_events/apps/app_followme.c?view=diff&rev=388987&r1=388986&r2=388987
==============================================================================
--- team/qwell/dial_events/apps/app_followme.c (original)
+++ team/qwell/dial_events/apps/app_followme.c Fri May 17 13:21:41 2013
@@ -64,6 +64,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">
@@ -557,6 +558,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;
@@ -778,6 +790,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;
}
@@ -789,6 +802,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 @@
case AST_CONTROL_BUSY:
ast_verb(3, "%s is busy\n", ast_channel_name(winner));
if (tmpuser) {
+ ast_channel_publish_dial(caller, winner, NULL, "BUSY");
/* Outbound call was busy. Drop it. */
clear_caller(tmpuser);
}
@@ -822,6 +838,7 @@
case AST_CONTROL_CONGESTION:
ast_verb(3, "%s is circuit-busy\n", ast_channel_name(winner));
if (tmpuser) {
+ ast_channel_publish_dial(caller, winner, NULL, "CONGESTION");
/* Outbound call was congested. Drop it. */
clear_caller(tmpuser);
}
@@ -970,6 +987,7 @@
ast_verb(3, "The calling channel hungup. Need to drop everyone.\n");
return NULL;
}
+ ast_channel_publish_dial(caller, winner, NULL, "NOANSWER");
/* Outgoing channel hung up. */
clear_caller(tmpuser);
}
@@ -1143,6 +1161,7 @@
ast_channel_unlock(tmpuser->ochan);
destroy_calling_node(tmpuser);
}
+ ast_channel_publish_dial(caller, tmpuser->ochan, tmpuser->dialarg, NULL);
}
AST_LIST_TRAVERSE_SAFE_END;
More information about the asterisk-commits
mailing list