[svn-commits] branch bweschke/bug_5374 - r7611 in /team/bweschke/bug_5374: ./ apps/ channel...

svn-commits at lists.digium.com svn-commits at lists.digium.com
Fri Dec 23 01:25:16 CST 2005


Author: bweschke
Date: Fri Dec 23 01:25:07 2005
New Revision: 7611

URL: http://svn.digium.com/view/asterisk?rev=7611&view=rev
Log:
 Bringing up to date with /trunk


Added:
    team/bweschke/bug_5374/configs/func_odbc.conf.sample
      - copied unchanged from r7610, trunk/configs/func_odbc.conf.sample
    team/bweschke/bug_5374/funcs/func_odbc.c
      - copied unchanged from r7610, trunk/funcs/func_odbc.c
Modified:
    team/bweschke/bug_5374/   (props changed)
    team/bweschke/bug_5374/UPGRADE.txt
    team/bweschke/bug_5374/apps/app_dial.c
    team/bweschke/bug_5374/apps/app_directed_pickup.c
    team/bweschke/bug_5374/apps/app_hasnewvoicemail.c
    team/bweschke/bug_5374/apps/app_meetme.c
    team/bweschke/bug_5374/apps/app_realtime.c
    team/bweschke/bug_5374/apps/app_rpt.c
    team/bweschke/bug_5374/apps/app_verbose.c
    team/bweschke/bug_5374/apps/app_voicemail.c
    team/bweschke/bug_5374/apps/app_waitforsilence.c
    team/bweschke/bug_5374/asterisk.c
    team/bweschke/bug_5374/channels/Makefile
    team/bweschke/bug_5374/channels/chan_agent.c
    team/bweschke/bug_5374/channels/chan_alsa.c
    team/bweschke/bug_5374/channels/chan_iax2.c
    team/bweschke/bug_5374/channels/chan_mgcp.c
    team/bweschke/bug_5374/channels/chan_sip.c
    team/bweschke/bug_5374/cli.c
    team/bweschke/bug_5374/codecs/Makefile
    team/bweschke/bug_5374/codecs/codec_gsm.c
    team/bweschke/bug_5374/configs/agents.conf.sample
    team/bweschke/bug_5374/configs/rpt.conf.sample
    team/bweschke/bug_5374/configs/sip.conf.sample
    team/bweschke/bug_5374/frame.c
    team/bweschke/bug_5374/funcs/Makefile
    team/bweschke/bug_5374/funcs/func_env.c
    team/bweschke/bug_5374/include/asterisk/channel.h
    team/bweschke/bug_5374/include/asterisk/frame.h
    team/bweschke/bug_5374/include/asterisk/rtp.h
    team/bweschke/bug_5374/include/asterisk/strings.h
    team/bweschke/bug_5374/pbx/pbx_ael.c
    team/bweschke/bug_5374/res/res_agi.c
    team/bweschke/bug_5374/res/res_features.c
    team/bweschke/bug_5374/rtp.c
    team/bweschke/bug_5374/utils.c

Propchange: team/bweschke/bug_5374/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Fri Dec 23 01:25:07 2005
@@ -1,2 +1,2 @@
 /branches/1.2:1-7351
-/trunk:1-7529
+/trunk:1-7610

Modified: team/bweschke/bug_5374/UPGRADE.txt
URL: http://svn.digium.com/view/asterisk/team/bweschke/bug_5374/UPGRADE.txt?rev=7611&r1=7610&r2=7611&view=diff
==============================================================================
--- team/bweschke/bug_5374/UPGRADE.txt (original)
+++ team/bweschke/bug_5374/UPGRADE.txt Fri Dec 23 01:25:07 2005
@@ -1,205 +1,10 @@
 Information for Upgrading From Previous Asterisk Releases
 =========================================================
 
-Compiling:
-
-* The Asterisk 1.2 source code now uses C language features
-  supported only by 'modern' C compilers.  Generally, this means GCC
-  version 3.0 or higher, although some GCC 2.96 releases will also
-  work.  Some non-GCC compilers that support C99 and the common GCC
-  extensions (including anonymous structures and unions) will also
-  work.  All releases of GCC 2.95 do _not_ have the requisite feature
-  support; systems using that compiler will need to be upgraded to
-  a more recent compiler release.
-
-Dialplan Expressions:
-
-* The dialplan expression parser (which handles $[ ... ] constructs)
-  has gone through a major upgrade, but has one incompatible change:
-  spaces are no longer required around expression operators, including
-  string comparisons. However, you can now use quoting to keep strings
-  together for comparison. For more details, please read the
-  doc/README.variables file, and check over your dialplan for possible
-  problems.
-
-Agents:
-
-* The default for ackcall has been changed to "no" instead of "yes" 
-  because of a bug which caused the "yes" behavior to generally act like
-  "no".  You may need to adjust the value if your agents behave 
-  differently than you expect with respect to acknowledgement.
-
-* The AgentCallBackLogin application now requires a second '|' before
-  specifying an extension at context.  This is to distinguish the options
-  string from the extension, so that they do not conflict.  See
-  'show application AgentCallbackLogin' for more details.
-
-Parking:
-
-* Parking behavior has changed slightly; when a parked call times out,
-  Asterisk will attempt to deliver the call back to the extension that
-  parked it, rather than the 's' extension. If that extension is busy
-  or unavailable, the parked call will be lost.
-
-Dialing:
-
-* The Caller*ID of the outbound leg is now the extension that was 
-  called, rather than the Caller*ID of the inbound leg of the call.  The 
-  "o" flag for Dial can be used to restore the original behavior if 
-  desired.  Note that if you are looking for the originating callerid
-  from the manager event, there is a new manager event "Dial" which 
-  provides the source and destination channels and callerid.
-
-IAX: 
-
-* The naming convention for IAX channels has changed in two ways: 
-   1. The call number follows a "-" rather than a "/" character.
-   2. The name of the channel has been simplified to IAX2/peer-callno,
-   rather than IAX2/peer at peer-callno or even IAX2/peer at peer/callno.
-
-SIP:
-
-* The global option "port" in 1.0.X that is used to set which port to
-  bind to has been changed to "bindport" to be more consistent with
-  the other channel drivers and to avoid confusion with the "port"
-  option for users/peers.
-
-* The "Registry" event now uses "Username" rather than "User" for 
-  consistency with IAX.
-
 Applications:
 
