[svn-commits] oej: branch oej/codename-pineapple r48006 - in /team/oej/codename-pineapple: ...

svn-commits at lists.digium.com svn-commits at lists.digium.com
Sat Nov 25 05:03:47 MST 2006


Author: oej
Date: Sat Nov 25 06:03:46 2006
New Revision: 48006

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

Modified:
    team/oej/codename-pineapple/   (props changed)
    team/oej/codename-pineapple/CHANGES
    team/oej/codename-pineapple/channels/chan_h323.c
    team/oej/codename-pineapple/channels/chan_sip.c
    team/oej/codename-pineapple/doc/asterisk-conf.txt
    team/oej/codename-pineapple/include/asterisk/causes.h
    team/oej/codename-pineapple/include/asterisk/channel.h
    team/oej/codename-pineapple/include/asterisk/doxyref.h
    team/oej/codename-pineapple/main/asterisk.c
    team/oej/codename-pineapple/main/channel.c
    team/oej/codename-pineapple/main/manager.c
    team/oej/codename-pineapple/main/pbx.c
    team/oej/codename-pineapple/main/rtp.c
    team/oej/codename-pineapple/main/translate.c

Propchange: team/oej/codename-pineapple/
------------------------------------------------------------------------------
Binary property 'branch-1.4-blocked' - no diff available.

Propchange: team/oej/codename-pineapple/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Propchange: team/oej/codename-pineapple/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Sat Nov 25 06:03:46 2006
@@ -1,1 +1,1 @@
-/trunk:1-47882
+/trunk:1-48005

Modified: team/oej/codename-pineapple/CHANGES
URL: http://svn.digium.com/view/asterisk/team/oej/codename-pineapple/CHANGES?view=diff&rev=48006&r1=48005&r2=48006
==============================================================================
--- team/oej/codename-pineapple/CHANGES (original)
+++ team/oej/codename-pineapple/CHANGES Sat Nov 25 06:03:46 2006
@@ -61,3 +61,5 @@
   * CID matching information is now shown when doing 'dialplan show'.
   * app_queue now has a 'loose' option which is almost exactly like 'strict' except it
      does not count paused queue members as unavailable.
+  * Added maxfiles option to options section of asterisk.conf which allows you to specify
+     what Asterisk should set as the maximum number of open files when it loads.

Modified: team/oej/codename-pineapple/channels/chan_h323.c
URL: http://svn.digium.com/view/asterisk/team/oej/codename-pineapple/channels/chan_h323.c?view=diff&rev=48006&r1=48005&r2=48006
==============================================================================
--- team/oej/codename-pineapple/channels/chan_h323.c (original)
+++ team/oej/codename-pineapple/channels/chan_h323.c Sat Nov 25 06:03:46 2006
@@ -2754,21 +2754,6 @@
 	h323_tokens_show, "Show all active call tokens",
 	show_tokens_usage };
 
