[asterisk-commits] murf: branch murf/bug8221 r48030 - in /team/murf/bug8221: ./ channels/ funcs/...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Sun Nov 26 13:59:56 MST 2006


Author: murf
Date: Sun Nov 26 14:59:55 2006
New Revision: 48030

URL: http://svn.digium.com/view/asterisk?view=rev&rev=48030
Log:
Merged revisions 47986,47995,47997,48001,48003-48004,48008-48014,48016,48018-48019 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

................
r47986 | oej | 2006-11-24 07:00:19 -0700 (Fri, 24 Nov 2006) | 6 lines

Doxygen update
- Document cause codes
- Document a bit more on channel variables - global, predefined and local
- Fix some doxygen in channel.h. Adding one comment for two definitions does not
  work. They won't be copied to each.

................
r47995 | murf | 2006-11-24 10:40:49 -0700 (Fri, 24 Nov 2006) | 1 line

This fix inspired by a patch supplied in bug 8189, which points out problems with the PLC code
................
r47997 | murf | 2006-11-24 11:17:25 -0700 (Fri, 24 Nov 2006) | 1 line

removed the svnmerge-integrated property from trunk; it's confusing svnmerge in newly created branches
................
r48001 | rizzo | 2006-11-25 02:02:42 -0700 (Sat, 25 Nov 2006) | 5 lines

set pointers to NULL after freeing memory to avoid multiple free()

probably 1.4/1.2 issue as well if someone can look into that.


................
r48003 | oej | 2006-11-25 02:45:57 -0700 (Sat, 25 Nov 2006) | 9 lines

- Adding comment on suspicious memory allocation. Seems like it's never freed, but I don't
  have a clear understanding of the frame allocation/deallocation, so I just mark this
  for investigation. (Reported by Ed Guy). We're trying to see if a free() hurts...

- Doxygen comments on p2p rtp bridge stuff.  I am a bit worried about shortcutting
  rtcp this way, but will need feedback from rtcp gurus. This should work for 
  video calls too, and possibly UDPTL.


................
r48004 | oej | 2006-11-25 02:48:30 -0700 (Sat, 25 Nov 2006) | 2 lines

Changing ERROR to lesser level. Imported from 1.2/1.4

................
r48008 | rizzo | 2006-11-25 10:37:04 -0700 (Sat, 25 Nov 2006) | 7 lines

generalize a bit the functions used to create an tcp socket
and then run a service on it.
The code in manager.c does essentially the same things,
so we will be able to reuse the code in here (probably
moving it to netsock.c or another appropriate library file).


................
r48009 | mattf | 2006-11-25 13:30:04 -0700 (Sat, 25 Nov 2006) | 1 line

Updates to show linkset command
................
r48010 | mattf | 2006-11-25 13:54:38 -0700 (Sat, 25 Nov 2006) | 2 lines

Add ss7 show linkset command

................
r48011 | mattf | 2006-11-25 14:32:33 -0700 (Sat, 25 Nov 2006) | 1 line

Make sure we don't send a group reset on a group larger than 32 CICs
................
r48012 | mattf | 2006-11-25 14:35:23 -0700 (Sat, 25 Nov 2006) | 1 line

bug fix
................
r48013 | mattf | 2006-11-25 14:46:58 -0700 (Sat, 25 Nov 2006) | 1 line

Make compiler happier
................
r48014 | mattf | 2006-11-25 14:50:42 -0700 (Sat, 25 Nov 2006) | 1 line

Little fix so we use the right message
................
r48016 | murf | 2006-11-25 17:15:42 -0700 (Sat, 25 Nov 2006) | 9 lines

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

........
r48015 | murf | 2006-11-25 17:01:34 -0700 (Sat, 25 Nov 2006) | 1 line

A little bit of func_cdr documentation upgrade-- no bug# involved, although 8221 may have inspired it.
........

................
r48018 | murf | 2006-11-25 17:31:13 -0700 (Sat, 25 Nov 2006) | 9 lines

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

........
r48017 | murf | 2006-11-25 17:26:16 -0700 (Sat, 25 Nov 2006) | 1 line

might as well also document the raw values of the flag vars
........

................
r48019 | russell | 2006-11-25 23:55:33 -0700 (Sat, 25 Nov 2006) | 6 lines

- Add some comments on thread storage with a brief explanation of what it is
  as well as what the motivation is for using it.
- Add a comment by the declaration of ast_inet_ntoa() noting that this function
  is not reentrant, and the result of a previous call to the function is no
  longer valid after calling it again.

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

