[asterisk-commits] kpfleming: branch markster/usersconf r43051 - in /team/markster/usersconf: ./...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Sat Sep 16 15:29:09 MST 2006


Author: kpfleming
Date: Sat Sep 16 17:29:08 2006
New Revision: 43051

URL: http://svn.digium.com/view/asterisk?rev=43051&view=rev
Log:
update to trunk

Modified:
    team/markster/usersconf/   (props changed)
    team/markster/usersconf/agi/Makefile
    team/markster/usersconf/apps/app_meetme.c
    team/markster/usersconf/apps/app_page.c
    team/markster/usersconf/apps/app_record.c
    team/markster/usersconf/apps/app_voicemail.c
    team/markster/usersconf/channels/chan_iax2.c
    team/markster/usersconf/channels/chan_sip.c
    team/markster/usersconf/channels/chan_zap.c
    team/markster/usersconf/configs/alsa.conf.sample
    team/markster/usersconf/configs/cdr.conf.sample
    team/markster/usersconf/configs/dundi.conf.sample
    team/markster/usersconf/configs/enum.conf.sample
    team/markster/usersconf/configs/extensions.ael.sample
    team/markster/usersconf/configs/extensions.conf.sample
    team/markster/usersconf/configs/features.conf.sample
    team/markster/usersconf/configs/iax.conf.sample
    team/markster/usersconf/configs/mgcp.conf.sample
    team/markster/usersconf/configs/misdn.conf.sample
    team/markster/usersconf/configs/osp.conf.sample
    team/markster/usersconf/configs/oss.conf.sample
    team/markster/usersconf/configs/phone.conf.sample
    team/markster/usersconf/configs/queues.conf.sample
    team/markster/usersconf/configs/sip.conf.sample
    team/markster/usersconf/configs/skinny.conf.sample
    team/markster/usersconf/configs/smdi.conf.sample
    team/markster/usersconf/configs/voicemail.conf.sample
    team/markster/usersconf/configs/vpb.conf.sample
    team/markster/usersconf/configs/zapata.conf.sample
    team/markster/usersconf/configure
    team/markster/usersconf/configure.ac
    team/markster/usersconf/doc/CODING-GUIDELINES
    team/markster/usersconf/doc/ael.txt
    team/markster/usersconf/doc/app-sms.txt
    team/markster/usersconf/doc/asterisk-conf.txt
    team/markster/usersconf/doc/backtrace.txt
    team/markster/usersconf/doc/billing.txt
    team/markster/usersconf/doc/callfiles.txt
    team/markster/usersconf/doc/chaniax.txt
    team/markster/usersconf/doc/configuration.txt
    team/markster/usersconf/doc/cygwin.txt
    team/markster/usersconf/doc/dundi.txt
    team/markster/usersconf/doc/extensions.txt
    team/markster/usersconf/doc/imapstorage.txt
    team/markster/usersconf/doc/ip-tos.txt
    team/markster/usersconf/doc/jabber.txt
    team/markster/usersconf/doc/manager.txt
    team/markster/usersconf/doc/misdn.txt
    team/markster/usersconf/doc/mp3.txt
    team/markster/usersconf/doc/osp.txt
    team/markster/usersconf/doc/queues-with-callback-members.txt
    team/markster/usersconf/doc/sms.txt
    team/markster/usersconf/doc/speechrec.txt
    team/markster/usersconf/include/asterisk/autoconfig.h.in
    team/markster/usersconf/include/asterisk/compat.h
    team/markster/usersconf/include/asterisk/strings.h
    team/markster/usersconf/include/asterisk/utils.h
    team/markster/usersconf/main/Makefile
    team/markster/usersconf/main/loader.c
    team/markster/usersconf/main/strcompat.c
    team/markster/usersconf/main/utils.c
    team/markster/usersconf/utils/Makefile

Propchange: team/markster/usersconf/
------------------------------------------------------------------------------
Binary property 'branch-1.2-blocked' - no diff available.

Propchange: team/markster/usersconf/
------------------------------------------------------------------------------
Binary property 'branch-1.2-merged' - no diff available.

Propchange: team/markster/usersconf/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Sat Sep 16 17:29:08 2006
@@ -1,1 +1,1 @@
-/trunk:1-42639
+/trunk:1-43050

Modified: team/markster/usersconf/agi/Makefile
URL: http://svn.digium.com/view/asterisk/team/markster/usersconf/agi/Makefile?rev=43051&r1=43050&r2=43051&view=diff
==============================================================================
--- team/markster/usersconf/agi/Makefile (original)
+++ team/markster/usersconf/agi/Makefile Sat Sep 16 17:29:08 2006
@@ -16,16 +16,18 @@
 AGIS=agi-test.agi eagi-test eagi-sphinx-test jukebox.agi
 
 ifeq ($(OSARCH),SunOS)
-  LIBS+=-lsocket -lnsl ../main/strcompat.o
+  LIBS+=-lsocket -lnsl
 endif
 
 include $(ASTTOPDIR)/Makefile.rules
 
 all: $(AGIS)
 
-eagi-test: eagi-test.o
+eagi-test: eagi-test.o strcompat.o
 
 eagi-sphinx-test: eagi-sphinx-test.o
+
+$(eval $(call ast_make_o_c,strcompat.o,../main/strcompat.c))
 
 install: all
 	mkdir -p $(DESTDIR)$(AGI_DIR)

Modified: team/markster/usersconf/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/team/markster/usersconf/apps/app_meetme.c?rev=43051&r1=43050&r2=43051&view=diff
==============================================================================
--- team/markster/usersconf/apps/app_meetme.c (original)
+++ team/markster/usersconf/apps/app_meetme.c Sat Sep 16 17:29:08 2006
@@ -156,6 +156,11 @@
 	CONFFLAG_HOLD = (1 << 27)
 };
 
