[asterisk-commits] branch oej/zfonepassthrough r27393 - in /team/oej/zfonepassthrough: ./ apps/ ...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Tue May 16 10:50:27 MST 2006


Author: oej
Date: Tue May 16 12:50:27 2006
New Revision: 27393

URL: http://svn.digium.com/view/asterisk?rev=27393&view=rev
Log:
Reset automerge, remove redundant code now that Mark committed stun code to rtp.c

Modified:
    team/oej/zfonepassthrough/   (props changed)
    team/oej/zfonepassthrough/Makefile
    team/oej/zfonepassthrough/apps/Makefile
    team/oej/zfonepassthrough/apps/app_externalivr.c
    team/oej/zfonepassthrough/apps/app_meetme.c
    team/oej/zfonepassthrough/apps/app_speech_utils.c
    team/oej/zfonepassthrough/apps/app_voicemail.c
    team/oej/zfonepassthrough/build_tools/cflags.xml
    team/oej/zfonepassthrough/build_tools/make_buildopts_h
    team/oej/zfonepassthrough/channels/Makefile
    team/oej/zfonepassthrough/channels/chan_agent.c
    team/oej/zfonepassthrough/channels/chan_sip.c
    team/oej/zfonepassthrough/dnsmgr.c
    team/oej/zfonepassthrough/funcs/func_cdr.c
    team/oej/zfonepassthrough/funcs/func_logic.c
    team/oej/zfonepassthrough/image.c
    team/oej/zfonepassthrough/include/asterisk/linkedlists.h
    team/oej/zfonepassthrough/include/asterisk/lock.h
    team/oej/zfonepassthrough/include/asterisk/rtp.h
    team/oej/zfonepassthrough/loader.c
    team/oej/zfonepassthrough/pbx.c
    team/oej/zfonepassthrough/res/res_features.c
    team/oej/zfonepassthrough/rtp.c

Propchange: team/oej/zfonepassthrough/
------------------------------------------------------------------------------
    automerge = http://edvina.net/training/

Propchange: team/oej/zfonepassthrough/
------------------------------------------------------------------------------
Binary property 'branch-1.2-merged' - no diff available.

Propchange: team/oej/zfonepassthrough/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Tue May 16 12:50:27 2006
@@ -1,1 +1,1 @@
-/trunk:1-26907
+/trunk:1-27300

Modified: team/oej/zfonepassthrough/Makefile
URL: http://svn.digium.com/view/asterisk/team/oej/zfonepassthrough/Makefile?rev=27393&r1=27392&r2=27393&view=diff
==============================================================================
--- team/oej/zfonepassthrough/Makefile (original)
+++ team/oej/zfonepassthrough/Makefile Tue May 16 12:50:27 2006
@@ -24,18 +24,6 @@
 #CROSS_PROC=arm
 #SUB_PROC=xscale # or maverick
 
-# Pentium Pro Optimize
-#PROC=i686
-
-# Pentium & VIA processors optimize
-#PROC=i586
-
-#PROC=k6
-#PROC=ppc
-
-CC=$(CROSS_COMPILE)gcc
-HOST_CC=gcc
-
 ifeq ($(CROSS_COMPILE),)
   OSARCH=$(shell uname -s)
   PROC?=$(shell uname -m)
@@ -70,26 +58,6 @@
 
 # Include debug and macro symbols in the executables (-g) and profiling info (-pg)
 DEBUG=-g3
-
-# Set NOCRYPTO to yes if you do not want to have crypto support or dependencies
-#NOCRYPTO=yes
-
-# If you are running a radio application, define RADIO_RELAX so that the DTMF
-# will be received more reliably
-#OPTIONS += -DRADIO_RELAX
-
-# If you don't have a lot of memory (e.g. embedded Asterisk), define LOW_MEMORY
-# to reduce the size of certain static buffers
-#ifneq ($(CROSS_COMPILE),)
-#OPTIONS += -DLOW_MEMORY
-#endif
-
-# Asterisk SMDI integration
-WITH_SMDI=1
-
-# Where to install asterisk after compiling
-# Default -> leave empty
-INSTALL_PREFIX?=
 
 # Staging directory
 # Files are copied here temporarily during the install process
@@ -191,7 +159,7 @@
 
 #   *CLI> show memory allocations [filename]
 #   *CLI> show memory summary [filename]
-ifneq ($(findstring -DMALLOC_DEBUG,$(ASTCFLAGS)),)
+ifneq ($(findstring MALLOC_DEBUG,$(MENUSELECT_CFLAGS)),)
   TOPDIR_CFLAGS+=-include include/asterisk/astmm.h
   MOD_SUBDIR_CFLAGS+=-include ../include/asterisk/astmm.h
 endif
@@ -241,7 +209,7 @@
   ID=/usr/xpg4/bin/id
 endif
 
-ASTCFLAGS+=-pipe  -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations $(DEBUG) $(INCLUDE)
+ASTCFLAGS+=-pipe -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations $(DEBUG)
 ASTCFLAGS+=$(OPTIMIZE)
 
 ifeq ($(AST_DEVMODE),yes)
@@ -276,8 +244,7 @@
 endif # FreeBSD
 
 ifeq ($(OSARCH),NetBSD)
-  ASTCFLAGS+=-pthread
-  INCLUDE+=-I$(CROSS_COMPILE_TARGET)/usr/pkg/include
+  AST_CFLAGS+=-pthread -I$(CROSS_COMPILE_TARGET)/usr/pkg/include
   MPG123TARG=netbsd
 endif
 
@@ -286,8 +253,7 @@
 endif
 
 ifeq ($(OSARCH),SunOS)
-  ASTCFLAGS+=-Wcast-align -DSOLARIS
-  INCLUDE+=-Iinclude/solaris-compat -I$(CROSS_COMPILE_TARGET)/usr/local/ssl/include
+  ASTCFLAGS+=-Wcast-align -DSOLARIS -Iinclude/solaris-compat -I$(CROSS_COMPILE_TARGET)/usr/local/ssl/include
 endif
 
 LIBEDIT=editline/libedit.a
@@ -314,7 +280,7 @@
 
 ASTCFLAGS+=$(MALLOC_DEBUG)$(BUSYDETECT)$(OPTIONS)
 ifeq ($(findstring dont-optimize,$(MAKECMDGOALS)),)
-ASTCFLAGS+=-fomit-frame-pointer 
+ASTCFLAGS+=-fomit-frame-pointer
 endif
 
 MOD_SUBDIRS=res channels pbx apps codecs formats cdr funcs