Modified:
    team/murf/bug8221/   (props changed)
    team/murf/bug8221/channels/chan_sip.c
    team/murf/bug8221/channels/chan_zap.c
    team/murf/bug8221/funcs/func_cdr.c
    team/murf/bug8221/include/asterisk/causes.h
    team/murf/bug8221/include/asterisk/channel.h
    team/murf/bug8221/include/asterisk/doxyref.h
    team/murf/bug8221/include/asterisk/threadstorage.h
    team/murf/bug8221/include/asterisk/utils.h
    team/murf/bug8221/main/channel.c
    team/murf/bug8221/main/http.c
    team/murf/bug8221/main/pbx.c
    team/murf/bug8221/main/rtp.c
    team/murf/bug8221/main/translate.c

Propchange: team/murf/bug8221/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Propchange: team/murf/bug8221/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Sun Nov 26 14:59:55 2006
@@ -1,1 +1,1 @@
-/trunk:1-47960
+/trunk:1-48028

Modified: team/murf/bug8221/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug8221/channels/chan_sip.c?view=diff&rev=48030&r1=48029&r2=48030
==============================================================================
--- team/murf/bug8221/channels/chan_sip.c (original)
+++ team/murf/bug8221/channels/chan_sip.c Sun Nov 26 14:59:55 2006
@@ -14456,7 +14456,7 @@
 
 			if ((firststate = ast_extension_state(NULL, p->context, p->exten)) < 0) {
 
-				ast_log(LOG_ERROR, "Got SUBSCRIBE for extension %s@%s from %s, but there is no hint for that extension\n", p->exten, p->context, ast_inet_ntoa(p->sa.sin_addr));
+				ast_log(LOG_NOTICE, "Got SUBSCRIBE for extension %s@%s from %s, but there is no hint for that extension.\n", p->exten, p->context, ast_inet_ntoa(p->sa.sin_addr));
 				transmit_response(p, "404 Not found", req);
 				ast_set_flag(&p->flags[0], SIP_NEEDDESTROY);	
 				return 0;

Modified: team/murf/bug8221/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug8221/channels/chan_zap.c?view=diff&rev=48030&r1=48029&r2=48030
==============================================================================
--- team/murf/bug8221/channels/chan_zap.c (original)
+++ team/murf/bug8221/channels/chan_zap.c Sun Nov 26 14:59:55 2006
@@ -8380,7 +8380,7 @@
 	startcic = linkset->pvts[0]->cic;
 
 	for (i = 0; i < linkset->numchans; i++) {
-		if (linkset->pvts[i+1] && (linkset->pvts[i+1]->cic - linkset->pvts[i]->cic) == 1) {
+		if (linkset->pvts[i+1] && ((linkset->pvts[i+1]->cic - linkset->pvts[i]->cic) == 1) && (linkset->pvts[i]->cic - startcic < 31)) {
 			continue;
 		} else {
 			endcic = linkset->pvts[i]->cic;
@@ -10568,23 +10568,23 @@
 	return RESULT_SUCCESS;
 }
 
-static const char pri_debug_help[] = 
+static char pri_debug_help[] = 
 	"Usage: pri debug span <span>\n"
 	"       Enables debugging on a given PRI span\n";
 	
-static const char pri_no_debug_help[] = 
+static char pri_no_debug_help[] = 
 	"Usage: pri no debug span <span>\n"
 	"       Disables debugging on a given PRI span\n";
 
-static const char pri_really_debug_help[] = 
+static char pri_really_debug_help[] = 
 	"Usage: pri intensive debug span <span>\n"
 	"       Enables debugging down to the Q.921 level\n";
 
-static const char pri_show_span_help[] = 
+static char pri_show_span_help[] = 
 	"Usage: pri show span <span>\n"
 	"       Displays PRI Information on a given PRI span\n";
 
-static const char pri_show_spans_help[] = 
+static char pri_show_spans_help[] = 
 	"Usage: pri show spans\n"
 	"       Displays PRI Information\n";
 
@@ -11556,7 +11556,6 @@
 	return RESULT_SUCCESS;
 }
 
-#if 0
 static int handle_ss7_show_linkset(int fd, int argc, char *argv[])
 {
 	int linkset;
@@ -11573,49 +11572,44 @@
 		return RESULT_SUCCESS;
 	}
 	if (linksets[linkset-1].ss7)
-		ss7 = linksets[linkset-1];
-
-	if (
+		ss7 = &linksets[linkset-1];
+
+	ast_cli(fd, "SS7 linkset %d status: %s\n", linkset, (ss7->state == LINKSET_STATE_UP) ? "Up" : "Down");
 
 	return RESULT_SUCCESS;
 }
-#endif
-
-static const char ss7_debug_help[] = 
+
+static char ss7_debug_help[] = 
 	"Usage: ss7 debug linkset <linkset>\n"
 	"       Enables debugging on a given SS7 linkset\n";
 	
-static const char ss7_no_debug_help[] = 
+static char ss7_no_debug_help[] = 
 	"Usage: ss7 no debug linkset <span>\n"
 	"       Disables debugging on a given SS7 linkset\n";
 
-static const char ss7_block_cic_help[] = 
+static char ss7_block_cic_help[] = 
 	"Usage: ss7 block cic <linkset> <CIC>\n"
 	"       Sends a remote blocking request for the given CIC on the specified linkset\n";
 
-static const char ss7_unblock_cic_help[] = 
+static char ss7_unblock_cic_help[] = 
 	"Usage: ss7 unblock cic <linkset> <CIC>\n"
 	"       Sends a remote unblocking request for the given CIC on the specified linkset\n";
 
-#if 0
-static const char ss7_show_linkset_help[] = 
+static char ss7_show_linkset_help[] = 
 	"Usage: ss7 show linkset <span>\n"
-	"       Disables debugging on a given SS7 linkset\n";
-#endif
+	"       Shows the status of an SS7 linkset.\n";
 
 static struct ast_cli_entry zap_ss7_cli[] = {
 	{ { "ss7", "debug", "linkset", NULL }, handle_ss7_debug,
 	  "Enables SS7 debugging on a linkset", ss7_debug_help, NULL },
 	{ { "ss7", "no", "debug", "linkset", NULL }, handle_ss7_no_debug,
-	  "Disables SS7 debugging on a linkset", ss7_debug_help, NULL },
+	  "Disables SS7 debugging on a linkset", ss7_no_debug_help, NULL },
 	{ { "ss7", "block", "cic", NULL }, handle_ss7_block_cic,
 	  "Disables SS7 debugging on a linkset", ss7_block_cic_help, NULL },
 	{ { "ss7", "unblock", "cic", NULL }, handle_ss7_unblock_cic,
 	  "Disables SS7 debugging on a linkset", ss7_unblock_cic_help, NULL },
-#if 0
 	{ { "ss7", "show", "linkset", NULL }, handle_ss7_show_linkset,
-	  "Disables SS7 debugging on a linkset", ss7_show_linkset_help, NULL },
-#endif
+	  "Shows the status of a linkset", ss7_show_linkset_help, NULL },
 };
 #endif /* HAVE_SS7 */
 