+enum {
+	OPT_ARG_WAITMARKED = 0,
+	OPT_ARG_ARRAY_SIZE = 1,
+} meetme_option_args;
+
 AST_APP_OPTIONS(meetme_opts, {
 	AST_APP_OPTION('A', CONFFLAG_MARKEDUSER ),
 	AST_APP_OPTION('a', CONFFLAG_ADMIN ),
@@ -178,7 +183,7 @@
 	AST_APP_OPTION('T', CONFFLAG_MONITORTALKER ),
 	AST_APP_OPTION('l', CONFFLAG_MONITOR ),
 	AST_APP_OPTION('t', CONFFLAG_TALKER ),
-	AST_APP_OPTION('w', CONFFLAG_WAITMARKED ),
+	AST_APP_OPTION_ARG('w', CONFFLAG_WAITMARKED, OPT_ARG_WAITMARKED ),
 	AST_APP_OPTION('X', CONFFLAG_EXIT_CONTEXT ),
 	AST_APP_OPTION('x', CONFFLAG_MARKEDEXIT ),
 	AST_APP_OPTION('1', CONFFLAG_NOONLYPERSON ),
@@ -237,7 +242,8 @@
 "      's' -- Present menu (user or admin) when '*' is received ('send' to menu)\n"
 "      't' -- set talk only mode. (Talk only, no listening)\n"
 "      'T' -- set talker detection (sent to manager interface and meetme list)\n"
-"      'w' -- wait until the marked user enters the conference\n"
+"      'w[(<secs>)]'\n"
+"          -- wait until the marked user enters the conference\n"
 "      'x' -- close the conference when last marked user exits\n"
 "      'X' -- allow user to exit the conference by entering a valid single\n"
 "             digit extension ${MEETME_EXIT_CONTEXT} or the current context\n"
@@ -1002,7 +1008,7 @@
 }
 
 
-static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int confflags)
+static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int confflags, char *optargs[])
 {
 	struct ast_conf_user *user = NULL;
 	struct ast_conf_user *usr = NULL;
@@ -1038,7 +1044,8 @@
 	char exitcontext[AST_MAX_CONTEXT] = "";
 	char recordingtmp[AST_MAX_EXTENSION] = "";
 	char members[10] = "";
-	int dtmf;
+	int dtmf, opt_waitmarked_timeout = 0;
+	time_t timeout = 0;
 	ZT_BUFFERINFO bi;
 	char __buf[CONF_SIZE + AST_FRIENDLY_OFFSET];
 	char *buf = __buf + AST_FRIENDLY_OFFSET;
@@ -1051,6 +1058,14 @@
 		}
 		AST_LIST_UNLOCK(&confs);
 		return ret;
+	}
+
+	/* Possible timeout waiting for marked user */
+	if ((confflags & CONFFLAG_WAITMARKED) &&
+		!ast_strlen_zero(optargs[OPT_ARG_WAITMARKED]) &&
+		(sscanf(optargs[OPT_ARG_WAITMARKED], "%d", &opt_waitmarked_timeout) == 1) &&
+		(opt_waitmarked_timeout > 0)) {
+		timeout = time(NULL) + opt_waitmarked_timeout;
 	}
 
 	if (confflags & CONFFLAG_RECORDCONF) {
@@ -1350,7 +1365,10 @@
 
 			outfd = -1;
 			ms = -1;
-			
+
+			if (timeout && time(NULL) >= timeout)
+				break;
+
 			/* if we have just exited from the menu, and the user had a channel-driver
 			   volume adjustment, restore it
 			*/
@@ -1414,6 +1432,8 @@
 						}
 					}
 				} else if(currentmarked >= 1 && lastmarked == 0) {
+					/* Marked user entered, so cancel timeout */
+					timeout = 0;
 					if (confflags & CONFFLAG_MONITOR)
 						ztc.confmode = ZT_CONF_CONFMON | ZT_CONF_LISTENER;
 					else if (confflags & CONFFLAG_TALKER)
@@ -2160,6 +2180,7 @@
 		AST_APP_ARG(options);
 		AST_APP_ARG(pin);
 	);
+	char *optargs[OPT_ARG_ARRAY_SIZE] = { NULL, };
 
 	u = ast_module_user_add(chan);
 
@@ -2188,7 +2209,7 @@
 		ast_copy_string(the_pin, args.pin, sizeof(the_pin));
 
 	if (args.options) {
-		ast_app_parse_options(meetme_opts, &confflags, NULL, args.options);
+		ast_app_parse_options(meetme_opts, &confflags, optargs, args.options);
 		dynamic = ast_test_flag(&confflags, CONFFLAG_DYNAMIC | CONFFLAG_DYNAMICPIN);
 		if (ast_test_flag(&confflags, CONFFLAG_DYNAMICPIN) && !args.pin)
 			strcpy(the_pin, "q");
@@ -2344,7 +2365,7 @@
 								if (!ast_strlen_zero(cnf->pinadmin) && !strcasecmp(pin, cnf->pinadmin)) 
 									ast_set_flag(&confflags, CONFFLAG_ADMIN);
 								/* Run the conference */
-								res = conf_run(chan, cnf, confflags.flags);
+								res = conf_run(chan, cnf, confflags.flags, optargs);
 								break;
 							} else {
 								/* Pin invalid */
@@ -2393,7 +2414,7 @@
 					allowretry = 0;
 
 					/* Run the conference */
-					res = conf_run(chan, cnf, confflags.flags);
+					res = conf_run(chan, cnf, confflags.flags, optargs);
 				}
 			}
 		}
@@ -2503,6 +2524,7 @@
 	char *info;
 	struct ast_flags confflags = {0};
 	int dynamic = 1;
+	char *options[OPT_ARG_ARRAY_SIZE] = { NULL, };
 	AST_DECLARE_APP_ARGS(args,
 		AST_APP_ARG(confno);
 		AST_APP_ARG(options);
@@ -2549,7 +2571,7 @@
 				ast_answer(chan);
 
 			/* Run the conference */
-			res = conf_run(chan, cnf, confflags.flags);
+			res = conf_run(chan, cnf, confflags.flags, options);
 		} else
 			ast_log(LOG_WARNING, "SLA%c: Found SLA '%s' but unable to build conference!\n", trunk ? 'T' : 'S', args.confno);
 		ASTOBJ_UNREF(sla, sla_destroy);

Modified: team/markster/usersconf/apps/app_page.c
URL: http://svn.digium.com/view/asterisk/team/markster/usersconf/apps/app_page.c?rev=43051&r1=43050&r2=43051&view=diff
==============================================================================
--- team/markster/usersconf/apps/app_page.c (original)
+++ team/markster/usersconf/apps/app_page.c Sat Sep 16 17:29:08 2006
@@ -176,7 +176,7 @@
 	if (options)
 		ast_app_parse_options(page_opts, &flags, NULL, options);
 
