? dick
? patch_20041215.txt
? solaris_x86.diff
? undo.diff
? include/asterisk/strcompat.h
? include/solaris-compat/strcompat.h
Index: Makefile
===================================================================
RCS file: /usr/cvsroot/asterisk/Makefile,v
retrieving revision 1.125
diff -u -r1.125 Makefile
--- Makefile	14 Dec 2004 23:36:29 -0000	1.125
+++ Makefile	15 Dec 2004 21:59:36 -0000
@@ -163,7 +163,8 @@
 endif
 ifeq (${OSARCH},SunOS)
 CFLAGS+=-Wcast-align -DSOLARIS
-INCLUDE+=-Iinclude/solaris-compat -I/usr/local/ssl/include
+INCLUDE+=-Iinclude/solaris-compat -I/usr/local/ssl/include -I/usr/src/zaptel-solaris
+CFLAGS+=$(shell if [ -f /usr/src/zaptel-solaris/zaptel.h ]; then echo "-DZAPTEL_OPTIMIZATIONS"; fi)
 endif
 
 #Uncomment this to use the older DSP routines
@@ -335,7 +336,7 @@
 	$(MAKE) -C stdtime clean
 
 datafiles: all
-	sh mkpkgconfig $(DESTDIR)/usr/lib/pkgconfig
+	bash mkpkgconfig $(DESTDIR)/usr/lib/pkgconfig
 	mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/sounds/digits
 	for x in sounds/digits/*.gsm; do \
 		if $(GREP) -q "^%`basename $$x`%" sounds.txt; then \
Index: asterisk.c
===================================================================
RCS file: /usr/cvsroot/asterisk/asterisk.c,v
retrieving revision 1.131
diff -u -r1.131 asterisk.c
--- asterisk.c	14 Dec 2004 23:36:29 -0000	1.131
+++ asterisk.c	15 Dec 2004 21:59:36 -0000
@@ -730,7 +730,7 @@
 			ret = 1;
 		}
 		if ((strncasecmp(s, "quit", 4) == 0 || strncasecmp(s, "exit", 4) == 0) &&
-		    (s[4] == '\0' || isspace(s[4]))) {
+		    (s[4] == '\0' || isspace((int)s[4]))) {
 			quit_handler(0, 0, 0, 0);
 			ret = 1;
 		}
@@ -1206,7 +1206,7 @@
 	ptr = (char *)lf->cursor;
 	if (ptr) {
 		while (ptr > lf->buffer) {
-			if (isspace(*ptr)) {
+			if (isspace((int)*ptr)) {
 				ptr++;
 				break;
 			}
@@ -1707,7 +1707,7 @@
 			exit(1);
 		}
 		if (setgid(gr->gr_gid)) {
-			ast_log(LOG_WARNING, "Unable to setgid to %d (%s)\n", gr->gr_gid, rungroup);
+			ast_log(LOG_WARNING, "Unable to setgid to %d (%s)\n", (int)gr->gr_gid, rungroup);
 			exit(1);
 		}
 		if (option_verbose)
@@ -1725,7 +1725,7 @@
 			exit(1);
 		}
 		if (setuid(pw->pw_uid)) {
-			ast_log(LOG_WARNING, "Unable to setuid to %d (%s)\n", pw->pw_uid, runuser);
+			ast_log(LOG_WARNING, "Unable to setuid to %d (%s)\n", (int)pw->pw_uid, runuser);
 			exit(1);
 		}
 		if (option_verbose)
@@ -1783,7 +1783,7 @@
 	unlink((char *)ast_config_AST_PID);
 	f = fopen((char *)ast_config_AST_PID, "w");
 	if (f) {
-		fprintf(f, "%d\n", getpid());
+		fprintf(f, "%d\n", (int)getpid());
 		fclose(f);
 	} else
 		ast_log(LOG_WARNING, "Unable to open pid file '%s': %s\n", (char *)ast_config_AST_PID, strerror(errno));
@@ -1794,7 +1794,7 @@
 		unlink((char *)ast_config_AST_PID);
 		f = fopen((char *)ast_config_AST_PID, "w");
 		if (f) {
-			fprintf(f, "%d\n", getpid());
+			fprintf(f, "%d\n", (int)getpid());
 			fclose(f);
 		} else
 			ast_log(LOG_WARNING, "Unable to open pid file '%s': %s\n", (char *)ast_config_AST_PID, strerror(errno));
Index: callerid.c
===================================================================
RCS file: /usr/cvsroot/asterisk/callerid.c,v
retrieving revision 1.26
diff -u -r1.26 callerid.c
--- callerid.c	22 Oct 2004 19:45:39 -0000	1.26
+++ callerid.c	15 Dec 2004 21:59:36 -0000
@@ -189,20 +189,20 @@
 		for (i = 1; i < strlen(cidstring); i++ ) {
 			if (cidstring[i] == 'C' || cidstring[i] == '#')
 				break;
-			if (isdigit(cidstring[i]))
+			if (isdigit((int)cidstring[i]))
 				number[i-1] = cidstring[i];
 			else
 				ast_log(LOG_DEBUG, "Unknown CID digit '%c'\n",
 					cidstring[i]);
 		}
 		number[i-1] = 0;
-	} else if (isdigit(cidstring[0])) {
+	} else if (isdigit((int)cidstring[0])) {
 		/* It begins with a digit, so we parse it as a number and hope
 		 * for the best */
 		ast_log(LOG_WARNING, "Couldn't detect start-character. CID "
 			"parsing might be unreliable\n");
 		for (i = 0; i < strlen(cidstring); i++) {
-			if (isdigit(cidstring[i]))
+			if (isdigit((int)cidstring[i]))
                                 number[i] = cidstring[i];
 			else
 				break;
Index: logger.c
===================================================================
RCS file: /usr/cvsroot/asterisk/logger.c,v
retrieving revision 1.52
diff -u -r1.52 logger.c
--- logger.c	14 Dec 2004 23:36:29 -0000	1.52
+++ logger.c	15 Dec 2004 21:59:37 -0000
@@ -575,7 +575,7 @@
 	if (level == __LOG_EVENT) {
 		va_start(ap, fmt);
 
-		fprintf(eventlog, "%s asterisk[%d]: ", date, getpid());
+		fprintf(eventlog, "%s asterisk[%d]: ", date, (int)getpid());
 		vfprintf(eventlog, fmt, ap);
 		fflush(eventlog);
 
Index: pbx.c
===================================================================
RCS file: /usr/cvsroot/asterisk/pbx.c,v
retrieving revision 1.184
diff -u -r1.184 pbx.c
--- pbx.c	11 Dec 2004 03:50:19 -0000	1.184
+++ pbx.c	15 Dec 2004 21:59:37 -0000
@@ -3192,7 +3192,7 @@
 	}
 	*e = '\0';
 	e++;
-	while(*e && !isdigit(*e)) e++;
+	while(*e && !isdigit((int)*e)) e++;
 	if (!*e) {
 		ast_log(LOG_WARNING, "Invalid time range.  Assuming no restrictions based on time.\n");
 		return;
Index: rtp.c
===================================================================
RCS file: /usr/cvsroot/asterisk/rtp.c,v
retrieving revision 1.101
diff -u -r1.101 rtp.c
--- rtp.c	14 Dec 2004 23:36:29 -0000	1.101
+++ rtp.c	15 Dec 2004 21:59:37 -0000
@@ -1087,15 +1087,13 @@
 #ifdef SOLARIS
 static void put_uint32(unsigned char *buf, int i)
 {
-  unsigned char *c = (unsigned char *)&i;
-
   buf[0] = (i>>24) & 0xff;
   buf[1] = (i>>16) & 0xff;
   buf[2] = (i>>8)  & 0xff;
   buf[3] = i       & 0xff;
 }
 #else
-#define put_uint32(p,v) ((*((unsigned int *)(p))) = (v))
+#define put_uint32(p,v) ((*((unsigned int *)(p))) = htonl(v))
 #endif
 
 static int ast_rtp_raw_write(struct ast_rtp *rtp, struct ast_frame *f, int codec)
@@ -1181,9 +1179,9 @@
 	/* Get a pointer to the header */
 	rtpheader = (unsigned char *)(f->data - hdrlen);
 
-	put_uint32(rtpheader, htonl((2 << 30) | (codec << 16) | (rtp->seqno) | (mark << 23)));
-	put_uint32(rtpheader + 4, htonl(rtp->lastts));
-	put_uint32(rtpheader + 8, htonl(rtp->ssrc)); 
+	put_uint32(rtpheader, (2 << 30) | (codec << 16) | (rtp->seqno) | (mark << 23));
+	put_uint32(rtpheader + 4, rtp->lastts);
+	put_uint32(rtpheader + 8, rtp->ssrc); 
 
 	rtp->seqno++;
 
Index: strcompat.c
===================================================================
RCS file: /usr/cvsroot/asterisk/strcompat.c,v
retrieving revision 1.1
diff -u -r1.1 strcompat.c
--- strcompat.c	14 Dec 2004 23:36:29 -0000	1.1
+++ strcompat.c	15 Dec 2004 21:59:37 -0000
@@ -2,6 +2,9 @@
 
 #include <sys/types.h>
 #include <stdio.h>
+#ifdef SOLARIS
+#include <solaris-compat/compat.h>
+#endif
 
 char* strsep(char** str, const char* delims)
 {
@@ -142,3 +145,9 @@
 
 	return ret;
 }
+
+int unsetenv(const char *name)
+{
+  setenv(name,"",0);
+}
+
Index: utils.c
===================================================================
RCS file: /usr/cvsroot/asterisk/utils.c,v
retrieving revision 1.23
diff -u -r1.23 utils.c
--- utils.c	14 Dec 2004 23:36:29 -0000	1.23
+++ utils.c	15 Dec 2004 21:59:37 -0000
@@ -161,8 +161,9 @@
 	   integers, we break with tradition and refuse to look up a
 	   pure integer */
 	s = host;
+	res = 0;
 	while(s && *s) {
-		if (!isdigit(*s))
+		if (!isdigit((int)*s))
 			break;
 		s++;
 	}
Index: apps/Makefile
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/Makefile,v
retrieving revision 1.85
diff -u -r1.85 Makefile
--- apps/Makefile	14 Dec 2004 23:36:29 -0000	1.85
+++ apps/Makefile	15 Dec 2004 21:59:37 -0000
@@ -49,6 +49,7 @@
 
 APPS+=$(shell if [ -f /usr/include/linux/zaptel.h ]; then echo "app_zapras.so app_meetme.so app_flash.so app_zapbarge.so app_zapscan.so" ; fi)
 APPS+=$(shell if [ -f /usr/local/include/zaptel.h ]; then echo "app_zapras.so app_meetme.so app_flash.so app_zapbarge.so app_zapscan.so" ; fi)
+APPS+=$(shell if [ -f /usr/src/zaptel-solaris/zaptel.h ]; then echo "app_zapras.so app_meetme.so app_flash.so app_zapbarge.so app_zapscan.so" ; fi)
 APPS+=$(shell if [ -f /usr/include/osp/osp.h ]; then echo "app_osplookup.so" ; fi)
 
 CFLAGS+=-fPIC
Index: apps/app_adsiprog.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_adsiprog.c,v
retrieving revision 1.9
diff -u -r1.9 app_adsiprog.c
--- apps/app_adsiprog.c	26 Jul 2004 03:23:38 -0000	1.9
+++ apps/app_adsiprog.c	15 Dec 2004 21:59:37 -0000
@@ -198,7 +198,7 @@
 			/* Convert */
 			*((unsigned int *)out) = htonl(*((unsigned int *)out));
 		}
-	} else if ((!ast_strlen_zero(src) && isdigit(src[0]))) {
+	} else if ((!ast_strlen_zero(src) && isdigit((int)src[0]))) {
 		if (!(argtype & ARG_NUMBER))
 			return -1;
 		/* Hex value */
Index: apps/app_enumlookup.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_enumlookup.c,v
retrieving revision 1.11
diff -u -r1.11 app_enumlookup.c
--- apps/app_enumlookup.c	2 Oct 2004 00:58:31 -0000	1.11
+++ apps/app_enumlookup.c	15 Dec 2004 21:59:37 -0000
@@ -114,7 +114,7 @@
 /* now copy over the number, skipping all non-digits and stop at ; or NULL */
 				t = tmp;	
 				while( *c && (*c != ';') && (t - tmp < (sizeof(tmp) - 1))) {
-					if (isdigit(*c))
+					if (isdigit((int)*c))
 						*t++ = *c;
 					c++;
 				}
Index: apps/app_sms.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_sms.c,v
retrieving revision 1.15
diff -u -r1.15 app_sms.c
--- apps/app_sms.c	14 Dec 2004 23:36:29 -0000	1.15
+++ apps/app_sms.c	15 Dec 2004 21:59:38 -0000
@@ -186,7 +186,7 @@
       *d++ = *s++;
    while (*s)
    {
-      if (isdigit (*s))
+      if (isdigit ((int)*s))
          *d++ = *s;
       s++;
    }
@@ -649,7 +649,7 @@
    } else
       o[1] = 0x81;
    while (*i)