-static struct ast_cli_entry cli_h323_debug_deprecated = {
-	{ "h.323", "debug", NULL },
-	h323_do_debug, "Enable H.323 debug",
-	debug_usage };
-
-static struct ast_cli_entry cli_h323_trace_deprecated = {
-	{ "h.323", "trace", NULL },
-	h323_do_trace, "Enable H.323 Stack Tracing",
-	trace_usage };
-
-static struct ast_cli_entry cli_h323_gk_cycle_deprecated = {
-	{ "h323", "cycle", "gk", NULL },
-	h323_gk_cycle, "Manually re-register with the Gatekeper",
-	show_cycle_usage };
-
 static struct ast_cli_entry cli_h323[] = {
 	{ { "h323", "set", "trace", NULL },
 	h323_do_trace, "Enable H.323 Stack Tracing",

Modified: team/oej/codename-pineapple/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/oej/codename-pineapple/channels/chan_sip.c?view=diff&rev=48006&r1=48005&r2=48006
==============================================================================
--- team/oej/codename-pineapple/channels/chan_sip.c (original)
+++ team/oej/codename-pineapple/channels/chan_sip.c Sat Nov 25 06:03:46 2006
@@ -558,7 +558,7 @@
 static int allow_external_domains;	/*!< Accept calls to external SIP domains? */
 static int global_callevents;		/*!< Whether we send manager events or not */
 static int global_t1min;		/*!< T1 roundtrip time minimum */
-static int global_autoframing;          /*!< ?????????? */
+static int global_autoframing;          /*!< Turn autoframing on or off. */
 static enum transfermodes global_allowtransfer;	/*!< SIP Refer restriction scheme */
 
 /*! \brief Codecs that we support by default: */
@@ -11724,7 +11724,7 @@
 	/* RFC3261 says we must treat every 1xx response (but not 100)
 	   that we don't recognize as if it was 183.
 	*/
-	if (resp > 100 && resp < 200 && resp != 180 && resp != 183)
+	if (resp > 100 && resp < 200 && resp!=101 && resp != 180 && resp != 183)
 		resp = 183;
 
  	/* Any response between 100 and 199 is PROCEEDING */
@@ -11738,6 +11738,7 @@
 
 	switch (resp) {
 	case 100:	/* Trying */
+	case 101:	/* Dialog establishment */
 		if (!ast_test_flag(req, SIP_PKT_IGNORE))
 			sip_cancel_destroy(p);
 		check_pendings(p);
@@ -12232,6 +12233,7 @@
 	} else if (ast_test_flag(&p->flags[0], SIP_OUTGOING)) {
 		switch(resp) {
 		case 100:	/* 100 Trying */
+		case 101:	/* 101 Dialog establishment */
 			if (sipmethod == SIP_INVITE) 
 				handle_response_invite(p, resp, rest, req, seqno);
 			break;
@@ -12940,6 +12942,7 @@
 		respcode = atoi(code);
 		switch (respcode) {
 		case 100:	/* Trying: */
+		case 101:	/* dialog establishment */
 			/* Don't do anything yet */
 			break;
 		case 183:	/* Ringing: */
@@ -14453,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;
@@ -14546,7 +14549,6 @@
 {
 	/* Called with p->lock held, as well as p->owner->lock if appropriate, keeping things
 	   relatively static */
-	struct sip_request resp;
 	const char *cmd;
 	const char *cseq;
 	const char *useragent;
@@ -14557,9 +14559,6 @@
 	int debug = sip_debug_test_pvt(p);
 	char *e;
 	int error = 0;
-
-	/* Clear out potential response */
-	memset(&resp, 0, sizeof(resp));
 
 	/* Get Method and Cseq */
 	cseq = get_header(req, "Cseq");
@@ -17116,6 +17115,7 @@
 			sip_destroy(iterator->call);
 		}
 		ASTOBJ_UNLOCK(iterator);
+	
 	} while(0));
 
 	/* Then, actually destroy users and registry */

Modified: team/oej/codename-pineapple/doc/asterisk-conf.txt
URL: http://svn.digium.com/view/asterisk/team/oej/codename-pineapple/doc/asterisk-conf.txt?view=diff&rev=48006&r1=48005&r2=48006
==============================================================================
--- team/oej/codename-pineapple/doc/asterisk-conf.txt (original)
+++ team/oej/codename-pineapple/doc/asterisk-conf.txt Sat Nov 25 06:03:46 2006
@@ -69,6 +69,7 @@
 	       	       				; when off, sound files are searched as <path>/<lang>/<file>
 						; when on, sound files are search as <lang>/<path>/<file>
 						; (only affects relative paths for sound files)
+maxlimit = <value>				; Maximum number open files for the Asterisk process
 
 [files]
 ; Changing the following lines may compromise your security

Modified: team/oej/codename-pineapple/include/asterisk/causes.h
URL: http://svn.digium.com/view/asterisk/team/oej/codename-pineapple/include/asterisk/causes.h?view=diff&rev=48006&r1=48005&r2=48006
==============================================================================
--- team/oej/codename-pineapple/include/asterisk/causes.h (original)
+++ team/oej/codename-pineapple/include/asterisk/causes.h Sat Nov 25 06:03:46 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/oej/codename-pineapple/include/asterisk/channel.h
URL: http://svn.digium.com/view/asterisk/team/oej/codename-pineapple/include/asterisk/channel.h?view=diff&rev=48006&r1=48005&r2=48006
==============================================================================
--- team/oej/codename-pineapple/include/asterisk/channel.h (original)
+++ team/oej/codename-pineapple/include/asterisk/channel.h Sat Nov 25 06:03:46 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/oej/codename-pineapple/include/asterisk/doxyref.h
URL: http://svn.digium.com/view/asterisk/team/oej/codename-pineapple/include/asterisk/doxyref.h?view=diff&rev=48006&r1=48005&r2=48006
==============================================================================
--- team/oej/codename-pineapple/include/asterisk/doxyref.h (original)
+++ team/oej/codename-pineapple/include/asterisk/doxyref.h Sat Nov 25 06:03:46 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/oej/codename-pineapple/main/asterisk.c
URL: http://svn.digium.com/view/asterisk/team/oej/codename-pineapple/main/asterisk.c?view=diff&rev=48006&r1=48005&r2=48006
==============================================================================
--- team/oej/codename-pineapple/main/asterisk.c (original)
+++ team/oej/codename-pineapple/main/asterisk.c Sat Nov 25 06:03:46 2006
@@ -1011,6 +1011,29 @@
 	if (n == 0 && option_debug)	
 		printf("Huh?  Child handler, but nobody there?\n");
 	signal(sig, child_handler);
+}
+
+/*! \brief Set maximum open files */
+static void set_ulimit(int value)
+{
+	struct rlimit l = {0, 0};
+	
+	if (value <= 0) {
+		ast_log(LOG_WARNING, "Unable to change max files open to invalid value %i\n",value);
+		return;
+	}
+	
+	l.rlim_cur = value;
+	l.rlim_max = value;
+	
+	if (setrlimit(RLIMIT_NOFILE, &l)) {
+		ast_log(LOG_WARNING, "Unable to disable core size resource limit: %s\n",strerror(errno));
+		return;
+	}
+	
+	ast_log(LOG_NOTICE, "Setting max files open to %d\n",value);
+	
+	return;
 }
 
 /*! \brief Set an X-term or screen title */
@@ -2293,6 +2316,9 @@
 			} else if ((sscanf(v->value, "%lf", &option_maxload) != 1) || (option_maxload < 0.0)) {
 				option_maxload = 0.0;
 			}
+		/* Set the maximum amount of open files */
+		} else if (!strcasecmp(v->name, "maxfiles")) {
+			set_ulimit(atoi(v->value));
 		/* What user to run as */
 		} else if (!strcasecmp(v->name, "runuser")) {
 			ast_copy_string(ast_config_AST_RUN_USER, v->value, sizeof(ast_config_AST_RUN_USER));

Modified: team/oej/codename-pineapple/main/channel.c
URL: http://svn.digium.com/view/asterisk/team/oej/codename-pineapple/main/channel.c?view=diff&rev=48006&r1=48005&r2=48006
==============================================================================
--- team/oej/codename-pineapple/main/channel.c (original)
+++ team/oej/codename-pineapple/main/channel.c Sat Nov 25 06:03:46 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/oej/codename-pineapple/main/manager.c
URL: http://svn.digium.com/view/asterisk/team/oej/codename-pineapple/main/manager.c?view=diff&rev=48006&r1=48005&r2=48006
==============================================================================
--- team/oej/codename-pineapple/main/manager.c (original)
+++ team/oej/codename-pineapple/main/manager.c Sat Nov 25 06:03:46 2006
@@ -1981,6 +1981,10 @@
 		return 0;
 	}
 