-	snprintf(meetmeopts, sizeof(meetmeopts), "%ud|%s%sqxdw", confid, (ast_test_flag(&flags, PAGE_DUPLEX) ? "" : "m"),
+	snprintf(meetmeopts, sizeof(meetmeopts), "%ud|%s%sqxdw(5)", confid, (ast_test_flag(&flags, PAGE_DUPLEX) ? "" : "m"),
 		(ast_test_flag(&flags, PAGE_RECORD) ? "r" : "") );
 
 	while ((tech = strsep(&tmp, "&"))) {

Modified: team/markster/usersconf/apps/app_record.c
URL: http://svn.digium.com/view/asterisk/team/markster/usersconf/apps/app_record.c?rev=43051&r1=43050&r2=43051&view=diff
==============================================================================
--- team/markster/usersconf/apps/app_record.c (original)
+++ team/markster/usersconf/apps/app_record.c Sat Sep 16 17:29:08 2006
@@ -329,11 +329,6 @@
 			}
 		} else if ((f->frametype == AST_FRAME_DTMF) &&
 		    (f->subclass == terminator)) {
-			 res = ast_writestream(s,f);
-			 
-		         if (res) {
-			 	ast_log(LOG_WARNING,"Problem writing final record frame\n");
-			 }		 
 			ast_frfree(f);
 			break;
 		}

Modified: team/markster/usersconf/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/markster/usersconf/apps/app_voicemail.c?rev=43051&r1=43050&r2=43051&view=diff
==============================================================================
--- team/markster/usersconf/apps/app_voicemail.c (original)
+++ team/markster/usersconf/apps/app_voicemail.c Sat Sep 16 17:29:08 2006
@@ -7459,11 +7459,10 @@
 	int res = 0;
 #ifdef IMAP_STORAGE
 	char origtimeS[256],cidS[256],contextS[256];
-	char *header_content,*filename,*temp;
-#else
+	char *header_content,*temp;
+#endif
 	char filename[256];
 	struct ast_config *msg_cfg;
-#endif
 	char *origtime, *cid, *context, *name, *num;
 	int retries = 0;
 
@@ -7511,8 +7510,8 @@
 		origtimeS[0] = '\0';
 	
 	origtime = &origtimeS[0];
-
-	filename = "IMAP_STORAGE";
+	
+	strcpy(filename, "IMAP_STORAGE");
 #else
 	make_file(vms->fn, sizeof(vms->fn), vms->curdir, msg);
 

Modified: team/markster/usersconf/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/team/markster/usersconf/channels/chan_iax2.c?rev=43051&r1=43050&r2=43051&view=diff
==============================================================================
--- team/markster/usersconf/channels/chan_iax2.c (original)
+++ team/markster/usersconf/channels/chan_iax2.c Sat Sep 16 17:29:08 2006
@@ -800,6 +800,7 @@
 static struct ast_frame *iax2_read(struct ast_channel *c);
 static struct iax2_peer *build_peer(const char *name, struct ast_variable *v, struct ast_variable *alt, int temponly);
 static struct iax2_user *build_user(const char *name, struct ast_variable *v, struct ast_variable *alt, int temponly);
+static void realtime_update_peer(const char *peername, struct sockaddr_in *sin, time_t regtime);
 static void destroy_user(struct iax2_user *user);
 static void prune_peers(void);
 
@@ -2496,6 +2497,7 @@
 		time(&nowtime);
 		if ((nowtime - regseconds) > IAX_DEFAULT_REG_EXPIRE) {
 			memset(&peer->addr, 0, sizeof(peer->addr));
+			realtime_update_peer(peer->name, &peer->addr, 0);
 			if (option_debug)
 				ast_log(LOG_DEBUG, "realtime_peer: Bah, '%s' is expired (%d/%d/%d)!\n",
 						peername, (int)(nowtime - regseconds), (int)regseconds, (int)nowtime);

Modified: team/markster/usersconf/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/markster/usersconf/channels/chan_sip.c?rev=43051&r1=43050&r2=43051&view=diff
==============================================================================
--- team/markster/usersconf/channels/chan_sip.c (original)
+++ team/markster/usersconf/channels/chan_sip.c Sat Sep 16 17:29:08 2006
@@ -201,6 +201,7 @@
 #define SIP_TRANS_TIMEOUT            32000            /*!< SIP request timeout (rfc 3261) 64*T1 
                                                       \todo Use known T1 for timeout (peerpoke)
                                                       */
+#define DEFAULT_TRANS_TIMEOUT        -1               /* Use default SIP transaction timeout */
 #define MAX_AUTHTRIES                3                /*!< Try authentication three times, then fail */
 
 #define SIP_MAX_HEADERS              64               /*!< Max amount of SIP headers to read */
@@ -328,7 +329,7 @@
 	AUTH_UNKNOWN_DOMAIN = -5,
 };
 
-/* States for outbound registrations (with register= lines in sip.conf */
+/*! \brief States for outbound registrations (with register= lines in sip.conf */
 enum sipregistrystate {
 	REG_STATE_UNREGISTERED = 0,	/*!< We are not registred */
 	REG_STATE_REGSENT,	/*!< Registration request sent */
@@ -533,14 +534,14 @@
 static int noncodeccapability = AST_RTP_DTMF;
 
 /* Object counters */
-static int suserobjs = 0;		/*!< Static users */
-static int ruserobjs = 0;		/*!< Realtime users */
-static int speerobjs = 0;		/*!< Statis peers */
-static int rpeerobjs = 0;		/*!< Realtime peers */
-static int apeerobjs = 0;		/*!< Autocreated peer objects */
-static int regobjs = 0;			/*!< Registry objects */
-
-static struct ast_flags global_flags[2] = {{0}};	/*!< global SIP_ flags */
+static int suserobjs = 0;                /*!< Static users */
+static int ruserobjs = 0;                /*!< Realtime users */
+static int speerobjs = 0;                /*!< Statis peers */
+static int rpeerobjs = 0;                /*!< Realtime peers */
+static int apeerobjs = 0;                /*!< Autocreated peer objects */
+static int regobjs = 0;                  /*!< Registry objects */
+
+static struct ast_flags global_flags[2] = {{0}};        /*!< global SIP_ flags */
 
 /*! \brief Protect the SIP dialog list (of sip_pvt's) */
 AST_MUTEX_DEFINE_STATIC(iflock);
@@ -557,11 +558,11 @@
    which are not currently in use.  */
 static pthread_t monitor_thread = AST_PTHREADT_NULL;
 
-static int sip_reloading = FALSE;			/*!< Flag for avoiding multiple reloads at the same time */
-static enum channelreloadreason sip_reloadreason;	/*!< Reason for last reload/load of configuration */
-
-static struct sched_context *sched;	/*!< The scheduling context */
-static struct io_context *io;		/*!< The IO context */
+static int sip_reloading = FALSE;                       /*!< Flag for avoiding multiple reloads at the same time */
+static enum channelreloadreason sip_reloadreason;       /*!< Reason for last reload/load of configuration */
+
+static struct sched_context *sched;     /*!< The scheduling context */
+static struct io_context *io;           /*!< The IO context */
 
 #define DEC_CALL_LIMIT	0
 #define INC_CALL_LIMIT	1
@@ -570,18 +571,18 @@
 
 /*! \brief sip_request: The data grabbed from the UDP socket */
 struct sip_request {
-	char *rlPart1; 		/*!< SIP Method Name or "SIP/2.0" protocol version */
-	char *rlPart2; 		/*!< The Request URI or Response Status */
-	int len;		/*!< Length */
-	int headers;		/*!< # of SIP Headers */
-	int method;		/*!< Method of this request */
-	int lines;		/*!< Body Content */
-	unsigned int flags;	/*!< SIP_PKT Flags for this packet */
+	char *rlPart1; 	        /*!< SIP Method Name or "SIP/2.0" protocol version */
+	char *rlPart2; 	        /*!< The Request URI or Response Status */
+	int len;                /*!< Length */
+	int headers;            /*!< # of SIP Headers */
+	int method;             /*!< Method of this request */
+	int lines;              /*!< Body Content */
+	unsigned int flags;     /*!< SIP_PKT Flags for this packet */
 	char *header[SIP_MAX_HEADERS];
 	char *line[SIP_MAX_LINES];
 	char data[SIP_MAX_PACKET];
 	unsigned int sdp_start; /*!< the line number where the SDP begins */
-	unsigned int sdp_end;	/*!< the line number where the SDP ends */
+	unsigned int sdp_end;   /*!< the line number where the SDP ends */
 };
 
 /*
@@ -638,6 +639,10 @@
 	SIP_DOMAIN_CONFIG,		/*!< This domain is from configuration */
 };
 
