aboutsummaryrefslogtreecommitdiffstats
path: root/channels/chan_phone.c
diff options
context:
space:
mode:
authorkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2005-07-15 23:00:47 +0000
committerkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2005-07-15 23:00:47 +0000
commitff15e0fa53156b9994da3f726bfe91232de6195a (patch)
tree896015cada90b49858e1bf6503d9583704a56179 /channels/chan_phone.c
parentc05cf07847cb384ba66aa29d5eda580eda413ffb (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: http://svn.digium.com/svn/asterisk/trunk@6146 f38db490-d61c-443f-a65b-d21fe96a405b
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. */