[svn-commits] twilson: branch twilson/calendaring r148568 - in /team/twilson/calendaring: ....

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Oct 13 17:27:20 CDT 2008


Author: twilson
Date: Mon Oct 13 17:27:19 2008
New Revision: 148568

URL: http://svn.digium.com/view/asterisk?view=rev&rev=148568
Log:
Re-sync with trunk after clearing up conflicts (forgot to save the svnmerge output, doh!)

Modified:
    team/twilson/calendaring/   (props changed)
    team/twilson/calendaring/CHANGES
    team/twilson/calendaring/UPGRADE.txt
    team/twilson/calendaring/apps/app_dial.c
    team/twilson/calendaring/apps/app_meetme.c
    team/twilson/calendaring/apps/app_sms.c
    team/twilson/calendaring/apps/app_speech_utils.c
    team/twilson/calendaring/apps/app_voicemail.c
    team/twilson/calendaring/build_tools/menuselect-deps.in
    team/twilson/calendaring/cdr/cdr_adaptive_odbc.c
    team/twilson/calendaring/cdr/cdr_odbc.c
    team/twilson/calendaring/channels/Makefile
    team/twilson/calendaring/channels/chan_dahdi.c
    team/twilson/calendaring/channels/chan_h323.c
    team/twilson/calendaring/channels/chan_iax2.c
    team/twilson/calendaring/channels/chan_misdn.c
    team/twilson/calendaring/channels/chan_oss.c
    team/twilson/calendaring/channels/chan_sip.c
    team/twilson/calendaring/channels/chan_usbradio.c
    team/twilson/calendaring/channels/console_gui.c
    team/twilson/calendaring/channels/console_video.c
    team/twilson/calendaring/channels/vcodecs.c
    team/twilson/calendaring/configs/extensions.conf.sample
    team/twilson/calendaring/configs/iax.conf.sample
    team/twilson/calendaring/configs/phoneprov.conf.sample
    team/twilson/calendaring/configs/res_ldap.conf.sample
    team/twilson/calendaring/configs/sip.conf.sample
    team/twilson/calendaring/configs/voicemail.conf.sample
    team/twilson/calendaring/configure
    team/twilson/calendaring/configure.ac
    team/twilson/calendaring/contrib/scripts/safe_asterisk
    team/twilson/calendaring/contrib/scripts/safe_asterisk_restart
    team/twilson/calendaring/doc/CODING-GUIDELINES
    team/twilson/calendaring/funcs/func_callerid.c
    team/twilson/calendaring/funcs/func_curl.c
    team/twilson/calendaring/funcs/func_odbc.c
    team/twilson/calendaring/include/asterisk.h
    team/twilson/calendaring/include/asterisk/autoconfig.h.in
    team/twilson/calendaring/include/asterisk/endian.h
    team/twilson/calendaring/include/asterisk/features.h
    team/twilson/calendaring/include/asterisk/options.h
    team/twilson/calendaring/include/asterisk/threadstorage.h
    team/twilson/calendaring/main/asterisk.c
    team/twilson/calendaring/main/astobj2.c
    team/twilson/calendaring/main/cli.c
    team/twilson/calendaring/main/config.c
    team/twilson/calendaring/main/cryptostub.c
    team/twilson/calendaring/main/features.c
    team/twilson/calendaring/main/manager.c
    team/twilson/calendaring/main/pbx.c
    team/twilson/calendaring/main/rtp.c
    team/twilson/calendaring/main/tcptls.c
    team/twilson/calendaring/main/tdd.c
    team/twilson/calendaring/main/term.c
    team/twilson/calendaring/main/translate.c
    team/twilson/calendaring/makeopts.in
    team/twilson/calendaring/pbx/pbx_config.c
    team/twilson/calendaring/phoneprov/000000000000.cfg
    team/twilson/calendaring/res/res_agi.c
    team/twilson/calendaring/res/res_config_odbc.c
    team/twilson/calendaring/res/res_config_sqlite.c
    team/twilson/calendaring/res/res_odbc.c
    team/twilson/calendaring/res/res_phoneprov.c
    team/twilson/calendaring/sounds/Makefile
    team/twilson/calendaring/sounds/sounds.xml
    team/twilson/calendaring/utils/Makefile
    team/twilson/calendaring/utils/extconf.c

Propchange: team/twilson/calendaring/
------------------------------------------------------------------------------
    automerge = re-automergify

Propchange: team/twilson/calendaring/
------------------------------------------------------------------------------
Binary property 'branch-1.4-blocked' - no diff available.

Propchange: team/twilson/calendaring/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Propchange: team/twilson/calendaring/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Mon Oct 13 17:27:19 2008
@@ -1,1 +1,1 @@
-/trunk:1-146918
+/trunk:1-148567

Modified: team/twilson/calendaring/CHANGES
URL: http://svn.digium.com/view/asterisk/team/twilson/calendaring/CHANGES?view=diff&rev=148568&r1=148567&r2=148568
==============================================================================
--- team/twilson/calendaring/CHANGES (original)
+++ team/twilson/calendaring/CHANGES Mon Oct 13 17:27:19 2008
@@ -7,6 +7,8 @@
  * Added support for SUBSCRIBE/NOTIFY with dialog-info based call pickups.
    Snom phones use this for call pickup of extensions that the phone is
    subscribed to.
+ * Added support for subscribing to a voice mailbox on a remote server and
+   making the new/old message count available to local devices.
 
 Dialplan Functions
 ------------------
@@ -26,6 +28,11 @@
  * res_jabber: autoprune has been disabled by default, to avoid misconfiguration 
    that would end up being interpreted as a bug once Asterisk started removing 
    the contacts from a user list.
+ * extensions.conf now allows you to use keyword "same" to define an extension
+   without actually specifying an extension.  It uses exactly the same pattern
+   as previously used on the last "exten" line.  For example:
+     exten => 123,1,NoOp(something)
+     same  =>     n,SomethingElse()
 
 ------------------------------------------------------------------------------
 --- Functionality changes from Asterisk 1.6.0 to Asterisk 1.6.1  -------------