+/*! \brief Domain data structure. 
+	\note In the future, we will connect this to a configuration tree specific
+	for this domain
+*/
 struct domain {
 	char domain[MAXHOSTNAMELEN];		/*!< SIP domain we are responsible for */
 	char context[AST_MAX_EXTENSION];	/*!< Incoming context for this domain */
@@ -659,10 +664,10 @@
 /*! \brief sip_auth: Creadentials for authentication to other SIP services */
 struct sip_auth {
 	char realm[AST_MAX_EXTENSION];  /*!< Realm in which these credentials are valid */
-	char username[256];		/*!< Username */
-	char secret[256];		/*!< Secret */
-	char md5secret[256];		/*!< MD5Secret */
-	struct sip_auth *next;		/*!< Next auth structure in list */
+	char username[256];             /*!< Username */
+	char secret[256];               /*!< Secret */
+	char md5secret[256];            /*!< MD5Secret */
+	struct sip_auth *next;          /*!< Next auth structure in list */
 };
 
 /*--- Various flags for the flags field in the pvt structure */
@@ -717,7 +722,7 @@
 	 SIP_PROG_INBAND | SIP_USECLIENTCODE | SIP_NAT | SIP_G726_NONSTANDARD | \
 	 SIP_USEREQPHONE | SIP_INSECURE_PORT | SIP_INSECURE_INVITE)
 
-/* a new page of flags */
+/*--- a new page of flags (for flags[1] */
 /* realtime flags */
 #define SIP_PAGE2_RTCACHEFRIENDS	(1 << 0)
 #define SIP_PAGE2_RTUPDATE		(1 << 1)
@@ -787,12 +792,12 @@
 
 /*! \brief T38 States for a call */
 enum t38state {
-	T38_DISABLED = 0,		/*! Not enabled */
-	T38_LOCAL_DIRECT,		/*! Offered from local */
-	T38_LOCAL_REINVITE,		/*! Offered from local - REINVITE */
-	T38_PEER_DIRECT,		/*! Offered from peer */
-	T38_PEER_REINVITE,		/*! Offered from peer - REINVITE */
-	T38_ENABLED			/*! Negotiated (enabled) */
+        T38_DISABLED = 0,                /*!< Not enabled */
+        T38_LOCAL_DIRECT,                /*!< Offered from local */
+        T38_LOCAL_REINVITE,              /*!< Offered from local - REINVITE */
+        T38_PEER_DIRECT,                 /*!< Offered from peer */
+        T38_PEER_REINVITE,               /*!< Offered from peer - REINVITE */
+        T38_ENABLED                      /*!< Negotiated (enabled) */
 };
 
 /*! \brief T.38 channel settings (at some point we need to make this alloc'ed */
