summaryrefslogtreecommitdiff
path: root/ratox.c
diff options
context:
space:
mode:
Diffstat (limited to 'ratox.c')
-rw-r--r--ratox.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/ratox.c b/ratox.c
index 27487de..2dcaee6 100644
--- a/ratox.c
+++ b/ratox.c
@@ -437,6 +437,7 @@ cbcallstate(ToxAV *av, uint32_t fnum, uint32_t state, void *udata)
if (f->av.state & RINGING) {
f->av.state &= ~RINGING;
f->av.state |= TRANSMITTING;
+ logmsg(": %s : Audio > Transmitting\n", f->name);
}
}
@@ -638,6 +639,7 @@ sendfriendcalldata(struct friend *f)
framesize * sizeof(int16_t) - (f->av.state & INCOMPLETE ? f->av.n : 0));
if (n == 0) {
f->av.state &= ~OUTGOING;
+ f->av.state &= ~INCOMPLETE;
return;
} else if (n < 0 || f->av.state & RINGING) {
/* discard data as long as the call is not established */
@@ -1962,7 +1964,7 @@ loop(void)
if (f->tx.state == TRANSFER_NONE)
FD_APPEND(f->fd[FFILE_IN]);
- if (!f->av.state || ((f->av.state & TRANSMITTING) && (f->av.state & OUTGOING)))
+ if (!f->av.state || (f->av.state & TRANSMITTING))
FD_APPEND(f->fd[FCALL_IN]);
}
FD_APPEND(f->fd[FREMOVE]);
@@ -2059,6 +2061,10 @@ loop(void)
}
f->av.state &= ~RINGING;
f->av.state |= TRANSMITTING;
+ logmsg(": %s : Audio > Answered\n", f->name);
+ ftruncate(f->fd[FCALL_STATE], 0);
+ lseek(f->fd[FCALL_STATE], 0, SEEK_SET);
+ dprintf(f->fd[FCALL_STATE], "transmitting\n");
}
}
@@ -2173,6 +2179,11 @@ loop(void)
fiforeset(f->dirfd, &f->fd[FCALL_IN], ffiles[FCALL_IN]);
break;
}
+
+ f->av.state |= RINGING;
+ logmsg(": %s : Audio : Tx > Inviting\n", f->name);
+ }
+ if (!(f->av.state & OUTGOING)) {
c0 = time(NULL);
f->av.n = 0;
f->av.lastsent.tv_sec = 0;
@@ -2183,10 +2194,8 @@ loop(void)
eprintf("malloc:");
f->av.state |= OUTGOING;
- f->av.state |= RINGING;
- logmsg(": %s : Audio : Tx > Inviting\n", f->name);
} else {
- if (f->av.state & OUTGOING)
+ if (f->av.state & TRANSMITTING)
sendfriendcalldata(f);
}
}