summaryrefslogtreecommitdiff
path: root/channels/chan_phone.c
diff options
context:
space:
mode:
authorKevin P. Fleming <kpfleming@digium.com>2005-07-15 23:00:47 +0000
committerKevin P. Fleming <kpfleming@digium.com>2005-07-15 23:00:47 +0000
commit22b0f5d30691e94b18e152ec44ed90a23f55b266 (patch)
tree896015cada90b49858e1bf6503d9583704a56179 /channels/chan_phone.c
parent60cd1fa57deeb80b7a564fd81194797b503d4846 (diff)
add a library of timeval manipulation functions, and change a large number of usses to use the new functions (bug #4504)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6146 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels/chan_phone.c')
-rwxr-xr-xchannels/chan_phone.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/channels/chan_phone.c b/channels/chan_phone.c
index 2611508b7..c307fbf4d 100755
--- a/channels/chan_phone.c
+++ b/channels/chan_phone.c
@@ -446,8 +446,7 @@ static struct ast_frame *phone_exception(struct ast_channel *ast)
p->fr.src = type;
p->fr.offset = 0;
p->fr.mallocd=0;
- p->fr.delivery.tv_sec = 0;
- p->fr.delivery.tv_usec = 0;
+ p->fr.delivery = ast_tv(0,0);
phonee.bytes = ioctl(p->fd, PHONE_EXCEPTION);
if (phonee.bits.dtmf_ready) {
@@ -509,8 +508,7 @@ static struct ast_frame *phone_read(struct ast_channel *ast)
p->fr.src = type;
p->fr.offset = 0;
p->fr.mallocd=0;
- p->fr.delivery.tv_sec = 0;
- p->fr.delivery.tv_usec = 0;
+ p->fr.delivery = ast_tv(0,0);
/* Try to read some data... */
CHECK_BLOCKING(ast);
@@ -993,7 +991,7 @@ static void *do_monitor(void *data)
if (i->dialtone) {
/* Remember we're going to have to come back and play
more dialtones */
- if (!tv.tv_usec && !tv.tv_sec) {
+ if (ast_tvzero(tv)) {
/* If we're due for a dialtone, play one */
if (write(i->fd, DialTone + tonepos, 240) != 240)
ast_log(LOG_WARNING, "Dial tone write error\n");
@@ -1016,15 +1014,13 @@ static void *do_monitor(void *data)
tonepos += 240;
if (tonepos >= sizeof(DialTone))
tonepos = 0;
- if (!tv.tv_usec && !tv.tv_sec) {
- tv.tv_usec = 30000;
- tv.tv_sec = 0;
+ if (ast_tvzero(tv)) {
+ tv = ast_tv(30000, 0);
}
res = ast_select(n + 1, &rfds, NULL, &efds, &tv);
} else {
res = ast_select(n + 1, &rfds, NULL, &efds, NULL);
- tv.tv_usec = 0;
- tv.tv_sec = 0;
+ tv = ast_tv(0,0);
tonepos = 0;
}
/* Okay, select has finished. Let's see what happened. */