Modified: team/murf/bug8221/funcs/func_cdr.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug8221/funcs/func_cdr.c?view=diff&rev=48030&r1=48029&r2=48030
==============================================================================
--- team/murf/bug8221/funcs/func_cdr.c (original)
+++ team/murf/bug8221/funcs/func_cdr.c Sun Nov 26 14:59:55 2006
@@ -130,6 +130,27 @@
 "  values, when the 'u' option is passed, but formatted as YYYY-MM-DD HH:MM:SS\n"
 "  otherwise.  Similarly, disposition and amaflags will return their raw\n"
 "  integral values.\n",
+"  Here is a list of all the available cdr field names:\n"
+"    clid          lastdata       disposition\n"
+"    src           start          amaflags\n"
+"    dst           answer         accountcode\n"
+"    dcontext      end            uniqueid\n"
+"    dstchannel    duration       userfield\n"
+"    lastapp       billsec        channel\n"
+"  All of the above variables are read-only, except for accountcode,\n"
+"  userfield, and amaflags. You may, however,  supply\n"
+"  a name not on the above list, and create your own\n"
+"  variable, whose value can be changed with this function,\n"
+"  and this variable will be stored on the cdr.\n"
+"   raw values for disposition:\n"
+"       1 = NO ANSWER\n"
+"	2 = BUSY\n"
+"	3 = FAILED\n"
+"	4 = ANSWERED\n"
+"    raw values for amaflags:\n"
+"       1 = OMIT\n"
+"       2 = BILLING\n"
+"       3 = DOCUMENTATION\n",
 };
 
 static int unload_module(void)

Modified: team/murf/bug8221/include/asterisk/causes.h
URL: http://svn.digium.com/view/asterisk/team/murf/bug8221/include/asterisk/causes.h?view=diff&rev=48030&r1=48029&r2=48030
==============================================================================
--- team/murf/bug8221/include/asterisk/causes.h (original)
+++ team/murf/bug8221/include/asterisk/causes.h Sun Nov 26 14:59:55 2006
@@ -22,6 +22,68 @@
 
 #ifndef _ASTERISK_CAUSES_H
 #define _ASTERISK_CAUSES_H
