diff options
author | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2003-10-01 22:59:06 +0000 |
---|---|---|
committer | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2003-10-01 22:59:06 +0000 |
commit | 05be3214f5316c5949170b6cff5d419875348dba (patch) | |
tree | b54d06c4a2a8217cb171edef2bed5931122b50cf /channels/chan_iax2.c | |
parent | bbb4b9588ee52a41e4ee8aba7ede10449c894aff (diff) |
Update IAX2 parser for sending caller info
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@1599 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_iax2.c')
-rwxr-xr-x | channels/chan_iax2.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c index 4de1bbfbb..fa635242a 100755 --- a/channels/chan_iax2.c +++ b/channels/chan_iax2.c @@ -1577,6 +1577,22 @@ static int auto_congest(void *nothing) return 0; } +static unsigned int iax2_datetime(void) +{ + time_t t; + struct tm tm; + unsigned int tmp; + time(&t); + localtime_r(&t, &tm); + tmp = (tm.tm_sec >> 1) & 0x1f; /* 5 bits of seconds */ + tmp |= (tm.tm_min & 0x3f) << 5; /* 6 bits of minutes */ + tmp |= (tm.tm_hour & 0x1f) << 11; /* 5 bits of hours */ + tmp |= (tm.tm_mday & 0x1f) << 16; /* 5 bits of day of month */ + tmp |= ((tm.tm_mon + 1) & 0xf) << 21; /* 4 bits of month */ + tmp |= ((tm.tm_year - 100) & 0x7f) << 25; /* 7 bits of year */ + return tmp; +} + static int iax2_call(struct ast_channel *c, char *dest, int timeout) { struct sockaddr_in sin; @@ -1697,6 +1713,7 @@ static int iax2_call(struct ast_channel *c, char *dest, int timeout) iax_ie_append_int(&ied, IAX_IE_FORMAT, c->nativeformats); iax_ie_append_int(&ied, IAX_IE_CAPABILITY, p->capability); iax_ie_append_short(&ied, IAX_IE_ADSICPE, c->adsicpe); + iax_ie_append_int(&ied, IAX_IE_DATETIME, iax2_datetime()); /* Transmit the string in a "NEW" request */ #if 0 /* XXX We have no equivalent XXX */ |