[Asterisk-cvs] asterisk/channels chan_iax2.c, 1.190, 1.191 chan_sip.c, 1.512, 1.513 iax2-parser.c, 1.27, 1.28 iax2-parser.h, 1.9, 1.10 iax2.h, 1.15, 1.16

markster at lists.digium.com markster at lists.digium.com
Fri Oct 1 21:54:03 CDT 2004


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

Modified Files:
	chan_iax2.c chan_sip.c iax2-parser.c iax2-parser.h iax2.h 
Log Message:
Add iax2 parsing for TNS/TON/PRES


Index: chan_iax2.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_iax2.c,v
retrieving revision 1.190
retrieving revision 1.191
diff -u -d -r1.190 -r1.191
--- chan_iax2.c	2 Oct 2004 00:58:31 -0000	1.190
+++ chan_iax2.c	2 Oct 2004 01:56:08 -0000	1.191
@@ -473,6 +473,9 @@
 	int authid;			/* Authentication rejection ID */
 	int authfail;		/* Reason to report failure */
 	int initid;			/* Initial peer auto-congest ID (based on qualified peers) */
+	int calling_ton;
+	int calling_tns;
+	int calling_pres;
 	char dproot[AST_MAX_EXTENSION];
 	char accountcode[20];
 	int amaflags;
@@ -3607,6 +3610,12 @@
 		strncpy(iaxs[callno]->language, ies->language, sizeof(iaxs[callno]->language)-1);
 	if (ies->username)
 		strncpy(iaxs[callno]->username, ies->username, sizeof(iaxs[callno]->username)-1);
+	if (ies->calling_ton > -1)
+		iaxs[callno]->calling_ton = ies->calling_ton;
+	if (ies->calling_tns > -1)
+		iaxs[callno]->calling_tns = ies->calling_tns;
+	if (ies->calling_pres > -1)
+		iaxs[callno]->calling_pres = ies->calling_pres;
 	if (ies->format)
 		iaxs[callno]->peerformat = ies->format;
 	if (ies->adsicpe)

Index: chan_sip.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_sip.c,v
retrieving revision 1.512
retrieving revision 1.513
diff -u -d -r1.512 -r1.513
--- chan_sip.c	2 Oct 2004 00:58:31 -0000	1.512
+++ chan_sip.c	2 Oct 2004 01:56:08 -0000	1.513
@@ -3694,8 +3694,10 @@
 
 	snprintf(p->lastmsg, sizeof(p->lastmsg), "Init: %s", cmd);
 
-	l = p->owner->cid.cid_num;
-	n = p->owner->cid.cid_name;
+	if (p->owner) {
+		l = p->owner->cid.cid_num;
+		n = p->owner->cid.cid_name;
+	}
 	if (!l || !ast_isphonenumber(l))
 			l = default_callerid;
 	/* if user want's his callerid restricted */

Index: iax2-parser.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/iax2-parser.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- iax2-parser.c	9 Sep 2004 01:36:01 -0000	1.27
+++ iax2-parser.c	2 Oct 2004 01:56:08 -0000	1.28
@@ -3,9 +3,9 @@
  *
  * Implementation of Inter-Asterisk eXchange
  * 
- * Copyright (C) 2003, Digium
+ * Copyright (C) 2003-2004, Digium
  *
- * Mark Spencer <markster at linux-support.net>
+ * Mark Spencer <markster at digium.com>
  *
  * This program is free software, distributed under the terms of
  * the GNU General Public License
@@ -158,6 +158,9 @@
 	{ IAX_IE_FWBLOCKDESC, "FW BLOCK DESC", dump_int },
 	{ IAX_IE_FWBLOCKDATA, "FW BLOCK DATA" },
 	{ IAX_IE_PROVVER, "PROVISIONG VER", dump_int },
+	{ IAX_IE_CALLINGPRES, "CALLING PRESNTN", dump_byte },
+	{ IAX_IE_CALLINGTON, "CALLING TYPEOFNUM", dump_byte },
+	{ IAX_IE_CALLINGTNS, "CALLING TRANSITNET", dump_short },
 };
 
 static struct iax2_ie prov_ies[] = {
@@ -481,6 +484,9 @@
 	memset(ies, 0, (int)sizeof(struct iax_ies));
 	ies->msgcount = -1;
 	ies->firmwarever = -1;
+	ies->calling_ton = -1;
+	ies->calling_tns = -1;
+	ies->calling_pres = -1;
 	while(datalen >= 2) {
 		ie = data[0];
 		len = data[1];
@@ -658,6 +664,29 @@
 				ies->provver = ntohl(*((unsigned int *)(data + 2)));
 			}
 			break;
+		case IAX_IE_CALLINGPRES:
+			if (len == 1)
+				ies->calling_pres = data[2];
+			else {
+				snprintf(tmp, (int)sizeof(tmp), "Expected single byte callingpres, but was %d long\n", len);
+				errorf(tmp);
+			}
+			break;
+		case IAX_IE_CALLINGTON:
+			if (len == 1)
+				ies->calling_ton = data[2];
+			else {
+				snprintf(tmp, (int)sizeof(tmp), "Expected single byte callington, but was %d long\n", len);
+				errorf(tmp);
+			}
+			break;
+		case IAX_IE_CALLINGTNS:
+			if (len != (int)sizeof(unsigned short)) {
+				snprintf(tmp, (int)sizeof(tmp), "Expecting callingtns to be %d bytes long but was %d\n", (int)sizeof(unsigned short), len);
+				errorf(tmp);
+			} else
+				ies->calling_tns = ntohs(*((unsigned short *)(data + 2)));	
+			break;
 		default:
 			snprintf(tmp, (int)sizeof(tmp), "Ignoring unknown information element '%s' (%d) of length %d\n", iax_ie2str(ie), ie, len);
 			outputf(tmp);

Index: iax2-parser.h
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/iax2-parser.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- iax2-parser.h	7 Jul 2004 09:34:01 -0000	1.9
+++ iax2-parser.h	2 Oct 2004 01:56:08 -0000	1.10
@@ -5,7 +5,7 @@
  * 
  * Copyright (C) 2003, Digium
  *
- * Mark Spencer <markster at linux-support.net>
+ * Mark Spencer <markster at digium.com>
  *
  * This program is free software, distributed under the terms of
  * the GNU General Public License
@@ -19,6 +19,9 @@
 	char *calling_number;
 	char *calling_ani;
 	char *calling_name;
+	int calling_ton;
+	int calling_tns;
+	int calling_pres;
 	char *called_context;
 	char *username;
 	char *password;

Index: iax2.h
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/iax2.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- iax2.h	25 May 2004 04:34:43 -0000	1.15
+++ iax2.h	2 Oct 2004 01:56:08 -0000	1.16
@@ -112,6 +112,9 @@
 #define IAX_IE_FWBLOCKDESC			35		/* Firmware block description -- u32 */
 #define IAX_IE_FWBLOCKDATA			36		/* Firmware block of data -- raw */
 #define IAX_IE_PROVVER				37		/* Provisioning Version (u32) */
+#define IAX_IE_CALLINGPRES			38		/* Calling presentation (u8) */
+#define IAX_IE_CALLINGTON			39		/* Calling type of number (u8) */
+#define IAX_IE_CALLINGTNS			40		/* Calling transit network select (u16) */
 
 #define IAX_AUTH_PLAINTEXT			(1 << 0)
 #define IAX_AUTH_MD5				(1 << 1)




More information about the svn-commits mailing list