+	if (!s->authenticated && strcasecmp(action, "Login") && strcasecmp(action, "Logoff") && strcasecmp(action, "Challenge")) {
+		astman_send_error(s, m, "Permission denied");
+		return 0;
+	}
 	/* XXX should we protect the list navigation ? */
 	for (tmp = first_action ; tmp; tmp = tmp->next) {
 		if (!strcasecmp(action, tmp->action)) {

Modified: team/oej/codename-pineapple/main/pbx.c
URL: http://svn.digium.com/view/asterisk/team/oej/codename-pineapple/main/pbx.c?view=diff&rev=48006&r1=48005&r2=48006
==============================================================================
--- team/oej/codename-pineapple/main/pbx.c (original)
+++ team/oej/codename-pineapple/main/pbx.c Sat Nov 25 06:03:46 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/oej/codename-pineapple/main/rtp.c
URL: http://svn.digium.com/view/asterisk/team/oej/codename-pineapple/main/rtp.c?view=diff&rev=48006&r1=48005&r2=48006
==============================================================================
--- team/oej/codename-pineapple/main/rtp.c (original)
+++ team/oej/codename-pineapple/main/rtp.c Sat Nov 25 06:03:46 2006
@@ -1705,7 +1705,7 @@
 			if (isAstFormat &&
 			    (code == AST_FORMAT_G726_AAL2) &&
 			    (options & AST_RTP_OPT_G726_NONSTANDARD))
-				return "AAL2-G726-32";
+				return "G726-32";
 			else
 				return mimeTypes[i].subtype;
 		}
@@ -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,8 +2951,13 @@
 	return 0;
 }
 
