[Asterisk-cvs] asterisk/channels chan_iax2.c,1.49,1.50 iax2-parser.c,1.8,1.9 iax2-parser.h,1.4,1.5 iax2.h,1.6,1.7

markster at lists.digium.com markster at lists.digium.com
Wed Oct 1 17:57:55 CDT 2003


Update of /usr/cvsroot/asterisk/channels
In directory mongoose.digium.com:/tmp/cvs-serv21086/channels

Modified Files:
	chan_iax2.c iax2-parser.c iax2-parser.h iax2.h 
Log Message:
Update IAX2 parser for sending caller info


Index: chan_iax2.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_iax2.c,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -d -r1.49 -r1.50
--- chan_iax2.c	30 Sep 2003 14:11:17 -0000	1.49
+++ chan_iax2.c	1 Oct 2003 22:59:06 -0000	1.50
@@ -1577,6 +1577,22 @@
 	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 @@
 	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 */

Index: iax2-parser.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/iax2-parser.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- iax2-parser.c	1 Sep 2003 19:24:23 -0000	1.8
+++ iax2-parser.c	1 Oct 2003 22:59:06 -0000	1.9
@@ -119,6 +119,7 @@
 	{ IAX_IE_RDNIS, "REFERRING DNIS", dump_string },
 	{ IAX_IE_PROVISIONING, "PROVISIONING" },
 	{ IAX_IE_AESPROVISIONING, "AES PROVISIONING" },
+	{ IAX_IE_DATETIME, "DATE TIME", dump_int },
 };
 
 const char *iax_ie2str(int ie)
@@ -498,6 +499,13 @@
 				errorf(tmp);
 			} else
 				ies->transferid = ntohl(*((unsigned int *)(data + 2)));
+			break;
+		case IAX_IE_DATETIME:
+			if (len != sizeof(unsigned int)) {
+				snprintf(tmp, sizeof(tmp), "Expecting date/time to be %d bytes long but was %d\n", sizeof(unsigned int), len);
+				errorf(tmp);
+			} else
+				ies->datetime = ntohl(*((unsigned int *)(data + 2)));
 			break;
 		default:
 			snprintf(tmp, sizeof(tmp), "Ignoring unknown information element '%s' (%d) of length %d\n", iax_ie2str(ie), ie, len);

Index: iax2-parser.h
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/iax2-parser.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- iax2-parser.h	14 May 2003 05:33:06 -0000	1.4
+++ iax2-parser.h	1 Oct 2003 22:59:06 -0000	1.5
@@ -43,6 +43,7 @@
 	int autoanswer;
 	int musiconhold;
 	unsigned int transferid;
+	unsigned int datetime;
 };
 
 #define DIRECTION_INGRESS 1

Index: iax2.h
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/iax2.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- iax2.h	1 Sep 2003 19:24:23 -0000	1.6
+++ iax2.h	1 Oct 2003 22:59:06 -0000	1.7
@@ -103,6 +103,7 @@
 #define IAX_IE_RDNIS				28		/* Referring DNIS -- string */
 #define IAX_IE_PROVISIONING			29		/* Provisioning info */
 #define IAX_IE_AESPROVISIONING			30		/* AES Provisioning info */
+#define IAX_IE_DATETIME				31		/* Date/Time */
 
 #define IAX_AUTH_PLAINTEXT			(1 << 0)
 #define IAX_AUTH_MD5				(1 << 1)




More information about the svn-commits mailing list