@@ -806,15 +811,15 @@
 
 /*! \brief Parameters to know status of transfer */
 enum referstatus {
-	REFER_IDLE,		/*!< No REFER is in progress */
-	REFER_SENT,		/*!< Sent REFER to transferee */
-	REFER_RECEIVED,		/*!< Received REFER from transferer */
-	REFER_CONFIRMED,	/*!< Refer confirmed with a 100 TRYING */
-	REFER_ACCEPTED,		/*!< Accepted by transferee */
-	REFER_RINGING,		/*!< Target Ringing */
-	REFER_200OK,		/*!< Answered by transfer target */
-	REFER_FAILED,		/*!< REFER declined - go on */
-	REFER_NOAUTH		/*!< We had no auth for REFER */
+        REFER_IDLE,                    /*!< No REFER is in progress */
+        REFER_SENT,                    /*!< Sent REFER to transferee */
+        REFER_RECEIVED,                /*!< Received REFER from transferer */
+        REFER_CONFIRMED,               /*!< Refer confirmed with a 100 TRYING */
+        REFER_ACCEPTED,                /*!< Accepted by transferee */
+        REFER_RINGING,                 /*!< Target Ringing */
+        REFER_200OK,                   /*!< Answered by transfer target */
+        REFER_FAILED,                  /*!< REFER declined - go on */
+        REFER_NOAUTH                   /*!< We had no auth for REFER */
 };
 
 static const struct c_referstatusstring {
@@ -1938,7 +1943,7 @@
 	p->autokillid = -1;
 
 	if (option_debug)
-		ast_log(LOG_DEBUG, "Auto destroying call '%s'\n", p->callid);
+		ast_log(LOG_DEBUG, "Auto destroying SIP dialog '%s'\n", p->callid);
 	append_history(p, "AutoDestroy", "%s", p->callid);
 	if (p->owner) {
 		ast_log(LOG_WARNING, "Autodestruct on dialog '%s' with owner in place (Method: %s)\n", p->callid, sip_methods[p->method].text);
@@ -1951,9 +1956,14 @@
 	return 0;
 }
 
-/*! \brief Schedule destruction of SIP call */
+/*! \brief Schedule destruction of SIP dialog */
 static void sip_scheddestroy(struct sip_pvt *p, int ms)
 {
+	if (ms < 0) {
+		if (p->timer_t1 == 0)
+			p->timer_t1 = 500;	/* Set timer T1 if not set (RFC 3261) */
+		ms = p->timer_t1 * 64;
+	}
 	if (sip_debug_test_pvt(p))
 		ast_verbose("Scheduling destruction of SIP dialog '%s' in %d ms (Method: %s)\n", p->callid, ms, sip_methods[p->method].text);
 	if (recordhistory)
@@ -2065,7 +2075,7 @@
 	parse_request(dst);
 }
 
-/* add a blank line if no body */
+/*! \brief add a blank line if no body */
 static void add_blank(struct sip_request *req)
 {
 	if (!req->lines) {
@@ -2393,9 +2403,9 @@
 	else
 		p = ASTOBJ_CONTAINER_FIND_FULL(&peerl, sin, name, sip_addr_hashfunc, 1, sip_addrcmp);
 
-	if (!p && realtime) {
+	if (!p && realtime)
 		p = realtime_peer(peer, sin);
-	}
+
 	return p;
 }
 
@@ -2474,107 +2484,106 @@
 /*! \brief Create address structure from peer reference.
  *  return -1 on error, 0 on success.
  */
-static int create_addr_from_peer(struct sip_pvt *r, struct sip_peer *peer)
+static int create_addr_from_peer(struct sip_pvt *dialog, struct sip_peer *peer)
 {
 	int natflags;
 
 	if ((peer->addr.sin_addr.s_addr || peer->defaddr.sin_addr.s_addr) &&
 	    (!peer->maxms || ((peer->lastms >= 0)  && (peer->lastms <= peer->maxms)))) {
-		r->sa = (peer->addr.sin_addr.s_addr) ? peer->addr : peer->defaddr;
-		r->recv = r->sa;
-	} else {
+		dialog->sa = (peer->addr.sin_addr.s_addr) ? peer->addr : peer->defaddr;
+		dialog->recv = dialog->sa;
+	} else 
 		return -1;
-	}
-
-	ast_copy_flags(&r->flags[0], &peer->flags[0], SIP_FLAGS_TO_COPY);
-	ast_copy_flags(&r->flags[1], &peer->flags[1], SIP_PAGE2_FLAGS_TO_COPY);
-	r->capability = peer->capability;
-	if (!ast_test_flag(&r->flags[1], SIP_PAGE2_VIDEOSUPPORT) && r->vrtp) {
-		ast_rtp_destroy(r->vrtp);
-		r->vrtp = NULL;
-	}
-	r->prefs = peer->prefs;
-	if (ast_test_flag(&r->flags[1], SIP_PAGE2_T38SUPPORT)) {
-		r->t38.capability = global_t38_capability;
-		if (r->udptl) {
-			if (ast_udptl_get_error_correction_scheme(r->udptl) == UDPTL_ERROR_CORRECTION_FEC )
-				r->t38.capability |= T38FAX_UDP_EC_FEC;
-			else if (ast_udptl_get_error_correction_scheme(r->udptl) == UDPTL_ERROR_CORRECTION_REDUNDANCY )
-				r->t38.capability |= T38FAX_UDP_EC_REDUNDANCY;
-			else if (ast_udptl_get_error_correction_scheme(r->udptl) == UDPTL_ERROR_CORRECTION_NONE )
-				r->t38.capability |= T38FAX_UDP_EC_NONE;
-			r->t38.capability |= T38FAX_RATE_MANAGEMENT_TRANSFERED_TCF;
+
+	ast_copy_flags(&dialog->flags[0], &peer->flags[0], SIP_FLAGS_TO_COPY);
+	ast_copy_flags(&dialog->flags[1], &peer->flags[1], SIP_PAGE2_FLAGS_TO_COPY);
+	dialog->capability = peer->capability;
+	if (!ast_test_flag(&dialog->flags[1], SIP_PAGE2_VIDEOSUPPORT) && dialog->vrtp) {
+		ast_rtp_destroy(dialog->vrtp);
+		dialog->vrtp = NULL;
+	}
+	dialog->prefs = peer->prefs;
+	if (ast_test_flag(&dialog->flags[1], SIP_PAGE2_T38SUPPORT)) {
+		dialog->t38.capability = global_t38_capability;
+		if (dialog->udptl) {
+			if (ast_udptl_get_error_correction_scheme(dialog->udptl) == UDPTL_ERROR_CORRECTION_FEC )
+				dialog->t38.capability |= T38FAX_UDP_EC_FEC;
+			else if (ast_udptl_get_error_correction_scheme(dialog->udptl) == UDPTL_ERROR_CORRECTION_REDUNDANCY )
+				dialog->t38.capability |= T38FAX_UDP_EC_REDUNDANCY;
+			else if (ast_udptl_get_error_correction_scheme(dialog->udptl) == UDPTL_ERROR_CORRECTION_NONE )
+				dialog->t38.capability |= T38FAX_UDP_EC_NONE;
+			dialog->t38.capability |= T38FAX_RATE_MANAGEMENT_TRANSFERED_TCF;
 			if (option_debug > 1)
-				ast_log(LOG_DEBUG,"Our T38 capability (%d)\n", r->t38.capability);
-		}
-		r->t38.jointcapability = r->t38.capability;
-	} else if (r->udptl) {
-		ast_udptl_destroy(r->udptl);
-		r->udptl = NULL;
-	}
-	natflags = ast_test_flag(&r->flags[0], SIP_NAT) & SIP_NAT_ROUTE;
-	if (r->rtp) {
+				ast_log(LOG_DEBUG,"Our T38 capability (%d)\n", dialog->t38.capability);
+		}
+		dialog->t38.jointcapability = dialog->t38.capability;
+	} else if (dialog->udptl) {
+		ast_udptl_destroy(dialog->udptl);
+		dialog->udptl = NULL;
+	}
+	natflags = ast_test_flag(&dialog->flags[0], SIP_NAT) & SIP_NAT_ROUTE;
+	if (dialog->rtp) {
 		if (option_debug)
 			ast_log(LOG_DEBUG, "Setting NAT on RTP to %s\n", natflags ? "On" : "Off");
-		ast_rtp_setnat(r->rtp, natflags);
-		ast_rtp_setdtmf(r->rtp, ast_test_flag(&r->flags[0], SIP_DTMF) != SIP_DTMF_INFO);
-		ast_rtp_setdtmfcompensate(r->rtp, ast_test_flag(&r->flags[1], SIP_PAGE2_RFC2833_COMPENSATE));
-	}
-	if (r->vrtp) {
+		ast_rtp_setnat(dialog->rtp, natflags);
+		ast_rtp_setdtmf(dialog->rtp, ast_test_flag(&dialog->flags[0], SIP_DTMF) != SIP_DTMF_INFO);
+		ast_rtp_setdtmfcompensate(dialog->rtp, ast_test_flag(&dialog->flags[1], SIP_PAGE2_RFC2833_COMPENSATE));
+	}
+	if (dialog->vrtp) {
 		if (option_debug)
 			ast_log(LOG_DEBUG, "Setting NAT on VRTP to %s\n", natflags ? "On" : "Off");
-		ast_rtp_setnat(r->vrtp, natflags);
-		ast_rtp_setdtmf(r->vrtp, 0);
-		ast_rtp_setdtmfcompensate(r->vrtp, 0);
-	}
-	if (r->udptl) {
+		ast_rtp_setnat(dialog->vrtp, natflags);
+		ast_rtp_setdtmf(dialog->vrtp, 0);
+		ast_rtp_setdtmfcompensate(dialog->vrtp, 0);
+	}
+	if (dialog->udptl) {
 		if (option_debug)
 			ast_log(LOG_DEBUG, "Setting NAT on UDPTL to %s\n", natflags ? "On" : "Off");
-		ast_udptl_setnat(r->udptl, natflags);
-	}
-	ast_string_field_set(r, peername, peer->username);
-	ast_string_field_set(r, authname, peer->username);
-	ast_string_field_set(r, username, peer->username);
-	ast_string_field_set(r, peersecret, peer->secret);
-	ast_string_field_set(r, peermd5secret, peer->md5secret);
-	ast_string_field_set(r, tohost, peer->tohost);
-	ast_string_field_set(r, fullcontact, peer->fullcontact);
-	if (!r->initreq.headers && !ast_strlen_zero(peer->fromdomain)) {
+		ast_udptl_setnat(dialog->udptl, natflags);
+	}
+	ast_string_field_set(dialog, peername, peer->username);
+	ast_string_field_set(dialog, authname, peer->username);
+	ast_string_field_set(dialog, username, peer->username);
+	ast_string_field_set(dialog, peersecret, peer->secret);
+	ast_string_field_set(dialog, peermd5secret, peer->md5secret);
+	ast_string_field_set(dialog, tohost, peer->tohost);
+	ast_string_field_set(dialog, fullcontact, peer->fullcontact);
+	if (!dialog->initreq.headers && !ast_strlen_zero(peer->fromdomain)) {
 		char *tmpcall;
 		char *c;
-		tmpcall = ast_strdupa(r->callid);
+		tmpcall = ast_strdupa(dialog->callid);
 		c = strchr(tmpcall, '@');
 		if (c) {
 			*c = '\0';
-			ast_string_field_build(r, callid, "%s@%s", tmpcall, peer->fromdomain);
-		}
-	}
-	if (ast_strlen_zero(r->tohost))
-		ast_string_field_set(r, tohost, ast_inet_ntoa(r->sa.sin_addr));
+			ast_string_field_build(dialog, callid, "%s@%s", tmpcall, peer->fromdomain);
+		}
+	}
+	if (ast_strlen_zero(dialog->tohost))
+		ast_string_field_set(dialog, tohost, ast_inet_ntoa(dialog->sa.sin_addr));
 	if (!ast_strlen_zero(peer->fromdomain))
-		ast_string_field_set(r, fromdomain, peer->fromdomain);
+		ast_string_field_set(dialog, fromdomain, peer->fromdomain);
 	if (!ast_strlen_zero(peer->fromuser))
-		ast_string_field_set(r, fromuser, peer->fromuser);
-	r->maxtime = peer->maxms;
-	r->callgroup = peer->callgroup;
-	r->pickupgroup = peer->pickupgroup;
-	r->allowtransfer = peer->allowtransfer;
+		ast_string_field_set(dialog, fromuser, peer->fromuser);
+	dialog->maxtime = peer->maxms;
+	dialog->callgroup = peer->callgroup;
+	dialog->pickupgroup = peer->pickupgroup;
+	dialog->allowtransfer = peer->allowtransfer;
 	/* Set timer T1 to RTT for this peer (if known by qualify=) */
 	/* Minimum is settable or default to 100 ms */
 	if (peer->maxms && peer->lastms)
-		r->timer_t1 = peer->lastms < global_t1min ? global_t1min : peer->lastms;
-	if ((ast_test_flag(&r->flags[0], SIP_DTMF) == SIP_DTMF_RFC2833) ||
-	    (ast_test_flag(&r->flags[0], SIP_DTMF) == SIP_DTMF_AUTO))
-		r->noncodeccapability |= AST_RTP_DTMF;
+		dialog->timer_t1 = peer->lastms < global_t1min ? global_t1min : peer->lastms;
+	if ((ast_test_flag(&dialog->flags[0], SIP_DTMF) == SIP_DTMF_RFC2833) ||
+	    (ast_test_flag(&dialog->flags[0], SIP_DTMF) == SIP_DTMF_AUTO))
+		dialog->noncodeccapability |= AST_RTP_DTMF;
 	else
-		r->noncodeccapability &= ~AST_RTP_DTMF;
-	ast_string_field_set(r, context, peer->context);
-	r->rtptimeout = peer->rtptimeout;
-	r->rtpholdtimeout = peer->rtpholdtimeout;
-	r->rtpkeepalive = peer->rtpkeepalive;
+		dialog->noncodeccapability &= ~AST_RTP_DTMF;
+	ast_string_field_set(dialog, context, peer->context);
+	dialog->rtptimeout = peer->rtptimeout;
+	dialog->rtpholdtimeout = peer->rtpholdtimeout;
+	dialog->rtpkeepalive = peer->rtpkeepalive;
 	if (peer->call_limit)
-		ast_set_flag(&r->flags[0], SIP_CALL_LIMIT);
-	r->maxcallbitrate = peer->maxcallbitrate;
+		ast_set_flag(&dialog->flags[0], SIP_CALL_LIMIT);
+	dialog->maxcallbitrate = peer->maxcallbitrate;
 	
 	return 0;
 }