-      if (isdigit (*i))
+      if (isdigit ((int)*i))
       {
          if (o[0] & 1)
             o[p++] |= ((*i & 0xF) << 4);
Index: apps/app_voicemail.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_voicemail.c,v
retrieving revision 1.179
diff -u -r1.179 app_voicemail.c
--- apps/app_voicemail.c	12 Dec 2004 04:52:24 -0000	1.179
+++ apps/app_voicemail.c	15 Dec 2004 21:59:38 -0000
@@ -1656,11 +1656,11 @@
 			fprintf(p, "Subject: New message %d in mailbox %s\n", msgnum + 1, mailbox);
 		else
 			fprintf(p, "Subject: [PBX]: New message %d in mailbox %s\n", msgnum + 1, mailbox);
-		fprintf(p, "Message-ID: <Asterisk-%d-%d-%s-%d@%s>\n", msgnum, (unsigned int)rand(), mailbox, getpid(), host);
+		fprintf(p, "Message-ID: <Asterisk-%d-%d-%s-%d@%s>\n", msgnum, (unsigned int)rand(), mailbox, (int)getpid(), host);
 		fprintf(p, "MIME-Version: 1.0\n");
 		if (attach_user_voicemail) {
 			/* Something unique. */
-			snprintf(bound, sizeof(bound), "voicemail_%d%s%d%d", msgnum, mailbox, getpid(), (unsigned int)rand());
+			snprintf(bound, sizeof(bound), "voicemail_%d%s%d%d", msgnum, mailbox, (int)getpid(), (unsigned int)rand());
 
 			fprintf(p, "Content-Type: multipart/mixed; boundary=\"%s\"\n\n\n", bound);
 
Index: channels/Makefile
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/Makefile,v
retrieving revision 1.66
diff -u -r1.66 Makefile
--- channels/Makefile	14 Dec 2004 23:36:29 -0000	1.66
+++ channels/Makefile	15 Dec 2004 21:59:38 -0000
@@ -59,6 +59,8 @@
 
 ifeq (${OSARCH},SunOS)
 SOLINK+=-lrt
+#CHANNEL_LIBS+=$(shell [ -f /usr/src/zaptel-solaris/zaptel.h ] && echo "chan_zap.so")
+CFLAGS+=-I/usr/src/zaptel-solaris
 endif
 
 CHANNEL_LIBS+=$(shell [ -f /usr/include/linux/ixjuser.h ] && echo chan_phone.so)
Index: channels/chan_mgcp.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_mgcp.c,v
retrieving revision 1.96
diff -u -r1.96 chan_mgcp.c
--- channels/chan_mgcp.c	14 Dec 2004 23:36:29 -0000	1.96
+++ channels/chan_mgcp.c	15 Dec 2004 21:59:38 -0000
@@ -1927,7 +1927,7 @@
 		ast_verbose("We're at %s port %d\n", ast_inet_ntoa(iabuf, sizeof(iabuf), p->parent->ourip), ntohs(sin.sin_port));	
     }
 	snprintf(v, sizeof(v), "v=0\r\n");
-	snprintf(o, sizeof(o), "o=root %d %d IN IP4 %s\r\n", getpid(), getpid(), ast_inet_ntoa(iabuf, sizeof(iabuf), dest.sin_addr));
+	snprintf(o, sizeof(o), "o=root %d %d IN IP4 %s\r\n", (int)getpid(), (int)getpid(), ast_inet_ntoa(iabuf, sizeof(iabuf), dest.sin_addr));
 	snprintf(s, sizeof(s), "s=session\r\n");
 	snprintf(c, sizeof(c), "c=IN IP4 %s\r\n", ast_inet_ntoa(iabuf, sizeof(iabuf), dest.sin_addr));
 	snprintf(t, sizeof(t), "t=0 0\r\n");
Index: channels/chan_modem.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_modem.c,v
retrieving revision 1.33
diff -u -r1.33 chan_modem.c
--- channels/chan_modem.c	14 Dec 2004 23:36:29 -0000	1.33
+++ channels/chan_modem.c	15 Dec 2004 21:59:38 -0000
@@ -797,7 +797,7 @@
 	strsep(&stringp, ":");
 	oldformat = format;
 
-	if (dev[0]=='g' && isdigit(dev[1])) {
+	if (dev[0]=='g' && isdigit((int)dev[1])) {
 		/* Retrieve the group number */
 		if (sscanf(dev+1, "%u", &group) < 1) {
 			ast_log(LOG_WARNING, "Unable to determine group from [%s]\n", (char *)data);
Index: channels/chan_sip.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_sip.c,v
retrieving revision 1.591
diff -u -r1.591 chan_sip.c
--- channels/chan_sip.c	13 Dec 2004 15:26:26 -0000	1.591
+++ channels/chan_sip.c	15 Dec 2004 21:59:39 -0000
@@ -3574,7 +3574,7 @@
     if( ( e= strrchr( req->rlPart2, 'S' ) ) == NULL ) {
       return -1;
     }
-    while( isspace( *(--e) ) ) {}
+    while( isspace( (int)*(--e) ) ) {}
     if( *e == '>' ) {
       *e= '\0';
     } else {
Index: channels/chan_zap.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_zap.c,v
retrieving revision 1.391
diff -u -r1.391 chan_zap.c
--- channels/chan_zap.c	15 Dec 2004 20:03:17 -0000	1.391
+++ channels/chan_zap.c	15 Dec 2004 21:59:40 -0000
@@ -765,7 +765,7 @@
 	int x;
 	isnum = 1;
 	for (x=0;x<strlen(fn);x++) {
-		if (!isdigit(fn[x])) {
+		if (!isdigit((int)fn[x])) {
 			isnum = 0;
 			break;
 		}
@@ -987,7 +987,7 @@
 }
 #endif
 
-static char *sig2str(int sig)
+static char *zap_sig2str(int sig)
 {
 	static char buf[256];
 	switch(sig) {
@@ -1042,6 +1042,8 @@
 		return buf;
 	}
 }
+
+#define sig2str zap_sig2str
 
 static int conf_add(struct zt_pvt *p, struct zt_subchannel *c, int index, int slavechannel)
 {
Index: channels/iax2-parser.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/iax2-parser.c,v
retrieving revision 1.31
diff -u -r1.31 iax2-parser.c
--- channels/iax2-parser.c	14 Dec 2004 23:36:29 -0000	1.31
+++ channels/iax2-parser.c	15 Dec 2004 21:59:40 -0000
@@ -42,8 +42,8 @@
 }
 
 #else
-#define get_uint32(p) (*((unsigned int *)(p)))
-#define get_uint16(p) (*((unsigned short *)(p)))
+#define get_uint32(p) ntohl(*((unsigned int *)(p)))
+#define get_uint16(p) ntohs(*((unsigned short *)(p)))
 #endif
 
 static void internaloutput(const char *str)
@@ -83,7 +83,7 @@
 static void dump_int(char *output, int maxlen, void *value, int len)
 {
 	if (len == (int)sizeof(unsigned int))
-		snprintf(output, maxlen, "%lu", (unsigned long)ntohl(get_uint32(value)));
+		snprintf(output, maxlen, "%lu", (unsigned long)get_uint32(value));
 	else
 		snprintf(output, maxlen, "Invalid INT");
 }
@@ -91,7 +91,7 @@
 static void dump_short(char *output, int maxlen, void *value, int len)
 {
 	if (len == (int)sizeof(unsigned short))
-		snprintf(output, maxlen, "%d", ntohs(get_uint16(value)));
+		snprintf(output, maxlen, "%d", get_uint16(value));
 	else
 		snprintf(output, maxlen, "Invalid SHORT");
 }
@@ -121,8 +121,8 @@
 {
 	char buf[256] = "";
 	if (len == (int)sizeof(unsigned int))
-		snprintf(output, maxlen, "%lu (%s)", (unsigned long)ntohl(get_uint32(value)),
-			iax_provflags2str(buf, sizeof(buf), ntohl(get_uint32(value))));
+		snprintf(output, maxlen, "%lu (%s)", (unsigned long)get_uint32(value),
+			iax_provflags2str(buf, sizeof(buf), get_uint32(value)));
 	else
 		snprintf(output, maxlen, "Invalid INT");
 }
@@ -566,14 +566,14 @@
 				snprintf(tmp, (int)sizeof(tmp), "Expecting capability to be %d bytes long but was %d\n", (int)sizeof(unsigned int), len);
 				errorf(tmp);
 			} else
-				ies->capability = ntohl(get_uint32(data + 2));
+				ies->capability = get_uint32(data + 2);
 			break;
 		case IAX_IE_FORMAT:
 			if (len != (int)sizeof(unsigned int)) {
 				snprintf(tmp, (int)sizeof(tmp), "Expecting format to be %d bytes long but was %d\n", (int)sizeof(unsigned int), len);
 				errorf(tmp);
 			} else
-				ies->format = ntohl(get_uint32(data + 2));
+				ies->format = get_uint32(data + 2);
 			break;
 		case IAX_IE_LANGUAGE:
 			ies->language = data + 2;
@@ -583,21 +583,21 @@
 				snprintf(tmp, (int)sizeof(tmp),  "Expecting version to be %d bytes long but was %d\n", (int)sizeof(unsigned short), len);
 				errorf(tmp);
 			} else
-				ies->version = ntohs(get_uint16(data + 2));
+				ies->version = get_uint16(data + 2);
 			break;
 		case IAX_IE_ADSICPE:
 			if (len != (int)sizeof(unsigned short)) {
 				snprintf(tmp, (int)sizeof(tmp), "Expecting adsicpe to be %d bytes long but was %d\n", (int)sizeof(unsigned short), len);
 				errorf(tmp);
 			} else
-				ies->adsicpe = ntohs(get_uint16(data + 2));
+				ies->adsicpe = get_uint16(data + 2);
 			break;
 		case IAX_IE_SAMPLINGRATE:
 			if (len != (int)sizeof(unsigned short)) {
 				snprintf(tmp, (int)sizeof(tmp), "Expecting samplingrate to be %d bytes long but was %d\n", (int)sizeof(unsigned short), len);
 				errorf(tmp);
 			} else
-				ies->samprate = ntohs(get_uint16(data + 2));
+				ies->samprate = get_uint16(data + 2);
 			break;
 		case IAX_IE_DNID:
 			ies->dnid = data + 2;
@@ -610,7 +610,7 @@
 				snprintf(tmp, (int)sizeof(tmp), "Expecting authmethods to be %d bytes long but was %d\n", (int)sizeof(unsigned short), len);
 				errorf(tmp);
 			} else
-				ies->authmethods = ntohs(get_uint16(data + 2));
+				ies->authmethods = get_uint16(data + 2);
 			break;
 		case IAX_IE_CHALLENGE:
 			ies->challenge = data + 2;
@@ -629,21 +629,21 @@
 				snprintf(tmp, (int)sizeof(tmp),  "Expecting refresh to be %d bytes long but was %d\n", (int)sizeof(unsigned short), len);
 				errorf(tmp);
 			} else
-				ies->refresh = ntohs(get_uint16(data + 2));
+				ies->refresh = get_uint16(data + 2);
 			break;
 		case IAX_IE_DPSTATUS:
 			if (len != (int)sizeof(unsigned short)) {
 				snprintf(tmp, (int)sizeof(tmp),  "Expecting dpstatus to be %d bytes long but was %d\n", (int)sizeof(unsigned short), len);
 				errorf(tmp);
 			} else
-				ies->dpstatus = ntohs(get_uint16(data + 2));
+				ies->dpstatus = get_uint16(data + 2);
 			break;
 		case IAX_IE_CALLNO:
 			if (len != (int)sizeof(unsigned short)) {
 				snprintf(tmp, (int)sizeof(tmp),  "Expecting callno to be %d bytes long but was %d\n", (int)sizeof(unsigned short), len);
 				errorf(tmp);
 			} else
-				ies->callno = ntohs(get_uint16(data + 2));
+				ies->callno = get_uint16(data + 2);
 			break;
 		case IAX_IE_CAUSE:
 			ies->cause = data + 2;
@@ -661,7 +661,7 @@
 				snprintf(tmp, (int)sizeof(tmp), "Expecting msgcount to be %d bytes long but was %d\n", (int)sizeof(unsigned short), len);
 				errorf(tmp);
 			} else
-				ies->msgcount = ntohs(get_uint16(data + 2));	
+				ies->msgcount = get_uint16(data + 2);	
 			break;
 		case IAX_IE_AUTOANSWER:
 			ies->autoanswer = 1;
@@ -674,21 +674,21 @@
 				snprintf(tmp, (int)sizeof(tmp), "Expecting transferid to be %d bytes long but was %d\n", (int)sizeof(unsigned int), len);
 				errorf(tmp);
 			} else