+
+/*! \page AstCauses Hangup Causes for Asterisk
+
+The Asterisk hangup causes are delivered to the dialplan in the
+${HANGUPCAUSE} channel variable after a call (after execution
+of "dial"). 
+
+In SIP, we have a conversion table to convert between SIP
+return codes and Q.931 both ways. This is to improve SIP/ISDN
+compatibility.
+
+These are the current codes, based on the Q.931
+specification:
+
+	- AST_CAUSE_UNALLOCATED				1
+	- AST_CAUSE_NO_ROUTE_TRANSIT_NET			2
+	- AST_CAUSE_NO_ROUTE_DESTINATION			3
+	- AST_CAUSE_CHANNEL_UNACCEPTABLE			6
+	- AST_CAUSE_CALL_AWARDED_DELIVERED		7
+	- AST_CAUSE_NORMAL_CLEARING			16
+	- AST_CAUSE_USER_BUSY				17
+	- AST_CAUSE_NO_USER_RESPONSE			18
+	- AST_CAUSE_NO_ANSWER				19
+	- AST_CAUSE_CALL_REJECTED				21
+	- AST_CAUSE_NUMBER_CHANGED			22
+	- AST_CAUSE_DESTINATION_OUT_OF_ORDER		27
+	- AST_CAUSE_INVALID_NUMBER_FORMAT			28
+	- AST_CAUSE_FACILITY_REJECTED			29
+	- AST_CAUSE_RESPONSE_TO_STATUS_ENQUIRY		30
+	- AST_CAUSE_NORMAL_UNSPECIFIED			31
+	- AST_CAUSE_NORMAL_CIRCUIT_CONGESTION		34
+	- AST_CAUSE_NETWORK_OUT_OF_ORDER			38
+	- AST_CAUSE_NORMAL_TEMPORARY_FAILURE		41
+	- AST_CAUSE_SWITCH_CONGESTION			42
+	- AST_CAUSE_ACCESS_INFO_DISCARDED			43
+	- AST_CAUSE_REQUESTED_CHAN_UNAVAIL		44
+	- AST_CAUSE_PRE_EMPTED				45
+	- AST_CAUSE_FACILITY_NOT_SUBSCRIBED  		50
+	- AST_CAUSE_OUTGOING_CALL_BARRED     		52
+	- AST_CAUSE_INCOMING_CALL_BARRED     		54
+	- AST_CAUSE_BEARERCAPABILITY_NOTAUTH		57
+	- AST_CAUSE_BEARERCAPABILITY_NOTAVAIL     	58
+	- AST_CAUSE_BEARERCAPABILITY_NOTIMPL		65
+	- AST_CAUSE_CHAN_NOT_IMPLEMENTED     		66
+	- AST_CAUSE_FACILITY_NOT_IMPLEMENTED      	69
+	- AST_CAUSE_INVALID_CALL_REFERENCE		81
+	- AST_CAUSE_INCOMPATIBLE_DESTINATION		88
+	- AST_CAUSE_INVALID_MSG_UNSPECIFIED  		95
+	- AST_CAUSE_MANDATORY_IE_MISSING			96
+	- AST_CAUSE_MESSAGE_TYPE_NONEXIST			97
+	- AST_CAUSE_WRONG_MESSAGE				98
+	- AST_CAUSE_IE_NONEXIST				99
+	- AST_CAUSE_INVALID_IE_CONTENTS			100
+	- AST_CAUSE_WRONG_CALL_STATE			101
+	- AST_CAUSE_RECOVERY_ON_TIMER_EXPIRE		102
+	- AST_CAUSE_MANDATORY_IE_LENGTH_ERROR		103
+	- AST_CAUSE_PROTOCOL_ERROR			111
+	- AST_CAUSE_INTERWORKING				127
+
+For more information:
+- \ref app_dial.c
+*/
 
 /* Causes for disconnection (from Q.931) */
 #define AST_CAUSE_UNALLOCATED				1

Modified: team/murf/bug8221/include/asterisk/channel.h
URL: http://svn.digium.com/view/asterisk/team/murf/bug8221/include/asterisk/channel.h?view=diff&rev=48030&r1=48029&r2=48030
==============================================================================
--- team/murf/bug8221/include/asterisk/channel.h (original)
+++ team/murf/bug8221/include/asterisk/channel.h Sun Nov 26 14:59:55 2006
@@ -84,6 +84,11 @@
 
 */
 
+/*! \page AstFileDesc File descriptors 
+	Asterisk File descriptors are connected to each channel (see \ref Def_Channel)
+	in the \ref ast_channel structure.
+*/
+
 #ifndef _ASTERISK_CHANNEL_H
 #define _ASTERISK_CHANNEL_H
 
@@ -336,8 +341,8 @@
 		AST_STRING_FIELD(uniqueid);		/*!< Unique Channel Identifier */
 	);
 	
-	/*! \brief File descriptor for channel -- Drivers will poll on these file descriptors, so at least one must be non -1.  */
-	int fds[AST_MAX_FDS];			
+	/*! \brief File descriptor for channel -- Drivers will poll on these file descriptors, so at least one must be non -1.  See \ref AstFileDesc */
+	int fds[AST_MAX_FDS];	
 
 	void *music_state;				/*!< Music State*/
 	void *generatordata;				/*!< Current generator data if there is any */
@@ -351,12 +356,11 @@
 	struct ast_channel *masqr;			/*!< Who we are masquerading as */
 	int cdrflags;					/*!< Call Detail Record Flags */
 