@@ -352,7 +359,7 @@
     driver is.
   * Added 'skinny show lines verbose' CLI command. This will show the subs for every channel.
   * Cleanup another bunch of CLI commands. Now all modules follow the same schema.
-    (Done by lmadsen, junky and mvanbaak during the AstriDevCon)
+    (Done by lmadsen, junky and mvanbaak during the devcon 2008)
 
 SIP changes
 -----------

Modified: team/twilson/calendaring/UPGRADE.txt
URL: http://svn.digium.com/view/asterisk/team/twilson/calendaring/UPGRADE.txt?view=diff&rev=148568&r1=148567&r2=148568
==============================================================================
--- team/twilson/calendaring/UPGRADE.txt (original)
+++ team/twilson/calendaring/UPGRADE.txt Mon Oct 13 17:27:19 2008
@@ -77,6 +77,13 @@
   had any significance).  Since this violates the Principle of Least Surprise,
   it has been changed.
 
+* The default console now will use colors according to the default background
+  color, instead of forcing the background color to black.  If you are using a
+  light colored background for your console, you may wish to use the option
+  flag '-W' to present better color choices for the various messages.  However,
+  if you'd prefer the old method of forcing colors to white text on a black
+  background, the compatiblity option -B is provided for this purpose.
+
 Voicemail:
 
 * The voicemail configuration values 'maxmessage' and 'minmessage' have

Modified: team/twilson/calendaring/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/team/twilson/calendaring/apps/app_dial.c?view=diff&rev=148568&r1=148567&r2=148568
==============================================================================
--- team/twilson/calendaring/apps/app_dial.c (original)
+++ team/twilson/calendaring/apps/app_dial.c Mon Oct 13 17:27:19 2008
@@ -1926,11 +1926,7 @@
 				res = -1;
 				goto done;
 			}
-			if (opermode && !strncmp(chan->tech->type, "DAHDI", 3) && !strncmp(peer->name, "DAHDI", 3)) {
-				/* what's this special handling for dahdi <-> dahdi ?
-				 * A: dahdi to dahdi calls are natively bridged at the kernel driver
-				 * level, so we need to ensure that this mode gets propagated
-				 * all the way down. */
+			if (opermode) {
 				struct oprmode oprmode;
 
 				oprmode.peer = peer;

Modified: team/twilson/calendaring/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/team/twilson/calendaring/apps/app_meetme.c?view=diff&rev=148568&r1=148567&r2=148568
==============================================================================
--- team/twilson/calendaring/apps/app_meetme.c (original)
+++ team/twilson/calendaring/apps/app_meetme.c Mon Oct 13 17:27:19 2008
@@ -2157,9 +2157,9 @@
 
 						for ( ; var; var = var->next) {
 							if (!strcasecmp(var->name, "endtime")) {
-								struct ast_tm tm;
-								ast_strptime(var->value, "%Y-%m-%d %H:%M:%S", &tm);
-								tmp = ast_mktime(&tm, NULL);
+								struct ast_tm endtime_tm;
+								ast_strptime(var->value, "%Y-%m-%d %H:%M:%S", &endtime_tm);
+								tmp = ast_mktime(&endtime_tm, NULL);
 								localendtime = tmp.tv_sec;
 							}
 						}
@@ -2172,16 +2172,16 @@
 							extended = 1;
 						}
 
-						if (conf->endtime && (now.tv_sec > conf->endtime)) {
+						if (conf->endtime && (now.tv_sec >= conf->endtime)) {
 							ast_verbose("Quitting time...\n");
 							goto outrun;
 						}
 
 						if (!announcement_played && conf->endalert) {
-							if (now.tv_sec + conf->endalert > conf->endtime) {
+							if (now.tv_sec + conf->endalert >= conf->endtime) {
 								if (!ast_streamfile(chan, "conf-will-end-in", chan->language))
 									ast_waitstream(chan, "");
-								ast_say_digits(chan, (now.tv_sec + conf->endalert - conf->endtime) / 60, "", chan->language);
+								ast_say_digits(chan, (conf->endtime - now.tv_sec) / 60, "", chan->language);
 								if (!ast_streamfile(chan, "minutes", chan->language))
 									ast_waitstream(chan, "");
 								announcement_played = 1;
@@ -3057,9 +3057,9 @@
 			} else if (!strcasecmp(var->name, "adminopts")) {
 				ast_copy_string(adminopts, var->value, sizeof(char[OPTIONS_LEN]));
 			} else if (!strcasecmp(var->name, "endtime")) {
-				struct ast_tm tm;
-				ast_strptime(var->value, "%Y-%m-%d %H:%M:%S", &tm);
-				endtime = ast_mktime(&tm, NULL);
+				struct ast_tm endtime_tm;
+				ast_strptime(var->value, "%Y-%m-%d %H:%M:%S", &endtime_tm);
+				endtime = ast_mktime(&endtime_tm, NULL);
 			}
 		}
 

Modified: team/twilson/calendaring/apps/app_sms.c
URL: http://svn.digium.com/view/asterisk/team/twilson/calendaring/apps/app_sms.c?view=diff&rev=148568&r1=148567&r2=148568
==============================================================================
--- team/twilson/calendaring/apps/app_sms.c (original)
+++ team/twilson/calendaring/apps/app_sms.c Mon Oct 13 17:27:19 2008
@@ -86,7 +86,7 @@
 	" t  - use protocol 2 (default used is protocol 1).\n"
 	" p(N)  - set the initial delay to N ms (default is 300).\n"
 	"         addr and body are a deprecated format to send messages out.\n"
-	" s  - set the Status Report Request (SRR) bit.\n"
+	" r  - set the Status Report Request (SRR) bit.\n"
 	" o  - the body should be coded as octets not 7-bit symbols.\n"
 	"Messages are processed as per text file message queues.\n" 
 	"smsq (a separate software) is a command to generate message\n"
@@ -919,6 +919,9 @@
 	char buf[30];
 	FILE *o;
 
+	if (ast_tvzero(h->scts)) {
+		h->scts = ast_tvnow();
+	}
 	snprintf(fn, sizeof(fn), "%s/sms/%s", ast_config_AST_SPOOL_DIR, h->smsc ? h->rx ? "morx" : "mttx" : h->rx ? "mtrx" : "motx");
 	ast_mkdir(fn, 0777);			/* ensure it exists */
 	ast_copy_string(fn2, fn, sizeof(fn2));

Modified: team/twilson/calendaring/apps/app_speech_utils.c
URL: http://svn.digium.com/view/asterisk/team/twilson/calendaring/apps/app_speech_utils.c?view=diff&rev=148568&r1=148567&r2=148568
==============================================================================
--- team/twilson/calendaring/apps/app_speech_utils.c (original)
+++ team/twilson/calendaring/apps/app_speech_utils.c Mon Oct 13 17:27:19 2008
@@ -743,6 +743,7 @@
 			speech->results->text = ast_strdup(dtmf);
 			speech->results->grammar = ast_strdup("dtmf");
 		}
+		ast_speech_change_state(speech, AST_SPEECH_STATE_NOT_READY);
 	}
 
 	/* See if it was because they hung up */

Modified: team/twilson/calendaring/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/twilson/calendaring/apps/app_voicemail.c?view=diff&rev=148568&r1=148567&r2=148568
==============================================================================
--- team/twilson/calendaring/apps/app_voicemail.c (original)
+++ team/twilson/calendaring/apps/app_voicemail.c Mon Oct 13 17:27:19 2008
@@ -47,8 +47,10 @@
 /*** MAKEOPTS
 <category name="MENUSELECT_OPTS_app_voicemail" displayname="Voicemail Build Options" positive_output="yes" remove_on_change="apps/app_voicemail.o apps/app_directory.o">
 	<member name="ODBC_STORAGE" displayname="Storage of Voicemail using ODBC">
-		<depend>unixodbc</depend>
+		<depend>unixodbc_or_iodbc</depend>
 		<depend>ltdl</depend>
+		<use>unixodbc</use>
+		<use>iodbc</use>
 		<conflict>IMAP_STORAGE</conflict>
 		<defaultenabled>no</defaultenabled>
 	</member>
@@ -61,12 +63,8 @@
 </category>
  ***/
 
-/* It is important to include the IMAP_STORAGE related headers
- * before asterisk.h since asterisk.h includes logger.h. logger.h
- * and c-client.h have conflicting definitions for AST_LOG_WARNING and
- * AST_LOG_DEBUG, so it's important that we use Asterisk's definitions
- * here instead of the c-client's 
- */
+#include "asterisk.h"
+
 #ifdef IMAP_STORAGE
 #include <ctype.h>
 #include <signal.h>
@@ -86,8 +84,6 @@
 #endif
 #endif
 
-#include "asterisk.h"
-
 ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
 #include "asterisk/paths.h"	/* use ast_config_AST_SPOOL_DIR */
@@ -97,6 +93,7 @@
 #include <time.h>
 #include <dirent.h>
 
+#include "asterisk/logger.h"
 #include "asterisk/lock.h"
 #include "asterisk/file.h"
 #include "asterisk/channel.h"
@@ -771,7 +768,7 @@
 #ifdef IMAP_STORAGE
 	} else if (!strcasecmp(var, "imapuser")) {
 		ast_copy_string(vmu->imapuser, value, sizeof(vmu->imapuser));
-	} else if (!strcasecmp(var, "imappassword")) {
+	} else if (!strcasecmp(var, "imappassword") || !strcasecmp(var, "imapsecret")) {
 		ast_copy_string(vmu->imappassword, value, sizeof(vmu->imappassword));
 #endif
 	} else if (!strcasecmp(var, "delete") || !strcasecmp(var, "deletevoicemail")) {
@@ -1003,7 +1000,7 @@
 #ifdef IMAP_STORAGE
 		} else if (!strcasecmp(tmp->name, "imapuser")) {
 			ast_copy_string(retval->imapuser, tmp->value, sizeof(retval->imapuser));
-		} else if (!strcasecmp(tmp->name, "imappassword")) {
+		} else if (!strcasecmp(tmp->name, "imappassword") || !strcasecmp(tmp->name, "imapsecret")) {
 			ast_copy_string(retval->imappassword, tmp->value, sizeof(retval->imappassword));
 #endif
 		} else