@@ -396,7 +362,7 @@
 endif
 
 ifeq ($(MAKETOPLEVEL),$(MAKELEVEL))
-  CFLAGS+=$(TOPDIR_CFLAGS) $(ASTCFLAGS)
+  CFLAGS+=$(TOPDIR_CFLAGS)$(ASTCFLAGS)
 endif
 
 # This is used when generating the doxygen documentation
@@ -518,7 +484,7 @@
 	@rm -f $@.tmp
 
 stdtime/libtime.a:
-	CFLAGS="$(MOD_SUBDIR_CFLAGS) $(ASTCFLAGS)" $(MAKE) -C stdtime libtime.a
+	CFLAGS="$(MOD_SUBDIR_CFLAGS)$(ASTCFLAGS)" $(MAKE) -C stdtime libtime.a
 
 asterisk: include/asterisk/buildopts.h editline/libedit.a db1-ast/libdb1.a stdtime/libtime.a $(OBJS)
 	build_tools/make_build_h > include/asterisk/build.h.tmp
@@ -533,9 +499,9 @@
 	$(CC) $(AUDIO_LIBS) -o muted muted.o
 
 subdirs: 
-	@for x in $(MOD_SUBDIRS); do CFLAGS="$(MOD_SUBDIR_CFLAGS) $(ASTCFLAGS)" $(MAKE) -C $$x || exit 1 ; done
-	@CFLAGS="$(OTHER_SUBDIR_CFLAGS) $(ASTCFLAGS)" $(MAKE) -C utils
-	@CFLAGS="$(OTHER_SUBDIR_CFLAGS) $(ASTCFLAGS)" $(MAKE) -C agi
+	@for x in $(MOD_SUBDIRS); do CFLAGS="$(MOD_SUBDIR_CFLAGS)$(ASTCFLAGS)" $(MAKE) -C $$x || exit 1 ; done
+	@CFLAGS="$(OTHER_SUBDIR_CFLAGS)$(ASTCFLAGS)" $(MAKE) -C utils
+	@CFLAGS="$(OTHER_SUBDIR_CFLAGS)$(ASTCFLAGS)" $(MAKE) -C agi
 
 clean-depend:
 	@for x in $(SUBDIRS); do $(MAKE) -C $$x clean-depend || exit 1 ; done
@@ -990,7 +956,7 @@
 menuselect: build_tools/menuselect makeopts.xml
 	- at build_tools/menuselect ${GLOBAL_MAKEOPTS} ${USER_MAKEOPTS} menuselect.makeopts && echo "menuselect changes saved!" || echo "menuselect changes NOT saved!"
 
-build_tools/menuselect: build_tools/menuselect.c build_tools/menuselect_curses.c build_tools/menuselect.h include/autoconfig.h mxml/libmxml.a $(MENUSELECT_OBJS)
+build_tools/menuselect: build_tools/menuselect.c build_tools/menuselect_curses.c build_tools/menuselect.h config.status mxml/libmxml.a $(MENUSELECT_OBJS)
 	$(MAKE) -C build_tools menuselect
 
 mxml/libmxml.a:

Modified: team/oej/zfonepassthrough/apps/Makefile
URL: http://svn.digium.com/view/asterisk/team/oej/zfonepassthrough/apps/Makefile?rev=27393&r1=27392&r2=27393&view=diff
==============================================================================
--- team/oej/zfonepassthrough/apps/Makefile (original)
+++ team/oej/zfonepassthrough/apps/Makefile Tue May 16 12:50:27 2006
@@ -12,10 +12,6 @@
 #
 
 MODS:=$(filter-out $(MENUSELECT_APPS),$(patsubst %.c,%.so,$(wildcard app_*.c)))
-
-ifneq ($(WITH_SMDI),)
-  CFLAGS+=-DWITH_SMDI
-endif
 
 # If you have UnixODBC you can use ODBC voicemail
 # storage

Modified: team/oej/zfonepassthrough/apps/app_externalivr.c
URL: http://svn.digium.com/view/asterisk/team/oej/zfonepassthrough/apps/app_externalivr.c?rev=27393&r1=27392&r2=27393&view=diff
==============================================================================
--- team/oej/zfonepassthrough/apps/app_externalivr.c (original)
+++ team/oej/zfonepassthrough/apps/app_externalivr.c Tue May 16 12:50:27 2006
@@ -258,14 +258,14 @@
 	FILE *child_commands = NULL;
 	FILE *child_errors = NULL;
 	FILE *child_events = NULL;
-	struct ivr_localuser foo, *u = &foo;
-
-	bzero(u, sizeof(*u));
+	struct ivr_localuser foo = {
+		.playlist = AST_LIST_HEAD_INIT_VALUE,
+		.finishlist = AST_LIST_HEAD_INIT_VALUE,
+	};
+	struct ivr_localuser *u = &foo;
 
 	LOCAL_USER_ADD(lu);
 	
-	AST_LIST_HEAD_INIT(&u->playlist);
-	AST_LIST_HEAD_INIT(&u->finishlist);
 	u->abort_current_sound = 0;
 	u->chan = chan;
 	

Modified: team/oej/zfonepassthrough/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/team/oej/zfonepassthrough/apps/app_meetme.c?rev=27393&r1=27392&r2=27393&view=diff
==============================================================================
--- team/oej/zfonepassthrough/apps/app_meetme.c (original)
+++ team/oej/zfonepassthrough/apps/app_meetme.c Tue May 16 12:50:27 2006
@@ -152,8 +152,6 @@
 	int zapconf;				/* Zaptel Conf # */
 	int users;				/* Number of active users */
 	int markedusers;			/* Number of marked users */
-	struct ast_conf_user *firstuser;	/* Pointer to the first user struct */
-	struct ast_conf_user *lastuser;		/* Pointer to the last user struct */
 	time_t start;				/* Start time (s) */
 	int refcount;				/* reference count of usage */
 	unsigned int recording:2;				/* recording status */
@@ -168,6 +166,7 @@
 	struct ast_frame *transframe[32];
 	struct ast_frame *origframe;
 	struct ast_trans_pvt *transpath[32];
+	AST_LIST_HEAD_NOLOCK(, ast_conf_user) userlist;
 	AST_LIST_ENTRY(ast_conference) list;
 };
 