-				ies->transferid = ntohl(get_uint32(data + 2));
+				ies->transferid = get_uint32(data + 2);
 			break;
 		case IAX_IE_DATETIME:
 			if (len != (int)sizeof(unsigned int)) {
 				snprintf(tmp, (int)sizeof(tmp), "Expecting date/time to be %d bytes long but was %d\n", (int)sizeof(unsigned int), len);
 				errorf(tmp);
 			} else
-				ies->datetime = ntohl(get_uint32(data + 2));
+				ies->datetime = get_uint32(data + 2);
 			break;
 		case IAX_IE_FIRMWAREVER:
 			if (len != (int)sizeof(unsigned short)) {
 				snprintf(tmp, (int)sizeof(tmp), "Expecting firmwarever to be %d bytes long but was %d\n", (int)sizeof(unsigned short), len);
 				errorf(tmp);
 			} else
-				ies->firmwarever = ntohs(get_uint16(data + 2));	
+				ies->firmwarever = get_uint16(data + 2);	
 			break;
 		case IAX_IE_DEVICETYPE:
 			ies->devicetype = data + 2;
@@ -701,7 +701,7 @@
 				snprintf(tmp, (int)sizeof(tmp), "Expected block desc to be %d bytes long but was %d\n", (int)sizeof(unsigned int), len);
 				errorf(tmp);
 			} else