@@ -2682,16 +2691,16 @@
 		} else if (!p->options->addsipheaders && !strncasecmp(ast_var_name(current), "SIPADDHEADER", strlen("SIPADDHEADER"))) {
 			/* Check whether there is a variable with a name starting with SIPADDHEADER */
 			p->options->addsipheaders = 1;
-		} else if (!strcasecmp(ast_var_name(current),"SIPTRANSFER")) {
+		} else if (!strcasecmp(ast_var_name(current), "SIPTRANSFER")) {
 			/* This is a transfered call */
 			p->options->transfer = 1;
-		} else if (!strcasecmp(ast_var_name(current),"SIPTRANSFER_REFERER")) {
+		} else if (!strcasecmp(ast_var_name(current), "SIPTRANSFER_REFERER")) {
 			/* This is the referer */
 			referer = ast_var_value(current);
-		} else if (!strcasecmp(ast_var_name(current),"SIPTRANSFER_REPLACES")) {
+		} else if (!strcasecmp(ast_var_name(current), "SIPTRANSFER_REPLACES")) {
 			/* We're replacing a call. */
 			p->options->replaces = ast_var_value(current);
-		} else if (!strcasecmp(ast_var_name(current),"T38CALL")) {
+		} else if (!strcasecmp(ast_var_name(current), "T38CALL")) {
 			p->t38.state = T38_LOCAL_DIRECT;
 			if (option_debug)
 				ast_log(LOG_DEBUG,"T38State change to %d on channel %s\n", p->t38.state, ast->name);
@@ -2709,9 +2718,8 @@
 			if (sipdebug && option_debug > 2)
 				ast_log(LOG_DEBUG, "Call for %s transfered by %s\n", p->username, referer);
 			snprintf(buf, sizeof(buf)-1, "-> %s (via %s)", p->cid_name, referer);
-		} else {
+		} else 
 			snprintf(buf, sizeof(buf)-1, "-> %s", p->cid_name);