@@ -180,8 +179,6 @@
 
 struct ast_conf_user {
 	int user_no;				/* User Number */
-	struct ast_conf_user *prevuser;		/* Pointer to the previous user */
-	struct ast_conf_user *nextuser;		/* Pointer to the next user */
 	int userflags;				/* Flags as set in the conference */
 	int adminflags;				/* Flags set by the Admin */
 	struct ast_channel *chan;		/* Connected channel */
@@ -192,6 +189,7 @@
 	time_t jointime;			/* Time the user joined the conference */
 	struct volume talk;
 	struct volume listen;
+	AST_LIST_ENTRY(ast_conf_user) list;
 };
 
 static int audio_buffers;			/* The number of audio buffers to be allocated on pseudo channels
@@ -532,9 +530,6 @@
 			cnf->start = time(NULL);
 			cnf->zapconf = ztc.confno;
 			cnf->isdynamic = dynamic ? 1 : 0;
-			cnf->firstuser = NULL;
-			cnf->lastuser = NULL;
-			cnf->locked = 0;
 			if (option_verbose > 2)
 				ast_verbose(VERBOSE_PREFIX_3 "Created MeetMe conference %d for conference '%s'\n", cnf->zapconf, cnf->confno);
 			AST_LIST_INSERT_HEAD(&confs, cnf, list);
@@ -665,7 +660,7 @@
 			return RESULT_SUCCESS;
 		}
 		/* Show all the users */