@@ -1518,9 +1515,9 @@
 
 	fprintf(text_file_ptr, "%s\n", "[message]");
 
+	get_header_by_tag(header_content, "X-Asterisk-VM-Caller-ID-Name:", buf, sizeof(buf));
+	fprintf(text_file_ptr, "callerid=\"%s\" ", S_OR(buf, ""));
 	get_header_by_tag(header_content, "X-Asterisk-VM-Caller-ID-Num:", buf, sizeof(buf));
-	fprintf(text_file_ptr, "callerid=\"%s\" ", S_OR(buf, ""));
-	get_header_by_tag(header_content, "X-Asterisk-VM-Caller-ID-Name:", buf, sizeof(buf));
 	fprintf(text_file_ptr, "<%s>\n", S_OR(buf, ""));
 	get_header_by_tag(header_content, "X-Asterisk-VM-Context:", buf, sizeof(buf));
 	fprintf(text_file_ptr, "context=%s\n", S_OR(buf, ""));
@@ -1530,6 +1527,8 @@
 	fprintf(text_file_ptr, "duration=%s\n", S_OR(buf, ""));
 	get_header_by_tag(header_content, "X-Asterisk-VM-Category:", buf, sizeof(buf));
 	fprintf(text_file_ptr, "category=%s\n", S_OR(buf, ""));
+	get_header_by_tag(header_content, "X-Asterisk-VM-Flag:", buf, sizeof(buf));
+	fprintf(text_file_ptr, "flag=%s\n", S_OR(buf, ""));
 	fclose(text_file_ptr);
 
 exit:
@@ -3675,7 +3674,8 @@
 	pbx_builtin_setvar_helper(ast, "VM_MSGNUM", passdata);
 	pbx_builtin_setvar_helper(ast, "VM_CONTEXT", context);
 	pbx_builtin_setvar_helper(ast, "VM_MAILBOX", mailbox);
