[svn-commits] file: branch file/netsock2 r97010 - in /team/file/netsock2: ./ apps/ build_to...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Jan 7 17:59:04 CST 2008


Author: file
Date: Mon Jan  7 17:59:03 2008
New Revision: 97010

URL: http://svn.digium.com/view/asterisk?view=rev&rev=97010
Log:
Merged revisions 96715-96717,96743,96776,96836,96858,96862,96885-96888,96933-96936,96987-96988 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

................
r96715 | russell | 2008-01-05 17:35:54 -0400 (Sat, 05 Jan 2008) | 3 lines

Add a note about changing modules.conf since another console channel driver is
now present that can not be used at the same time as chan_alsa or chan_oss.

................
r96716 | russell | 2008-01-05 18:04:08 -0400 (Sat, 05 Jan 2008) | 3 lines

Print out the name of a function being registered in color, just like the name
of applications when they get registered.

................
r96717 | russell | 2008-01-05 18:09:06 -0400 (Sat, 05 Jan 2008) | 15 lines

Now that the version.h file was getting properly regenerated every time the svn
revision changed, every module that used the version was getting rebuilt after
every svn update.  This severly annoyed me pretty quickly, so I have improved
the situation.

Now, instead of generating version.h, main/version.c is generated.  version.c
includes the version information, as well as a couple of API calls for modules
to retrieve the version.  So now, only version.c will get rebuilt, and the main
asterisk binary relinked, which is must faster than rebuilding http.c, manager.c,
asterisk.c, relinking the asterisk binary, chan_sip.c, func_version.c, res_agi ...

The only minor change in behavior here is that the version information reported by
chan_sip, for example, is the version of the Asterisk core, and not necessarily the
Asterisk version that the chan_sip module came from.

................
r96743 | russell | 2008-01-05 19:05:35 -0400 (Sat, 05 Jan 2008) | 4 lines

Convert this file over the new method of getting the Asterisk version.
(I don't have this building on this machine, so caio1982 on IRC is going to
 test it for me.  :) )

................
r96776 | rizzo | 2008-01-07 07:22:01 -0400 (Mon, 07 Jan 2008) | 4 lines

resolve a load-time problem avoiding a call to console_do_answer.
On passing, fix dialling from the keypad.


................
r96836 | rizzo | 2008-01-07 11:06:54 -0400 (Mon, 07 Jan 2008) | 4 lines

update comments to reflect reality (or at least planned behaviour).
minor code cleanups


................
r96858 | file | 2008-01-07 11:52:55 -0400 (Mon, 07 Jan 2008) | 6 lines