-				ies->fwdesc = ntohl(get_uint32(data + 2));
+				ies->fwdesc = get_uint32(data + 2);
 			break;
 		case IAX_IE_FWBLOCKDATA:
 			ies->fwdata = data + 2;
@@ -713,7 +713,7 @@
 				errorf(tmp);
 			} else {
 				ies->provverpres = 1;
-				ies->provver = ntohl(get_uint32(data + 2));
+				ies->provver = get_uint32(data + 2);
 			}
 			break;
 		case IAX_IE_CALLINGPRES:
@@ -737,7 +737,7 @@
 				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(get_uint16(data + 2));	
+				ies->calling_tns = get_uint16(data + 2);	
 			break;
 		default:
 			snprintf(tmp, (int)sizeof(tmp), "Ignoring unknown information element '%s' (%d) of length %d\n", iax_ie2str(ie), ie, len);
Index: include/asterisk/channel.h
===================================================================
RCS file: /usr/cvsroot/asterisk/include/asterisk/channel.h,v
retrieving revision 1.63
diff -u -r1.63 channel.h
--- include/asterisk/channel.h	14 Dec 2004 23:36:30 -0000	1.63
+++ include/asterisk/channel.h	15 Dec 2004 21:59:40 -0000
@@ -14,6 +14,9 @@
 #ifndef _ASTERISK_CHANNEL_H
 #define _ASTERISK_CHANNEL_H
 