-		}
 		ast_string_field_set(p, cid_name, buf);
 	} 
 	if (option_debug)
@@ -2725,12 +2733,11 @@
 		if (option_debug)
 			ast_log(LOG_DEBUG,"Our T38 capability (%d), joint T38 capability (%d)\n", p->t38.capability, p->t38.jointcapability);
 		transmit_invite(p, SIP_INVITE, 1, 2);
-		if (p->maxtime) {
+		if (p->maxtime)
 			/* Initialize auto-congest time */
 			p->initid = ast_sched_add(sched, p->maxtime * 4, auto_congest, p);
-		} else {
+		else 
 			p->initid = ast_sched_add(sched, SIP_TRANS_TIMEOUT, auto_congest, p);
-		}
 	}
 	return res;
 }
@@ -3166,7 +3173,7 @@
 			ast_log(LOG_DEBUG, "SIP Transfer: Not hanging up right now... Rescheduling hangup for %s.\n", p->callid);
 		if (p->autokillid > -1)
 			sip_cancel_destroy(p);
-		sip_scheddestroy(p, SIP_TRANS_TIMEOUT);
+		sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT);
 		ast_clear_flag(&p->flags[0], SIP_DEFER_BYE_ON_TRANSFER);	/* Really hang up next time */
 		ast_clear_flag(&p->flags[0], SIP_NEEDDESTROY);
 		p->owner->tech_pvt = NULL;
@@ -3179,9 +3186,8 @@
 		else 
 			ast_log(LOG_DEBUG, "Hangup call %s, SIP callid %s)\n", ast->name, p->callid);
 	}
-	if (option_debug && ast_test_flag(ast, AST_FLAG_ZOMBIE)) {
+	if (option_debug && ast_test_flag(ast, AST_FLAG_ZOMBIE)) 
 		ast_log(LOG_DEBUG, "Hanging up zombie call. Be scared.\n");
-	}
 
 	ast_mutex_lock(&p->lock);
 	if (option_debug && sipdebug)
@@ -3220,7 +3226,7 @@
 	if (ast_test_flag(&p->flags[0], SIP_ALREADYGONE))
 		needdestroy = 1;	/* Set destroy flag at end of this function */
 	else