Move ModuleLoad and ModuleCheck manager commands from loader.c to manager.c. Previously they would get registered twice because of the way manager.c operates.
(closes issue #11699)
Reported by: caio1982
Patches:
      manager_module_commands1.diff uploaded by caio1982 (license 22)

................
r96862 | kpfleming | 2008-01-07 12:17:31 -0400 (Mon, 07 Jan 2008) | 2 lines

add a file-format driver for 16KHz signed linear... which may or may not work

................
r96885 | russell | 2008-01-07 12:42:42 -0400 (Mon, 07 Jan 2008) | 11 lines

Merged revisions 96884 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r96884 | russell | 2008-01-07 10:39:23 -0600 (Mon, 07 Jan 2008) | 3 lines

Don't crash if something happens when setting up an SMDI interface and it gets
destroyed before the SMDI port handling thread gets created.

........

................
r96886 | russell | 2008-01-07 12:59:04 -0400 (Mon, 07 Jan 2008) | 2 lines

Build the HTML version of the doc files for tarballs, as well

................
r96887 | russell | 2008-01-07 13:09:23 -0400 (Mon, 07 Jan 2008) | 3 lines

If the HTML documentation exists, install it in the static-http/docs directory
so that it can be viewed through the Asterisk http server if it is turned on.

................
r96888 | russell | 2008-01-07 13:15:11 -0400 (Mon, 07 Jan 2008) | 2 lines

Add a note about viewing the default set of documentation using the built-in http server

................
r96933 | russell | 2008-01-07 16:48:23 -0400 (Mon, 07 Jan 2008) | 18 lines

Merged revisions 96932 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

................
r96932 | russell | 2008-01-07 14:47:52 -0600 (Mon, 07 Jan 2008) | 10 lines

Merged revisions 96931 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r96931 | russell | 2008-01-07 14:46:22 -0600 (Mon, 07 Jan 2008) | 2 lines

Change misery.digium.com to pbx.digium.com

........

................

................
r96934 | mmichelson | 2008-01-07 17:04:09 -0400 (Mon, 07 Jan 2008) | 7 lines

Adding user-configurable TCP timeout settings to IMAP voicemail. This could
go a long way towards preventing unexplainable hangs experienced by people. In the
case of MWI hangs, this also will mean that the SIP port isn't blocked anymore.

(closes issue #11665, reported by yehavi)


................
r96935 | mmichelson | 2008-01-07 17:10:59 -0400 (Mon, 07 Jan 2008) | 4 lines

Document some weird casting magic that's necessary to interface
with the c-client


................
r96936 | qwell | 2008-01-07 17:12:33 -0400 (Mon, 07 Jan 2008) | 4 lines

Display a message if no config mappings are found with "core show config mappings".

Closes issue #11704, patch by kshumard.

................
r96987 | mmichelson | 2008-01-07 18:31:03 -0400 (Mon, 07 Jan 2008) | 3 lines

Explicitly make literal constants long where they are expected to be.


................
r96988 | rizzo | 2008-01-07 19:03:11 -0400 (Mon, 07 Jan 2008) | 5 lines

add support for cropping the keypad image while displaying it.
This way it can contain additional elements (e.g. fonts, buttons,
widgets) without having to use a zillion files to store them.


................

Added:
    team/file/netsock2/build_tools/make_version_c
      - copied unchanged from r96988, trunk/build_tools/make_version_c
    team/file/netsock2/formats/format_sln16.c
      - copied unchanged from r96988, trunk/formats/format_sln16.c
Removed:
    team/file/netsock2/build_tools/make_version_h
Modified:
    team/file/netsock2/   (props changed)
    team/file/netsock2/Makefile
    team/file/netsock2/UPGRADE.txt
    team/file/netsock2/apps/app_voicemail.c
    team/file/netsock2/build_tools/prep_tarball
    team/file/netsock2/channels/chan_sip.c
    team/file/netsock2/channels/console_gui.c
    team/file/netsock2/configs/extensions.conf.sample
    team/file/netsock2/configs/http.conf.sample
    team/file/netsock2/doc/tex/imapstorage.tex
    team/file/netsock2/funcs/func_version.c
    team/file/netsock2/include/asterisk/   (props changed)
    team/file/netsock2/main/   (props changed)
    team/file/netsock2/main/Makefile
    team/file/netsock2/main/asterisk.c
    team/file/netsock2/main/config.c
    team/file/netsock2/main/http.c
    team/file/netsock2/main/loader.c
    team/file/netsock2/main/manager.c
    team/file/netsock2/main/pbx.c
    team/file/netsock2/res/res_agi.c
    team/file/netsock2/res/res_smdi.c
    team/file/netsock2/res/snmp/agent.c

Propchange: team/file/netsock2/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Propchange: team/file/netsock2/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Mon Jan  7 17:59:03 2008
@@ -1,1 +1,1 @@
-/trunk:1-96694
+/trunk:1-97008

Modified: team/file/netsock2/Makefile
URL: http://svn.digium.com/view/asterisk/team/file/netsock2/Makefile?view=diff&rev=97010&r1=97009&r2=97010
==============================================================================
--- team/file/netsock2/Makefile (original)
+++ team/file/netsock2/Makefile Mon Jan  7 17:59:03 2008
@@ -372,7 +372,7 @@
 	@$(MAKE) $(PRINT_DIR) $(MOD_SUBDIRS_EMBED_LDFLAGS)
 	@$(MAKE) $(PRINT_DIR) $(MOD_SUBDIRS_EMBED_LIBS)
 
-$(SUBDIRS): include/asterisk/version.h include/asterisk/build.h include/asterisk/buildopts.h defaults.h makeopts.embed_rules
+$(SUBDIRS): main/version.c include/asterisk/build.h include/asterisk/buildopts.h defaults.h makeopts.embed_rules
 
 ifeq ($(findstring $(OSARCH), mingw32 cygwin ),)
     # Non-windows:
@@ -403,8 +403,8 @@
 	@cmp -s $@.tmp $@ || mv $@.tmp $@
 	@rm -f $@.tmp
 
-include/asterisk/version.h:
-	@build_tools/make_version_h > $@.tmp
+main/version.c:
+	@build_tools/make_version_c > $@.tmp
 	@cmp -s $@.tmp $@ || mv $@.tmp $@
 	@rm -f $@.tmp
 
@@ -427,7 +427,7 @@
 clean: $(SUBDIRS_CLEAN)
 	rm -f defaults.h
 	rm -f include/asterisk/build.h
-	rm -f include/asterisk/version.h
+	rm -f main/version.c
 	@$(MAKE) -C menuselect clean
 	cp -f .cleancount .lastclean
 
@@ -454,6 +454,12 @@
 	for x in static-http/*; do \
 		$(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/static-http ; \
 	done
+	if [ -d doc/tex/asterisk ] ; then \
+			mkdir -p $(DESTDIR)$(ASTDATADIR)/static-http/docs ; \
+			for n in doc/tex/asterisk/* ; do \
+				$(INSTALL) -m 644 $$n $(DESTDIR)$(ASTDATADIR)/static-http/docs ; \
+			done \
+	fi
 	mkdir -p $(DESTDIR)$(ASTDATADIR)/images
 	for x in images/*.jpg; do \
 		$(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/images ; \
@@ -695,7 +701,7 @@
 
 rpm: __rpm
 
-__rpm: include/asterisk/version.h include/asterisk/buildopts.h spec
+__rpm: main/version.c include/asterisk/buildopts.h spec
 	rm -rf /tmp/asterisk ; \
 	mkdir -p /tmp/asterisk/redhat/RPMS/i386 ; \
 	$(MAKE) DESTDIR=/tmp/asterisk install ; \
@@ -820,4 +826,4 @@
 asterisk.pdf:
 	$(MAKE) -C doc/tex asterisk.pdf
 
-.PHONY: menuselect main sounds clean dist-clean distclean all prereqs cleantest uninstall _uninstall uninstall-all pdf dont-optimize $(SUBDIRS_INSTALL) $(SUBDIRS_DIST_CLEAN) $(SUBDIRS_CLEAN) $(SUBDIRS_UNINSTALL) $(SUBDIRS) $(MOD_SUBDIRS_EMBED_LDSCRIPT) $(MOD_SUBDIRS_EMBED_LDFLAGS) $(MOD_SUBDIRS_EMBED_LIBS) include/asterisk/version.h
+.PHONY: menuselect main sounds clean dist-clean distclean all prereqs cleantest uninstall _uninstall uninstall-all pdf dont-optimize $(SUBDIRS_INSTALL) $(SUBDIRS_DIST_CLEAN) $(SUBDIRS_CLEAN) $(SUBDIRS_UNINSTALL) $(SUBDIRS) $(MOD_SUBDIRS_EMBED_LDSCRIPT) $(MOD_SUBDIRS_EMBED_LDFLAGS) $(MOD_SUBDIRS_EMBED_LIBS) main/version.c

Modified: team/file/netsock2/UPGRADE.txt
URL: http://svn.digium.com/view/asterisk/team/file/netsock2/UPGRADE.txt?view=diff&rev=97010&r1=97009&r2=97010
==============================================================================
--- team/file/netsock2/UPGRADE.txt (original)
+++ team/file/netsock2/UPGRADE.txt Mon Jan  7 17:59:03 2008
@@ -136,6 +136,13 @@
   to be compatible with settings in sip.conf. The "tos" and "cos" configuration
   is deprecated and will stop working in the next release of Asterisk.
 
+* Console: A new console channel driver, chan_console, has been added to Asterisk.
+  This new module can not be loaded at the same time as chan_alsa or chan_oss.  The
+  default modules.conf only loads one of them (chan_oss by default).  So, unless you
+  have modified your modules.conf to not use the autoload option, then you will need
+  to modify modules.conf to add another "noload" line to ensure that only one of
+  these three modules gets loaded.
+
 Configuration:
 
 * pbx_dundi.c: tos parameter changed to use new values. Old values like lowdelay,

Modified: team/file/netsock2/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/file/netsock2/apps/app_voicemail.c?view=diff&rev=97010&r1=97009&r2=97010
==============================================================================
--- team/file/netsock2/apps/app_voicemail.c (original)
+++ team/file/netsock2/apps/app_voicemail.c Mon Jan  7 17:59:03 2008
@@ -8213,6 +8213,34 @@
 			ast_copy_string(greetingfolder, imapfolder, sizeof(greetingfolder));
 		}
 
+		/* There is some very unorthodox casting done here. This is due
+		 * to the way c-client handles the argument passed in. It expects a 
+		 * void pointer and casts the pointer directly to a long without
+		 * first dereferencing it. */
+		if ((val = ast_variable_retrieve(cfg, "general", "imapreadtimeout"))) {
+			mail_parameters(NIL, SET_READTIMEOUT, (void *) (atol(val)));
+		} else {
+			mail_parameters(NIL, SET_READTIMEOUT, (void *) 60L);
+		}
+
+		if ((val = ast_variable_retrieve(cfg, "general", "imapwritetimeout"))) {
+			mail_parameters(NIL, SET_WRITETIMEOUT, (void *) (atol(val)));
+		} else {
+			mail_parameters(NIL, SET_WRITETIMEOUT, (void *) 60L);
+		}
+
+		if ((val = ast_variable_retrieve(cfg, "general", "imapopentimeout"))) {
+			mail_parameters(NIL, SET_OPENTIMEOUT, (void *) (atol(val)));
+		} else {
+			mail_parameters(NIL, SET_OPENTIMEOUT, (void *) 60L);
+		}
+
+		if ((val = ast_variable_retrieve(cfg, "general", "imapclosetimeout"))) {
+			mail_parameters(NIL, SET_CLOSETIMEOUT, (void *) (atol(val)));
+		} else {
+			mail_parameters(NIL, SET_CLOSETIMEOUT, (void *) 60L);
+		}
+
 #endif
 		/* External voicemail notify application */
 		if ((val = ast_variable_retrieve(cfg, "general", "externnotify"))) {

Modified: team/file/netsock2/build_tools/prep_tarball
URL: http://svn.digium.com/view/asterisk/team/file/netsock2/build_tools/prep_tarball?view=diff&rev=97010&r1=97009&r2=97010
==============================================================================
--- team/file/netsock2/build_tools/prep_tarball (original)
+++ team/file/netsock2/build_tools/prep_tarball Mon Jan  7 17:59:03 2008
@@ -10,4 +10,4 @@
 
 VERSION=`cat .version`
 sed -i -e "s/ASTERISKVERSION/${VERSION}/" doc/tex/asterisk.tex
-cd doc/tex && rubber --pdf asterisk.tex
+cd doc/tex && rubber --pdf asterisk.tex && latex2html asterisk.tex

Modified: team/file/netsock2/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/file/netsock2/channels/chan_sip.c?view=diff&rev=97010&r1=97009&r2=97010
==============================================================================
--- team/file/netsock2/channels/chan_sip.c (original)
+++ team/file/netsock2/channels/chan_sip.c Mon Jan  7 17:59:03 2008
@@ -18371,8 +18371,8 @@
 	global_directrtpsetup = FALSE;		/* Experimental feature, disabled by default */
 	global_alwaysauthreject = 0;
 	global_allowsubscribe = FALSE;
-	snprintf(global_useragent, sizeof(global_useragent), "%s %s", DEFAULT_USERAGENT, ASTERISK_VERSION);
-	snprintf(global_sdpsession, sizeof(global_sdpsession), "%s %s", DEFAULT_SDPSESSION, ASTERISK_VERSION);
+	snprintf(global_useragent, sizeof(global_useragent), "%s %s", DEFAULT_USERAGENT, ast_get_version());
+	snprintf(global_sdpsession, sizeof(global_sdpsession), "%s %s", DEFAULT_SDPSESSION, ast_get_version());
 	snprintf(global_sdpowner, sizeof(global_sdpowner), "%s", DEFAULT_SDPOWNER);
 	ast_copy_string(default_notifymime, DEFAULT_NOTIFYMIME, sizeof(default_notifymime));
 	ast_copy_string(global_realm, S_OR(ast_config_AST_SYSTEM_NAME, DEFAULT_REALM), sizeof(global_realm));

Modified: team/file/netsock2/channels/console_gui.c
URL: http://svn.digium.com/view/asterisk/team/file/netsock2/channels/console_gui.c?view=diff&rev=97010&r1=97009&r2=97010
==============================================================================
--- team/file/netsock2/channels/console_gui.c (original)
+++ team/file/netsock2/channels/console_gui.c Mon Jan  7 17:59:03 2008
@@ -2,6 +2,37 @@
  * GUI for console video.
  * The routines here are in charge of loading the keypad and handling events.
  * $Revision$
+ */
+
+/*
+ * GUI layout, structure and management
+ 
+For the GUI we use SDL to create a large surface (gui->screen)
+containing tree sections: remote video on the left, local video
+on the right, and the keypad with all controls and text windows
+in the center.
+The central section is built using an image for the skin, fonts and
+other GUI elements.  Comments embedded in the image to indicate to
+what function each area is mapped to.
+
+Mouse and keyboard events are detected on the whole surface, and
+handled differently according to their location:
+
+- drag on the local video window are used to move the captured
+  area (in the case of X11 grabber) or the picture-in-picture
+  location (in case of camera included on the X11 grab).
+- click on the keypad are mapped to the corresponding key;
+- drag on some keypad areas (sliders etc.) are mapped to the
+  corresponding functions;
+- keystrokes are used as keypad functions, or as text input
+  if we are in text-input mode.
+
+Configuration options control the appeareance of the gui:
+
+    keypad = /tmp/phone.jpg	; the skin
+    keypad_font = /tmp/font.ttf	; the font to use for output (XXX deprecated)
+
+ *
  */
 
 #include "asterisk.h"
@@ -11,11 +42,10 @@
 #include "asterisk/utils.h"	/* ast_calloc and ast_realloc */
 #include <math.h>		/* sqrt */
 
-/* we support 3 regions in the GUI */
+/* We use 3 'windows' in the GUI */
 enum { WIN_LOCAL, WIN_REMOTE, WIN_KEYPAD, WIN_MAX };
 
-#ifndef HAVE_SDL
-/* stubs if we don't have any sdl */
+#ifndef HAVE_SDL	/* stubs if we don't have any sdl */
 static void show_frame(struct video_desc *env, int out)	{}
 static void sdl_setup(struct video_desc *env)		{}
 static struct gui_info *cleanup_sdl(struct gui_info *gui)	{ return NULL; }
@@ -48,7 +78,21 @@
 };
 #define GUI_BUFFER_LEN 256			/* buffer lenght used for input buffers */
 
-struct keypad_entry;	/* defined in console_gui.c */
+/* Where do we send the keyboard/keypad output */
+enum kb_output {
+	KO_NONE,
+	KO_INPUT,	/* the local input window */
+	KO_DIALED,	/* the 'dialed number' window */
+};
+
+enum drag_window {	/* which window are we dragging */
+	DRAG_NONE,
+	DRAG_LOCAL,	/* local video */
+	DRAG_REMOTE,	/* remote video */
+	DRAG_DIALED,	/* dialed number */
+	DRAG_INPUT,	/* input window */
+	DRAG_MESSAGE,	/* message window */
+};
 
 /*! \brief info related to the gui: button status, mouse coords, etc. */
 struct gui_info {
@@ -56,8 +100,8 @@
 	int			inbuf_pos;	/* next free position in inbuf */
 	char			msgbuf[GUI_BUFFER_LEN];	/* buffer for text-message buffer */
 	int			msgbuf_pos;	/* next free position in msgbuf */
-	int			text_mode;	/* switch to-dial and text-message mode */
-	int			drag_mode;	/* switch phone and drag-source mode */
+	enum kb_output		kb_output;	/* where the keyboard output goes */
+	enum drag_window	drag_window;	/* which window are we dragging */
 	int			x_drag;		/* x coordinate where the drag starts */
 	int			y_drag;		/* y coordinate where the drag starts */
 #ifdef HAVE_SDL_TTF
@@ -67,7 +111,11 @@
 	SDL_Surface             *screen;	/* the main window */
 
 	int			outfd;		/* fd for output */
-	SDL_Surface		*keypad;	/* the pixmap for the keypad */
+	SDL_Surface		*keypad;	/* the skin for the keypad */
+
+	SDL_Rect		kp_rect;	/* portion of the skin to display - default all */
+
+	/* variable-size array mapping keypad regions to functions */
 	int kp_size, kp_used;
 	struct keypad_entry *kp;
 
@@ -171,73 +219,43 @@
 }
 
 /*
- * GUI layout, structure and management
- *
-
-For the GUI we use SDL to create a large surface (gui->screen)
-containing tree sections: remote video on the left, local video
-on the right, and the keypad with all controls and text windows
-in the center.
-The central section is built using two images: one is the skin,
-the other one is a mask where the sensitive areas of the skin
-are colored in different grayscale levels according to their
-functions. The mapping between colors and function is defined
-in the 'enum pixel_value' below.
-
-Mouse and keyboard events are detected on the whole surface, and
-handled differently according to their location, as follows:
-
-- drag on the local video window are used to move the captured
-  area (in the case of X11 grabber) or the picture-in-picture
-  location (in case of camera included on the X11 grab).
-- click on the keypad are mapped to the corresponding key;
-- drag on some keypad areas (sliders etc.) are mapped to the
-  corresponding functions;
-- keystrokes are used as keypad functions, or as text input
-  if we are in text-input mode.
-
-To manage these behavior we use two status variables,
-that defines if keyboard events should be redirect to dialing functions
-or to write message functions, and if mouse events should be used
-to implement keypad functionalities or to drag the capture device.
-
-Configuration options control the appeareance of the gui:
-
-    keypad = /tmp/phone.jpg		; the keypad on the screen
-    keypad_font = /tmp/font.ttf		; the font to use for output
-
- *
- */
-
-/* enumerate for the pixel value. 0..127 correspond to ascii chars */
-enum pixel_value {
+ * Identifiers for regions of the main window.
+ * Values between 0 and 127 correspond to ASCII characters.
+ * The corresponding strings to be used in the skin comment section
+ * are defined in gui_key_map.
+ */
+enum skin_area {
 	/* answer/close functions */
 	KEY_PICK_UP = 128,
 	KEY_HANG_UP = 129,
 
-	/* other functions */
 	KEY_MUTE = 130,
 	KEY_AUTOANSWER = 131,
 	KEY_SENDVIDEO = 132,
 	KEY_LOCALVIDEO = 133,
 	KEY_REMOTEVIDEO = 134,
 	KEY_WRITEMESSAGE = 135,
-	KEY_GUI_CLOSE = 136,		/* close gui */
-
-	/* other areas within the keypad */
-	KEY_DIGIT_BACKGROUND = 255,
+	KEY_FLASH = 136,
+	KEY_GUI_CLOSE = 199,		/* close gui */
+
+	/* regions of the skin - active area, fonts, etc. */
+	KEY_KEYPAD = 200,		/* the keypad - default to the whole image */
+	KEY_FONT = 201,		/* the font */
 
 	/* areas outside the keypad - simulated */
-	KEY_OUT_OF_KEYPAD = 251,
-	KEY_REM_DPY = 252,
-	KEY_LOC_DPY = 253,
+	KEY_OUT_OF_KEYPAD = 241,
+	KEY_REM_DPY = 242,
+	KEY_LOC_DPY = 243,
+	KEY_RESET = 253,		/* the 'reset' keyword */
+	KEY_NONE = 254,			/* invalid area */
+	KEY_DIGIT_BACKGROUND = 255,	/* other areas within the keypad */
 };
 
 /*
  * Handlers for the various keypad functions
  */
 
-/*! \brief append a character, or reset if '\0' */
+/*! \brief append a character, or reset if  c = '\0' */
 static void append_char(char *str, int *str_pos, const char c)
 {
 	int i = *str_pos;
@@ -251,6 +269,13 @@
 	*str_pos = i;
 }
 
+/*! \brief append string to a buffer */
+static void append_string(char *str, int *str_pos, const char *s)
+{
+	while (*s)
+		append_char(str, str_pos, *s++);
+}
+
 /* accumulate digits, possibly call dial if in connected mode */
 static void keypad_digit(struct video_desc *env, int digit)
 {	
@@ -262,15 +287,6 @@
 	} else {		/* no call, accumulate digits */
 		append_char(env->gui->inbuf, &env->gui->inbuf_pos, digit);
 	}
-}
-
-/* this is a wrapper for actions that are available through the cli */
-/* TODO append arg to command and send the resulting string as cli command */
-static void keypad_send_command(struct video_desc *env, char *command)
-{	
-	ast_log(LOG_WARNING, "keypad_send_command(%s) called\n", command);
-	ast_cli_command(env->gui->outfd, command);
-	return;
 }
 
 /* function used to toggle on/off the status of some variables */
@@ -316,12 +332,12 @@
 	ast_log(LOG_WARNING, "keypad_pick_up called\n");
 
 	if (env->owner) { /* someone is calling us, just answer */
-		console_do_answer(-1);
+		ast_cli_command(gui->outfd, "console answer");
 	} else if (gui->inbuf_pos) { /* we have someone to call */
 		ast_cli_command(gui->outfd, gui->inbuf);
 	}
-
 	append_char(gui->inbuf, &gui->inbuf_pos, '\0'); /* clear buffer */
+	append_string(gui->inbuf, &gui->inbuf_pos, "console dial ");
 }
 
 #if 0 /* still unused */
@@ -382,7 +398,7 @@
  *
  * x, y are referred to the upper left corner of the main SDL window.
  */
-static void handle_button_event(struct video_desc *env, SDL_MouseButtonEvent button)
+static void handle_mousedown(struct video_desc *env, SDL_MouseButtonEvent button)
 {
 	uint8_t index = KEY_OUT_OF_KEYPAD;	/* the key or region of the display we clicked on */
 	struct gui_info *gui = env->gui;
@@ -391,8 +407,8 @@
 	ast_log(LOG_WARNING, "event %d %d have %d/%d regions at %p\n",
 		button.x, button.y, gui->kp_used, gui->kp_size, gui->kp);
 #endif
-	/* for each click we come back in normal mode */
-	gui->text_mode = 0;
+	/* for each mousedown we end previous drag */
+	gui->drag_window = DRAG_NONE;
 
 	/* define keypad boundary */
 	if (button.x < env->rem_dpy.w)
@@ -436,11 +452,6 @@
 		break;
 	case KEY_REMOTEVIDEO:
 		break;
-	case KEY_WRITEMESSAGE:
-		/* goes in text-mode */
-		env->gui->text_mode = 1;
-		break;
-
 
 	/* press outside the keypad. right increases size, center decreases, left drags */
 	case KEY_LOC_DPY:
@@ -451,7 +462,7 @@
 				* and switch in drag mode */
 				env->gui->x_drag = button.x;
 				env->gui->y_drag = button.y;
-				env->gui->drag_mode = 1;
+				env->gui->drag_window = DRAG_LOCAL;
 			}
 			break;
 		} else {
@@ -479,24 +490,31 @@
  * depending on the text_mode variable value.
  *
  * key is the SDLKey structure corresponding to the key pressed.
+ * XXX needs to be cleaned up when handling returns etc.
  */
 static void handle_keyboard_input(struct video_desc *env, SDLKey key)
 {
 	struct gui_info *gui = env->gui;
-	if (gui->text_mode) {
+	switch (gui->kb_output) {
+	default:
+		break;
+	case KO_INPUT:
 		/* append in the text-message buffer */
 		if (key == SDLK_RETURN) {
 			/* send the text message and return in normal mode */
-			gui->text_mode = 0;
-			keypad_send_command(env, "send text");
+			gui->kb_output = KO_NONE;
+			ast_cli_command(gui->outfd, gui->msgbuf);
+			append_char(gui->msgbuf, &gui->msgbuf_pos, '\0');
 		} else {
 			/* accumulate the key in the message buffer */
 			append_char(gui->msgbuf, &gui->msgbuf_pos, key);
 		}
-	}
-	else {
+		break;
+	case KO_DIALED:
+		/* XXX actually, enter should be a 'console dial ' */
 		/* append in the dial buffer */
 		append_char(gui->inbuf, &gui->inbuf_pos, key);
+		break;
 	}
 
 	return;
@@ -565,16 +583,16 @@
 				handle_keyboard_input(env, ev[i].key.keysym.sym);
 				break;
 			case SDL_MOUSEMOTION:
-				if (gui->drag_mode != 0)
+				if (gui->drag_window == DRAG_LOCAL)
 					move_capture_source(env, ev[i].motion.x, ev[i].motion.y);
 				break;
 			case SDL_MOUSEBUTTONDOWN:
-				handle_button_event(env, ev[i].button);
+				handle_mousedown(env, ev[i].button);
 				break;
 			case SDL_MOUSEBUTTONUP:
-				if (gui->drag_mode != 0) {
+				if (gui->drag_window == DRAG_LOCAL) {
 					move_capture_source(env, ev[i].button.x, ev[i].button.y);
-					gui->drag_mode = 0;
+					gui->drag_window = DRAG_NONE;
 				}
 				break;
 			}
@@ -594,7 +612,7 @@
 	}
 }
 
-static SDL_Surface *get_keypad(const char *file)
+static SDL_Surface *load_image(const char *file)
 {
 	SDL_Surface *temp;
  
@@ -620,12 +638,13 @@
 	if (gui == NULL)
 		return NULL;
 	/* initialize keypad status */
-	gui->text_mode = 0;
-	gui->drag_mode = 0;
+	gui->kb_output = KO_DIALED;
+	gui->drag_window = DRAG_NONE;
 	gui->outfd = -1;
 
 	/* initialize keyboard buffer */
 	append_char(gui->inbuf, &gui->inbuf_pos, '\0');
+	append_string(gui->inbuf, &gui->inbuf_pos, "console dial ");
 	append_char(gui->msgbuf, &gui->msgbuf_pos, '\0');
 
 	keypad_setup(gui, keypad_file);
@@ -685,7 +704,7 @@
 
 	if (gui->keypad)
 		return;
-	gui->keypad = get_keypad(kp_file);
+	gui->keypad = load_image(kp_file);
 	if (!gui->keypad)
 		return;
 	/* now try to read the keymap from the file. */
@@ -772,8 +791,13 @@
 		goto no_sdl;
 
 	if (gui->keypad) {
-		kp_w = gui->keypad->w;
-		kp_h = gui->keypad->h;
+		if (gui->kp_rect.w > 0 && gui->kp_rect.h > 0) {
+			kp_w = gui->kp_rect.w;
+			kp_h = gui->kp_rect.h;
+		} else {
+			kp_w = gui->keypad->w;
+			kp_h = gui->keypad->h;
+		}
 	}
 #define BORDER	5	/* border around our windows */
 	maxw = env->rem_dpy.w + env->loc_dpy.w + kp_w;
@@ -800,11 +824,12 @@
 	 */
 	if (gui->keypad) {
 		struct SDL_Rect *dest = &gui->win[WIN_KEYPAD].rect;
+		struct SDL_Rect *src = (gui->kp_rect.w > 0 && gui->kp_rect.h > 0) ? & gui->kp_rect : NULL;
 		dest->x = 2*BORDER + env->rem_dpy.w;
 		dest->y = BORDER;
-		dest->w = gui->keypad->w;
-		dest->h = gui->keypad->h;
-		SDL_BlitSurface(gui->keypad, NULL, gui->screen, dest);
+		dest->w = kp_w;
+		dest->h = kp_h;
+		SDL_BlitSurface(gui->keypad, src, gui->screen, dest);
 		SDL_UpdateRects(gui->screen, 1, dest);
 	}
 	return;
@@ -856,13 +881,30 @@
         {"HANG_UP",	KEY_HANG_UP },
         {"HANGUP",	KEY_HANG_UP },
         {"MUTE",	KEY_MUTE },
+        {"FLASH",	KEY_FLASH },
         {"AUTOANSWER",	KEY_AUTOANSWER },
         {"SENDVIDEO",	KEY_SENDVIDEO },
         {"LOCALVIDEO",	KEY_LOCALVIDEO },
         {"REMOTEVIDEO",	KEY_REMOTEVIDEO },
         {"WRITEMESSAGE", KEY_WRITEMESSAGE },
         {"GUI_CLOSE",	KEY_GUI_CLOSE },
+        {"KEYPAD",	KEY_KEYPAD },	/* x0 y0 w h - active area of the keypad */
+        {"FONT",	KEY_FONT },	/* x0 yo w h rows cols - location and format of the font */
         {NULL, 0 } };
+
+static int gui_map_token(const char *s)
+{
+	/* map the string into token to be returned */
+	int i = atoi(s);
+	struct _s_k *p;
+	if (i > 0 || s[1] == '\0')	/* numbers or single characters */
+		return (i > 9) ? i : s[0];
+	for (p = gui_key_map; p->s; p++) {
+		if (!strcasecmp(p->s, s))
+			return p->k;
+	}
+	return KEY_NONE;	/* not found */
+}
 
 /*! \brief read a keypad entry line in the format
  *	reset
@@ -877,35 +919,51 @@
 {
 	struct keypad_entry e;
 	char s1[16], s2[16];
-	int i, ret = 0;
+	int i, ret = 0; /* default, error */
 
 	if (gui == NULL || val == NULL)
 		return 0;
 
+	s1[0] = s2[0] = '\0';
 	bzero(&e, sizeof(e));
 	i = sscanf(val, "%14s %14s %d %d %d %d %d",
                 s1, s2, &e.x0, &e.y0, &e.x1, &e.y1, &e.h);
 
+	e.c = gui_map_token(s1);
+	if (e.c == KEY_NONE)
+		return 0;	/* nothing found */
 	switch (i) {
 	default:
 		break;
 	case 1:	/* only "reset" is allowed */
-		if (strcasecmp(s1, "reset"))	/* invalid */
+		if (e.c != KEY_RESET)
 			break;
-		if (gui->kp) {
+		if (gui->kp)
 			gui->kp_used = 0;
-		}
-		break;
-	case 5: /* token circle xc yc diameter */
+		break;
+	case 5:
+		if (e.c == KEY_KEYPAD) {	/* active keypad area */
+			gui->kp_rect.x = atoi(s2);
+			gui->kp_rect.y = e.x0;
+			gui->kp_rect.w = e.y0;
+			gui->kp_rect.h = e.x1;
+			break;
+		}
 		if (strcasecmp(s2, "circle"))	/* invalid */
 			break;
+		/* token circle xc yc diameter */
 		e.h = e.x1;
 		e.y1 = e.y0;	/* map radius in x1 y1 */
 		e.x1 = e.x0 + e.h;	/* map radius in x1 y1 */
 		e.x0 = e.x0 - e.h;	/* map radius in x1 y1 */
 		/* fallthrough */
 
-	case 7: /* token circle|rect x0 y0 x1 y1 h */
+	case 7:
+		if (e.c == KEY_FONT) {	/* font - x0 y0 w h rows cols */
+			ast_log(LOG_WARNING, "font not supported yet\n");
+			break;
+		}
+		/* token circle|rect x0 y0 x1 y1 h */
 		if (e.x1 < e.x0 || e.h <= 0) {
 			ast_log(LOG_WARNING, "error in coordinates\n");
 			e.type = 0;
@@ -926,23 +984,6 @@
 	// ast_log(LOG_WARNING, "reading [%s] returns %d %d\n", val, i, ret);
 	if (ret == 0)
 		return 0;
-	/* map the string into token to be returned */
-	i = atoi(s1);
-	if (i > 0 || s1[1] == '\0')	/* numbers or single characters */
-		e.c = (i > 9) ? i : s1[0];
-	else {
-		struct _s_k *p;
-		for (p = gui_key_map; p->s; p++) {
-			if (!strcasecmp(p->s, s1)) {
-				e.c = p->k;
-				break;
-			}
-		}
-	}
-	if (e.c == 0) {
-		ast_log(LOG_WARNING, "missing token\n");
-		return 0;
-	}
 	if (gui->kp_size == 0) {
 		gui->kp = ast_calloc(10, sizeof(e));
 		if (gui->kp == NULL) {

Modified: team/file/netsock2/configs/extensions.conf.sample
URL: http://svn.digium.com/view/asterisk/team/file/netsock2/configs/extensions.conf.sample?view=diff&rev=97010&r1=97009&r2=97010
==============================================================================
--- team/file/netsock2/configs/extensions.conf.sample (original)
+++ team/file/netsock2/configs/extensions.conf.sample Mon Jan  7 17:59:03 2008
@@ -487,7 +487,7 @@
 ; Asterisk demo.
 ;
 exten => 500,1,Playback(demo-abouttotry); Let them know what's going on
-exten => 500,n,Dial(IAX2/guest at misery.digium.com/s at default)	; Call the Asterisk demo
+exten => 500,n,Dial(IAX2/guest at pbx.digium.com/s at default)	; Call the Asterisk demo
 exten => 500,n,Playback(demo-nogo)	; Couldn't connect to the demo site
 exten => 500,n,Goto(s,6)		; Return to the start over message.
 

Modified: team/file/netsock2/configs/http.conf.sample
URL: http://svn.digium.com/view/asterisk/team/file/netsock2/configs/http.conf.sample?view=diff&rev=97010&r1=97009&r2=97010
==============================================================================
--- team/file/netsock2/configs/http.conf.sample (original)
+++ team/file/netsock2/configs/http.conf.sample Mon Jan  7 17:59:03 2008
@@ -1,6 +1,15 @@
 ;
 ; Asterisk Builtin mini-HTTP server
 ;
+;
+; Note about Asterisk documentation:
+;   If Asterisk was installed from a tarball, then the HTML documentation should
+;   be installed in the static-http/docs directory which is
+;   (/var/lib/asterisk/static-http/docs) on linux by default.  If the Asterisk
+;   HTTP server is enabled in this file by setting the "enabled", "bindaddr",
+;   and "bindport" options, then you should be able to view the documentation
+;   remotely by browsing to:
+;       http://<server_ip>:<bindport/asterisk/static/docs/index.html
 ;
 [general]
 ;

Modified: team/file/netsock2/doc/tex/imapstorage.tex
URL: http://svn.digium.com/view/asterisk/team/file/netsock2/doc/tex/imapstorage.tex?view=diff&rev=97010&r1=97009&r2=97010
==============================================================================
--- team/file/netsock2/doc/tex/imapstorage.tex (original)
+++ team/file/netsock2/doc/tex/imapstorage.tex Mon Jan  7 17:59:03 2008
@@ -80,6 +80,10 @@
 expungeonhangup=<yes or no>
 authuser=<username>
 authpassword=<password>
+opentimeout=<TCP open timeout in seconds>
+closetimeout=<TCP close timeout in seconds>
+readtimeout=<TCP read timeout in seconds>
+writetimeout=<TCP write timeout in seconds>
 \end{verbatim}
 \end{astlisting}
 

Modified: team/file/netsock2/funcs/func_version.c
URL: http://svn.digium.com/view/asterisk/team/file/netsock2/funcs/func_version.c?view=diff&rev=97010&r1=97009&r2=97010
==============================================================================
--- team/file/netsock2/funcs/func_version.c (original)
+++ team/file/netsock2/funcs/func_version.c Mon Jan  7 17:59:03 2008
@@ -34,39 +34,35 @@
 #include "asterisk/version.h"
 #include "asterisk/build.h"
 
-#define STRING_IT(vernum) STRING_IT2(vernum)
-#define STRING_IT2(vernum) #vernum
-
 static int acf_version_exec(struct ast_channel *chan, const char *cmd,
 			 char *parse, char *buffer, size_t buflen)
 {
-	char *response_char = ASTERISK_VERSION;
+	const char *response_char = ast_get_version();
 	AST_DECLARE_APP_ARGS(args,
-			     AST_APP_ARG(info);
+		AST_APP_ARG(info);
 	);
 
 	AST_STANDARD_APP_ARGS(args, parse);
 
 	if (!ast_strlen_zero(args.info) ) {
-		if (strcasecmp(args.info,"ASTERISK_VERSION_NUM") == 0)
-			response_char = STRING_IT(ASTERISK_VERSION_NUM);
-		else if (strcasecmp(args.info,"BUILD_USER") == 0)
+		if (!strcasecmp(args.info,"ASTERISK_VERSION_NUM"))
+			response_char = ast_get_version_num();
+		else if (!strcasecmp(args.info,"BUILD_USER"))
 			response_char = BUILD_USER;
-		else if (strcasecmp(args.info,"BUILD_HOSTNAME") == 0)
+		else if (!strcasecmp(args.info,"BUILD_HOSTNAME"))
 			response_char = BUILD_HOSTNAME;
-		else if (strcasecmp(args.info,"BUILD_MACHINE") == 0)
+		else if (!strcasecmp(args.info,"BUILD_MACHINE"))
 			response_char = BUILD_MACHINE;
-		else if (strcasecmp(args.info,"BUILD_KERNEL") == 0)
+		else if (!strcasecmp(args.info,"BUILD_KERNEL"))
 			response_char = BUILD_KERNEL;
-		else if (strcasecmp(args.info,"BUILD_OS") == 0)
+		else if (!strcasecmp(args.info,"BUILD_OS"))
 			response_char = BUILD_OS;
-		else if (strcasecmp(args.info,"BUILD_DATE") == 0)
+		else if (!strcasecmp(args.info,"BUILD_DATE"))
 			response_char = BUILD_DATE;
-
 	}
 
+	ast_debug(1, "VERSION returns %s result, given %s argument\n", response_char, args.info);
 
-	ast_debug(1, "VERSION returns %s result, given %s argument\n", response_char, args.info);
 	snprintf(buffer, buflen, "%s", response_char);
 
 	return 0;

Propchange: team/file/netsock2/include/asterisk/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Mon Jan  7 17:59:03 2008
@@ -1,4 +1,3 @@
 build.h
-version.h
 buildopts.h
 autoconfig.h

Propchange: team/file/netsock2/main/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Mon Jan  7 17:59:03 2008
@@ -2,3 +2,4 @@
 *.s
 asterisk
 *.d
+version.c

Modified: team/file/netsock2/main/Makefile
URL: http://svn.digium.com/view/asterisk/team/file/netsock2/main/Makefile?view=diff&rev=97010&r1=97009&r2=97010
==============================================================================
--- team/file/netsock2/main/Makefile (original)
+++ team/file/netsock2/main/Makefile Mon Jan  7 17:59:03 2008
@@ -29,7 +29,7 @@
 	netsock.o slinfactory.o ast_expr2.o ast_expr2f.o \
 	cryptostub.o sha1.o http.o fixedjitterbuf.o abstract_jb.o \
 	strcompat.o threadstorage.o dial.o event.o adsistub.o audiohook.o \
-	astobj2.o hashtab.o global_datastores.o netsock2.o $(RESAMPLE_OBJS)
+	astobj2.o hashtab.o global_datastores.o netsock2.o $(RESAMPLE_OBJS) version.o
 
 # we need to link in the objects statically, not as a library, because
 # otherwise modules will not have them available if none of the static

Modified: team/file/netsock2/main/asterisk.c
URL: http://svn.digium.com/view/asterisk/team/file/netsock2/main/asterisk.c?view=diff&rev=97010&r1=97009&r2=97010
==============================================================================
--- team/file/netsock2/main/asterisk.c (original)
+++ team/file/netsock2/main/asterisk.c Mon Jan  7 17:59:03 2008
@@ -135,7 +135,7 @@
 
 /*! \brief Welcome message when starting a CLI interface */
 #define WELCOME_MESSAGE \
-    ast_verbose("Asterisk " ASTERISK_VERSION ", Copyright (C) 1999 - 2007 Digium, Inc. and others.\n" \
+    ast_verbose("Asterisk %s, Copyright (C) 1999 - 2007 Digium, Inc. and others.\n" \
                 "Created by Mark Spencer <markster at digium.com>\n" \
                 "Asterisk comes with ABSOLUTELY NO WARRANTY; type 'core show warranty' for details.\n" \
                 "This is free software, with components licensed under the GNU General Public\n" \
@@ -143,7 +143,7 @@
                 "certain conditions. Type 'core show license' for details.\n" \
                 "=========================================================================\n" \
                 "NOTE: This is a development version of Asterisk, and should not be used in\n" \
-                "production installations.\n");
+                "production installations.\n", ast_get_version());
 
 /*! \defgroup main_options Main Configuration Options
  * \brief Main configuration options from asterisk.conf or OS command line on starting Asterisk.
@@ -394,7 +394,7 @@
 
 	ast_cli(a->fd, "\nPBX Core settings\n");
 	ast_cli(a->fd, "-----------------\n");
-	ast_cli(a->fd, "  Version:                     %s\n", "" ASTERISK_VERSION "" );
+	ast_cli(a->fd, "  Version:                     %s\n", ast_get_version());
 	if (option_maxcalls)
 		ast_cli(a->fd, "  Max. calls:                  %d (Current %d)\n", option_maxcalls, ast_active_channels());
 	else
@@ -980,7 +980,7 @@
 	
 	if (gethostname(hostname, sizeof(hostname)-1))
 		ast_copy_string(hostname, "<Unknown>", sizeof(hostname));
-	snprintf(tmp, sizeof(tmp), "%s/%ld/%s\n", hostname, (long)ast_mainpid, ASTERISK_VERSION);
+	snprintf(tmp, sizeof(tmp), "%s/%ld/%s\n", hostname, (long)ast_mainpid, ast_get_version());
 	fdprint(con->fd, tmp);
 	for (;;) {
 		fds[0].fd = con->fd;
@@ -1515,7 +1515,7 @@
 	if (a->argc != 3)
 		return CLI_SHOWUSAGE;
 	ast_cli(a->fd, "Asterisk %s built by %s @ %s on a %s running %s on %s\n",
-		ASTERISK_VERSION, ast_build_user, ast_build_hostname,
+		ast_get_version(), ast_build_user, ast_build_hostname,
 		ast_build_machine, ast_build_os, ast_build_date);
 	return CLI_SUCCESS;
 }
@@ -2387,12 +2387,12 @@
 
 static int show_version(void)
 {
-	printf("Asterisk " ASTERISK_VERSION "\n");
+	printf("Asterisk %s\n", ast_get_version());
 	return 0;
 }
 
 static int show_cli_help(void) {
-	printf("Asterisk " ASTERISK_VERSION ", Copyright (C) 1999 - 2007, Digium, Inc. and others.\n");
+	printf("Asterisk %s, Copyright (C) 1999 - 2007, Digium, Inc. and others.\n", ast_get_version());

[... 420 lines stripped ...]



More information about the svn-commits mailing list