+#ifdef SOLARIS
+#include <solaris-compat/compat.h>
+#endif
 #include <asterisk/frame.h>
 #include <asterisk/sched.h>
 #include <asterisk/chanvars.h>
Index: include/asterisk/logger.h
===================================================================
RCS file: /usr/cvsroot/asterisk/include/asterisk/logger.h,v
retrieving revision 1.9
diff -u -r1.9 logger.h
--- include/asterisk/logger.h	12 Feb 2004 22:11:02 -0000	1.9
+++ include/asterisk/logger.h	15 Dec 2004 21:59:40 -0000
@@ -13,7 +13,9 @@
 
 #ifndef _LOGGER_H
 #define _LOGGER_H
-
+#ifdef SOLARIS
+#include <solaris-compat/compat.h>
+#endif
 #include <stdarg.h>
 
 #if defined(__cplusplus) || defined(c_plusplus)
Index: include/asterisk/utils.h
===================================================================
RCS file: /usr/cvsroot/asterisk/include/asterisk/utils.h,v
retrieving revision 1.10
diff -u -r1.10 utils.h
--- include/asterisk/utils.h	17 Oct 2004 22:13:05 -0000	1.10
+++ include/asterisk/utils.h	15 Dec 2004 21:59:40 -0000
@@ -12,6 +12,9 @@
 #ifndef _ASTERISK_UTIL_H
 #define _ASTERISK_UTIL_H
 