-	pbx_builtin_setvar_helper(ast, "VM_CALLERID", ast_callerid_merge(callerid, sizeof(callerid), cidname, cidnum, "Unknown Caller"));
+	pbx_builtin_setvar_helper(ast, "VM_CALLERID", (!ast_strlen_zero(cidname) || !ast_strlen_zero(cidnum)) ?
+		ast_callerid_merge(callerid, sizeof(callerid), cidname, cidnum, NULL) : "an unknown caller");
 	pbx_builtin_setvar_helper(ast, "VM_CIDNAME", (!ast_strlen_zero(cidname) ? cidname : "an unknown caller"));
 	pbx_builtin_setvar_helper(ast, "VM_CIDNUM", (!ast_strlen_zero(cidnum) ? cidnum : "an unknown caller"));
 	pbx_builtin_setvar_helper(ast, "VM_DATE", date);
@@ -7756,8 +7756,11 @@
 	/* Notify the user that the temp greeting is set and give them the option to remove it */
 	snprintf(prefile, sizeof(prefile), "%s%s/%s/temp", VM_SPOOL_DIR, vmu->context, vms->username);
 	if (ast_test_flag(vmu, VM_TEMPGREETWARN)) {
-		if (ast_fileexists(prefile, NULL, NULL) > 0)
+		RETRIEVE(prefile, -1, vmu->mailbox, vmu->context);
+		if (ast_fileexists(prefile, NULL, NULL) > 0) {
 			ast_play_and_wait(chan, "vm-tempgreetactive");
+		}
+		DISPOSE(prefile, -1);
 	}
 
 	/* Play voicemail intro - syntax is different for different languages */
@@ -8095,9 +8098,11 @@
 		default: 
 			cmd = 0;
 			snprintf(prefile, sizeof(prefile), "%s%s/%s/temp", VM_SPOOL_DIR, vmu->context, vms->username);
+			RETRIEVE(prefile, -1, vmu->mailbox, vmu->context);
 			if (ast_fileexists(prefile, NULL, NULL)) {
 				cmd = ast_play_and_wait(chan, "vm-tmpexists");
 			}
+			DISPOSE(prefile, -1);
 			if (!cmd) {
 				cmd = ast_play_and_wait(chan, "vm-options");
 			}

Modified: team/twilson/calendaring/build_tools/menuselect-deps.in
URL: http://svn.digium.com/view/asterisk/team/twilson/calendaring/build_tools/menuselect-deps.in?view=diff&rev=148568&r1=148567&r2=148568
==============================================================================
--- team/twilson/calendaring/build_tools/menuselect-deps.in (original)
+++ team/twilson/calendaring/build_tools/menuselect-deps.in Mon Oct 13 17:27:19 2008
@@ -14,6 +14,7 @@
 ICONV=@PBX_ICONV@
 IKSEMEL=@PBX_IKSEMEL@
 IMAP_TK=@PBX_IMAP_TK@
+IODBC=@PBX_IODBC@
 ISDNNET=@PBX_ISDNNET@
 IXJUSER=@PBX_IXJUSER@
 JACK=@PBX_JACK@
@@ -25,6 +26,7 @@
 NETSNMP=@PBX_NETSNMP@
 NEWT=@PBX_NEWT@
 NEON=@PBX_NEON@
+UNIXODBC_OR_IODBC=@PBX_ODBC@
 OGG=@PBX_OGG@
 OPENH323=@PBX_OPENH323@
 OSPTK=@PBX_OSPTK@

Modified: team/twilson/calendaring/cdr/cdr_adaptive_odbc.c
URL: http://svn.digium.com/view/asterisk/team/twilson/calendaring/cdr/cdr_adaptive_odbc.c?view=diff&rev=148568&r1=148567&r2=148568
==============================================================================
--- team/twilson/calendaring/cdr/cdr_adaptive_odbc.c (original)
+++ team/twilson/calendaring/cdr/cdr_adaptive_odbc.c Mon Oct 13 17:27:19 2008
@@ -25,7 +25,9 @@
  */
 
 /*** MODULEINFO
-	<depend>unixodbc</depend>
+	<depend>unixodbc_or_iodbc</depend>
+	<use>unixodbc</use>
+	<use>iodbc</use>
  ***/
 
 #include "asterisk.h"