-		sip_scheddestroy(p, SIP_TRANS_TIMEOUT);
+		sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT);
 
 	/* Start the process if it's not already started */
 	if (!ast_test_flag(&p->flags[0], SIP_ALREADYGONE) && !ast_strlen_zero(p->initreq.data)) {
@@ -3239,7 +3245,7 @@
 					/* Actually don't destroy us yet, wait for the 487 on our original 
 					   INVITE, but do set an autodestruct just in case we never get it. */
 					needdestroy = 0;
-					sip_scheddestroy(p, SIP_TRANS_TIMEOUT);
+					sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT);
 				}
 				if ( p->initid != -1 ) {
 					/* channel still up - reverse dec of inUse counter
@@ -3331,9 +3337,8 @@
 			if (option_debug > 1)
 				ast_log(LOG_DEBUG,"T38State change to %d on channel %s\n", p->t38.state, ast->name);
 			res = transmit_response_with_t38_sdp(p, "200 OK", &p->initreq, XMIT_CRITICAL);
-		} else {
+		} else 
 			res = transmit_response_with_sdp(p, "200 OK", &p->initreq, XMIT_CRITICAL);
-		}
 	}
 	ast_mutex_unlock(&p->lock);
 	return res;
@@ -4771,9 +4776,8 @@
 			if ((sscanf(a, "T38FaxMaxBuffer:%d", &x) == 1)) {
 				found = 1;
 				if (option_debug > 2)
-					ast_log(LOG_DEBUG,"MaxBufferSize:%d\n",x);
-			}
-			if ((sscanf(a, "T38MaxBitRate:%d", &x) == 1)) {
+					ast_log(LOG_DEBUG, "MaxBufferSize:%d\n",x);
+			} else if ((sscanf(a, "T38MaxBitRate:%d", &x) == 1)) {
 				found = 1;
 				if (option_debug > 2)
 					ast_log(LOG_DEBUG,"T38MaxBitRate: %d\n",x);
@@ -4797,57 +4801,51 @@
 					peert38capability |= T38FAX_RATE_2400;
 					break;
 				}
-			}
-			if ((sscanf(a, "T38FaxVersion:%d", &x) == 1)) {
+			} else if ((sscanf(a, "T38FaxVersion:%d", &x) == 1)) {
 				found = 1;
 				if (option_debug > 2)
-					ast_log(LOG_DEBUG,"FaxVersion: %d\n",x);
+					ast_log(LOG_DEBUG, "FaxVersion: %d\n",x);
 				if (x == 0)
 					peert38capability |= T38FAX_VERSION_0;
 				else if (x == 1)
 					peert38capability |= T38FAX_VERSION_1;
-			}
-			if ((sscanf(a, "T38FaxMaxDatagram:%d", &x) == 1)) {
+			} else if ((sscanf(a, "T38FaxMaxDatagram:%d", &x) == 1)) {
 				found = 1;
 				if (option_debug > 2)
-					ast_log(LOG_DEBUG,"FaxMaxDatagram: %d\n",x);
+					ast_log(LOG_DEBUG, "FaxMaxDatagram: %d\n",x);
 				ast_udptl_set_far_max_datagram(p->udptl, x);
 				ast_udptl_set_local_max_datagram(p->udptl, x);
-			}
-			if ((sscanf(a, "T38FaxFillBitRemoval:%d", &x) == 1)) {
+			} else if ((sscanf(a, "T38FaxFillBitRemoval:%d", &x) == 1)) {
 				found = 1;
 				if (option_debug > 2)
-					ast_log(LOG_DEBUG,"FillBitRemoval: %d\n",x);
+					ast_log(LOG_DEBUG, "FillBitRemoval: %d\n",x);
 				if (x == 1)
 					peert38capability |= T38FAX_FILL_BIT_REMOVAL;
-			}
-			if ((sscanf(a, "T38FaxTranscodingMMR:%d", &x) == 1)) {
+			} else if ((sscanf(a, "T38FaxTranscodingMMR:%d", &x) == 1)) {
 				found = 1;
 				if (option_debug > 2)
-					ast_log(LOG_DEBUG,"Transcoding MMR: %d\n",x);
+					ast_log(LOG_DEBUG, "Transcoding MMR: %d\n",x);
 				if (x == 1)
 					peert38capability |= T38FAX_TRANSCODING_MMR;
 			}
 			if ((sscanf(a, "T38FaxTranscodingJBIG:%d", &x) == 1)) {
 				found = 1;
 				if (option_debug > 2)
-					ast_log(LOG_DEBUG,"Transcoding JBIG: %d\n",x);
+					ast_log(LOG_DEBUG, "Transcoding JBIG: %d\n",x);
 				if (x == 1)
 					peert38capability |= T38FAX_TRANSCODING_JBIG;
-			}
-			if ((sscanf(a, "T38FaxRateManagement:%s", s) == 1)) {
+			} else if ((sscanf(a, "T38FaxRateManagement:%s", s) == 1)) {
 				found = 1;
 				if (option_debug > 2)
-					ast_log(LOG_DEBUG,"RateMangement: %s\n", s);
+					ast_log(LOG_DEBUG, "RateMangement: %s\n", s);
 				if (!strcasecmp(s, "localTCF"))
 					peert38capability |= T38FAX_RATE_MANAGEMENT_LOCAL_TCF;
 				else if (!strcasecmp(s, "transferredTCF"))
 					peert38capability |= T38FAX_RATE_MANAGEMENT_TRANSFERED_TCF;
-			}
-			if ((sscanf(a, "T38FaxUdpEC:%s", s) == 1)) {
+			} else if ((sscanf(a, "T38FaxUdpEC:%s", s) == 1)) {
 				found = 1;
 				if (option_debug > 2)
-					ast_log(LOG_DEBUG,"UDP EC: %s\n", s);
+					ast_log(LOG_DEBUG, "UDP EC: %s\n", s);
 				if (!strcasecmp(s, "t38UDPRedundancy")) {
 					peert38capability |= T38FAX_UDP_EC_REDUNDANCY;
 					ast_udptl_set_error_correction_scheme(p->udptl, UDPTL_ERROR_CORRECTION_REDUNDANCY);
@@ -4867,7 +4865,7 @@
 			p->t38.jointcapability |= (peert38capability & p->t38.capability); /* Put the lower of our's and peer's speed */
 		}
 		if (debug)
-			ast_log(LOG_DEBUG,"Our T38 capability = (%d), peer T38 capability (%d), joint T38 capability (%d)\n",
+			ast_log(LOG_DEBUG, "Our T38 capability = (%d), peer T38 capability (%d), joint T38 capability (%d)\n",
 				p->t38.capability,
 				p->t38.peercapability,
 				p->t38.jointcapability);
@@ -5569,8 +5567,8 @@
 	return 0;
 }
 
-/*! \brief add XML encoded media control with update */
-/*! \note XML: The only way to turn 0 bits of information into a few hundred. */
+/*! \brief add XML encoded media control with update 
+	\note XML: The only way to turn 0 bits of information into a few hundred. (markster) */
 static int add_vidupdate(struct sip_request *req)
 {
 	const char *xml_is_a_huge_waste_of_space =
@@ -5697,9 +5695,8 @@
 		udptldest.sin_port = udptlsin.sin_port;
 	}
 	
-	if (debug) {
+	if (debug) 
 		ast_log(LOG_DEBUG, "T.38 UDPTL is at %s port %d\n", ast_inet_ntoa(p->ourip), ntohs(udptlsin.sin_port));
-	}
 	
 	/* We break with the "recommendation" and send our IP, in order that our
 	   peer doesn't have to ast_gethostbyname() us */
@@ -5999,7 +5996,7 @@
 	if (option_debug > 2)
 		ast_log(LOG_DEBUG, "-- Done with adding codecs to SDP\n");
 
-	if(!ast_internal_timing_enabled(p->owner))
+	if(!p->owner || !ast_internal_timing_enabled(p->owner))
 		ast_build_string(&a_audio_next, &a_audio_left, "a=silenceSupp:off - - - -\r\n");
 
 	if ((m_audio_left < 2) || (m_video_left < 2) || (a_audio_left == 0) || (a_video_left == 0))
@@ -6042,7 +6039,7 @@
 	return 0;
 }
 
-/*--- transmit_response_with_t38_sdp: Used for 200 OK and 183 early media ---*/
+/*! \brief Used for 200 OK and 183 early media */
 static int transmit_response_with_t38_sdp(struct sip_pvt *p, char *msg, struct sip_request *req, int retrans)
 {
 	struct sip_request resp;
@@ -6056,9 +6053,8 @@
 	if (p->udptl) {
 		ast_udptl_offered_from_local(p->udptl, 0);
 		add_t38_sdp(&resp, p);
-	} else {
+	} else 
 		ast_log(LOG_ERROR, "Can't add SDP to response, since we have no UDPTL session allocated. Call-ID %s\n", p->callid);
-	}
 	return send_response(p, &resp, retrans, seqno);
 }
 
@@ -6090,9 +6086,8 @@
 	if (p->rtp) {
 		try_suggested_sip_codec(p);	

[... 2707 lines stripped ...]


More information about the asterisk-commits mailing list