-/*! \brief Bridge loop for partial native bridge (packet2packet) */
-static enum ast_bridge_result bridge_p2p_loop(struct ast_channel *c0, struct ast_channel *c1, struct ast_rtp *p0, struct ast_rtp *p1, struct ast_rtp *vp0, struct ast_rtp *vp1, int timeoutms, int flags, struct ast_frame **fo, struct ast_channel **rc, void *pvt0, void *pvt1)
+/*! \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;
 	struct ast_channel *who = NULL, *other = NULL, *cs[3] = {NULL, };
@@ -2965,12 +2970,6 @@
 	p0->bridged = p1;
 	ast_clear_flag(p1, FLAG_P2P_SENT_MARK);
 	p1->bridged = p0;
-	if (vp0) {
-		ast_clear_flag(vp0, FLAG_P2P_SENT_MARK);
-		vp0->bridged = vp1;
-		ast_clear_flag(vp1, FLAG_P2P_SENT_MARK);
-		vp1->bridged = vp0;
-	}
 
 	/* Activate callback modes if possible */
 	p0_callback = p2p_callback_enable(c0, p0, &p0_iod[0]);
@@ -3032,22 +3031,12 @@
 						p1_callback = p2p_callback_disable(c1, p1, &p1_iod[0]);
 					p0->bridged = NULL;
 					p1->bridged = NULL;
-					if (vp0) {
-						vp0->bridged = NULL;
-						vp1->bridged = NULL;
-					}
 				} else if (fr->subclass == AST_CONTROL_UNHOLD) {
 					/* If we are off hold, then go back to callback mode and P2P bridging */
 					ast_clear_flag(p0, FLAG_P2P_SENT_MARK);
 					p0->bridged = p1;
 					ast_clear_flag(p1, FLAG_P2P_SENT_MARK);
 					p1->bridged = p0;
-					if (vp0) {
-						ast_clear_flag(vp0, FLAG_P2P_SENT_MARK);
-						vp0->bridged = vp1;
-						ast_clear_flag(vp1, FLAG_P2P_SENT_MARK);
-						vp1->bridged = vp0;
-					}
 					p0_callback = p2p_callback_enable(c0, p0, &p0_iod[0]);
 					p1_callback = p2p_callback_enable(c1, p1, &p1_iod[0]);
 				}
@@ -3085,10 +3074,6 @@
 	/* Break out of the direct bridge */
 	p0->bridged = NULL;
 	p1->bridged = NULL;
-	if (vp0) {
-		vp0->bridged = NULL;
-		vp1->bridged = NULL;
-	}
 
 	return res;
 }
@@ -3188,7 +3173,7 @@
 		}
 		if (option_verbose > 2)
 			ast_verbose(VERBOSE_PREFIX_3 "Packet2Packet bridging %s and %s\n", c0->name, c1->name);
-		res = bridge_p2p_loop(c0, c1, p0, p1, vp0, vp1, timeoutms, flags, fo, rc, pvt0, pvt1);
+		res = bridge_p2p_loop(c0, c1, p0, p1, timeoutms, flags, fo, rc, pvt0, pvt1);
 	} else {
 		if (option_verbose > 2) 
 			ast_verbose(VERBOSE_PREFIX_3 "Native bridging %s and %s\n", c0->name, c1->name);

Modified: team/oej/codename-pineapple/main/translate.c
URL: http://svn.digium.com/view/asterisk/team/oej/codename-pineapple/main/translate.c?view=diff&rev=48006&r1=48005&r2=48006
==============================================================================
--- team/oej/codename-pineapple/main/translate.c (original)
+++ team/oej/codename-pineapple/main/translate.c Sat Nov 25 06:03:46 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 svn-commits mailing list