@@ -371,9 +373,9 @@
 
 			/* Check if we have a similarly named variable */
 			if (datefield && tableptr->usegmtime) {
-				struct timeval tv = (datefield == 1) ? cdr->start : (datefield == 2) ? cdr->answer : cdr->end;
+				struct timeval date_tv = (datefield == 1) ? cdr->start : (datefield == 2) ? cdr->answer : cdr->end;
 				struct ast_tm tm = { 0, };
-				ast_localtime(&tv, &tm, "UTC");
+				ast_localtime(&date_tv, &tm, "UTC");
 				ast_strftime(colbuf, sizeof(colbuf), "%Y-%m-%d %H:%M:%S", &tm);
 			} else {
 				ast_cdr_getvar(cdr, entry->cdrname, &colptr, colbuf, sizeof(colbuf), 0, datefield ? 0 : 1);

Modified: team/twilson/calendaring/cdr/cdr_odbc.c
URL: http://svn.digium.com/view/asterisk/team/twilson/calendaring/cdr/cdr_odbc.c?view=diff&rev=148568&r1=148567&r2=148568
==============================================================================
--- team/twilson/calendaring/cdr/cdr_odbc.c (original)
+++ team/twilson/calendaring/cdr/cdr_odbc.c Mon Oct 13 17:27:19 2008
@@ -29,8 +29,10 @@
  */
 
 /*** MODULEINFO
-	<depend>unixodbc</depend>
+	<depend>unixodbc_or_iodbc</depend>
 	<depend>ltdl</depend>
+	<use>unixodbc</use>
+	<use>iodbc</use>
  ***/
 
 #include "asterisk.h"

Modified: team/twilson/calendaring/channels/Makefile
URL: http://svn.digium.com/view/asterisk/team/twilson/calendaring/channels/Makefile?view=diff&rev=148568&r1=148567&r2=148568
==============================================================================
--- team/twilson/calendaring/channels/Makefile (original)
+++ team/twilson/calendaring/channels/Makefile Mon Oct 13 17:27:19 2008
@@ -16,8 +16,8 @@
 MENUSELECT_DESCRIPTION=Channel Drivers
 
 ifeq ($(OSARCH),OpenBSD)
-  PTLIB=-lpt_OpenBSD_x86_r
-  H323LIB=-lh323_OpenBSD_x86_r
+  PTLIB=-lpt
+  H323LIB=-lh323
 endif
 
 ifeq ($(OSARCH),linux-gnu)

Modified: team/twilson/calendaring/channels/chan_dahdi.c
URL: http://svn.digium.com/view/asterisk/team/twilson/calendaring/channels/chan_dahdi.c?view=diff&rev=148568&r1=148567&r2=148568
==============================================================================
--- team/twilson/calendaring/channels/chan_dahdi.c (original)
+++ team/twilson/calendaring/channels/chan_dahdi.c Mon Oct 13 17:27:19 2008
@@ -3638,6 +3638,13 @@
 		break;
 	case AST_OPTION_OPRMODE:  /* Operator services mode */
 		oprmode = (struct oprmode *) data;
+		/* We don't support operator mode across technologies */
+		if (strcasecmp(chan->tech->type, oprmode->peer->tech->type)) {
+			ast_log(LOG_NOTICE, "Operator mode not supported on %s to %s calls.\n",
+					chan->tech->type, oprmode->peer->tech->type);
+			errno = EINVAL;
+			return -1;
+		}
 		pp = oprmode->peer->tech_pvt;
 		p->oprmode = pp->oprmode = 0;
 		/* setup peers */
@@ -11647,7 +11654,7 @@
 	int level = 0;
 	switch (cmd) {
 	case CLI_INIT:	
-		e->command = "pri set debug {<level>|on|off} span";
+		e->command = "pri set debug [on|off] span";
 		e->usage = 
 			"Usage: pri set debug <level|on|off> span <span>\n"
 			"       Enables debugging on a given PRI span\n";
@@ -13648,8 +13655,9 @@
  					return -1;
 		} else if (!strcasecmp(v->name, "buffers")) {
 			int res;
-			char policy[8] = "";
-			res = sscanf(v->value, "%d,%s", &confp->chan.buf_no, policy);
+			char policy[21] = "";
+
+			res = sscanf(v->value, "%d,%20s", &confp->chan.buf_no, policy);
 			if (res != 2) {
 				ast_log(LOG_WARNING, "Parsing buffers option data failed, using defaults.\n");
 				confp->chan.buf_no = numbufs;

Modified: team/twilson/calendaring/channels/chan_h323.c
URL: http://svn.digium.com/view/asterisk/team/twilson/calendaring/channels/chan_h323.c?view=diff&rev=148568&r1=148567&r2=148568
==============================================================================
--- team/twilson/calendaring/channels/chan_h323.c (original)
+++ team/twilson/calendaring/channels/chan_h323.c Mon Oct 13 17:27:19 2008
@@ -2633,6 +2633,9 @@
 	if (!strcasecmp(a->argv[3], "off")) {
 		h323_debug(0, 0);
 		ast_cli(a->fd, "H.323 Trace Disabled\n");
+	} else if (!strcasecmp(a->argv[3], "on")) {
+		h323_debug(1, 1);
+		ast_cli(a->fd, "H.323 Trace Enabled\n");
 	} else {
 		int tracelevel = atoi(a->argv[3]);
 		h323_debug(1, tracelevel);

Modified: team/twilson/calendaring/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/team/twilson/calendaring/channels/chan_iax2.c?view=diff&rev=148568&r1=148567&r2=148568
==============================================================================
--- team/twilson/calendaring/channels/chan_iax2.c (original)
+++ team/twilson/calendaring/channels/chan_iax2.c Mon Oct 13 17:27:19 2008
@@ -3823,6 +3823,9 @@
 		/* these two cannot be sent, because they require a result */
 		errno = ENOSYS;
 		return -1;
+	case AST_OPTION_OPRMODE:
+		errno = EINVAL;
+		return -1;
 	default:
 		if (!(h = ast_malloc(datalen + sizeof(*h))))
 			return -1;
@@ -6587,7 +6590,7 @@
 	
 	memset(&ied, 0, sizeof(ied));
 	if (ies->apparent_addr)
-		bcopy(ies->apparent_addr, &new, sizeof(new));
+		memmove(&new, ies->apparent_addr, sizeof(new));
 	if (ies->callno)
 		newcall = ies->callno;
 	if (!newcall || !new.sin_addr.s_addr || !new.sin_port) {
@@ -6725,7 +6728,7 @@
 
 	memset(&us, 0, sizeof(us));
 	if (ies->apparent_addr)
-		bcopy(ies->apparent_addr, &us, sizeof(us));
+		memmove(&us, ies->apparent_addr, sizeof(us));
 	if (ies->username)
 		ast_copy_string(peer, ies->username, sizeof(peer));
 	if (ies->refresh)

Modified: team/twilson/calendaring/channels/chan_misdn.c
URL: http://svn.digium.com/view/asterisk/team/twilson/calendaring/channels/chan_misdn.c?view=diff&rev=148568&r1=148567&r2=148568
==============================================================================
--- team/twilson/calendaring/channels/chan_misdn.c (original)
+++ team/twilson/calendaring/channels/chan_misdn.c Mon Oct 13 17:27:19 2008
@@ -737,7 +737,7 @@
 
 	switch (cmd) {
 	case CLI_INIT:
-		e->command = "misdn set debug {on|off|<level>}";
+		e->command = "misdn set debug [on|off]";
 		e->usage =
 			"Usage: misdn set debug {on|off|<level>} [only] | [port <port> [only]]\n"
 			"       Set the debug level of the mISDN channel.\n";

Modified: team/twilson/calendaring/channels/chan_oss.c
URL: http://svn.digium.com/view/asterisk/team/twilson/calendaring/channels/chan_oss.c?view=diff&rev=148568&r1=148567&r2=148568
==============================================================================
--- team/twilson/calendaring/channels/chan_oss.c (original)
+++ team/twilson/calendaring/channels/chan_oss.c Mon Oct 13 17:27:19 2008
@@ -701,7 +701,7 @@
 
 	/* XXX can be simplified returning &ast_null_frame */
 	/* prepare a NULL frame in case we don't have enough data to return */
-	bzero(f, sizeof(struct ast_frame));
+	memset(f, '\0', sizeof(struct ast_frame));
 	f->frametype = AST_FRAME_NULL;
 	f->src = oss_tech.type;
 

Modified: team/twilson/calendaring/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/twilson/calendaring/channels/chan_sip.c?view=diff&rev=148568&r1=148567&r2=148568
==============================================================================
--- team/twilson/calendaring/channels/chan_sip.c (original)
+++ team/twilson/calendaring/channels/chan_sip.c Mon Oct 13 17:27:19 2008
@@ -216,6 +216,7 @@
 #define DEFAULT_DEFAULT_EXPIRY  120
 #define DEFAULT_MIN_EXPIRY      60
 #define DEFAULT_MAX_EXPIRY      3600
+#define DEFAULT_MWI_EXPIRY      3600
 #define DEFAULT_REGISTRATION_TIMEOUT 20
 #define DEFAULT_MAX_FORWARDS    "70"
 
@@ -235,6 +236,7 @@
 static int min_expiry = DEFAULT_MIN_EXPIRY;        /*!< Minimum accepted registration time */
 static int max_expiry = DEFAULT_MAX_EXPIRY;        /*!< Maximum accepted registration time */
 static int default_expiry = DEFAULT_DEFAULT_EXPIRY;
+static int mwi_expiry = DEFAULT_MWI_EXPIRY;
 
 #ifndef MAX
 #define MAX(a,b) ((a) > (b) ? (a) : (b))
@@ -727,6 +729,8 @@
 static char default_parkinglot[AST_MAX_CONTEXT]; /*!< Parkinglot */
 static int default_maxcallbitrate;	/*!< Maximum bitrate for call */
 static struct ast_codec_pref default_prefs;		/*!< Default codec prefs */
+static unsigned int default_transports;			/*!< Default Transports (enum sip_transport) that are acceptable */
+static unsigned int default_primary_transport;		/*!< Default primary Transport (enum sip_transport) for outbound connections to devices */
 
 /*! \brief a place to store all global settings for the sip channel driver */
 struct sip_settings {
@@ -1379,6 +1383,8 @@
 	struct sip_st_dlg *stimer;		/*!< SIP Session-Timers */              
   
 	int red; 
+
+	struct sip_subscription_mwi *mwi;       /*!< If this is a subscription MWI dialog, to which subscription */
 };
 
 /*! Max entires in the history list for a sip_pvt */
@@ -1480,7 +1486,7 @@
 struct sip_peer {
 	char name[80];			/*!< peer->name is the unique name of this object */
 	struct sip_socket socket;	/*!< Socket used for this peer */
-	unsigned int transports:3; /*!< Transports (enum sip_transport) that are acceptable for this peer */
+	unsigned int transports:3;      /*!< Transports (enum sip_transport) that are acceptable for this peer */
 	char secret[80];		/*!< Password */
 	char md5secret[80];		/*!< Password in MD5 */
 	struct sip_auth *auth;		/*!< Realm authentication list */
@@ -1616,6 +1622,25 @@
 	AST_LIST_ENTRY(sip_threadinfo) list;
 };
 
+/*! \brief Definition of an MWI subscription to another server */
+struct sip_subscription_mwi {
+	ASTOBJ_COMPONENTS_FULL(struct sip_subscription_mwi,1,1);
+	AST_DECLARE_STRING_FIELDS(
+		AST_STRING_FIELD(username);     /*!< Who we are sending the subscription as */
+		AST_STRING_FIELD(authuser);     /*!< Who we *authenticate* as */
+		AST_STRING_FIELD(hostname);     /*!< Domain or host we subscribe to */
+		AST_STRING_FIELD(secret);       /*!< Password in clear text */
+		AST_STRING_FIELD(mailbox);      /*!< Mailbox store to put MWI into */
+		);
+	enum sip_transport transport;    /*!< Transport to use */
+	int portno;                      /*!< Optional port override */
+	int resub;                       /*!< Sched ID of resubscription */
+	unsigned int subscribed:1;       /*!< Whether we are currently subscribed or not */
+	struct sip_pvt *call;            /*!< Outbound subscription dialog */
+	struct ast_dnsmgr_entry *dnsmgr; /*!< DNS refresh manager for subscription */
+	struct sockaddr_in us;           /*!< Who the server thinks we are */
+};
+
 /* --- Hash tables of various objects --------*/
 
 #ifdef LOW_MEMORY
@@ -1640,6 +1665,11 @@
 	ASTOBJ_CONTAINER_COMPONENTS(struct sip_registry);
 	int recheck;
 } regl;
+
+/*! \brief  The MWI subscription list */
+static struct ast_subscription_mwi_list {
+	ASTOBJ_CONTAINER_COMPONENTS(struct sip_subscription_mwi);
+} submwil;
 
 /*! \brief
  * \note The only member of the peer used here is the name field
@@ -1972,7 +2002,7 @@
 	else if (!(peer->transports & tmpl->socket.type)) {\
 		ast_log(LOG_ERROR, \
 			"'%s' is not a valid transport for '%s'. we only use '%s'! ending call.\n", \
-			get_transport(tmpl->socket.type), peer->name, get_transport_list(peer) \
+			get_transport(tmpl->socket.type), peer->name, get_transport_list(peer->transports) \
 			); \
 		ret = 1; \
 	} else if (peer->socket.type & SIP_TRANSPORT_TLS) { \
@@ -2024,6 +2054,7 @@
 static char *sip_show_registry(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a);
 static char *sip_unregister(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a);
 static char *sip_show_settings(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a);
+static char *sip_show_mwi(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a);
 static const char *subscription_type2str(enum subscriptiontype subtype) attribute_pure;
 static const struct cfsubscription_types *find_subscription_type(enum subscriptiontype subtype);
 static char *complete_sip_peer(const char *word, int state, int flags2);
@@ -2181,6 +2212,7 @@
 static void handle_response_invite(struct sip_pvt *p, int resp, char *rest, struct sip_request *req, int seqno);
 static void handle_response_notify(struct sip_pvt *p, int resp, char *rest, struct sip_request *req, int seqno);
 static void handle_response_refer(struct sip_pvt *p, int resp, char *rest, struct sip_request *req, int seqno);
+static void handle_response_subscribe(struct sip_pvt *p, int resp, char *rest, struct sip_request *req, int seqno);
 static int handle_response_register(struct sip_pvt *p, int resp, char *rest, struct sip_request *req, int seqno);
 static void handle_response(struct sip_pvt *p, int resp, char *rest, struct sip_request *req, int seqno);
 
@@ -2213,6 +2245,12 @@
 static enum st_mode st_get_mode(struct sip_pvt *);
 static struct sip_st_dlg* sip_st_alloc(struct sip_pvt *const p);
 
+/*!--- SIP MWI Subscription support */
+static int sip_subscribe_mwi(const char *value, int lineno);
+static void sip_subscribe_mwi_destroy(struct sip_subscription_mwi *mwi);
+static void sip_send_all_mwi_subscriptions(void);
+static int sip_subscribe_mwi_do(const void *data);
+static int __sip_subscribe_mwi_do(struct sip_subscription_mwi *mwi);
 
 /*! \brief Definition of this channel for PBX channel registration */
 static const struct ast_channel_tech sip_tech = {
@@ -2264,7 +2302,7 @@
 	.master = AST_PTHREADT_NULL,
 	.tls_cfg = NULL,
 	.poll_timeout = -1,
-	.name = "sip tcp server",
+	.name = "SIP TCP server",
 	.accept_fn = ast_tcptls_server_root,
 	.worker_fn = sip_tcp_worker_fn,
 };
@@ -2275,7 +2313,7 @@
 	.master = AST_PTHREADT_NULL,
 	.tls_cfg = &sip_tls_cfg,
 	.poll_timeout = -1,
-	.name = "sip tls server",
+	.name = "SIP TLS server",
 	.accept_fn = ast_tcptls_server_root,
 	.worker_fn = sip_tcp_worker_fn,
 };
@@ -2349,6 +2387,8 @@
 	else
 		me->type = SIP_TRANSPORT_TCP;
 
+	ast_debug(2, "Starting thread for %s server\n", ser->ssl ? "SSL" : "TCP");
+
 	AST_LIST_LOCK(&threadl);
 	AST_LIST_INSERT_TAIL(&threadl, me, list);
 	AST_LIST_UNLOCK(&threadl);
@@ -2375,7 +2415,7 @@
 		}
 		res = ast_wait_for_input(ser->fd, -1);
 		if (res < 0) {
-			ast_debug(1, "ast_wait_for_input returned %d\n", res);
+			ast_debug(2, "SIP %s server :: ast_wait_for_input returned %d\n", ser->ssl ? "SSL": "TCP", res);
 			goto cleanup;
 		}
 
@@ -2394,6 +2434,7 @@
 		}
 		copy_request(&reqcpy, &req);
 		parse_request(&reqcpy);
+		/* In order to know how much to read, we need the content-length header */
 		if (sscanf(get_header(&reqcpy, "Content-Length"), "%d", &cl)) {
 			while (cl > 0) {
 				ast_mutex_lock(&ser->lock);
@@ -2409,6 +2450,9 @@
 				req.len = req.data->used;
 			}
 		}
+		/*! \todo XXX If there's no Content-Length or if the content-lenght and what
+				we receive is not the same - we should generate an error */
+
 		req.socket.ser = ser;
 		handle_request_do(&req, &ser->requestor);
 	}
@@ -2430,6 +2474,8 @@
 		ast_free(req.data);
 		req.data = NULL;
 	}
