[Asterisk-cvs] asterisk/apps app_chanspy.c,1.9,1.10
anthm at lists.digium.com
anthm at lists.digium.com
Thu Mar 31 13:07:13 CST 2005
Update of /usr/cvsroot/asterisk/apps
In directory mongoose.digium.com:/tmp/cvs-serv25332/apps
Modified Files:
app_chanspy.c
Log Message:
more optimizations
Index: app_chanspy.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_chanspy.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- app_chanspy.c 31 Mar 2005 18:00:35 -0000 1.9
+++ app_chanspy.c 31 Mar 2005 19:00:40 -0000 1.10
@@ -201,7 +201,6 @@
ast_mutex_unlock(&spy->lock);
}
-
static int spy_generate(struct ast_channel *chan, void *data, int len, int samples)
{
struct ast_frame *f, *f0, *f1;
@@ -311,7 +310,7 @@
csth->frame.data = csth->buf;
ast_write(chan, &csth->frame);
-
+
if (f0) {
ast_frfree(f0);
}
@@ -395,6 +394,7 @@
int running = 1, res = 0, x = 0;
char inp[24];
char *name=NULL;
+ struct ast_frame *f;
if (chan && !ast_check_hangup(chan) && spyee && !ast_check_hangup(spyee)) {
memset(inp, 0, sizeof(inp));
@@ -413,9 +413,22 @@
start_spying(spyee, chan, &csth.spy);
ast_activate_generator(chan, &spygen, &csth);
- while(csth.spy.status == CHANSPY_RUNNING && chan && !ast_check_hangup(chan) && spyee && !ast_check_hangup(spyee) && running == 1) {
- res = ast_waitfordigit(chan, 100);
-
+ while(csth.spy.status == CHANSPY_RUNNING &&
+ chan && !ast_check_hangup(chan) &&
+ spyee &&
+ !ast_check_hangup(spyee)
+ && running == 1 &&
+ (res = ast_waitfor(chan, -1) > -1)) {
+ if ((f = ast_read(chan))) {
+ res = 0;
+ if(f->frametype == AST_FRAME_DTMF) {
+ res = f->subclass;
+ }
+ ast_frfree(f);
+ if(!res) {
+ continue;
+ }
+ }
if (x == sizeof(inp)) {
x = 0;
}
More information about the svn-commits
mailing list