-* With the addition of dialplan functions (which operate similarly
-  to variables), the SetVar application has been renamed to Set.
-
-* The CallerPres application has been removed.  Use SetCallerPres 
-  instead.  It accepts both numeric and symbolic names.
-
-* The applications GetGroupCount, GetGroupMatchCount, SetGroup, and
-  CheckGroup have been deprecated in favor of functions.  Here is a
-  table of their replacements:
-
-  GetGroupCount([groupname][@category]	       GROUP_COUNT([groupname][@category])	Set(GROUPCOUNT=${GROUP_COUNT()})
-  GroupMatchCount(groupmatch[@category])       GROUP_MATCH_COUNT(groupmatch[@category])	Set(GROUPCOUNT=${GROUP_MATCH_COUNT(SIP/.*)})
-  SetGroup(groupname[@category])	       GROUP([category])=groupname		Set(GROUP()=test)
-  CheckGroup(max[@category])		       N/A					GotoIf($[ ${GROUP_COUNT()} > 5 ]?103)
-
-  Note that CheckGroup does not have a direct replacement.  There is
-  also a new function called GROUP_LIST() which will return a space
-  separated list of all of the groups set on a channel.  The GROUP()
-  function can also return the name of the group set on a channel when
-  used in a read environment.
-
-* The applications DBGet and DBPut have been deprecated in favor of
-  functions.  Here is a table of their replacements:
-
-  DBGet(foo=family/key)        Set(foo=${DB(family/key)})
-  DBPut(family/key=${foo})     Set(DB(family/key)=${foo})
-
-* The application SetLanguage has been deprecated in favor of the
-  function LANGUAGE().
-
-  SetLanguage(fr)		Set(LANGUAGE()=fr)
-
-  The LANGUAGE function can also return the currently set language:
-
-  Set(MYLANG=${LANGUAGE()})
-
-* The applications AbsoluteTimeout, DigitTimeout, and ResponseTimeout
-  have been deprecated in favor of the function TIMEOUT(timeouttype):
-
-  AbsoluteTimeout(300)		Set(TIMEOUT(absolute)=300)
-  DigitTimeout(15)		Set(TIMEOUT(digit)=15)
-  ResponseTimeout(15)		Set(TIMEOUT(response)=15)
-
-  The TIMEOUT() function can also return the currently set timeouts:
-
-  Set(DTIMEOUT=${TIMEOUT(digit)})
-
-* The applications SetCIDName, SetCIDNum, and SetRDNIS have been
-  deprecated in favor of the CALLERID(datatype) function:
-
-  SetCIDName(Joe Cool)		Set(CALLERID(name)=Joe Cool)
-  SetCIDNum(2025551212)		Set(CALLERID(number)=2025551212)
-  SetRDNIS(2024561414)		Set(CALLERID(RDNIS)=2024561414)
-
-* The application Record now uses the period to separate the filename
-  from the format, rather than the colon.
-
-* The application VoiceMail now supports a 'temporary' greeting for each
-  mailbox. This greeting can be recorded by using option 4 in the
-  'mailbox options' menu, and 'change your password' option has been
-  moved to option 5.
-
-* The application VoiceMailMain now only matches the 'default' context if
-  none is specified in the arguments.  (This was the previously 
-  documented behavior, however, we didn't follow that behavior.)  The old
-  behavior can be restored by setting searchcontexts=yes in voicemail.conf.
-
-Queues:
-
-* A queue is now considered empty not only if there are no members but if
-  none of the members are available (e.g. agents not logged on).  To
-  restore the original behavior, use "leavewhenempty=strict" or 
-  "joinwhenempty=strict" instead of "=yes" for those options.
-
-* It is now possible to use multi-digit extensions in the exit context
-  for a queue (although you should not have overlapping extensions,
-  as there is no digit timeout). This means that the EXITWITHKEY event
-  in queue_log can now contain a key field with more than a single
-  character in it.
-
-Extensions:
-
-* By default, there is a new option called "autofallthrough" in
-  extensions.conf that is set to yes.  Asterisk 1.0 (and earlier) 
-  behavior was to wait for an extension to be dialed after there were no 
-  more extensions to execute.  "autofallthrough" changes this behavior
-  so that the call will immediately be terminated with BUSY,
-  CONGESTION, or HANGUP based on Asterisk's best guess.  If you are
-  writing an extension for IVR, you must use the WaitExten application
-  if "autofallthrough" is set to yes.
-
-AGI:
-
-* AGI scripts did not always get SIGHUP at the end, previously.  That 
-  behavior has been fixed.  If you do not want your script to terminate 
-  at the end of AGI being called (e.g. on a hangup) then set SIGHUP to 
-  be ignored within your application.
-
-* CallerID is reported with agi_callerid and agi_calleridname instead
-  of a single parameter holding both.
-
-Music On Hold:
-
-* The preferred format for musiconhold.conf has changed; please see the
-  sample configuration file for the new format. The existing format
-  is still supported but will generate warnings when the module is loaded.
-
-chan_modem:
-
-* All the chan_modem channel drivers (aopen, bestdata and i4l) are deprecated
-  in this release, and will be removed in the next major Asterisk release.
-  Please migrate to chan_misdn for ISDN interfaces; there is no upgrade
-  path for aopen and bestdata modem users.
-
-MeetMe:
-
-* The conference application now allows users to increase/decrease their
-  speaking volume and listening volume (independently of each other and 
-  other users); the 'admin' and 'user' menus have changed, and new sound 
-  files are included with this release. However, if a user calling in 
-  over a Zaptel channel that does NOT have hardware DTMF detection 
-  increases their speaking volume, it is likely they will no longer be 
-  able to enter/exit the menu or make any further adjustments, as the  
-  software DTMF detector will not be able to recognize the DTMF coming 
-  from their device.
-
-GetVar Manager Action:
-
-* Previously, the behavior of the GetVar manager action reported the value
-  of a variable in the following manner:
-   > name: value
-  This has been changed to a manner similar to the SetVar action and is now
-   > Variable: name
-   > Value: value
+* In previous Asterisk releases, many applications would jump to priority n+101
+  to indicate some kind of status or error condition.  This functionality was
+  marked deprecated in Asterisk 1.2.  An option to disable it was provided with
+  the default value set to 'on'.  The default value for the global priority
+  jumping option is now 'off'.

Modified: team/bweschke/bug_5374/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/bug_5374/apps/app_dial.c?rev=7611&r1=7610&r2=7611&view=diff
==============================================================================
--- team/bweschke/bug_5374/apps/app_dial.c (original)
+++ team/bweschke/bug_5374/apps/app_dial.c Fri Dec 23 01:25:07 2005
@@ -53,6 +53,7 @@
 #include "asterisk/utils.h"
 #include "asterisk/app.h"
 #include "asterisk/causes.h"
+#include "asterisk/rtp.h"
 #include "asterisk/manager.h"
 #include "asterisk/privacy.h"
 
@@ -310,7 +311,7 @@
 } while (0)
 
 
-static int onedigit_goto(struct ast_channel *chan, char *context, char exten, int pri) 
+static int onedigit_goto(struct ast_channel *chan, const char *context, char exten, int pri) 
 {
 	char rexten[2] = { exten, '\0' };
 
@@ -380,7 +381,7 @@
 	int pos;
 	int single;
 	struct ast_channel *winner;
-	char *context = NULL;
+	const char *context = NULL;
 	char cidname[AST_MAX_EXTENSION];
 
 	single = (outgoing && !outgoing->next && !ast_test_flag(outgoing, OPT_MUSICBACK | OPT_RINGBACK));
@@ -475,6 +476,7 @@
 						ast_clear_flag(o, DIAL_STILLGOING);	
 						HANDLE_CAUSE(cause, in);
 					} else {
+						ast_rtp_make_compatible(o->chan, in);
 						if (o->chan->cid.cid_num)
 							free(o->chan->cid.cid_num);
 						o->chan->cid.cid_num = NULL;
@@ -744,16 +746,17 @@
 	long timelimit = 0;
 	long play_warning = 0;
 	long warning_freq=0;
-	char *warning_sound=NULL;
-	char *end_sound=NULL;
-	char *start_sound=NULL;
+	const char *warning_sound=NULL;
+	const char *end_sound=NULL;
+	const char *start_sound=NULL;
 	char *dtmfcalled=NULL, *dtmfcalling=NULL;
-	char *var;
+	const char *var;
 	char status[256];
 	int play_to_caller=0,play_to_callee=0;
 	int sentringing=0, moh=0;
-	char *outbound_group = NULL;
-	char *macro_result = NULL, *macro_transfer_dest = NULL;
+	const char *outbound_group = NULL;
+	const char *macro_result = NULL;
+	char *macro_transfer_dest = NULL;
 	int digit = 0, result = 0;
 	time_t start_time, answer_time, end_time;
 	struct ast_app *app = NULL;
@@ -1052,6 +1055,9 @@
 			}
 		}
 