-		for (user = cnf->firstuser; user; user = user->nextuser){
+		AST_LIST_TRAVERSE(&cnf->userlist, user, list) {
 			now = time(NULL);
 			hr = (now - user->jointime) / 3600;
 			min = ((now - user->jointime) % 3600) / 60;
@@ -751,7 +746,7 @@
 
 			if (cnf) {
 				/* Search for the user */
-				for (usr = cnf->firstuser; usr; usr = usr->nextuser) {
+				AST_LIST_TRAVERSE(&cnf->userlist, usr, list) {
 					snprintf(usrno, sizeof(usrno), "%d", usr->user_no);
 					if (!strncasecmp(word, usrno, len) && ++which > state)
 						break;
@@ -928,24 +923,13 @@
 		conf->markedusers++;
       
    	ast_mutex_lock(&conf->playlock);
-	if (!conf->firstuser) {
-		/* Fill the first new User struct */
+
+	if (AST_LIST_EMPTY(&conf->userlist))
 		user->user_no = 1;
-		conf->firstuser = user;
-		conf->lastuser = user;
-	} else {
-		/* Fill the new user struct */	
-		user->user_no = conf->lastuser->user_no + 1; 
-		user->prevuser = conf->lastuser;
-		if (conf->lastuser->nextuser) {
-			ast_log(LOG_WARNING, "Error in User Management!\n");
-			ast_mutex_unlock(&conf->playlock);
-			goto outrun;
-		} else {
-			conf->lastuser->nextuser = user;
-			conf->lastuser = user;
-		}
-	}
+	else
+		user->user_no = AST_LIST_LAST(&conf->userlist)->user_no + 1;
+
+	AST_LIST_INSERT_TAIL(&conf->userlist, user, list);
 
 	user->chan = chan;
 	user->userflags = confflags;
@@ -1480,7 +1464,7 @@
 								break;
 							case '3': /* Eject last user */
 								menu_active = 0;
-								usr = conf->lastuser;
+								usr = AST_LIST_LAST(&conf->userlist);
 								if ((usr->chan->name == chan->name)||(usr->userflags & CONFFLAG_ADMIN)) {
 									if(!ast_streamfile(chan, "conf-errormenu", chan->language))
 										ast_waitstream(chan, "");
@@ -1711,39 +1695,12 @@
 		ast_update_realtime("meetme", "confno", conf->confno, "members", members, NULL);
 		if (confflags & CONFFLAG_MARKEDUSER) 
 			conf->markedusers--;
-		if (!conf->users) {
+		if (AST_LIST_EMPTY(&conf->userlist)) {
 			/* close this one when no more users and no references*/
-			if (!conf->refcount){
+			if (!conf->refcount)
 				conf_free(conf);
-			}
 		} else {
-			/* Remove the user struct */ 
-			if (user == conf->firstuser) {
-				if (user->nextuser) {
-					/* There is another entry */
-					user->nextuser->prevuser = NULL;
-				} else {
-					/* We are the only entry */
-					conf->lastuser = NULL;
-				}
-				/* In either case */
-				conf->firstuser = user->nextuser;
-			} else if (user == conf->lastuser){
-				if (user->prevuser)
-					user->prevuser->nextuser = NULL;
-				else
-					ast_log(LOG_ERROR, "Bad bad bad!  We're the last, not the first, but nobody before us??\n");
-				conf->lastuser = user->prevuser;
-			} else {
-				if (user->nextuser)
-					user->nextuser->prevuser = user->prevuser;
-				else
-					ast_log(LOG_ERROR, "Bad! Bad! Bad! user->nextuser is NULL but we're not the end!\n");
-				if (user->prevuser)
-					user->prevuser->nextuser = user->nextuser;
-				else
-					ast_log(LOG_ERROR, "Bad! Bad! Bad! user->prevuser is NULL but we're not the beginning!\n");
-			}
+			AST_LIST_REMOVE(&conf->userlist, user, list);
 		}
 		/* Return the number of seconds the user was in the conf */
 		snprintf(meetmesecs, sizeof(meetmesecs), "%d", (int) (time(NULL) - user->jointime));
@@ -2221,18 +2178,16 @@
 	return res;
 }
 
-static struct ast_conf_user* find_user(struct ast_conference *conf, char *callerident) 
+static struct ast_conf_user *find_user(struct ast_conference *conf, char *callerident) 
 {
 	struct ast_conf_user *user = NULL;
 	int cid;
 	
 	sscanf(callerident, "%i", &cid);
 	if (conf && callerident) {
-		user = conf->firstuser;
-		while (user) {
+		AST_LIST_TRAVERSE(&conf->userlist, user, list) {
 			if (cid == user->user_no)
 				return user;
-			user = user->nextuser;
 		}
 	}
 	return NULL;
@@ -2282,23 +2237,15 @@
 			case 108: /* l: Unlock */ 
 				cnf->locked = 0;
 				break;
-			case 75: /* K: kick all users*/
-				user = cnf->firstuser;
-				while(user) {
+			case 75: /* K: kick all users */
+				AST_LIST_TRAVERSE(&cnf->userlist, user, list)
 					user->adminflags |= ADMINFLAG_KICKME;
-					if (user->nextuser) {
-						user = user->nextuser;
-					} else {
-						break;
-					}
-				}
 				break;
 			case 101: /* e: Eject last user*/
-				user = cnf->lastuser;
-				if (!(user->userflags & CONFFLAG_ADMIN)) {
+				user = AST_LIST_LAST(&cnf->userlist);
+				if (!(user->userflags & CONFFLAG_ADMIN))
 					user->adminflags |= ADMINFLAG_KICKME;
-					break;
-				} else
+				else
 					ast_log(LOG_NOTICE, "Not kicking last user, is an Admin!\n");
 				break;
 			case 77: /* M: Mute */ 
@@ -2314,15 +2261,9 @@
 				}
 				break;
 			case 78: /* N: Mute all users */
-				user = cnf->firstuser;
-				while(user) {
-					if (user && !(user->userflags & CONFFLAG_ADMIN))
+				AST_LIST_TRAVERSE(&cnf->userlist, user, list) {
+					if (!(user->userflags & CONFFLAG_ADMIN))
 						user->adminflags |= ADMINFLAG_MUTED;
-					if (user->nextuser) {
-						user = user->nextuser;
-					} else {
-						break;
-					}
 				}
 				break;					
 			case 109: /* m: Unmute */ 
@@ -2337,25 +2278,15 @@
 					ast_log(LOG_NOTICE, "Specified User not found or he muted himself!\n");
 				}
 				break;
-			case  110: /* n: Unmute all users */
-				user = cnf->firstuser;
-				while(user) {
-					if (user && (user-> adminflags & ADMINFLAG_MUTED)) {
-						user->adminflags ^= ADMINFLAG_MUTED;
-					}
-					if (user->nextuser) {
-						user = user->nextuser;
-					} else {
-						break;
-					}
-				}
+			case 110: /* n: Unmute all users */
+				AST_LIST_TRAVERSE(&cnf->userlist, user, list)
+					user->adminflags &= ~ADMINFLAG_MUTED;
 				break;
 			case 107: /* k: Kick user */ 
-				if (user) {
+				if (user)
 					user->adminflags |= ADMINFLAG_KICKME;
-				} else {
+				else
 					ast_log(LOG_NOTICE, "Specified User not found!");
-				}
 				break;
 			}
 		} else {

Modified: team/oej/zfonepassthrough/apps/app_speech_utils.c
URL: http://svn.digium.com/view/asterisk/team/oej/zfonepassthrough/apps/app_speech_utils.c?rev=27393&r1=27392&r2=27393&view=diff
==============================================================================
--- team/oej/zfonepassthrough/apps/app_speech_utils.c (original)
+++ team/oej/zfonepassthrough/apps/app_speech_utils.c Tue May 16 12:50:27 2006
@@ -511,6 +511,12 @@
                 LOCAL_USER_REMOVE(u);
                 return -1;
         }
+
+	/* If channel is not already answered, then answer it */
+	if (chan->_state != AST_STATE_UP && ast_answer(chan)) {
+		LOCAL_USER_REMOVE(u);
+		return -1;
+	}
 
         /* Record old read format */
         oldreadformat = chan->readformat;

Modified: team/oej/zfonepassthrough/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/oej/zfonepassthrough/apps/app_voicemail.c?rev=27393&r1=27392&r2=27393&view=diff
==============================================================================
--- team/oej/zfonepassthrough/apps/app_voicemail.c (original)
+++ team/oej/zfonepassthrough/apps/app_voicemail.c Tue May 16 12:50:27 2006
@@ -919,7 +919,7 @@
 			odbc_release_obj(obj);
 			goto yuck;
 		}
-		fd = open(full_fn, O_RDWR | O_CREAT | O_TRUNC);
+		fd = open(full_fn, O_RDWR | O_CREAT | O_TRUNC, 0770);
 		if (fd < 0) {
 			ast_log(LOG_WARNING, "Failed to write '%s': %s\n", full_fn, strerror(errno));
 			SQLFreeHandle (SQL_HANDLE_STMT, stmt);
@@ -949,13 +949,13 @@
 			if (!strcasecmp(coltitle, "recording")) {
 				res = SQLGetData(stmt, x + 1, SQL_BINARY, NULL, 0, &colsize);
 				fdlen = colsize;
-				fd = open(full_fn, O_RDWR | O_TRUNC | O_CREAT, 0770);
 				if (fd > -1) {
 					char tmp[1]="";
 					lseek(fd, fdlen - 1, SEEK_SET);
 					if (write(fd, tmp, 1) != 1) {
 						close(fd);
 						fd = -1;
+						continue;
 					}
 					if (fd > -1)
 						fdm = mmap(NULL, fdlen, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);

Modified: team/oej/zfonepassthrough/build_tools/cflags.xml
URL: http://svn.digium.com/view/asterisk/team/oej/zfonepassthrough/build_tools/cflags.xml?rev=27393&r1=27392&r2=27393&view=diff
==============================================================================
--- team/oej/zfonepassthrough/build_tools/cflags.xml (original)
+++ team/oej/zfonepassthrough/build_tools/cflags.xml Tue May 16 12:50:27 2006
@@ -11,10 +11,13 @@
 		</member>
 		<member name="MALLOC_DEBUG" displayname="Keep Track of Memory Allocations">
 		</member>
+		<member name="MTX_PROFILE" displayname="Enable Code Profiling Using TSC Counters">
+		</member>
 		<member name="RADIO_RELAX" displayname="Relax DTMF for Radio Applications">
 		</member>
 		<member name="TRACE_FRAMES" displayname="Trace Frame Allocations">
 		</member>
-		<member name="MTX_PROFILE" displayname="Enable Code Profiling Using TSC Counters">
+		<member name="WITH_SMDI" displayname="Include SMDI Support">
+			<defaultenabled>yes</defaultenabled>
 		</member>
 	</category>

Modified: team/oej/zfonepassthrough/build_tools/make_buildopts_h
URL: http://svn.digium.com/view/asterisk/team/oej/zfonepassthrough/build_tools/make_buildopts_h?rev=27393&r1=27392&r2=27393&view=diff
==============================================================================
--- team/oej/zfonepassthrough/build_tools/make_buildopts_h (original)
+++ team/oej/zfonepassthrough/build_tools/make_buildopts_h Tue May 16 12:50:27 2006
@@ -9,5 +9,5 @@
 END
 TMP=`grep MENUSELECT_CFLAGS menuselect.makeopts | sed s/MENUSELECT_CFLAGS\=//g | sed s/-D//g`
 for x in ${TMP}; do
-     echo "#define ${x}"
+     echo "#define ${x} 1"
 done

Modified: team/oej/zfonepassthrough/channels/Makefile
URL: http://svn.digium.com/view/asterisk/team/oej/zfonepassthrough/channels/Makefile?rev=27393&r1=27392&r2=27393&view=diff
==============================================================================
--- team/oej/zfonepassthrough/channels/Makefile (original)
+++ team/oej/zfonepassthrough/channels/Makefile Tue May 16 12:50:27 2006
@@ -42,10 +42,6 @@
 
 ifeq ($(OSARCH),SunOS)
   SOLINK+=-lrt
-endif
-
-ifeq ($(WITH_SMDI),1)
-  CFLAGS+=-DWITH_SMDI
 endif
 
 ifeq ($(wildcard h323/libchanh323.a),)

Modified: team/oej/zfonepassthrough/channels/chan_agent.c
URL: http://svn.digium.com/view/asterisk/team/oej/zfonepassthrough/channels/chan_agent.c?rev=27393&r1=27392&r2=27393&view=diff
==============================================================================
--- team/oej/zfonepassthrough/channels/chan_agent.c (original)
+++ team/oej/zfonepassthrough/channels/chan_agent.c Tue May 16 12:50:27 2006
@@ -2597,19 +2597,16 @@
 	ast_manager_unregister("AgentLogoff");
 	ast_manager_unregister("AgentCallbackLogin");
 	/* Unregister channel */
-	ast_channel_unregister(&agent_tech);
-	if (!AST_LIST_LOCK(&agents)) {
-		/* Hangup all interfaces if they have an owner */
-		AST_LIST_TRAVERSE(&agents, p, list) {
-			if (p->owner)
-				ast_softhangup(p->owner, AST_SOFTHANGUP_APPUNLOAD);
-		}
-		AST_LIST_UNLOCK(&agents);
-		AST_LIST_HEAD_INIT(&agents);
-	} else {
-		ast_log(LOG_WARNING, "Unable to lock the monitor\n");
-		return -1;
-	}		
+	AST_LIST_LOCK(&agents);
+	/* Hangup all interfaces if they have an owner */
+	while ((p = AST_LIST_REMOVE_HEAD(&agents, list))) {
+		if (p->owner)
+			ast_softhangup(p->owner, AST_SOFTHANGUP_APPUNLOAD);
+		free(p);
+	}
+	AST_LIST_UNLOCK(&agents);
+	AST_LIST_HEAD_DESTROY(&agents);
+
 	return 0;
 }
 

Modified: team/oej/zfonepassthrough/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/oej/zfonepassthrough/channels/chan_sip.c?rev=27393&r1=27392&r2=27393&view=diff
==============================================================================
--- team/oej/zfonepassthrough/channels/chan_sip.c (original)
+++ team/oej/zfonepassthrough/channels/chan_sip.c Tue May 16 12:50:27 2006
@@ -1199,7 +1199,6 @@
 static void make_our_tag(char *tagbuf, size_t len);
 static int add_header(struct sip_request *req, const char *var, const char *value);
 static int add_header_contentLength(struct sip_request *req, int len);
-static int add_blank_header(struct sip_request *req);
 static int add_line(struct sip_request *req, const char *line);
 static int add_text(struct sip_request *req, const char *text);
 static int add_digit(struct sip_request *req, char digit);
@@ -1796,11 +1795,22 @@
 	parse_request(dst);
 }
 
+/* add a blank line if no body */
+static void add_blank(struct sip_request *req)
+{
+	if (!req->lines) {
+		/* Add extra empty return. add_header() reserves 4 bytes so cannot be truncated */
+		snprintf(req->data + req->len, sizeof(req->data) - req->len, "\r\n");
+		req->len += strlen(req->data + req->len);
+	}
+}
+
 /*! \brief Transmit response on SIP request*/
 static int send_response(struct sip_pvt *p, struct sip_request *req, enum xmittype reliable, int seqno)
 {
 	int res;
 
+	add_blank(req);
 	if (sip_debug_test_pvt(p)) {
 		char iabuf[INET_ADDRSTRLEN];
 		if (ast_test_flag(&p->flags[0], SIP_NAT_ROUTE))
@@ -1827,6 +1837,7 @@
 {
 	int res;
 
+	add_blank(req);
 	if (sip_debug_test_pvt(p)) {
 		char iabuf[INET_ADDRSTRLEN];
 		if (ast_test_flag(&p->flags[0], SIP_NAT_ROUTE))
@@ -4148,28 +4159,6 @@
 	return add_header(req, "Content-Length", clen);
 }
 
-/*! \brief Add blank header to SIP message */
-static int add_blank_header(struct sip_request *req)
-{
-	if (req->headers == SIP_MAX_HEADERS)  {
-		ast_log(LOG_WARNING, "Out of SIP header space\n");
-		return -1;
-	}
-	if (req->lines) {
-		ast_log(LOG_WARNING, "Can't add more headers when lines have been added\n");
-		return -1;
-	}
-	if (req->len >= sizeof(req->data) - 4) {
-		ast_log(LOG_WARNING, "Out of space, can't add anymore\n");
-		return -1;
-	}
-	req->header[req->headers] = req->data + req->len;
-	snprintf(req->header[req->headers], sizeof(req->data) - req->len, "\r\n");
-	req->len += strlen(req->header[req->headers]);
-	req->headers++;
-	return 0;	
-}
-
 /*! \brief Add content (not header) to SIP message */
 static int add_line(struct sip_request *req, const char *line)
 {
@@ -4578,7 +4567,6 @@
 		snprintf(buf, sizeof(buf), "%d", p->owner->hangupcause);
 		add_header(&resp, "X-Asterisk-HangupCauseCode", buf);
 	}
-	add_blank_header(&resp);
 	return send_response(p, &resp, reliable, seqno);
 }
 
@@ -4625,7 +4613,6 @@
 	respprep(&resp, p, msg, req);
 	append_date(&resp);
 	add_header_contentLength(&resp, 0);
-	add_blank_header(&resp);
 	return send_response(p, &resp, XMIT_UNRELIABLE, 0);
 }
 
@@ -4636,7 +4623,6 @@
 	respprep(&resp, p, msg, req);
 	add_header(&resp, "Accept", "application/sdp");
 	add_header_contentLength(&resp, 0);
-	add_blank_header(&resp);
 	return send_response(p, &resp, reliable, 0);
 }
 
@@ -4657,7 +4643,6 @@
 	respprep(&resp, p, msg, req);
 	add_header(&resp, header, tmp);
 	add_header_contentLength(&resp, 0);
-	add_blank_header(&resp);
 	return send_response(p, &resp, reliable, seqno);
 }
 
@@ -4985,50 +4970,41 @@
 }
 
 /*! \brief Parse first line of incoming SIP request */
-static int determine_firstline_parts( struct sip_request *req ) 
-{
-	char *e, *cmd;
-	int len;
-  
-	cmd = ast_skip_blanks(req->header[0]);
-	if (!*cmd)
+static int determine_firstline_parts(struct sip_request *req) 
+{
+	char *e = ast_skip_blanks(req->header[0]);	/* there shouldn't be any */
+
+	if (!*e)
 		return -1;
-	req->rlPart1 = cmd;
-	e = ast_skip_nonblanks(cmd);
-	/* Get the command */
+	req->rlPart1 = e;	/* method or protocol */
+	e = ast_skip_nonblanks(e);
 	if (*e)
 		*e++ = '\0';
+	/* Get URI or status code */
 	e = ast_skip_blanks(e);
 	if ( !*e )
 		return -1;
-
-	if ( !strcasecmp(cmd, "SIP/2.0") ) {
-		/* We have a response */
+	ast_trim_blanks(e);
+
+	if (!strcasecmp(req->rlPart1, "SIP/2.0") ) { /* We have a response */
+		if (strlen(e) < 3)	/* status code is 3 digits */
+			return -1;
 		req->rlPart2 = e;
-		len = strlen( req->rlPart2 );
-		if ( len < 2 ) { 
+	} else { /* We have a request */
+		if ( *e == '<' ) { /* XXX the spec says it must not be in <> ! */
+			ast_log(LOG_WARNING, "bogus uri in <> %s\n", e);
+			e++;
+			if (!*e)
+				return -1; 
+		}
+		req->rlPart2 = e;	/* URI */
+		e = ast_skip_nonblanks(e);
+		if (*e)
+			*e++ = '\0';
+		e = ast_skip_blanks(e);
+		if (strcasecmp(e, "SIP/2.0") ) {
+			ast_log(LOG_WARNING, "Bad request protocol %s\n", e);
 			return -1;
-		}
-		ast_trim_blanks(e);
-	} else {
-		/* We have a request */
-		if ( *e == '<' ) { 
-			e++;
-			if ( !*e ) { 
-				return -1; 
-			}  
-		}
-		req->rlPart2 = e;	/* URI */
-		if ( ( e= strrchr( req->rlPart2, 'S' ) ) == NULL ) {
-			return -1;
-		}
-		/* XXX maybe trim_blanks() ? */
-		while( isspace( *(--e) ) )
-			;
-		if ( *e == '>' ) {
-			*e = '\0';
-		} else {
-			*(++e)= '\0';
 		}
 	}
 	return 1;
@@ -5395,7 +5371,6 @@
 		add_sdp(&req, p);
 	} else {
 		add_header_contentLength(&req, 0);
-		add_blank_header(&req);
 	}
 
 	if (!p->initreq.headers)
@@ -5915,7 +5890,6 @@
 	add_header(&req, "Contact", p->our_contact);
 	add_header(&req, "Event", "registration");
 	add_header_contentLength(&req, 0);
-	add_blank_header(&req);
 
 	initialize_initreq(p, &req);
 	if (sip_debug_test_pvt(p))
@@ -6000,7 +5974,6 @@
 	add_header(&req, "Supported", SUPPORTED_EXTENSIONS);
 	if (!ast_strlen_zero(p->our_contact))
 		add_header(&req, "Referred-By", p->our_contact);
-	add_blank_header(&req);
 
 	return send_request(p, &req, 1, p->ocseq);
 	/* We should propably wait for a NOTIFY here until we ack the transfer */
@@ -6038,7 +6011,6 @@
 	struct sip_request resp;
 	reqprep(&resp, p, sipmethod, seqno, newbranch);
 	add_header_contentLength(&resp, 0);
-	add_blank_header(&resp);
 	return send_request(p, &resp, reliable, seqno ? seqno : p->ocseq);
 }
 
@@ -6073,7 +6045,6 @@
 	}
 
 	add_header_contentLength(&resp, 0);
-	add_blank_header(&resp);
 	return send_request(p, &resp, reliable, seqno ? seqno : p->ocseq);	
 }
 
@@ -9315,7 +9286,6 @@
 		for (var = varlist; var; var = var->next)
 			add_header(&req, var->name, var->value);
 
-		add_blank_header(&req);
 		/* Recalculate our side, and recalculate Call ID */
 		if (ast_sip_ouraddrfor(&p->sa.sin_addr, &p->ourip))
 			p->ourip = __ourip;

Modified: team/oej/zfonepassthrough/dnsmgr.c
URL: http://svn.digium.com/view/asterisk/team/oej/zfonepassthrough/dnsmgr.c?rev=27393&r1=27392&r2=27393&view=diff
==============================================================================
--- team/oej/zfonepassthrough/dnsmgr.c (original)
+++ team/oej/zfonepassthrough/dnsmgr.c Tue May 16 12:50:27 2006
@@ -58,7 +58,7 @@
 	char name[1];
 };
 
-static AST_LIST_HEAD(entry_list, ast_dnsmgr_entry) entry_list;
+static AST_LIST_HEAD_STATIC(entry_list, ast_dnsmgr_entry);
 
 AST_MUTEX_DEFINE_STATIC(refresh_lock);
 
@@ -285,7 +285,6 @@
 		ast_log(LOG_ERROR, "Unable to create schedule context.\n");
 		return -1;
 	}
-	AST_LIST_HEAD_INIT(&entry_list);
 	ast_cli_register(&cli_reload);
 	ast_cli_register(&cli_status);
 	return do_reload(1);

Modified: team/oej/zfonepassthrough/funcs/func_cdr.c
URL: http://svn.digium.com/view/asterisk/team/oej/zfonepassthrough/funcs/func_cdr.c?rev=27393&r1=27392&r2=27393&view=diff
==============================================================================
--- team/oej/zfonepassthrough/funcs/func_cdr.c (original)
+++ team/oej/zfonepassthrough/funcs/func_cdr.c Tue May 16 12:50:27 2006
@@ -98,6 +98,8 @@
 		ast_cdr_setaccount(chan, value);
 	else if (!strcasecmp(args.variable, "userfield"))
 		ast_cdr_setuserfield(chan, value);
+	else if (!strcasecmp(args.variable, "amaflags"))
+		ast_cdr_setamaflags(chan, value);
 	else if (chan->cdr)
 		ast_cdr_setvar(chan->cdr, args.variable, value, ast_test_flag(&flags, OPT_RECURSIVE));
 		/* No need to worry about the u flag, as all fields for which setting

Modified: team/oej/zfonepassthrough/funcs/func_logic.c
URL: http://svn.digium.com/view/asterisk/team/oej/zfonepassthrough/funcs/func_logic.c?rev=27393&r1=27392&r2=27393&view=diff
==============================================================================
--- team/oej/zfonepassthrough/funcs/func_logic.c (original)
+++ team/oej/zfonepassthrough/funcs/func_logic.c Tue May 16 12:50:27 2006
@@ -110,7 +110,7 @@
 	if (iffalse)
 		iffalse = ast_strip_quoted(iffalse, "\"", "\"");
 
-	ast_copy_string(buf, ast_true(expr) ? iftrue : iffalse, len);
+	ast_copy_string(buf, pbx_checkcondition(expr) ? iftrue : iffalse, len);
 
 	return 0;
 }

Modified: team/oej/zfonepassthrough/image.c
URL: http://svn.digium.com/view/asterisk/team/oej/zfonepassthrough/image.c?rev=27393&r1=27392&r2=27393&view=diff
==============================================================================
--- team/oej/zfonepassthrough/image.c (original)
+++ team/oej/zfonepassthrough/image.c Tue May 16 12:50:27 2006
@@ -205,7 +205,6 @@
 
 int ast_image_init(void)
 {
-	ast_cli_register(&show_images);
-	return 0;
-}
-
+	return ast_cli_register(&show_images);
+}
+

Modified: team/oej/zfonepassthrough/include/asterisk/linkedlists.h
URL: http://svn.digium.com/view/asterisk/team/oej/zfonepassthrough/include/asterisk/linkedlists.h?rev=27393&r1=27392&r2=27393&view=diff
==============================================================================
--- team/oej/zfonepassthrough/include/asterisk/linkedlists.h (original)
+++ team/oej/zfonepassthrough/include/asterisk/linkedlists.h Tue May 16 12:50:27 2006
@@ -208,6 +208,12 @@
 #define	AST_LIST_FIRST(head)	((head)->first)
 
 /*!
+  \brief Returns the last entry contained in a list.
+  \param head This is a pointer to the list tail structure
+ */
+#define	AST_LIST_LAST(head)	((head)->last)
+
+/*!
   \brief Returns the next entry in the list after the given entry.
   \param elm This is a pointer to the current entry.
   \param field This is the name of the field (declared using AST_LIST_ENTRY())
@@ -352,19 +358,6 @@
   \brief Closes a safe loop traversal block.
  */
 #define AST_LIST_TRAVERSE_SAFE_END  }
-
-/*!
-  \brief Initializes a list head structure.
-  \param head This is a pointer to the list head structure
-
-  This macro initializes a list head structure by setting the head
-  entry to \a NULL (empty list) and recreating the embedded lock.
-*/
-#define AST_LIST_HEAD_INIT(head) {					\
-	(head)->first = NULL;						\
-	(head)->last = NULL;						\
-	ast_mutex_init(&(head)->lock);					\
-}
 
 /*!
   \brief Destroys a list head structure.

Modified: team/oej/zfonepassthrough/include/asterisk/lock.h
URL: http://svn.digium.com/view/asterisk/team/oej/zfonepassthrough/include/asterisk/lock.h?rev=27393&r1=27392&r2=27393&view=diff
==============================================================================
--- team/oej/zfonepassthrough/include/asterisk/lock.h (original)
+++ team/oej/zfonepassthrough/include/asterisk/lock.h Tue May 16 12:50:27 2006
@@ -571,10 +571,10 @@
 #else /* !DEBUG_THREADS */
 
 