+#ifdef SOLARIS
+#include <solaris-compat/compat.h>
+#endif
 #include <netinet/in.h>
 #include <netdb.h>
 #include <pthread.h>
Index: include/solaris-compat/compat.h
===================================================================
RCS file: /usr/cvsroot/asterisk/include/solaris-compat/compat.h,v
retrieving revision 1.1
diff -u -r1.1 compat.h
--- include/solaris-compat/compat.h	14 Dec 2004 23:36:30 -0000	1.1
+++ include/solaris-compat/compat.h	15 Dec 2004 21:59:40 -0000
@@ -8,19 +8,15 @@
 #define __P(p) p
 #endif
 
-#define LITTLE_ENDIAN 1234
-#define BIG_ENDIAN 4321
 
-#define __LITTLE_ENDIAN 1234
-#define __BIG_ENDIAN 4321
 
-#ifdef __sparc__
-#define BYTE_ORDER BIG_ENDIAN
-#define __BYTE_ORDER BIG_ENDIAN
-#else
-#define BYTE_ORDER LITTLE_ENDIAN
-#define ____BYTE_ORDER BIG_ENDIAN
-#endif
+#include <alloca.h>
+#include <strings.h>
+#include <string.h>
+#include <pthread.h>
+#include <sys/stat.h>
+#include <signal.h>
+#include <netinet/in.h>
 
 #ifndef __BIT_TYPES_DEFINED__
 #define __BIT_TYPES_DEFINED__