+		/* Setup outgoing SDP to match incoming one */
+		ast_rtp_make_compatible(tmp->chan, chan);
+		
 		/* Inherit specially named variables from parent channel */
 		ast_channel_inherit_variables(chan, tmp->chan);
 
@@ -1190,7 +1196,7 @@
 		if (peer->name)
 			pbx_builtin_setvar_helper(chan, "DIALEDPEERNAME", peer->name);
 
-		number = pbx_builtin_getvar_helper(peer, "DIALEDPEERNUMBER");
+		number = (char *)pbx_builtin_getvar_helper(peer, "DIALEDPEERNUMBER");
 		if (!number)
 			number = numsubst;
 		pbx_builtin_setvar_helper(chan, "DIALEDPEERNUMBER", number);
@@ -1602,7 +1608,8 @@
 
 static int retrydial_exec(struct ast_channel *chan, void *data)
 {
-	char *announce = NULL, *context = NULL, *dialdata = NULL;
+	char *announce = NULL, *dialdata = NULL;
+	const char *context = NULL;
 	int sleep = 0, loops = 0, res = 0;
 	struct localuser *u;
 	struct ast_flags peerflags;

Modified: team/bweschke/bug_5374/apps/app_directed_pickup.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/bug_5374/apps/app_directed_pickup.c?rev=7611&r1=7610&r2=7611&view=diff
==============================================================================
--- team/bweschke/bug_5374/apps/app_directed_pickup.c (original)
+++ team/bweschke/bug_5374/apps/app_directed_pickup.c Fri Dec 23 01:25:07 2005
@@ -77,7 +77,7 @@
 
 	/* Find a channel to pickup */
 	origin = ast_get_channel_by_exten_locked(exten, context);
-	if (origin) {
+	if (origin && origin->cdr) {
 		ast_cdr_getvar(origin->cdr, "dstchannel", &tmp, workspace,
 			       sizeof(workspace), 0);
 		if (tmp) {
@@ -89,6 +89,8 @@
 		}
 		ast_mutex_unlock(&origin->lock);
 	} else {
+		if (origin)
+			ast_mutex_unlock(&origin->lock);
 		ast_log(LOG_DEBUG, "No originating channel found.\n");
 	}
 	

Modified: team/bweschke/bug_5374/apps/app_hasnewvoicemail.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/bug_5374/apps/app_hasnewvoicemail.c?rev=7611&r1=7610&r2=7611&view=diff
==============================================================================
--- team/bweschke/bug_5374/apps/app_hasnewvoicemail.c (original)
+++ team/bweschke/bug_5374/apps/app_hasnewvoicemail.c Fri Dec 23 01:25:07 2005
@@ -90,7 +90,6 @@
 		while ((vment = readdir(vmdir))) {
 			if (!strncmp(vment->d_name + 7, ".txt", 4)) {
 				count++;
-				break;
 			}
 		}
 		closedir(vmdir);

Modified: team/bweschke/bug_5374/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/bug_5374/apps/app_meetme.c?rev=7611&r1=7610&r2=7611&view=diff
==============================================================================
--- team/bweschke/bug_5374/apps/app_meetme.c (original)
+++ team/bweschke/bug_5374/apps/app_meetme.c Fri Dec 23 01:25:07 2005
@@ -54,6 +54,8 @@
 #include "asterisk/cli.h"
 #include "asterisk/say.h"
 #include "asterisk/utils.h"
+#include "asterisk/translate.h"
+#include "asterisk/ulaw.h"
 
 static const char *tdesc = "MeetMe conference bridge";
 
@@ -95,6 +97,10 @@
 "      's' -- Present menu (user or admin) when '*' is received ('send' to menu)\n"
 "      't' -- set talk only mode. (Talk only, no listening)\n"
 "      'T' -- set talker detection (sent to manager interface and meetme list)\n"
+"      'o' -- set talker optimization - treats talkers who aren't speaking as\n"
+"             being muted, meaning (a) No encode is done on transmission and\n"
+"             (b) Received audio that is not registered as talking is omitted\n"
+"             causing no buildup in background noise\n"
 "      'v' -- video mode\n"
 "      'w' -- wait until the marked user enters the conference\n"
 "      'x' -- close the conference when last marked user exits\n"
@@ -129,6 +135,8 @@
 LOCAL_USER_DECL;
 
 static struct ast_conference {
+	ast_mutex_t playlock;				/* Conference specific lock (players) */
+	ast_mutex_t listenlock;				/* Conference specific lock (listeners) */
 	char confno[AST_MAX_EXTENSION];		/* Conference */
 	struct ast_channel *chan;		/* Announcements channel */
 	int fd;					/* Announcements fd */
@@ -147,6 +155,9 @@
 	const char *recordingformat;			/* Format to record the Conference in */
 	char pin[AST_MAX_EXTENSION];		/* If protected by a PIN */
 	char pinadmin[AST_MAX_EXTENSION];	/* If protected by a admin PIN */
+	struct ast_frame *transframe[32];
+	struct ast_frame *origframe;
+	struct ast_trans_pvt *transpath[32];
 	struct ast_conference *next;
 } *confs;
 
@@ -182,6 +193,8 @@
 #define MEETME_DELAYDETECTTALK 		300
 #define MEETME_DELAYDETECTENDTALK 	1000
 
+#define AST_FRAME_BITS 32
+
 enum volume_action {
 	VOL_UP,
 	VOL_DOWN,
@@ -190,6 +203,7 @@
 AST_MUTEX_DEFINE_STATIC(conflock);
 
 static int admin_exec(struct ast_channel *chan, void *data);
+static struct ast_frame null_frame = { AST_FRAME_NULL, };
 
 static void *recordthread(void *args);
 
@@ -200,8 +214,9 @@
 #define LEAVE	1
 
 #define MEETME_RECORD_OFF	0
-#define MEETME_RECORD_ACTIVE	1
-#define MEETME_RECORD_TERMINATE	2
+#define MEETME_RECORD_STARTED	1
+#define MEETME_RECORD_ACTIVE	2
+#define MEETME_RECORD_TERMINATE	3
 
 #define CONF_SIZE 320
 
@@ -227,12 +242,14 @@
 #define CONFFLAG_EMPTYNOPIN (1 << 20)
 #define CONFFLAG_ALWAYSPROMPT (1 << 21)
 #define CONFFLAG_ANNOUNCEUSERCOUNT (1 << 22)	/* If set, when user joins the conference, they will be told the number of users that are already in */
+#define CONFFLAG_OPTIMIZETALKER (1 << 23)	/* If set, treats talking users as muted users */
 
 
 AST_APP_OPTIONS(meetme_opts, {
 	AST_APP_OPTION('a', CONFFLAG_ADMIN ),
 	AST_APP_OPTION('c', CONFFLAG_ANNOUNCEUSERCOUNT ),
 	AST_APP_OPTION('T', CONFFLAG_MONITORTALKER ),
+	AST_APP_OPTION('o', CONFFLAG_OPTIMIZETALKER ),
 	AST_APP_OPTION('i', CONFFLAG_INTROUSER ),
 	AST_APP_OPTION('m', CONFFLAG_MONITOR ),
 	AST_APP_OPTION('p', CONFFLAG_POUNDEXIT ),
@@ -263,14 +280,17 @@
 		return "(not talking)";
 }
 
-static int careful_write(int fd, unsigned char *data, int len)
+static int careful_write(int fd, unsigned char *data, int len, int block)
 {
 	int res;
 	int x;
 
 	while (len) {
-		x = ZT_IOMUX_WRITE | ZT_IOMUX_SIGEVENT;
-		res = ioctl(fd, ZT_IOMUX, &x);
+		if (block) {
+			x = ZT_IOMUX_WRITE | ZT_IOMUX_SIGEVENT;
+			res = ioctl(fd, ZT_IOMUX, &x);
+		} else
+			res = 0;
 		if (res >= 0)
 			res = write(fd, data, len);
 		if (res < 1) {
@@ -403,6 +423,8 @@
 	unsigned char *data;
 	int len;
 	int res = -1;
+	short *data2;
+	int x;
 
 	if (!chan->_softhangup)
 		res = ast_autoservice_start(chan);
@@ -422,8 +444,12 @@
 		data = NULL;
 		len = 0;
 	}
-	if (data) 
-		careful_write(conf->fd, data, len);
+	if (data) {
+		data2 = alloca(len * 2);
+		for (x=0;x<len;x++)
+			data2[x] = AST_MULAW(data[x]);
+		careful_write(conf->fd, (unsigned char *)data2, len << 1, 1);
+	}
 
 	ast_mutex_unlock(&conflock);
 
@@ -447,12 +473,16 @@
 		/* Make a new one */
 		cnf = calloc(1, sizeof(*cnf));
 		if (cnf) {
+			ast_mutex_init(&cnf->playlock);
+			ast_mutex_init(&cnf->listenlock);
 			ast_copy_string(cnf->confno, confno, sizeof(cnf->confno));
 			ast_copy_string(cnf->pin, pin, sizeof(cnf->pin));
 			ast_copy_string(cnf->pinadmin, pinadmin, sizeof(cnf->pinadmin));
 			cnf->markedusers = 0;
-			cnf->chan = ast_request("zap", AST_FORMAT_ULAW, "pseudo", NULL);
+			cnf->chan = ast_request("zap", AST_FORMAT_SLINEAR, "pseudo", NULL);
 			if (cnf->chan) {
+				ast_set_read_format(cnf->chan, AST_FORMAT_SLINEAR);
+				ast_set_write_format(cnf->chan, AST_FORMAT_SLINEAR);
 				cnf->fd = cnf->chan->fds[0];	/* for use by conf_play() */
 			} else {
 				ast_log(LOG_WARNING, "Unable to open pseudo channel - trying device\n");
@@ -479,6 +509,7 @@
 				cnf = NULL;
 				goto cnfout;
 			}
+
 			/* Fill the conference struct */
 			cnf->start = time(NULL);
 			cnf->zapconf = ztc.confno;
@@ -749,7 +780,8 @@
 static int conf_free(struct ast_conference *conf)
 {
 	struct ast_conference *prev = NULL, *cur = confs;
-
+	int x;
+	
 	while (cur) {
 		if (cur == conf) {
 			if (prev)
@@ -776,6 +808,14 @@
 		}
 	}
 
+	for (x=0;x<AST_FRAME_BITS;x++) {
+		if (conf->transframe[x])
+			ast_frfree(conf->transframe[x]);
+		if (conf->transpath[x])
+			ast_translator_free_path(conf->transpath[x]);
+	}
+	if (conf->origframe)
+		ast_frfree(conf->origframe);
 	if (conf->chan)
 		ast_hangup(conf->chan);
 	else
@@ -828,21 +868,26 @@
 		return ret;
 	}
 
-	if (confflags & CONFFLAG_RECORDCONF && conf->recording !=MEETME_RECORD_ACTIVE) {
-		conf->recordingfilename = pbx_builtin_getvar_helper(chan, "MEETME_RECORDINGFILE");
+	if (confflags & CONFFLAG_RECORDCONF) {
 		if (!conf->recordingfilename) {
-			snprintf(recordingtmp, sizeof(recordingtmp), "meetme-conf-rec-%s-%s", conf->confno, chan->uniqueid);
-			conf->recordingfilename = ast_strdupa(recordingtmp);
-		}
-		conf->recordingformat = pbx_builtin_getvar_helper(chan, "MEETME_RECORDINGFORMAT");
-		if (!conf->recordingformat) {
-			snprintf(recordingtmp, sizeof(recordingtmp), "wav");
-			conf->recordingformat = ast_strdupa(recordingtmp);
-		}
+			conf->recordingfilename = pbx_builtin_getvar_helper(chan, "MEETME_RECORDINGFILE");
+			if (!conf->recordingfilename) {
+				snprintf(recordingtmp, sizeof(recordingtmp), "meetme-conf-rec-%s-%s", conf->confno, chan->uniqueid);
+				conf->recordingfilename = ast_strdupa(recordingtmp);
+			}
+			conf->recordingformat = pbx_builtin_getvar_helper(chan, "MEETME_RECORDINGFORMAT");
+			if (!conf->recordingformat) {
+				snprintf(recordingtmp, sizeof(recordingtmp), "wav");
+				conf->recordingformat = ast_strdupa(recordingtmp);
+			}
+			ast_verbose(VERBOSE_PREFIX_4 "Starting recording of MeetMe Conference %s into file %s.%s.\n",
+				    conf->confno, conf->recordingfilename, conf->recordingformat);
+		}
+	}
+
+	if ((conf->recording == MEETME_RECORD_OFF) && ((confflags & CONFFLAG_RECORDCONF) || (conf->chan))) {
 		pthread_attr_init(&conf->attr);
 		pthread_attr_setdetachstate(&conf->attr, PTHREAD_CREATE_DETACHED);
-		ast_verbose(VERBOSE_PREFIX_4 "Starting recording of MeetMe Conference %s into file %s.%s.\n",
-			    conf->confno, conf->recordingfilename, conf->recordingformat);
 		ast_pthread_create(&conf->recordthread, &conf->attr, recordthread, conf);
 	}
 
@@ -858,7 +903,7 @@
 	if (confflags & CONFFLAG_MARKEDUSER)
 		conf->markedusers++;
       
-   	ast_mutex_lock(&conflock);
+   	ast_mutex_lock(&conf->playlock);
 	if (!conf->firstuser) {
 		/* Fill the first new User struct */
 		user->user_no = 1;
@@ -870,7 +915,7 @@
 		user->prevuser = conf->lastuser;
 		if (conf->lastuser->nextuser) {
 			ast_log(LOG_WARNING, "Error in User Management!\n");
-			ast_mutex_unlock(&conflock);
+			ast_mutex_unlock(&conf->playlock);
 			goto outrun;
 		} else {
 			conf->lastuser->nextuser = user;
@@ -883,7 +928,7 @@
 	user->adminflags = 0;
 	user->talking = -1;
 	conf->users++;
-	ast_mutex_unlock(&conflock);
+	ast_mutex_unlock(&conf->playlock);
 
 	if (confflags & CONFFLAG_EXIT_CONTEXT) {
 		if ((agifile = pbx_builtin_getvar_helper(chan, "MEETME_EXIT_CONTEXT"))) 
@@ -1026,7 +1071,7 @@
 	ztc.chan = 0;	
 	ztc.confno = conf->zapconf;
 
-	ast_mutex_lock(&conflock);
+	ast_mutex_lock(&conf->playlock);
 
 	if (!(confflags & CONFFLAG_QUIET) && (confflags & CONFFLAG_INTROUSER) && conf->users > 1) {
 		if (conf->chan && ast_fileexists(user->namerecloc, NULL, NULL)) {
@@ -1047,7 +1092,7 @@
 	if (ioctl(fd, ZT_SETCONF, &ztc)) {
 		ast_log(LOG_WARNING, "Error setting conference\n");
 		close(fd);
-		ast_mutex_unlock(&conflock);
+		ast_mutex_unlock(&conf->playlock);
 		goto outrun;
 	}
 	ast_log(LOG_DEBUG, "Placed channel %s in ZAP conf %d\n", chan->name, conf->zapconf);
@@ -1066,7 +1111,7 @@
 				conf_play(chan, conf, ENTER);
 	}
 
-	ast_mutex_unlock(&conflock);
+	ast_mutex_unlock(&conf->playlock);
 
 	conf_flush(fd, chan);
 
@@ -1103,7 +1148,7 @@
 			x = 1;
 			ast_channel_setoption(chan, AST_OPTION_TONE_VERIFY, &x, sizeof(char), 0);
 		}	
-		if (confflags & CONFFLAG_MONITORTALKER && !(dsp = ast_dsp_new())) {
+		if (confflags & (CONFFLAG_MONITORTALKER | CONFFLAG_OPTIMIZETALKER) && !(dsp = ast_dsp_new())) {
 			ast_log(LOG_WARNING, "Unable to allocate DSP!\n");
 			res = -1;
 		}
@@ -1142,6 +1187,7 @@
 			}
 
 			c = ast_waitfor_nandfds(&chan, 1, &fd, nfds, NULL, &outfd, &ms);
+			
 			
 			/* Update the struct with the actual confflags */
 			user->userflags = confflags;
@@ -1266,14 +1312,17 @@
 					user->zapchannel = !retryzap;
 					goto zapretry;
 				}
-				f = ast_read(c);
+				if ((confflags & CONFFLAG_MONITOR) || (user->adminflags & ADMINFLAG_MUTED))
+					f = ast_read_noaudio(c);
+				else
+					f = ast_read(c);
 				if (!f)
 					break;
 				if ((f->frametype == AST_FRAME_VOICE) && (f->subclass == AST_FORMAT_SLINEAR)) {
 					if (user->talk.actual)
 						ast_frame_adjust_volume(f, user->talk.actual);
 
-					if (confflags &  CONFFLAG_MONITORTALKER) {
+					if (confflags & (CONFFLAG_MONITORTALKER | CONFFLAG_OPTIMIZETALKER)) {
 						int totalsilence;
 
 						if (user->talking == -1)
@@ -1282,7 +1331,8 @@
 						res = ast_dsp_silence(dsp, f, &totalsilence);
 						if (!user->talking && totalsilence < MEETME_DELAYDETECTTALK) {
 							user->talking = 1;
-							manager_event(EVENT_FLAG_CALL, "MeetmeTalking",
+							if (confflags & CONFFLAG_MONITORTALKER)
+								manager_event(EVENT_FLAG_CALL, "MeetmeTalking",
 								      "Channel: %s\r\n"
 								      "Uniqueid: %s\r\n"
 								      "Meetme: %s\r\n"
@@ -1291,7 +1341,8 @@
 						}
 						if (user->talking && totalsilence > MEETME_DELAYDETECTENDTALK) {
 							user->talking = 0;
-							manager_event(EVENT_FLAG_CALL, "MeetmeStopTalking",
+							if (confflags & CONFFLAG_MONITORTALKER)
+								manager_event(EVENT_FLAG_CALL, "MeetmeStopTalking",
 								      "Channel: %s\r\n"
 								      "Uniqueid: %s\r\n"
 								      "Meetme: %s\r\n"
@@ -1308,7 +1359,12 @@
 						   audio frames (in which case carefully writing would only
 						   have delayed the audio even further).
 						*/
-						write(fd, f->data, f->datalen);
+						/* As it turns out, we do want to use careful write.  We just
+						   don't want to block, but we do want to at least *try*
+						   to write out all the samples.
+						 */
+						if (user->talking || !(confflags & CONFFLAG_OPTIMIZETALKER))
+							careful_write(fd, f->data, f->datalen, 0);
 					}
 				} else if ((f->frametype == AST_FRAME_DTMF) && (confflags & CONFFLAG_EXIT_CONTEXT)) {
 					char tmp[2];
@@ -1504,10 +1560,46 @@
 					fr.samples = res/2;
 					fr.data = buf;
 					fr.offset = AST_FRIENDLY_OFFSET;
-					if (user->listen.actual)
-						ast_frame_adjust_volume(&fr, user->listen.actual);
-					if (ast_write(chan, &fr) < 0) {
-						ast_log(LOG_WARNING, "Unable to write frame to channel: %s\n", strerror(errno));
+					if (!user->listen.actual && 
+						((confflags & CONFFLAG_MONITOR) || 
+						 (user->adminflags & ADMINFLAG_MUTED) ||
+						 (user->talking && (confflags & CONFFLAG_OPTIMIZETALKER))
+						 )) {
+						int index;
+						for (index=0;index<AST_FRAME_BITS;index++)
+							if (chan->rawwriteformat & (1 << index))
+								break;
+						if (index >= AST_FRAME_BITS)
+							goto bailoutandtrynormal;
+						ast_mutex_lock(&conf->listenlock);
+						if (!conf->transframe[index]) {
+							if (conf->origframe) {
+								if (!conf->transpath[index])
+									conf->transpath[index] = ast_translator_build_path((1 << index), AST_FORMAT_SLINEAR);
+								if (conf->transpath[index]) {
+									conf->transframe[index] = ast_translate(conf->transpath[index], conf->origframe, 0);
+									if (!conf->transframe[index])
+										conf->transframe[index] = &null_frame;
+								}
+							}
+						}
+						if (conf->transframe[index]) {
+ 							if (conf->transframe[index]->frametype != AST_FRAME_NULL) {
+	 							if (ast_write(chan, conf->transframe[index]))
+									ast_log(LOG_WARNING, "Unable to write frame to channel: %s\n", strerror(errno));
+							}
+						} else {
+							ast_mutex_unlock(&conf->listenlock);
+							goto bailoutandtrynormal;
+						}
+						ast_mutex_unlock(&conf->listenlock);
+					} else {
+bailoutandtrynormal:					
+						if (user->listen.actual)
+							ast_frame_adjust_volume(&fr, user->listen.actual);
+						if (ast_write(chan, &fr) < 0) {
+							ast_log(LOG_WARNING, "Unable to write frame to channel: %s\n", strerror(errno));
+						}
 					}
 				} else 
 					ast_log(LOG_WARNING, "Failed to read frame: %s\n", strerror(errno));
@@ -1549,7 +1641,7 @@
  outrun:
 	ast_mutex_lock(&conflock);
 
-	if (confflags & CONFFLAG_MONITORTALKER && dsp)
+	if (dsp)
 		ast_dsp_free(dsp);
 	
 	if (user->user_no) { /* Only cleanup users who really joined! */
@@ -1991,15 +2083,16 @@
 	return res;
 }
 
-static struct ast_conf_user* find_user(struct ast_conference *conf, char *callerident) {
+static struct ast_conf_user* find_user(struct ast_conference *conf, char *callerident) 
+{
 	struct ast_conf_user *user = NULL;
-	char usrno[1024] = "";
-
+	int cid;
+	
+	sscanf(callerident, "%i", &cid);
 	if (conf && callerident) {
 		user = conf->firstuser;
 		while (user) {
-			snprintf(usrno, sizeof(usrno), "%d", user->user_no);
-			if (strcmp(usrno, callerident) == 0)
+			if (cid == user->user_no)
 				return user;
 			user = user->nextuser;
 		}
@@ -2093,7 +2186,7 @@
 				if (user && (user->adminflags & ADMINFLAG_MUTED)) {
 					user->adminflags ^= ADMINFLAG_MUTED;
 				} else {
-					ast_log(LOG_NOTICE, "Specified User not found or he muted himself!");
+					ast_log(LOG_NOTICE, "Specified User not found or he muted himself!\n");
 				}
 				break;
 			case  110: /* n: Unmute all users */
@@ -2133,39 +2226,62 @@
 	struct ast_conference *cnf = args;
 	struct ast_frame *f=NULL;
 	int flags;
-	struct ast_filestream *s;
+	struct ast_filestream *s=NULL;
 	int res=0;
+	int x;
+	const char *oldrecordingfilename = NULL;
 
 	if (!cnf || !cnf->chan) {
 		pthread_exit(0);
 	}
+
 	ast_stopstream(cnf->chan);
 	flags = O_CREAT|O_TRUNC|O_WRONLY;
-	s = ast_writefile(cnf->recordingfilename, cnf->recordingformat, NULL, flags, 0, 0644);
-
-	if (s) {
-		cnf->recording = MEETME_RECORD_ACTIVE;
-		while (ast_waitfor(cnf->chan, -1) > -1) {
-			f = ast_read(cnf->chan);
-			if (!f) {
-				res = -1;
+
+
+	cnf->recording = MEETME_RECORD_ACTIVE;
+	while (ast_waitfor(cnf->chan, -1) > -1) {
+		if (cnf->recording == MEETME_RECORD_TERMINATE) {
+			ast_mutex_lock(&conflock);
+			ast_mutex_unlock(&conflock);
+			break;
+		}
+		if (!s && cnf->recordingfilename && (cnf->recordingfilename != oldrecordingfilename)) {
+			s = ast_writefile(cnf->recordingfilename, cnf->recordingformat, NULL, flags, 0, 0644);
+			oldrecordingfilename = cnf->recordingfilename;
+		}
+		
+		f = ast_read(cnf->chan);
+		if (!f) {
+			res = -1;
+			break;
+		}
+		if (f->frametype == AST_FRAME_VOICE) {
+			ast_mutex_lock(&cnf->listenlock);
+			for (x=0;x<AST_FRAME_BITS;x++) {
+				/* Free any translations that have occured */
+				if (cnf->transframe[x]) {
+					ast_frfree(cnf->transframe[x]);
+					cnf->transframe[x] = NULL;
+				}
+				if (cnf->origframe)
+					ast_frfree(cnf->origframe);
+				cnf->origframe = f;
+			}
+			ast_mutex_unlock(&cnf->listenlock);
+			if (s)
+				res = ast_writestream(s, f);
+			if (res) {
+				ast_frfree(f);
 				break;
 			}
-			if (f->frametype == AST_FRAME_VOICE) {
-				res = ast_writestream(s, f);
-				if (res) 
-					break;
-			}
-			ast_frfree(f);
-			if (cnf->recording == MEETME_RECORD_TERMINATE) {
-				ast_mutex_lock(&conflock);
-				ast_mutex_unlock(&conflock);
-				break;
-			}
-		}
-		cnf->recording = MEETME_RECORD_OFF;
+		}
+		ast_frfree(f);
+	}
+	cnf->recording = MEETME_RECORD_OFF;
+	if (s)
 		ast_closestream(s);
-	}
+	
 	pthread_exit(0);
 }
 

Modified: team/bweschke/bug_5374/apps/app_realtime.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/bug_5374/apps/app_realtime.c?rev=7611&r1=7610&r2=7611&view=diff
==============================================================================
--- team/bweschke/bug_5374/apps/app_realtime.c (original)
+++ team/bweschke/bug_5374/apps/app_realtime.c Fri Dec 23 01:25:07 2005
@@ -53,13 +53,18 @@
 static char *usynopsis = "Realtime Data Rewrite";
 static char *USAGE = "RealTime(<family>|<colmatch>|<value>[|<prefix>])";
 static char *UUSAGE = "RealTimeUpdate(<family>|<colmatch>|<value>|<newcol>|<newval>)";
-static char *desc = "Use the RealTime config handler system to read data into channel variables.\n"
+static char *desc =
+"Use the RealTime config handler system to read data into channel variables.\n"
 "RealTime(<family>|<colmatch>|<value>[|<prefix>])\n\n"
-"All unique column names will be set as channel variables with optional prefix to the name.\n"
-"e.g. prefix of 'var_' would make the column 'name' become the variable ${var_name}\n\n";
+"All unique column names will be set as channel variables with optional prefix\n"
+"to the name.  For example, a prefix of 'var_' would make the column 'name'\n"
+"become the variable ${var_name}.  REALTIMECOUNT will be set with the number\n"
+"of values read.\n";
 static char *udesc = "Use the RealTime config handler system to update a value\n"
 "RealTimeUpdate(<family>|<colmatch>|<value>|<newcol>|<newval>)\n\n"
-"The column <newcol> in 'family' matching column <colmatch>=<value> will be updated to <newval>\n";
+"The column <newcol> in 'family' matching column <colmatch>=<value> will be\n"
+"updated to <newval>.  REALTIMECOUNT will be set with the number of rows\n"
+"updated or -1 if an error occurs.\n";
 
 STANDARD_LOCAL_USER;
 LOCAL_USER_DECL;
@@ -130,7 +135,8 @@
 {
 	char *family=NULL, *colmatch=NULL, *value=NULL, *newcol=NULL, *newval=NULL;
 	struct localuser *u;
-	int res = 0;
+	int res = 0, count = 0;
+	char countc[13];
 
 	if (ast_strlen_zero(data)) {
 		ast_log(LOG_ERROR,"Invalid input: usage %s\n",UUSAGE);
@@ -156,8 +162,11 @@
 		ast_log(LOG_ERROR,"Invalid input: usage %s\n",UUSAGE);
 		res = -1;
 	} else {
-		ast_update_realtime(family,colmatch,value,newcol,newval,NULL);
-	}
+		count = ast_update_realtime(family,colmatch,value,newcol,newval,NULL);
+	}
+
+	snprintf(countc, sizeof(countc), "%d", count);
+	pbx_builtin_setvar_helper(chan, "REALTIMECOUNT", countc);
 
 	LOCAL_USER_REMOVE(u);
 	
@@ -167,10 +176,11 @@
 
 static int realtime_exec(struct ast_channel *chan, void *data)
 {
-	int res=0;
+	int res=0, count=0;
 	struct localuser *u;
 	struct ast_variable *var, *itt;
 	char *family=NULL, *colmatch=NULL, *value=NULL, *prefix=NULL, *vname=NULL;
+	char countc[13];
 	size_t len;
 		
 	if (ast_strlen_zero(data)) {
@@ -207,11 +217,14 @@
 					vname = itt->name;
 
 				pbx_builtin_setvar_helper(chan, vname, itt->value);
+				count++;
 			}
 			ast_variables_destroy(var);
 		} else if (option_verbose > 3)
 			ast_verbose(VERBOSE_PREFIX_4"No Realtime Matches Found.\n");
 	}
+	snprintf(countc, sizeof(countc), "%d", count);
+	pbx_builtin_setvar_helper(chan, "REALTIMECOUNT", countc);
 	
 	LOCAL_USER_REMOVE(u);
 	return res;

Modified: team/bweschke/bug_5374/apps/app_rpt.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/bug_5374/apps/app_rpt.c?rev=7611&r1=7610&r2=7611&view=diff
==============================================================================
--- team/bweschke/bug_5374/apps/app_rpt.c (original)
+++ team/bweschke/bug_5374/apps/app_rpt.c Fri Dec 23 01:25:07 2005
@@ -20,7 +20,7 @@
 /*
  *
  * Radio Repeater / Remote Base program 
- *  version 0.37 11/3/05
+ *  version 0.39 12/19/05
  * 
  * See http://www.zapatatelephony.org/app_rpt.html
  *
@@ -114,6 +114,9 @@
 
 #define	MAXREMSTR 15
 
+#define	DELIMCHR ','
+#define	QUOTECHR 34
+
 #define	NODES "nodes"
 #define MEMORY "memory"
 #define	FUNCTIONS "functions"
@@ -139,7 +142,8 @@
 
 enum{ID,PROC,TERM,COMPLETE,UNKEY,REMDISC,REMALREADY,REMNOTFOUND,REMGO,
 	CONNECTED,CONNFAIL,STATUS,TIMEOUT,ID1, STATS_TIME,
-	STATS_VERSION, IDTALKOVER, ARB_ALPHA, TEST_TONE, REV_PATCH};
+	STATS_VERSION, IDTALKOVER, ARB_ALPHA, TEST_TONE, REV_PATCH,
+	TAILMSG};
 
 enum {REM_SIMPLEX,REM_MINUS,REM_PLUS};
 
@@ -153,7 +157,8 @@
 
 enum {REM_MODE_FM,REM_MODE_USB,REM_MODE_LSB,REM_MODE_AM};
 
-enum {HF_SCAN_OFF,HF_SCAN_DOWN_SLOW,HF_SCAN_DOWN_QUICK,HF_SCAN_DOWN_FAST,HF_SCAN_UP_SLOW,HF_SCAN_UP_QUICK,HF_SCAN_UP_FAST};
+enum {HF_SCAN_OFF,HF_SCAN_DOWN_SLOW,HF_SCAN_DOWN_QUICK,
+      HF_SCAN_DOWN_FAST,HF_SCAN_UP_SLOW,HF_SCAN_UP_QUICK,HF_SCAN_UP_FAST};
 
 #include "asterisk.h"
 
@@ -197,7 +202,7 @@
 #include "asterisk/say.h"
 #include "asterisk/localtime.h"
 
-static  char *tdesc = "Radio Repeater / Remote Base  version 0.37  11/03/2005";
+static  char *tdesc = "Radio Repeater / Remote Base  version 0.39  12/19/2005";
 
 static char *app = "Rpt";
 
@@ -341,6 +346,7 @@
 	int totime;
 	int idtime;
 	int unkeytocttimer;
+	int duplex;
 	char keyed;
 	char exttx;
 	char localtx;
@@ -360,7 +366,7 @@
 	struct rpt_tele tele;
 	pthread_t rpt_call_thread,rpt_thread;
 	time_t rem_dtmf_time,dtmf_time_rem;
-	int tailtimer,totimer,idtimer,txconf,conf,callmode,cidx,scantimer;
+	int tailtimer,totimer,idtimer,txconf,conf,callmode,cidx,scantimer,tmsgtimer;
 	int mustid;
 	int politeid;
 	int dtmfidx,rem_dtmfidx;
@@ -387,6 +393,11 @@
 	int longestfunc;
 	int longestnode;
 	int threadrestarts;		
+	int tailmessagetime;
+	int tailsquashedtime;
+	char *tailmessages[500];
+	int tailmessagemax;
+	int tailmessagen;
 	time_t disgorgetime;
 	time_t lastthreadrestarttime;
 	char	nobusyout;
@@ -459,6 +470,44 @@
 	{"remote", function_remote}
 } ;
 	
+static int finddelim(char *str,char *strp[])
+{
+int     i,inquo;
+
+        inquo = 0;
+        i = 0;
+        strp[i++] = str;
+        if (!*str)
+           {
+                strp[0] = 0;
+                return(0);
+           }
+        for(; *str; str++)
+           {
+                if (*str == QUOTECHR)
+                   {
+                        if (inquo)
+                           {
+                                *str = 0;
+                                inquo = 0;
+                           }
+                        else
+                           {
+                                strp[i - 1] = str + 1;
+                                inquo = 1;
+                           }

[... 1856 lines stripped ...]


More information about the svn-commits mailing list