+
+	ast_debug(2, "Shutting down thread for %s server\n", ser->ssl ? "SSL" : "TCP");
 	
 
 	ao2_ref(ser, -1);
@@ -2738,8 +2784,9 @@
 	return sip_debug_test_addr(sip_real_dst(p));
 }
 
-static inline const char *get_transport_list(struct sip_peer *peer) {
-	switch (peer->transports) {
+/*! \brief Return configuration of transports for a device */
+static inline const char *get_transport_list(unsigned int transports) {
+	switch (transports) {
 		case SIP_TRANSPORT_UDP:
 			return "UDP";
 		case SIP_TRANSPORT_TCP:
@@ -2753,11 +2800,12 @@
 		case SIP_TRANSPORT_TCP | SIP_TRANSPORT_TLS:
 			return "TLS,TCP";
 		default:
-			return peer->transports ? 
+			return transports ? 
 				"TLS,TCP,UDP" : "UNKNOWN";	
 	}
 }
 
+/*! \brief Return transport as string */
 static inline const char *get_transport(enum sip_transport t)
 {
 	switch (t) {
@@ -2772,6 +2820,12 @@
 	return "UNKNOWN";
 }
 
+/*! \brief Return transport of dialog.
+	\note this is based on a false assumption. We don't always use the
+	outbound proxy for all requests in a dialog. It depends on the
+	"force" parameter. The FIRST request is always sent to the ob proxy.
+	\todo Fix this function to work correctly
+*/
 static inline const char *get_transport_pvt(struct sip_pvt *p)
 {
 	if (p->outboundproxy && p->outboundproxy->transport)
@@ -2790,7 +2844,7 @@
 	int res = 0;
 	const struct sockaddr_in *dst = sip_real_dst(p);
 
-	ast_debug(1, "Trying to put '%.10s' onto %s socket destined for %s:%d\n", data->str, get_transport_pvt(p), ast_inet_ntoa(dst->sin_addr), htons(dst->sin_port));
+	ast_debug(2, "Trying to put '%.10s' onto %s socket destined for %s:%d\n", data->str, get_transport_pvt(p), ast_inet_ntoa(dst->sin_addr), htons(dst->sin_port));
 
 	if (sip_prepare_socket(p) < 0)
 		return XMIT_ERROR;
@@ -2804,7 +2858,7 @@
 		if (p->socket.ser->f) 
 			res = ast_tcptls_server_write(p->socket.ser, data->str, len);
 		else
-			ast_debug(1, "No p->socket.ser->f len=%d\n", len);
+			ast_debug(2, "No p->socket.ser->f len=%d\n", len);
 	} 
 
 	if (p->socket.ser)
@@ -3081,14 +3135,15 @@
 
 	/* If the transport is something reliable (TCP or TLS) then don't really send this reliably */
 	/* I removed the code from retrans_pkt that does the same thing so it doesn't get loaded into the scheduler */
-	/* According to the RFC some packets need to be retransmitted even if its TCP, so this needs to get revisited */
+	/*! \todo According to the RFC some packets need to be retransmitted even if its TCP, so this needs to get revisited */
 	if (!(p->socket.type & SIP_TRANSPORT_UDP)) {
-		xmitres = __sip_xmit(dialog_ref(p, "pasing dialog ptr into callback..."), data, len);	/* Send packet */
+		xmitres = __sip_xmit(dialog_ref(p, "passing dialog ptr into callback..."), data, len);	/* Send packet */
 		if (xmitres == XMIT_ERROR) {	/* Serious network trouble, no need to try again */
 			append_history(p, "XmitErr", "%s", fatal ? "(Critical)" : "(Non-critical)");
 			return AST_FAILURE;
-		} else
+		} else {
 			return AST_SUCCESS;
+		}
 	}
 
 	if (!(pkt = ast_calloc(1, sizeof(*pkt) + len + 1)))
@@ -4366,7 +4421,7 @@
 
 		/* Let's see if we can find the host in DNS. First try DNS SRV records,
 		   then hostname lookup */
-		/*! \todo Fix this function. When we ask SRC, we should check all transports 
+		/*! \todo Fix this function. When we ask for SRV, we should check all transports 
 			  In the future, we should first check NAPTR to find out transport preference
 		 */
 		hostn = peername;
@@ -4539,6 +4594,20 @@
 	
 }
 
+/*! \brief Destroy MWI subscription object */
+static void sip_subscribe_mwi_destroy(struct sip_subscription_mwi *mwi)
+{
+	if (mwi->call) {
+		mwi->call->mwi = NULL;
+		sip_destroy(mwi->call);
+	}
+	
+	AST_SCHED_DEL(sched, mwi->resub);
+	ast_string_field_free_memory(mwi);
+	ast_dnsmgr_release(mwi->dnsmgr);
+	ast_free(mwi);
+}
+
 /*! \brief Execute destruction of SIP dialog structure, release memory */
 static void __sip_destroy(struct sip_pvt *p, int lockowner, int lockdialoglist)
 {
@@ -4692,13 +4761,13 @@
 	/* incoming and outgoing affects the inUse counter */
 	case DEC_CALL_LIMIT:
 		/* Decrement inuse count if applicable */
-		if (inuse && ast_test_flag(&fup->flags[0], SIP_INC_COUNT)) {
+		if (inuse && *inuse > 0 && ast_test_flag(&fup->flags[0], SIP_INC_COUNT)) {
 			ast_atomic_fetchadd_int(inuse, -1);
 			ast_clear_flag(&fup->flags[0], SIP_INC_COUNT);
 		} else
 			*inuse = 0;
 		/* Decrement ringing count if applicable */
-		if (inringing && ast_test_flag(&fup->flags[0], SIP_INC_RINGING)) {
+		if (inringing && *inringing > 0 && ast_test_flag(&fup->flags[0], SIP_INC_RINGING)) {
 			ast_atomic_fetchadd_int(inringing, -1);
 			ast_clear_flag(&fup->flags[0], SIP_INC_RINGING);
 		}
@@ -4736,7 +4805,7 @@
 		break;
 
 	case DEC_CALL_RINGING:
-		if (inringing && ast_test_flag(&fup->flags[0], SIP_INC_RINGING)) {
+		if (inringing && *inringing > 0 && ast_test_flag(&fup->flags[0], SIP_INC_RINGING)) {
 			ast_atomic_fetchadd_int(inringing, -1);
 			ast_clear_flag(&fup->flags[0], SIP_INC_RINGING);
 		}
@@ -5688,9 +5757,9 @@
 }
 
 /*! \brief Reads one line of SIP message body */
-static char *get_body_by_line(const char *line, const char *name, int nameLen)
-{
-	if (!strncasecmp(line, name, nameLen) && line[nameLen] == '=')
+static char *get_body_by_line(const char *line, const char *name, int nameLen, char delimiter)
+{
+	if (!strncasecmp(line, name, nameLen) && line[nameLen] == delimiter)
 		return ast_skip_blanks(line + nameLen + 1);
 
 	return "";
@@ -5705,7 +5774,7 @@
 	int len = strlen(name);
 
 	while (*start < req->sdp_end) {
-		const char *r = get_body_by_line(req->line[(*start)++], name, len);
+		const char *r = get_body_by_line(req->line[(*start)++], name, len, '=');
 		if (r[0] != '\0')
 			return r;
 	}
@@ -5722,14 +5791,14 @@
 }
 
 /*! \brief Get a specific line from the message body */
-static char *get_body(struct sip_request *req, char *name) 
+static char *get_body(struct sip_request *req, char *name, char delimiter) 
 {
 	int x;
 	int len = strlen(name);
 	char *r;
 
 	for (x = 0; x < req->lines; x++) {
-		r = get_body_by_line(req->line[x], name, len);
+		r = get_body_by_line(req->line[x], name, len, delimiter);
 		if (r[0] != '\0')
 			return r;
 	}
@@ -6388,6 +6457,80 @@
 	reg->ocseq = INITIAL_CSEQ;
 	ASTOBJ_CONTAINER_LINK(&regl, reg); /* Add the new registry entry to the list */
 	registry_unref(reg, "unref the reg pointer");	/* release the reference given by ASTOBJ_INIT. The container has another reference */
+	return 0;
+}
+
+/*! \brief Parse mwi=> line in sip.conf and add to list */

[... 2635 lines stripped ...]



More information about the svn-commits mailing list