@@ -29,6 +25,9 @@
 typedef unsigned int	u_int32_t;
 #endif
 
+char* strsep(char** str, const char* delims);
+uint64_t
+strtoq(const char *nptr, char **endptr, int base);
 int setenv(const char *name, const char *value, int overwrite);
-
+int unsetenv(const char *name);
 #endif
Index: pbx/pbx_config.c
===================================================================
RCS file: /usr/cvsroot/asterisk/pbx/pbx_config.c,v
retrieving revision 1.51
diff -u -r1.51 pbx_config.c
--- pbx/pbx_config.c	24 Oct 2004 02:53:24 -0000	1.51
+++ pbx/pbx_config.c	15 Dec 2004 21:59:40 -0000
@@ -394,7 +394,7 @@
 		 */
 		if (strcmp("hint", c)) {
     		    while (*c != '\0') {
-			if (!isdigit(*c++)) {
+			if (!isdigit((int)*c++)) {
 				ast_cli(fd, "Invalid priority '%s'\n", argv[3]);
 				return RESULT_FAILURE;
 			}
Index: res/res_agi.c
===================================================================
RCS file: /usr/cvsroot/asterisk/res/res_agi.c,v
retrieving revision 1.18
diff -u -r1.18 res_agi.c
--- res/res_agi.c	14 Dec 2004 18:39:25 -0000	1.18
+++ res/res_agi.c	15 Dec 2004 21:59:40 -0000
@@ -48,6 +48,9 @@
 #include <asterisk/agi.h>
 #include "../asterisk.h"
 #include "../astconf.h"
+#ifdef SOLARIS
+#include <asterisk/astmm.h>
+#endif
 
 #define MAX_ARGS 128
 #define MAX_COMMANDS 128
Index: res/res_indications.c
===================================================================
RCS file: /usr/cvsroot/asterisk/res/res_indications.c,v
retrieving revision 1.7
diff -u -r1.7 res_indications.c
--- res/res_indications.c	14 Jul 2004 13:57:15 -0000	1.7
+++ res/res_indications.c	15 Dec 2004 21:59:40 -0000
@@ -253,7 +253,7 @@
 				ring = strsep(&c,",");
 				while (ring) {
 					int *tmp, val;
-					if (!isdigit(ring[0]) || (val=atoi(ring))==-1) {
+					if (!isdigit((int)ring[0]) || (val=atoi(ring))==-1) {
 						ast_log(LOG_WARNING,"Invalid ringcadance given '%s' at line %d.\n",ring,v->lineno);
 						ring = strsep(&c,",");
 						continue;
Index: utils/Makefile
===================================================================
RCS file: /usr/cvsroot/asterisk/utils/Makefile,v
retrieving revision 1.4
diff -u -r1.4 Makefile
--- utils/Makefile	15 Dec 2004 20:29:31 -0000	1.4
+++ utils/Makefile	15 Dec 2004 21:59:40 -0000
@@ -12,6 +12,9 @@
 
 TARGET+=$(shell if [ -f /usr/include/popt.h ]; then echo "smsq"; else if [ -f /usr/local/include/popt.h ]; then echo "smsq"; fi ; fi)
 TARGET+=$(shell if [ -f /usr/include/newt.h ]; then echo "astman"; else if [ -f /usr/local/include/newt.h ]; then echo "astman"; fi ; fi)
+ifeq (${OSARCH},SunOS)
+SOL=../strcompat.o
+endif
 
 all: depend $(TARGET)
 
@@ -31,7 +34,7 @@
 	$(CC) $(CFLAGS) -o astman astman.o ../md5.o -lnewt
 
 smsq: smsq.o
-	$(CC) $(CFLAGS) -o smsq smsq.o -lpopt
+	$(CC) $(CFLAGS) -o smsq ${SOL} smsq.o -lpopt
 
 ifneq ($(wildcard .depend),)
 include .depend
Index: utils/smsq.c
===================================================================
RCS file: /usr/cvsroot/asterisk/utils/smsq.c,v
retrieving revision 1.2
diff -u -r1.2 smsq.c
--- utils/smsq.c	12 Dec 2004 23:29:47 -0000	1.2
+++ utils/smsq.c	15 Dec 2004 21:59:40 -0000
@@ -9,6 +9,10 @@
 #include <stdlib.h>
 #include <unistd.h>
 #include <time.h>
+#ifdef SOLARIS
+#include <solaris-compat/compat.h>
+#define     POPT_ARGFLAG_SHOW_DEFAULT 0x00800000
+#endif
 
 // SMS queuing application for use with asterisk app_sms
 // by Adrian Kennard, 2004
@@ -100,7 +104,7 @@
       ql = p - queue;
       subaddress = p[1];
    }
-   snprintf (temp, sizeof(temp), "sms/.smsq-%d", getpid ());
+   snprintf (temp, sizeof(temp), "sms/.smsq-%d", (int)getpid ());
    f = fopen (temp, "w");
    if (!f)
    {
@@ -170,7 +174,7 @@
    DIR *d;
    int ql = strlen (queue);
    struct dirent *fn;
-   snprintf(temp, sizeof(temp), "sms/.smsq-%d", getpid ());
+   snprintf(temp, sizeof(temp), "sms/.smsq-%d", (int)getpid ());
    snprintf(dirname, sizeof(dirname), "sms/%s", dir);
    d = opendir (dirname);
    if (!d)
@@ -647,10 +651,10 @@
         queuename[100],
        *dir = (mo ? rx ? "sms/morx" : "sms/motx" : rx ? "sms/mtrx" : "sms/mttx");
       FILE *f;
-      snprintf (temp, sizeof(temp), "sms/.smsq-%d", getpid ());
+      snprintf (temp, sizeof(temp), "sms/.smsq-%d", (int)getpid ());
       mkdir ("sms", 0777);      // ensure directory exists
       mkdir (dir, 0777);        // ensure directory exists
-      snprintf (queuename, sizeof(queuename), "%s/%s.%ld-%d", dir, *queue ? queue : "0", (long)time (0), getpid ());
+      snprintf (queuename, sizeof(queuename), "%s/%s.%ld-%d", dir, *queue ? queue : "0", (long)time (0), (int)getpid ());
       f = fopen (temp, "w");
       if (!f)
       {