-	/*! \brief Whether or not we have been hung up...  Do not set this value
-	    directly, use ast_softhangup */
-	int _softhangup;
+	int _softhangup;				/*!< Whether or not we have been hung up...  Do not set this value
+	    							directly, use ast_softhangup() */
 	time_t	whentohangup;				/*!< Non-zero, set to actual time when channel is to be hung up */
 	pthread_t blocker;				/*!< If anyone is blocking, this is them */
-	ast_mutex_t lock;				/*!< Lock, can be used to lock a channel for some operations */
+	ast_mutex_t lock;				/*!< Lock, can be used to lock a channel for some operations - see ast_channel_lock() */
 	const char *blockproc;				/*!< Procedure causing blocking */
 
 	const char *appl;				/*!< Current application */
@@ -373,7 +377,7 @@
 	int (*timingfunc)(void *data);
 	void *timingdata;
 
-	enum ast_channel_state _state;			/*!< State of line -- Don't write directly, use ast_setstate */
+	enum ast_channel_state _state;			/*!< State of line -- Don't write directly, use ast_setstate() */
 	int rings;					/*!< Number of rings so far */
 	struct ast_callerid cid;			/*!< Caller ID, name, presentation etc */
 	char dtmfq[AST_MAX_EXTENSION];			/*!< Any/all queued DTMF characters */
@@ -397,17 +401,16 @@
 
 	struct ast_channel_monitor *monitor;		/*!< Channel monitoring */
 
-	/*! Track the read/written samples for monitor use */
-	unsigned long insmpl;
-	unsigned long outsmpl;
-
-	/* Frames in/out counters. The high bit is a debug mask, so
-	 * the counter is only in the remaining bits
-	 */
-	unsigned int fin;
-	unsigned int fout;
+	unsigned long insmpl;				/*!< Track the read/written samples for monitor use */
+	unsigned long outsmpl;				/*!< Track the read/written samples for monitor use */
+
+	unsigned int fin;				/*!< Frames in counters. The high bit is a debug mask, so
+	 						 * the counter is only in the remaining bits */
+	unsigned int fout;				/*!< Frames out counters. The high bit is a debug mask, so
+	 						 * the counter is only in the remaining bits */
 	int hangupcause;				/*!< Why is the channel hanged up. See causes.h */
-	struct varshead varshead;			/*!< A linked list for channel variables */
+	struct varshead varshead;			/*!< A linked list for channel variables 
+								(see \ref AstChanVar ) */
 	ast_group_t callgroup;				/*!< Call group for call pickups */
 	ast_group_t pickupgroup;			/*!< Pickup group - which calls groups can be picked up? */
 	unsigned int flags;				/*!< channel flags of AST_FLAG_ type */

Modified: team/murf/bug8221/include/asterisk/doxyref.h
URL: http://svn.digium.com/view/asterisk/team/murf/bug8221/include/asterisk/doxyref.h?view=diff&rev=48030&r1=48029&r2=48030
==============================================================================
--- team/murf/bug8221/include/asterisk/doxyref.h (original)
+++ team/murf/bug8221/include/asterisk/doxyref.h Sun Nov 26 14:59:55 2006
@@ -135,9 +135,67 @@
  *  \verbinclude video.txt
  */
 
-/*! \page AstVar Global channel variables
- * \section globchan Global Channel Variables
+/*! \page AstVar Globally predefined channel variables
+ * \section globchan Globally predefined channel variables
+ *
+ * More and more of these variables are being replaced by dialplan functions.
+ * Some still exist though and some that does still exist needs to move to
+ * dialplan functions.
+ *
+ * See also
+ * - \ref pbx_retrieve_variable()
+ * - \ref AstChanVar
+ *
  *  \verbinclude channelvariables.txt
+
+ */
+
+/*! \page AstChanVar Asterisk Dialplan Variables
+ *	Asterisk Dialplan variables are divided into three groups:
+ *	- Predefined global variables, handled by the PBX core
+ *	- Global variables, that exist for the duration of the pbx execution
+ *	- Channel variables, that exist during a channel
+ *
+ * Global variables are reachable in all channels, all of the time.
+ * Channel variables are only reachable within the channel.
+ *
+ * For more information on the predefined variables, see \ref AstVar
+ * 
+ * Global and Channel variables:
+ * - Names are Case insensitive
+ * - Names that start with a character, but are alphanumeric
+ * - Global variables are defined and reached with the GLOBAL() dialplan function
+ *   and the set application, like
+ *
+ * 	exten => 1234,1,set(GLOBAL(myvariable)=tomteluva)
+ *
+ * 	- \ref func_global.c
+ *
+ * - Channel variables are defined with the set() dialplan application
+ *
+ *	exten => 1234,1,set(xmasattribute=tomtegröt)
+ *
+ * - Some channels also supports setting channel variables with the \b setvar=
+ *   configuraiton option for a device or line.
+ *
+ * \section AstChanVar_globalvars Global Variables
+ * Global variables can also be set in the [globals] section of extensions.conf. The
+ * setting \b clearglobalvars in extensions.conf [general] section affects whether
+ * or not the global variables defined in \b globals are reset at dialplan reload.
+ * 
+ * There are CLI commands to change and read global variables. This can be handy
+ * to reset counters at midnight from an external script.
+ *
+ * \section AstChanVar_devnotes Developer notes
+ * Variable handling is managed within \ref pbx.c
+ * You need to include pbx.h to reach these functions.
+ *	- \ref pbx_builtin_setvar_helper()
+ * 	- \ref pbx_builtin_getvar_helper()
+ *
+ * The variables is a linked list stored in the channel data structure
+ * with the list starting at varshead in struct ast_channel
+ * 
+ *
  */
 
 /*! \page AstENUM ENUM
@@ -209,7 +267,7 @@
  * \verbinclude features.conf.sample
  */
 