-#define AST_MUTEX_INIT_VALUE	PTHREAD_MUTEX_INIT_VALUE
-
 
 typedef pthread_mutex_t ast_mutex_t;
+
+#define AST_MUTEX_INIT_VALUE	((ast_mutex_t)PTHREAD_MUTEX_INIT_VALUE)
 
 static inline int ast_mutex_init(ast_mutex_t *pmutex)
 {

Modified: team/oej/zfonepassthrough/include/asterisk/rtp.h
URL: http://svn.digium.com/view/asterisk/team/oej/zfonepassthrough/include/asterisk/rtp.h?rev=27393&r1=27392&r2=27393&view=diff
==============================================================================
--- team/oej/zfonepassthrough/include/asterisk/rtp.h (original)
+++ team/oej/zfonepassthrough/include/asterisk/rtp.h Tue May 16 12:50:27 2006
@@ -106,6 +106,8 @@
 
 void ast_rtp_reset(struct ast_rtp *rtp);
 
+void ast_rtp_stun_request(struct ast_rtp *rtp, struct sockaddr_in *suggestion, const char *username);
+
 void ast_rtp_set_callback(struct ast_rtp *rtp, ast_rtp_callback callback);
 
 void ast_rtp_set_data(struct ast_rtp *rtp, void *data);

Modified: team/oej/zfonepassthrough/loader.c
URL: http://svn.digium.com/view/asterisk/team/oej/zfonepassthrough/loader.c?rev=27393&r1=27392&r2=27393&view=diff
==============================================================================
--- team/oej/zfonepassthrough/loader.c (original)
+++ team/oej/zfonepassthrough/loader.c Tue May 16 12:50:27 2006
@@ -722,8 +722,6 @@
 	if (m == NULL)	/* MOD_0 modules may still have a mod_data entry */
 		m = find_symbol(cur, "mod_data", 0);
 	if (m != NULL) {	/* new style module */
-		ast_log(LOG_WARNING, "new style %s (0x%x) loaded RTLD_LOCAL\n",
-			resource_name, m->flags);
 		cur->cb = m;	/* use the mod_data from the module itself */
 		errors = check_exported(cur);
 	} else {

Modified: team/oej/zfonepassthrough/pbx.c
URL: http://svn.digium.com/view/asterisk/team/oej/zfonepassthrough/pbx.c?rev=27393&r1=27392&r2=27393&view=diff
==============================================================================
--- team/oej/zfonepassthrough/pbx.c (original)
+++ team/oej/zfonepassthrough/pbx.c Tue May 16 12:50:27 2006
@@ -950,7 +950,7 @@
 		int match = extension_match_core(eroot->exten, exten, action);
 		/* 0 on fail, 1 on match, 2 on earlymatch */
 
-		if (!match || (eroot->matchcid && matchcid(eroot->cidmatch, callerid)))
+		if (!match || (eroot->matchcid && !matchcid(eroot->cidmatch, callerid)))
 			continue;	/* keep trying */
 		if (match == 2 && action == E_MATCHMORE) {
 			/* We match an extension ending in '!'.
@@ -3465,14 +3465,12 @@
 void ast_merge_contexts_and_delete(struct ast_context **extcontexts, const char *registrar)
 {
 	struct ast_context *tmp, *lasttmp = NULL;
-	struct store_hints store;
+	struct store_hints store = AST_LIST_HEAD_INIT_VALUE;
 	struct store_hint *this;
 	struct ast_hint *hint;
 	struct ast_exten *exten;
 	int length;
 	struct ast_state_cb *thiscb, *prevcb;
-
-	AST_LIST_HEAD_INIT(&store);
 
 	/* it is very important that this function hold the hint list lock _and_ the conlock
 	   during its operation; not only do we need to ensure that the list of contexts

Modified: team/oej/zfonepassthrough/res/res_features.c
URL: http://svn.digium.com/view/asterisk/team/oej/zfonepassthrough/res/res_features.c?rev=27393&r1=27392&r2=27393&view=diff
==============================================================================
--- team/oej/zfonepassthrough/res/res_features.c (original)
+++ team/oej/zfonepassthrough/res/res_features.c Tue May 16 12:50:27 2006
@@ -782,7 +782,7 @@
 };
 
 
-static AST_LIST_HEAD(feature_list,ast_call_feature) feature_list;
+static AST_LIST_HEAD_STATIC(feature_list,ast_call_feature);
 
 /*! \brief register new feature into feature_list*/
 void ast_register_feature(struct ast_call_feature *feature)
@@ -2104,7 +2104,6 @@
 	int res;
 	
 	__mod_desc = mod;
-	AST_LIST_HEAD_INIT(&feature_list);
 	memset(parking_ext, 0, sizeof(parking_ext));
 	memset(parking_con, 0, sizeof(parking_con));
 

Modified: team/oej/zfonepassthrough/rtp.c
URL: http://svn.digium.com/view/asterisk/team/oej/zfonepassthrough/rtp.c?rev=27393&r1=27392&r2=27393&view=diff
==============================================================================
--- team/oej/zfonepassthrough/rtp.c (original)
+++ team/oej/zfonepassthrough/rtp.c Tue May 16 12:50:27 2006
@@ -68,6 +68,7 @@
 static int rtpstart = 0;		/*!< First port for RTP sessions (set in rtp.conf) */
 static int rtpend = 0;			/*!< Last port for RTP sessions (set in rtp.conf) */
 static int rtpdebug = 0;		/*!< Are we debugging? */
+static int stundebug = 0;		/*!< Are we debugging stun? */
 static struct sockaddr_in rtpdebugaddr;	/*!< Debug packets to/from this host */
 #ifdef SO_NO_CHECK
 static int nochecksums = 0;
@@ -143,6 +144,261 @@
 	struct sockaddr_in them;	/*!< Socket representation of the remote endpoint. */
 };
 
+
+typedef struct { unsigned int id[4]; } __attribute__((packed)) stun_trans_id;
+
+/* XXX Maybe stun belongs in another file if it ever has use outside of RTP */
+struct stun_header {
+	unsigned short msgtype;
+	unsigned short msglen;
+	stun_trans_id  id;
+	unsigned char ies[0];
+} __attribute__((packed));
+
+struct stun_attr {
+	unsigned short attr;
+	unsigned short len;
+	unsigned char value[0];
+} __attribute__((packed));
+
+struct stun_addr {
+	unsigned char unused;
+	unsigned char family;
+	unsigned short port;
+	unsigned int addr;
+} __attribute__((packed));
+
+#define STUN_IGNORE		(0)
+#define STUN_ACCEPT		(1)
+
+#define STUN_BINDREQ	0x0001
+#define STUN_BINDRESP	0x0101
+#define STUN_BINDERR	0x0111
+#define STUN_SECREQ		0x0002
+#define STUN_SECRESP	0x0102
+#define STUN_SECERR		0x0112
+
+#define STUN_MAPPED_ADDRESS		0x0001
+#define STUN_RESPONSE_ADDRESS	0x0002
+#define STUN_CHANGE_REQUEST		0x0003
+#define STUN_SOURCE_ADDRESS		0x0004
+#define STUN_CHANGED_ADDRESS	0x0005
+#define STUN_USERNAME			0x0006
+#define STUN_PASSWORD			0x0007
+#define STUN_MESSAGE_INTEGRITY	0x0008
+#define STUN_ERROR_CODE			0x0009
+#define STUN_UNKNOWN_ATTRIBUTES	0x000a
+#define STUN_REFLECTED_FROM		0x000b
+
+static const char *stun_msg2str(int msg)
+{
+	switch(msg) {
+	case STUN_BINDREQ:
+		return "Binding Request";
+	case STUN_BINDRESP:
+		return "Binding Response";
+	case STUN_BINDERR:
+		return "Binding Error Response";
+	case STUN_SECREQ:
+		return "Shared Secret Request";
+	case STUN_SECRESP:
+		return "Shared Secret Response";
+	case STUN_SECERR:
+		return "Shared Secret Error Response";
+	}
+	return "Non-RFC3489 Message";
+}
+
+static const char *stun_attr2str(int msg)
+{
+	switch(msg) {
+	case STUN_MAPPED_ADDRESS:
+		return "Mapped Address";
+	case STUN_RESPONSE_ADDRESS:
+		return "Response Address";
+	case STUN_CHANGE_REQUEST:
+		return "Change Request";
+	case STUN_SOURCE_ADDRESS:
+		return "Source Address";
+	case STUN_CHANGED_ADDRESS:
+		return "Changed Address";
+	case STUN_USERNAME:
+		return "Username";
+	case STUN_PASSWORD:
+		return "Password";
+	case STUN_MESSAGE_INTEGRITY:
+		return "Message Integrity";
+	case STUN_ERROR_CODE:
+		return "Error Code";
+	case STUN_UNKNOWN_ATTRIBUTES:
+		return "Unknown Attributes";
+	case STUN_REFLECTED_FROM:
+		return "Reflected From";
+	}
+	return "Non-RFC3489 Attribute";
+}
+
+struct stun_state {
+	unsigned char *username;
+	unsigned char *password;

[... 324 lines stripped ...]


More information about the asterisk-commits mailing list