-/*! \page Config_followme followme.conf 
+/*! \page Config_followme Followme: An application for simple follow-me calls
  * \section followmeconf Followme.conf
  * - See app_followme.c
  * \verbinclude followme.conf.sample

Modified: team/murf/bug8221/include/asterisk/threadstorage.h
URL: http://svn.digium.com/view/asterisk/team/murf/bug8221/include/asterisk/threadstorage.h?view=diff&rev=48030&r1=48029&r2=48030
==============================================================================
--- team/murf/bug8221/include/asterisk/threadstorage.h (original)
+++ team/murf/bug8221/include/asterisk/threadstorage.h Sun Nov 26 14:59:55 2006
@@ -21,7 +21,20 @@
  * \author Russell Bryant <russell at digium.com>
  *
  * \brief Definitions to aid in the use of thread local storage
-*/
+ *
+ * The POSIX threads (pthreads) API provides the ability to define thread
+ * specific data.  The functions and structures defined here are intended
+ * to centralize the code that is commonly used when using thread local
+ * storage.
+ *
+ * The motivation for using this code in Asterisk is for situations where
+ * storing data on a thread-specific basis can provide some amount of
+ * performance benefit.  For example, there are some call types in Asterisk
+ * where ast_frame structures must be allocated very rapidly (easily 50, 100,
+ * 200 times a second).  Instead of doing the equivalent of that many calls
+ * to malloc() and free() per second, thread local storage is used to keep a
+ * list of unused frame structures so that they can be continuously reused.
+ */
 
 #ifndef ASTERISK_THREADSTORAGE_H
 #define ASTERISK_THREADSTORAGE_H

Modified: team/murf/bug8221/include/asterisk/utils.h
URL: http://svn.digium.com/view/asterisk/team/murf/bug8221/include/asterisk/utils.h?view=diff&rev=48030&r1=48029&r2=48030
==============================================================================
--- team/murf/bug8221/include/asterisk/utils.h (original)
+++ team/murf/bug8221/include/asterisk/utils.h Sun Nov 26 14:59:55 2006
@@ -218,6 +218,16 @@
 
 int test_for_thread_safety(void);
 
+/*!
+ * \brief thread-safe replacement for inet_ntoa().
+ *
+ * \note It is very important to note that even though this is a thread-safe
+ *       replacement for inet_ntoa(), it is *not* reentrant.  In a single
+ *       thread, the result from a previous call to this function is no longer
+ *       valid once it is called again.  If the result from multiple calls to
+ *       this function need to be kept or used at once, then the result must be
+ *       copied to a local buffer before calling this function again.
+ */
 const char *ast_inet_ntoa(struct in_addr ia);
 
 #ifdef inet_ntoa

Modified: team/murf/bug8221/main/channel.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug8221/main/channel.c?view=diff&rev=48030&r1=48029&r2=48030
==============================================================================
--- team/murf/bug8221/main/channel.c (original)
+++ team/murf/bug8221/main/channel.c Sun Nov 26 14:59:55 2006
@@ -1027,6 +1027,7 @@
 		free(cid->cid_ani);
 	if (cid->cid_rdnis)
 		free(cid->cid_rdnis);
+	cid->cid_dnid = cid->cid_num = cid->cid_name = cid->cid_ani = cid->cid_rdnis = NULL;
 }
 
 /*! \brief Free a channel structure */

Modified: team/murf/bug8221/main/http.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug8221/main/http.c?view=diff&rev=48030&r1=48029&r2=48030
==============================================================================
--- team/murf/bug8221/main/http.c (original)
+++ team/murf/bug8221/main/http.c Sun Nov 26 14:59:55 2006
@@ -63,6 +63,7 @@
  * in or out the DO_SSL macro.
  * We declare most of ssl support variables unconditionally,
  * because their number is small and this simplifies the code.
+ * XXX this eventually goes into a generic header file.
  */
 #if defined(HAVE_OPENSSL) && (defined(HAVE_FUNOPEN) || defined(HAVE_FOPENCOOKIE))
 #define	DO_SSL	/* comment in/out if you want to support ssl */
@@ -103,7 +104,13 @@
 	int is_ssl;		/* is this an SSL accept ? */
 	int accept_fd;
 	pthread_t master;
+	void *(*accept_fn)(void *);	/* the function in charge of doing the accept */
+	void *(*worker_fn)(void *);	/* the function in charge of doing the actual work */
+	const char *name;
 };
+
+static void *http_root(void *arg);
+static void *httpd_helper_thread(void *arg);
 
 /*!
  * we have up to two accepting threads, one for http, one for https
@@ -112,12 +119,18 @@
 	.accept_fd = -1,
 	.master = AST_PTHREADT_NULL,
 	.is_ssl = 0,
+	.name = "http server",
+	.accept_fn = http_root,
+	.worker_fn = httpd_helper_thread,
 };
 
 static struct server_args https_desc = {
 	.accept_fd = -1,
 	.master = AST_PTHREADT_NULL,
 	.is_ssl = 1,
+	.name = "https server",
+	.accept_fn = http_root,
+	.worker_fn = httpd_helper_thread,
 };
 
 static struct ast_http_uri *uris;	/*!< list of supported handlers */
@@ -471,7 +484,7 @@
 }
 #endif	/* DO_SSL */
 
-static void *ast_httpd_helper_thread(void *data)
+static void *httpd_helper_thread(void *data)
 {
 	char buf[4096];
 	char cookie[4096];
@@ -667,7 +680,7 @@
 		pthread_attr_init(&attr);
 		pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
 			
-		if (ast_pthread_create_background(&launched, &attr, ast_httpd_helper_thread, ser)) {
+		if (ast_pthread_create_background(&launched, &attr, desc->worker_fn, ser)) {
 			ast_log(LOG_WARNING, "Unable to launch helper thread: %s\n", strerror(errno));
 			close(ser->fd);
 			free(ser);
@@ -721,7 +734,12 @@
 #endif
 }
 
-static void http_server_start(struct server_args *desc)
+/*!
+ * This is a generic (re)start routine for a TCP server,
+ * which does the socket/bind/listen and starts a thread for handling
+ * accept().
+ */
+static void server_start(struct server_args *desc)
 {
 	int flags;
 	int x = 1;
@@ -729,7 +747,7 @@
 	/* Do nothing if nothing has changed */
 	if (!memcmp(&desc->oldsin, &desc->sin, sizeof(desc->oldsin))) {
 		if (option_debug)
-			ast_log(LOG_DEBUG, "Nothing changed in http\n");
+			ast_log(LOG_DEBUG, "Nothing changed in %s\n", desc->name);
 		return;
 	}
 	
@@ -748,33 +766,33 @@
 	/* If there's no new server, stop here */
 	if (desc->sin.sin_family == 0)
 		return;
-	
-	
+
 	desc->accept_fd = socket(AF_INET, SOCK_STREAM, 0);
 	if (desc->accept_fd < 0) {
-		ast_log(LOG_WARNING, "Unable to allocate socket: %s\n", strerror(errno));
+		ast_log(LOG_WARNING, "Unable to allocate socket for %s: %s\n",
+			desc->name, strerror(errno));
 		return;
 	}
 	
 	setsockopt(desc->accept_fd, SOL_SOCKET, SO_REUSEADDR, &x, sizeof(x));
 	if (bind(desc->accept_fd, (struct sockaddr *)&desc->sin, sizeof(desc->sin))) {
-		ast_log(LOG_NOTICE, "Unable to bind http server to %s:%d: %s\n",
+		ast_log(LOG_NOTICE, "Unable to bind %s to %s:%d: %s\n",
+			desc->name,
 			ast_inet_ntoa(desc->sin.sin_addr), ntohs(desc->sin.sin_port),
 			strerror(errno));
 		goto error;
 	}
 	if (listen(desc->accept_fd, 10)) {
-		ast_log(LOG_NOTICE, "Unable to listen!\n");
-		close(desc->accept_fd);
-		desc->accept_fd = -1;
-		return;
+		ast_log(LOG_NOTICE, "Unable to listen for %s!\n", desc->name);
+		goto error;
 	}
 	flags = fcntl(desc->accept_fd, F_GETFL);
 	fcntl(desc->accept_fd, F_SETFL, flags | O_NONBLOCK);
-	if (ast_pthread_create_background(&desc->master, NULL, http_root, desc)) {
-		ast_log(LOG_NOTICE, "Unable to launch http server on %s:%d: %s\n",
-				ast_inet_ntoa(desc->sin.sin_addr), ntohs(desc->sin.sin_port),
-				strerror(errno));
+	if (ast_pthread_create_background(&desc->master, NULL, desc->accept_fn, desc)) {
+		ast_log(LOG_NOTICE, "Unable to launch %s on %s:%d: %s\n",
+			desc->name,
+			ast_inet_ntoa(desc->sin.sin_addr), ntohs(desc->sin.sin_port),
+			strerror(errno));
 		goto error;
 	}
 	return;
@@ -794,8 +812,10 @@
 	struct ast_hostent ahp;
 	char newprefix[MAX_PREFIX];
 
+	/* default values */
 	memset(&http_desc.sin, 0, sizeof(http_desc.sin));
 	http_desc.sin.sin_port = htons(8088);
+
 	memset(&https_desc.sin, 0, sizeof(https_desc.sin));
 	https_desc.sin.sin_port = htons(8089);
 	strcpy(newprefix, DEFAULT_PREFIX);
@@ -854,9 +874,9 @@
 	if (strcmp(prefix, newprefix))
 		ast_copy_string(prefix, newprefix, sizeof(prefix));
 	enablestatic = newenablestatic;
-	http_server_start(&http_desc);
+	server_start(&http_desc);
 	if (ssl_setup())
-		http_server_start(&https_desc);
+		server_start(&https_desc);
 	return 0;
 }
 

Modified: team/murf/bug8221/main/pbx.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug8221/main/pbx.c?view=diff&rev=48030&r1=48029&r2=48030
==============================================================================
--- team/murf/bug8221/main/pbx.c (original)
+++ team/murf/bug8221/main/pbx.c Sun Nov 26 14:59:55 2006
@@ -1094,9 +1094,12 @@
 	return ret;
 }
 
-/*! \brief  pbx_retrieve_variable: Support for Asterisk built-in variables and
-      functions in the dialplan
-  ---*/
+/*! \brief  Support for Asterisk built-in variables and functions in the dialplan
+
+\note	See also
+	- \ref AstVar	Channel variables
+	- \ref AstCauses The HANGUPCAUSE variable
+ */
 void pbx_retrieve_variable(struct ast_channel *c, const char *var, char **ret, char *workspace, int workspacelen, struct varshead *headp)
 {
 	const char not_found = '\0';

Modified: team/murf/bug8221/main/rtp.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug8221/main/rtp.c?view=diff&rev=48030&r1=48029&r2=48030
==============================================================================
--- team/murf/bug8221/main/rtp.c (original)
+++ team/murf/bug8221/main/rtp.c Sun Nov 26 14:59:55 2006
@@ -2474,6 +2474,7 @@
 	return 0;
 }
 
+/*! \brief Write RTP packet with audio or video media frames into UDP packet */
 static int ast_rtp_raw_write(struct ast_rtp *rtp, struct ast_frame *f, int codec)
 {
 	unsigned char *rtpheader;
@@ -2659,11 +2660,10 @@
 			ast_rtp_raw_write(rtp, f, codec);
 	} else {
 	        /* Don't buffer outgoing frames; send them one-per-packet: */
-		if (_f->offset < hdrlen) {
-			f = ast_frdup(_f);
-		} else {
+		if (_f->offset < hdrlen) 
+			f = ast_frdup(_f);	/*! \bug XXX this might never be free'd. Why do we do this? */
+		else
 			f = _f;
-		}
 		ast_rtp_raw_write(rtp, f, codec);
 	}
 		
@@ -2850,7 +2850,7 @@
 	return AST_BRIDGE_FAILED;
 }
 
-/*! \brief P2P RTP/RTCP Callback */
+/*! \brief peer 2 peer RTP mode  RTP/RTCP Callback */
 static int p2p_rtp_callback(int *id, int fd, short events, void *cbdata)
 {
 	int res = 0, hdrlen = 12;
@@ -2951,7 +2951,12 @@
 	return 0;
 }
 
-/*! \brief Bridge loop for partial native bridge (packet2packet) */
+/*! \brief Bridge loop for partial native bridge (packet2packet) 
+
+	In p2p mode, Asterisk is a very basic RTP proxy, just forwarding whatever
+	rtp/rtcp we get in to the channel. 
+	\note this currently only works for Audio
+*/
 static enum ast_bridge_result bridge_p2p_loop(struct ast_channel *c0, struct ast_channel *c1, struct ast_rtp *p0, struct ast_rtp *p1, int timeoutms, int flags, struct ast_frame **fo, struct ast_channel **rc, void *pvt0, void *pvt1)
 {
 	struct ast_frame *fr = NULL;

Modified: team/murf/bug8221/main/translate.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug8221/main/translate.c?view=diff&rev=48030&r1=48029&r2=48030
==============================================================================
--- team/murf/bug8221/main/translate.c (original)
+++ team/murf/bug8221/main/translate.c Sun Nov 26 14:59:55 2006
@@ -172,6 +172,7 @@
 				}
 				l = plc_fillin(pvt->plc, dst + pvt->samples, l);
 				pvt->samples += l;
+				pvt->datalen = pvt->samples * 2;	/* SLIN has 2bytes for 1sample */
 			}
 			return 0;
 		}



More information about the asterisk-commits mailing list