[svn-commits] murf: branch murf/bug_7638 r57555 - in /team/murf/bug_7638: ./ apps/ channels...

svn-commits at lists.digium.com svn-commits at lists.digium.com
Fri Mar 2 13:19:57 MST 2007


Author: murf
Date: Fri Mar  2 14:19:56 2007
New Revision: 57555

URL: http://svn.digium.com/view/asterisk?view=rev&rev=57555
Log:
Merged revisions 56665,56686,56731-56732,56742,56784,56786,56811,56840,56849,56860,56889,56926,56952,56976,57011,57050,57054,57056,57090,57094,57140,57145,57147,57184,57204,57209,57241,57259,57293,57319,57365,57397,57438,57474,57476,57478 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

................
r56665 | oej | 2007-02-24 13:29:41 -0700 (Sat, 24 Feb 2007) | 2 lines

Doxygen additions, corrections

................
r56686 | tilghman | 2007-02-25 07:53:40 -0700 (Sun, 25 Feb 2007) | 19 lines

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

................
r56685 | tilghman | 2007-02-25 08:46:41 -0600 (Sun, 25 Feb 2007) | 11 lines

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

........
r56684 | tilghman | 2007-02-25 08:38:03 -0600 (Sun, 25 Feb 2007) | 3 lines

Issue 9130 - If prev is the last item on the channel list, then evaluating
additional conditions (e.g. name prefix) will cause a NULL dereference.

........

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

................
r56731 | russell | 2007-02-25 17:37:03 -0700 (Sun, 25 Feb 2007) | 3 lines

There is no need to look in the iaxs array for the pvt struct when we already
have a pointer to it.

................
r56732 | russell | 2007-02-25 17:38:49 -0700 (Sun, 25 Feb 2007) | 3 lines

Remove redundant check to ensure that LOW_MEMORY is not defined.
(issue #9136, mvanbaak)

................
r56742 | russell | 2007-02-25 18:05:15 -0700 (Sun, 25 Feb 2007) | 10 lines

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

........
r56740 | russell | 2007-02-25 19:04:40 -0600 (Sun, 25 Feb 2007) | 2 lines

Move a comment to be in the correct struct.

........

................
r56784 | file | 2007-02-26 09:38:10 -0700 (Mon, 26 Feb 2007) | 10 lines

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

........
r56783 | file | 2007-02-26 11:36:08 -0500 (Mon, 26 Feb 2007) | 2 lines

Allow both of the show version files and core show file versions CLI commands to work. (issue #9135 reported by mvanbaak)

........

................
r56786 | russell | 2007-02-26 09:54:17 -0700 (Mon, 26 Feb 2007) | 11 lines

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

........
r56785 | russell | 2007-02-26 10:51:18 -0600 (Mon, 26 Feb 2007) | 3 lines

Do more complete locking of the chan_iax2_pvt struct in the indicate callback.
(Problem brought up by Ben Smithurst on the asterisk-dev list)

........

................
r56811 | file | 2007-02-26 10:12:18 -0700 (Mon, 26 Feb 2007) | 10 lines

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

........
r56805 | file | 2007-02-26 12:09:53 -0500 (Mon, 26 Feb 2007) | 2 lines

Use ast_strlen_zero to see if the language and/or context argument is not present for Background instead of just checking if it is NULL. (issue #9141 reported by mjagdis)

........

................
r56840 | file | 2007-02-26 12:34:59 -0700 (Mon, 26 Feb 2007) | 10 lines

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

........
r56839 | file | 2007-02-26 14:33:48 -0500 (Mon, 26 Feb 2007) | 2 lines

Update app_record documentation to use new CLI command, core show file formats. (issue #9151 reported by junky)

........

................
r56849 | russell | 2007-02-26 13:04:53 -0700 (Mon, 26 Feb 2007) | 10 lines

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

........
r56847 | russell | 2007-02-26 14:04:13 -0600 (Mon, 26 Feb 2007) | 2 lines

Fix a crash in my last change to iax2_indicate(). (issue #9150)

........

................
r56860 | file | 2007-02-26 13:09:06 -0700 (Mon, 26 Feb 2007) | 18 lines

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

................
r56856 | file | 2007-02-26 15:07:18 -0500 (Mon, 26 Feb 2007) | 10 lines

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

........
r56850 | file | 2007-02-26 15:05:02 -0500 (Mon, 26 Feb 2007) | 2 lines

Obey the clearglobalvars option in extensions reload (or dialplan reload depending on your version). (issue #9146 reported by ramonpeek)

........

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

................
r56889 | russell | 2007-02-26 13:43:18 -0700 (Mon, 26 Feb 2007) | 12 lines

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

........
r56888 | russell | 2007-02-26 14:42:21 -0600 (Mon, 26 Feb 2007) | 4 lines

Restore the behavior of Asterisk 1.2 where if a device was not specified in
alsa.conf, then we just use the system default, instead of creating our own
default of hw:0,0.  (issue #9139)

........

................
r56926 | tilghman | 2007-02-26 15:02:54 -0700 (Mon, 26 Feb 2007) | 9 lines

Blocked revisions 56922 via svnmerge

........
r56922 | tilghman | 2007-02-26 16:01:23 -0600 (Mon, 26 Feb 2007) | 2 lines

Picky, picky... show deprecation warning in application help, too (reported via list)

........

................
r56952 | tilghman | 2007-02-26 17:11:32 -0700 (Mon, 26 Feb 2007) | 2 lines

Issue 7789 - some telcos want the TON set based on the number, but without the NANP prefix removed

................
r56976 | russell | 2007-02-27 10:38:57 -0700 (Tue, 27 Feb 2007) | 14 lines

(also issue #9159)

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

........
r56975 | russell | 2007-02-27 11:36:09 -0600 (Tue, 27 Feb 2007) | 4 lines

Fix voicemail email attachments.  I missed the conversion of one of the line
endings and there was an extra one where it should not have been.
(issue #9128)

........

................
r57011 | file | 2007-02-27 15:17:42 -0700 (Tue, 27 Feb 2007) | 2 lines

Properly hangup the original dialed channel, not the new channel that appeared from the forwarding. (issue #9161 reported by PhilSmith)

................
r57050 | murf | 2007-02-28 10:22:45 -0700 (Wed, 28 Feb 2007) | 9 lines

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

........
r57049 | murf | 2007-02-28 10:15:27 -0700 (Wed, 28 Feb 2007) | 1 line

I was surprised that I had not yet downgraded missing goto targets and macro call defs to a warning, in case they are in extensions.conf; I rectified this problem. Also, A goto in a macro to a target in a catch block was not being found; I fixed this too; the cause was that I needed to treat catch statements like an extension in the find_match code.
........

................
r57054 | file | 2007-02-28 10:47:41 -0700 (Wed, 28 Feb 2007) | 10 lines

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

........
r57053 | file | 2007-02-28 12:45:50 -0500 (Wed, 28 Feb 2007) | 2 lines

Better handle timeouts when the individual speaks after everything has been played but before the timeout ends.

........

................
r57056 | file | 2007-02-28 10:56:04 -0700 (Wed, 28 Feb 2007) | 10 lines

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

........
r57055 | file | 2007-02-28 12:55:03 -0500 (Wed, 28 Feb 2007) | 2 lines

Picky compiler...

........

................
r57090 | russell | 2007-02-28 11:21:47 -0700 (Wed, 28 Feb 2007) | 16 lines

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

........
r57089 | russell | 2007-02-28 12:20:05 -0600 (Wed, 28 Feb 2007) | 8 lines

Merge current set of changes from svn/asterisk/team/russell/sla_updates

* Add support for station ring delays.  Ring delays can be set globally for a
  station or for specific trunks on the station.
* Fix a few bugs in existing code.
* Restructure and Reorganize code to improve readability and maintainability.
* Improve formatting of the "sla show (trunks|stations)" CLI commands.

........

................
r57094 | file | 2007-02-28 12:00:24 -0700 (Wed, 28 Feb 2007) | 18 lines

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

................
r57093 | file | 2007-02-28 13:57:52 -0500 (Wed, 28 Feb 2007) | 10 lines

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

........
r57092 | file | 2007-02-28 13:55:45 -0500 (Wed, 28 Feb 2007) | 2 lines

Fix a few more issues with the agent logoff CLI command. (issue #9123 reported by arbrandes)

........

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

................
r57140 | murf | 2007-02-28 12:30:58 -0700 (Wed, 28 Feb 2007) | 17 lines

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

................
r57139 | murf | 2007-02-28 12:23:05 -0700 (Wed, 28 Feb 2007) | 9 lines

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

........
r57118 | murf | 2007-02-28 12:12:41 -0700 (Wed, 28 Feb 2007) | 1 line

a small documentation update, to reflect reality in the goto doc strings, as per 9156, Goto does not proceed to next prio if jump fails
........

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

................
r57145 | russell | 2007-02-28 12:57:41 -0700 (Wed, 28 Feb 2007) | 14 lines

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

........
r57144 | russell | 2007-02-28 13:56:20 -0600 (Wed, 28 Feb 2007) | 6 lines

Merge changes from svn/asterisk/team/russell/sla_updates

* Add support for the "barge=no" option for trunks.  If this option is set,
  then stations will not be able to join in on a call that is on progress
  on this trunk.

........

................
r57147 | russell | 2007-02-28 12:59:26 -0700 (Wed, 28 Feb 2007) | 10 lines

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

........
r57146 | russell | 2007-02-28 13:58:56 -0600 (Wed, 28 Feb 2007) | 2 lines

Minor formatting change

........

................
r57184 | file | 2007-02-28 13:46:01 -0700 (Wed, 28 Feb 2007) | 2 lines

Convert the PBX core to use read/write locks. This yields a nifty performance improvement when it comes to simultaneous calls going through the dialplan. Using murf's test the old mutex based core took an average of 57.3 seconds while the rwlock based core took 31.1 seconds. That's a nifty 26.2 seconds performance improvement. The other good part is that if we do need to switch back then we just have to change the lock/unlock API calls. I converted everywhere that used to touch the mutex locks directly to use them.

................
r57204 | russell | 2007-02-28 15:09:33 -0700 (Wed, 28 Feb 2007) | 15 lines

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

........
r57203 | russell | 2007-02-28 16:07:05 -0600 (Wed, 28 Feb 2007) | 7 lines

Merge more changes from svn/asterisk/team/russell/sla_updates

* Add support for private hold.  By setting "hold=private" for a trunk, only
  the station that put the call on hold will be able to retrieve it from hold.
  Also, by setting "hold=private" for a station, any call that station puts
  on hold can only be retrieved by that station.

........

................
r57209 | russell | 2007-02-28 16:02:49 -0700 (Wed, 28 Feb 2007) | 10 lines

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

........
r57207 | russell | 2007-02-28 17:01:52 -0600 (Wed, 28 Feb 2007) | 2 lines

minor tweaks to the sla docs

........

................
r57241 | file | 2007-02-28 17:08:18 -0700 (Wed, 28 Feb 2007) | 2 lines

Minor code cleanup... nothing to write home about.

................
r57259 | transnexus | 2007-02-28 20:01:11 -0700 (Wed, 28 Feb 2007) | 2 lines

1. Corrected a typo for www.etsi.org. Thank Patrick.

................
r57293 | russell | 2007-03-01 13:24:59 -0700 (Thu, 01 Mar 2007) | 2 lines

Constify the list of codec preferences.

................
r57319 | file | 2007-03-01 15:23:26 -0700 (Thu, 01 Mar 2007) | 18 lines

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

................
r57318 | file | 2007-03-01 17:21:44 -0500 (Thu, 01 Mar 2007) | 10 lines

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

........
r57317 | file | 2007-03-01 17:19:32 -0500 (Thu, 01 Mar 2007) | 2 lines

Don't even attempt to optimize things when a proxy channel is involved. It will just explode in weird and unexplaineable ways. (issue #9175 reported by clegall_proformatique)

........

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

................
r57365 | russell | 2007-03-01 16:44:09 -0700 (Thu, 01 Mar 2007) | 24 lines

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

........
r57364 | russell | 2007-03-01 17:42:53 -0600 (Thu, 01 Mar 2007) | 16 lines

Merge changes from svn/asterisk/team/russell/sla_updates

* Originally, I put in the documentation that only Zap interfaces would be
  supported on the trunk side.  However, after a discussion with Qwell, we came
  up with a way to make IP trunks work as well, using some things already in
  Asterisk.  So, here it is, this now officially supports IP trunks.
* Update the SLA documentation to reflect how to setup IP trunks.
* Add a section in sla.txt that describes how to set up an SLA system with
  voicemail.
* Simplify the way DTMF passthrough is handled in MeetMe.
* Fix a bug that exposed itself when using a Local channel on the trunk side
  in SLA.  The station's channel needs to be passed to the dial API when
  dialing the trunk.
* Change a WARNING message to DEBUG in channel.h.  This message is of no use
  to users.

........

................
r57397 | russell | 2007-03-01 17:22:22 -0700 (Thu, 01 Mar 2007) | 12 lines

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

........
r57396 | russell | 2007-03-01 18:20:44 -0600 (Thu, 01 Mar 2007) | 4 lines

Return the correct digit that interrupted the stream.  This fixes exiting the
Background application when using the m option.
(issue #9176, mjagdis)

........

................
r57438 | murf | 2007-03-01 22:57:06 -0700 (Thu, 01 Mar 2007) | 9 lines

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

........
r57426 | murf | 2007-03-01 22:21:36 -0700 (Thu, 01 Mar 2007) | 1 line

I almost had comma escapes right, but 9184 points out the problem-- the escape is removed by pbx_config, and pbx_ael should also, before sending it down into the pbx engine. Also, you have to insert it back in, if you are generating extensions.conf code from the AEL.
........

................
r57474 | russell | 2007-03-02 09:59:22 -0700 (Fri, 02 Mar 2007) | 3 lines

Add the channel's Language to the "show channel" CLI command and the DumpChan
application.  (issue #9187, Junky)

................
r57476 | murf | 2007-03-02 10:03:47 -0700 (Fri, 02 Mar 2007) | 17 lines

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

................
r57473 | murf | 2007-03-02 09:55:16 -0700 (Fri, 02 Mar 2007) | 9 lines

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

........
r57458 | murf | 2007-03-02 09:39:33 -0700 (Fri, 02 Mar 2007) | 1 line

further refinement in wording of goto documentation, as per 9156, goto not proceeding to next instruction
........

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

................
r57478 | file | 2007-03-02 10:09:18 -0700 (Fri, 02 Mar 2007) | 18 lines

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

................
r57477 | file | 2007-03-02 12:06:52 -0500 (Fri, 02 Mar 2007) | 10 lines

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

........
r57475 | file | 2007-03-02 12:02:46 -0500 (Fri, 02 Mar 2007) | 2 lines

If a SIP message comes in and goes to a method handler that requires additional values that may not be present then send back an error.

........

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

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

Modified:
    team/murf/bug_7638/   (props changed)
    team/murf/bug_7638/apps/app_amd.c
    team/murf/bug_7638/apps/app_dial.c
    team/murf/bug_7638/apps/app_dumpchan.c
    team/murf/bug_7638/apps/app_meetme.c
    team/murf/bug_7638/apps/app_record.c
    team/murf/bug_7638/apps/app_speech_utils.c
    team/murf/bug_7638/apps/app_while.c
    team/murf/bug_7638/channels/chan_agent.c
    team/murf/bug_7638/channels/chan_alsa.c
    team/murf/bug_7638/channels/chan_h323.c
    team/murf/bug_7638/channels/chan_iax2.c
    team/murf/bug_7638/channels/chan_local.c
    team/murf/bug_7638/channels/chan_sip.c
    team/murf/bug_7638/channels/chan_zap.c
    team/murf/bug_7638/configs/sla.conf.sample
    team/murf/bug_7638/configs/zapata.conf.sample
    team/murf/bug_7638/doc/osp.txt
    team/murf/bug_7638/doc/sla.txt
    team/murf/bug_7638/include/asterisk/ael_structs.h
    team/murf/bug_7638/include/asterisk/channel.h
    team/murf/bug_7638/include/asterisk/config.h
    team/murf/bug_7638/include/asterisk/doxyref.h
    team/murf/bug_7638/include/asterisk/http.h
    team/murf/bug_7638/include/asterisk/jingle.h
    team/murf/bug_7638/include/asterisk/pbx.h
    team/murf/bug_7638/include/asterisk/utils.h
    team/murf/bug_7638/include/asterisk/zapata.h
    team/murf/bug_7638/main/asterisk.c
    team/murf/bug_7638/main/channel.c
    team/murf/bug_7638/main/cli.c
    team/murf/bug_7638/main/config.c
    team/murf/bug_7638/main/file.c
    team/murf/bug_7638/main/pbx.c
    team/murf/bug_7638/main/rtp.c
    team/murf/bug_7638/pbx/pbx_config.c
    team/murf/bug_7638/pbx/pbx_dundi.c
    team/murf/bug_7638/res/res_limit.c
    team/murf/bug_7638/utils/ael_main.c

Propchange: team/murf/bug_7638/
------------------------------------------------------------------------------
Binary property 'branch-1.4-blocked' - no diff available.

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

Propchange: team/murf/bug_7638/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Fri Mar  2 14:19:56 2007
@@ -1,1 +1,1 @@
-/trunk:1-56654
+/trunk:1-57509

Modified: team/murf/bug_7638/apps/app_amd.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug_7638/apps/app_amd.c?view=diff&rev=57555&r1=57554&r2=57555
==============================================================================
--- team/murf/bug_7638/apps/app_amd.c (original)
+++ team/murf/bug_7638/apps/app_amd.c Fri Mar  2 14:19:56 2007
@@ -18,6 +18,14 @@
  * A license has been granted to Digium (via disclaimer) for the use of
  * this code.
  */
+
+/*! \file
+ *
+ * \brief Answering machine detection
+ *
+ * \author Claude Klimos (claude.klimos at aheeva.com)
+ */
+
 
 #include "asterisk.h"
  

Modified: team/murf/bug_7638/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug_7638/apps/app_dial.c?view=diff&rev=57555&r1=57554&r2=57555
==============================================================================
--- team/murf/bug_7638/apps/app_dial.c (original)
+++ team/murf/bug_7638/apps/app_dial.c Fri Mar  2 14:19:56 2007
@@ -428,6 +428,7 @@
 	struct cause_args *num, struct ast_flags *peerflags, int single)
 {
 	char tmpchan[256];
+	struct ast_channel *original = o->chan;
 	struct ast_channel *c = o->chan; /* the winner */
 	struct ast_channel *in = num->chan; /* the input channel */
 	char *stuff;
@@ -498,7 +499,7 @@
 		if (ast_call(c, tmpchan, 0)) {
 			ast_log(LOG_NOTICE, "Failed to dial on local channel for call forward to '%s'\n", tmpchan);
 			ast_clear_flag(o, DIAL_STILLGOING);	
-			ast_hangup(c);
+			ast_hangup(original);
 			c = o->chan = NULL;
 			num->nochan++;
 		} else {
@@ -509,7 +510,7 @@
 				ast_set_callerid(c, S_OR(in->macroexten, in->exten), get_cid_name(cidname, sizeof(cidname), in), NULL);
 			}
 			/* Hangup the original channel now, in case we needed it */
-			ast_hangup(c);
+			ast_hangup(original);
 		}
 	}
 }

Modified: team/murf/bug_7638/apps/app_dumpchan.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug_7638/apps/app_dumpchan.c?view=diff&rev=57555&r1=57554&r2=57555
==============================================================================
--- team/murf/bug_7638/apps/app_dumpchan.c (original)
+++ team/murf/bug_7638/apps/app_dumpchan.c Fri Mar  2 14:19:56 2007
@@ -85,7 +85,8 @@
 			 "CallerIDNum=        %s\n"
 			 "CallerIDName=       %s\n"
 			 "DNIDDigits=         %s\n"
-			 "RDNIS=              %s\n" 
+			 "RDNIS=              %s\n"
+ 			 "Language=           %s\n"
 			 "State=              %s (%d)\n"
 			 "Rings=              %d\n"
 			 "NativeFormat=       %s\n"
@@ -113,6 +114,7 @@
 			 S_OR(c->cid.cid_name, "(N/A)"),
 			 S_OR(c->cid.cid_dnid, "(N/A)"),
 			 S_OR(c->cid.cid_rdnis, "(N/A)"),
+			 c->language,
 			 ast_state2str(c->_state),
 			 c->_state,
 			 c->rings,

Modified: team/murf/bug_7638/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug_7638/apps/app_meetme.c?view=diff&rev=57555&r1=57554&r2=57555
==============================================================================
--- team/murf/bug_7638/apps/app_meetme.c (original)
+++ team/murf/bug_7638/apps/app_meetme.c Fri Mar  2 14:19:56 2007
@@ -334,6 +334,7 @@
 	int actual;                             /*!< Actual volume adjustment (for channels that can't adjust) */
 };
 
+/*! \brief The MeetMe User object */
 struct ast_conf_user {
 	int user_no;                            /*!< User Number */
 	int userflags;                          /*!< Flags as set in the conference */
@@ -346,7 +347,6 @@
 	time_t jointime;                        /*!< Time the user joined the conference */
 	struct volume talk;
 	struct volume listen;
-	AST_LIST_HEAD_NOLOCK(, ast_frame) frame_q;
 	AST_LIST_ENTRY(ast_conf_user) list;
 };
 
@@ -360,6 +360,15 @@
 	SLA_TRUNK_STATE_RINGING,
 	SLA_TRUNK_STATE_UP,
 	SLA_TRUNK_STATE_ONHOLD,
+};
+
+enum sla_hold_access {
+	/*! This means that any station can put it on hold, and any station
+	 * can retrieve the call from hold. */
+	SLA_HOLD_OPEN,
+	/*! This means that only the station that put the call on hold may
+	 * retrieve it from hold. */
+	SLA_HOLD_PRIVATE,
 };
 
 struct sla_trunk_ref;
@@ -377,6 +386,13 @@
 	 *  is set for a specific trunk on this station, that will take
 	 *  priority over this value. */
 	unsigned int ring_timeout;
+	/*! Ring delay for this station, for any trunk.  If a ring delay
+	 *  is set for a specific trunk on this station, that will take
+	 *  priority over this value. */
+	unsigned int ring_delay;
+	/*! This option uses the values in the sla_hold_access enum and sets the
+	 * access control type for hold on this station. */
+	unsigned int hold_access:1;
 };
 
 struct sla_station_ref {
@@ -399,10 +415,13 @@
 	/*! Number of stations that have this trunk on hold. */
 	unsigned int hold_stations;
 	struct ast_channel *chan;
-	/*! Ring timeout to use when this trunk is ringing on this specific
-	 *  station.  This takes higher priority than a ring timeout set at
-	 *  the station level. */
 	unsigned int ring_timeout;
+	/*! If set to 1, no station will be able to join an active call with
+	 *  this trunk. */
+	unsigned int barge_disabled:1;
+	/*! This option uses the values in the sla_hold_access enum and sets the
+	 * access control type for hold on this trunk. */
+	unsigned int hold_access:1;
 };
 
 struct sla_trunk_ref {
@@ -410,7 +429,14 @@
 	struct sla_trunk *trunk;
 	enum sla_trunk_state state;
 	struct ast_channel *chan;
+	/*! Ring timeout to use when this trunk is ringing on this specific
+	 *  station.  This takes higher priority than a ring timeout set at
+	 *  the station level. */
 	unsigned int ring_timeout;
+	/*! Ring delay to use when this trunk is ringing on this specific
+	 *  station.  This takes higher priority than a ring delay set at
+	 *  the station level. */
+	unsigned int ring_delay;
 };
 
 static AST_RWLIST_HEAD_STATIC(sla_stations, sla_station);
@@ -981,36 +1007,60 @@
 "Usage: meetme (un)lock|(un)mute|kick|list [concise] <confno> <usernumber>\n"
 "       Executes a command for the conference or on a conferee\n";
 
+static const char *sla_hold_str(unsigned int hold_access)
+{
+	const char *hold = "Unknown";
+
+	switch (hold_access) {
+	case SLA_HOLD_OPEN:
+		hold = "Open";
+		break;
+	case SLA_HOLD_PRIVATE:
+		hold = "Private";
+	default:
+		break;
+	}
+
+	return hold;
+}
+
 static int sla_show_trunks(int fd, int argc, char **argv)
 {
 	const struct sla_trunk *trunk;
 
 	ast_cli(fd, "\n"
-	            "--- Configured SLA Trunks -----------------------------------\n"
-	            "-------------------------------------------------------------\n"
-	            "---\n");
+	            "=============================================================\n"
+	            "=== Configured SLA Trunks ===================================\n"
+	            "=============================================================\n"
+	            "===\n");
 	AST_RWLIST_RDLOCK(&sla_trunks);
 	AST_RWLIST_TRAVERSE(&sla_trunks, trunk, entry) {
 		struct sla_station_ref *station_ref;
 		char ring_timeout[16] = "(none)";
 		if (trunk->ring_timeout)
 			snprintf(ring_timeout, sizeof(ring_timeout), "%u Seconds", trunk->ring_timeout);
-		ast_cli(fd, "--- Trunk Name:      %s\n"
-		            "--- ==> Device:      %s\n"
-					"--- ==> AutoContext: %s\n"
-					"--- ==> RingTimeout: %s\n"
-					"--- ==> Stations ...\n",
-					trunk->name, trunk->device, 
-					S_OR(trunk->autocontext, "(none)"), 
-					ring_timeout);
+		ast_cli(fd, "=== ---------------------------------------------------------\n"
+		            "=== Trunk Name:       %s\n"
+		            "=== ==> Device:       %s\n"
+		            "=== ==> AutoContext:  %s\n"
+		            "=== ==> RingTimeout:  %s\n"
+		            "=== ==> BargeAllowed: %s\n"
+		            "=== ==> HoldAccess:   %s\n"
+		            "=== ==> Stations ...\n",
+		            trunk->name, trunk->device, 
+		            S_OR(trunk->autocontext, "(none)"), 
+		            ring_timeout,
+		            trunk->barge_disabled ? "No" : "Yes",
+		            sla_hold_str(trunk->hold_access));
 		AST_RWLIST_RDLOCK(&sla_stations);
 		AST_LIST_TRAVERSE(&trunk->stations, station_ref, entry)
-			ast_cli(fd, "---    ==> Station name: %s\n", station_ref->station->name);
+			ast_cli(fd, "===    ==> Station name: %s\n", station_ref->station->name);
 		AST_RWLIST_UNLOCK(&sla_stations);
-		ast_cli(fd, "---\n");
+		ast_cli(fd, "=== ---------------------------------------------------------\n"
+		            "===\n");
 	}
 	AST_RWLIST_UNLOCK(&sla_trunks);
-	ast_cli(fd, "-------------------------------------------------------------\n"
+	ast_cli(fd, "=============================================================\n"
 	            "\n");
 
 	return RESULT_SUCCESS;
@@ -1038,24 +1088,35 @@
 	const struct sla_station *station;
 
 	ast_cli(fd, "\n" 
-	            "--- Configured SLA Stations ---------------------------------\n"
-	            "-------------------------------------------------------------\n"
-	            "---\n");
+	            "=============================================================\n"
+	            "=== Configured SLA Stations =================================\n"
+	            "=============================================================\n"
+	            "===\n");
 	AST_RWLIST_RDLOCK(&sla_stations);
 	AST_RWLIST_TRAVERSE(&sla_stations, station, entry) {
 		struct sla_trunk_ref *trunk_ref;
 		char ring_timeout[16] = "(none)";
+		char ring_delay[16] = "(none)";
 		if (station->ring_timeout) {
 			snprintf(ring_timeout, sizeof(ring_timeout), 
 				"%u", station->ring_timeout);
 		}
-		ast_cli(fd, "--- Station Name:    %s\n"
-		            "--- ==> Device:      %s\n"
-					"--- ==> AutoContext: %s\n"
-					"--- ==> RingTimeout: %s\n"
-					"--- ==> Trunks ...\n",
-					station->name, station->device,
-					S_OR(station->autocontext, "(none)"), ring_timeout);
+		if (station->ring_delay) {
+			snprintf(ring_delay, sizeof(ring_delay), 
+				"%u", station->ring_delay);
+		}
+		ast_cli(fd, "=== ---------------------------------------------------------\n"
+		            "=== Station Name:    %s\n"
+		            "=== ==> Device:      %s\n"
+		            "=== ==> AutoContext: %s\n"
+		            "=== ==> RingTimeout: %s\n"
+		            "=== ==> RingDelay:   %s\n"
+		            "=== ==> HoldAccess:  %s\n"
+		            "=== ==> Trunks ...\n",
+		            station->name, station->device,
+		            S_OR(station->autocontext, "(none)"), 
+		            ring_timeout, ring_delay,
+		            sla_hold_str(station->hold_access));
 		AST_RWLIST_RDLOCK(&sla_trunks);
 		AST_LIST_TRAVERSE(&station->trunks, trunk_ref, entry) {
 			if (trunk_ref->ring_timeout) {
@@ -1063,17 +1124,25 @@
 					"%u", trunk_ref->ring_timeout);
 			} else
 				strcpy(ring_timeout, "(none)");
-			ast_cli(fd, "---    ==> Trunk Name: %s\n", 
-				trunk_ref->trunk->name);
-			ast_cli(fd, "---       ==> State:       %s\n", 
-				trunkstate2str(trunk_ref->state));
-			ast_cli(fd, "---       ==> RingTimeout: %s\n", ring_timeout);
+			if (trunk_ref->ring_delay) {
+				snprintf(ring_delay, sizeof(ring_delay),
+					"%u", trunk_ref->ring_delay);
+			} else
+				strcpy(ring_delay, "(none)");
+			ast_cli(fd, "===    ==> Trunk Name: %s\n"
+			            "===       ==> State:       %s\n"
+			            "===       ==> RingTimeout: %s\n"
+			            "===       ==> RingDelay:   %s\n",
+			            trunk_ref->trunk->name,
+			            trunkstate2str(trunk_ref->state),
+			            ring_timeout, ring_delay);
 		}
 		AST_RWLIST_UNLOCK(&sla_trunks);
-		ast_cli(fd, "---\n");
+		ast_cli(fd, "=== ---------------------------------------------------------\n"
+		            "===\n");
 	}
 	AST_RWLIST_UNLOCK(&sla_stations);
-	ast_cli(fd, "-------------------------------------------------------------\n"
+	ast_cli(fd, "============================================================\n"
 	            "\n");
 
 	return RESULT_SUCCESS;
@@ -1168,17 +1237,15 @@
 }
 
 static void conf_queue_dtmf(const struct ast_conference *conf,
-	const struct ast_conf_user *sender, const struct ast_frame *_f)
-{
-	struct ast_frame *f;
+	const struct ast_conf_user *sender, struct ast_frame *f)
+{
 	struct ast_conf_user *user;
 
 	AST_LIST_TRAVERSE(&conf->userlist, user, list) {
 		if (user == sender)
 			continue;
-		if (!(f = ast_frdup(_f)))
-			return;
-		AST_LIST_INSERT_TAIL(&user->frame_q, f, frame_list);
+		if (ast_write(user->chan, f) < 0)
+			ast_log(LOG_WARNING, "Error writing frame to channel %s\n", user->chan->name);
 	}
 }
 
@@ -1805,14 +1872,6 @@
 					f = ast_read(c);
 				if (!f)
 					break;
-				if (!AST_LIST_EMPTY(&user->frame_q)) {
-					struct ast_frame *f;
-					f = AST_LIST_REMOVE_HEAD(&user->frame_q, frame_list);
-					if (ast_write(chan, f) < 0) {
-						ast_log(LOG_WARNING, "Error writing frame to channel!\n");
-					}
-					ast_frfree(f);
-				}
 				if ((f->frametype == AST_FRAME_VOICE) && (f->subclass == AST_FORMAT_SLINEAR)) {
 					if (user->talk.actual)
 						ast_frame_adjust_volume(f, user->talk.actual);
@@ -3046,14 +3105,50 @@
 	return station;
 }
 
-static struct sla_trunk_ref *sla_sla_find_trunk_ref(const struct sla_station *station,
+static int sla_check_station_hold_access(const struct sla_trunk *trunk)
+{
+	struct sla_station_ref *station_ref;
+	struct sla_trunk_ref *trunk_ref;
+
+	/* For each station that has this call on hold, check for private hold. */
+	AST_LIST_TRAVERSE(&trunk->stations, station_ref, entry) {
+		AST_LIST_TRAVERSE(&station_ref->station->trunks, trunk_ref, entry) {
+			if (trunk_ref->trunk != trunk)
+				continue;
+			if (trunk_ref->state == SLA_TRUNK_STATE_ONHOLD && trunk_ref->chan &&
+				station_ref->station->hold_access == SLA_HOLD_PRIVATE)
+				return 1;
+			return 0;
+		}
+	}
+
+	return 0;
+}
+
+/*! \brief Find a trunk reference on a station by name
+ * \param station the station
+ * \param name the trunk's name
+ * \return a pointer to the station's trunk reference.  If the trunk
+ *         is not found, it is not idle and barge is disabled, or if
+ *         it is on hold and private hold is set, then NULL will be returned.
+ */
+static struct sla_trunk_ref *sla_find_trunk_ref_byname(const struct sla_station *station,
 	const char *name)
 {
 	struct sla_trunk_ref *trunk_ref = NULL;
 
 	AST_LIST_TRAVERSE(&station->trunks, trunk_ref, entry) {
-		if (!strcasecmp(trunk_ref->trunk->name, name))
-			break;
+		if (strcasecmp(trunk_ref->trunk->name, name))
+			continue;
+
+		if ( (trunk_ref->trunk->barge_disabled 
+			&& trunk_ref->state != SLA_TRUNK_STATE_IDLE) ||
+			(trunk_ref->trunk->hold_stations 
+			&& trunk_ref->trunk->hold_access == SLA_HOLD_PRIVATE) ||
+			sla_check_station_hold_access(trunk_ref->trunk) )
+			trunk_ref = NULL;
+
+		break;
 	}
 
 	return trunk_ref;
@@ -3089,8 +3184,6 @@
 {
 	struct sla_station *station;
 	struct sla_trunk_ref *trunk_ref;
-
-	ast_log(LOG_DEBUG, "Setting all refs of trunk %s to state %s\n", trunk->name, trunkstate2str(state));
 
 	AST_LIST_TRAVERSE(&sla_stations, station, entry) {
 		AST_LIST_TRAVERSE(&station->trunks, trunk_ref, entry) {
@@ -3206,6 +3299,64 @@
 static void sla_dial_state_callback(struct ast_dial *dial)
 {
 	sla_queue_event(SLA_EVENT_DIAL_STATE);
+}
+
+/*! \brief Check to see if dialing this station already timed out for this ringing trunk
+ * \note Assumes sla.lock is locked
+ */
+static int sla_check_timed_out_station(const struct sla_ringing_trunk *ringing_trunk,
+	const struct sla_station *station)
+{
+	struct sla_station_ref *timed_out_station;
+
+	AST_LIST_TRAVERSE(&ringing_trunk->timed_out_stations, timed_out_station, entry) {
+		if (station == timed_out_station->station)
+			return 1;
+	}
+
+	return 0;
+}
+
+/*! \brief Choose the highest priority ringing trunk for a station
+ * \param station the station
+ * \param remove remove the ringing trunk once selected
+ * \param trunk_ref a place to store the pointer to this stations reference to
+ *        the selected trunk
+ * \return a pointer to the selected ringing trunk, or NULL if none found
+ * \note Assumes that sla.lock is locked
+ */
+static struct sla_ringing_trunk *sla_choose_ringing_trunk(struct sla_station *station, 
+	struct sla_trunk_ref **trunk_ref, int remove)
+{
+	struct sla_trunk_ref *s_trunk_ref;
+	struct sla_ringing_trunk *ringing_trunk = NULL;
+
+	AST_LIST_TRAVERSE(&station->trunks, s_trunk_ref, entry) {
+		AST_LIST_TRAVERSE_SAFE_BEGIN(&sla.ringing_trunks, ringing_trunk, entry) {
+			/* Make sure this is the trunk we're looking for */
+			if (s_trunk_ref->trunk != ringing_trunk->trunk)
+				continue;
+
+			/* This trunk on the station is ringing.  But, make sure this station
+			 * didn't already time out while this trunk was ringing. */
+			if (sla_check_timed_out_station(ringing_trunk, station))
+				continue;
+
+			if (remove)
+				AST_LIST_REMOVE_CURRENT(&sla.ringing_trunks, entry);
+
+			if (trunk_ref)
+				*trunk_ref = s_trunk_ref;
+
+			break;
+		}
+		AST_LIST_TRAVERSE_SAFE_END
+	
+		if (ringing_trunk)
+			break;
+	}
+
+	return ringing_trunk;
 }
 
 static void sla_handle_dial_state_event(void)
@@ -3234,36 +3385,22 @@
 		case AST_DIAL_RESULT_ANSWERED:
 			AST_LIST_REMOVE_CURRENT(&sla.ringing_stations, entry);
 			/* Find the appropriate trunk to answer. */
-			AST_LIST_TRAVERSE(&ringing_station->station->trunks, s_trunk_ref, entry) {
-				ast_mutex_lock(&sla.lock);
-				AST_LIST_TRAVERSE_SAFE_BEGIN(&sla.ringing_trunks, ringing_trunk, entry) {
-					struct sla_station_ref *station_ref;
-					if (s_trunk_ref->trunk != ringing_trunk->trunk)
-						continue;
-					/* This trunk on the station is ringing.  But, make sure this station
-					 * didn't already time out while this trunk was ringing. */
-					AST_LIST_TRAVERSE(&ringing_trunk->timed_out_stations, station_ref, entry) {
-						if (station_ref->station == ringing_station->station)
-							break;
-					}
-					if (station_ref)
-						continue;
-					AST_LIST_REMOVE_CURRENT(&sla.ringing_trunks, entry);
-					break;
-				}
-				AST_LIST_TRAVERSE_SAFE_END
-				ast_mutex_unlock(&sla.lock);
-				if (ringing_trunk)
-					break;
-			}
+			ast_mutex_lock(&sla.lock);
+			ringing_trunk = sla_choose_ringing_trunk(ringing_station->station, &s_trunk_ref, 1);
+			ast_mutex_unlock(&sla.lock);
 			if (!ringing_trunk) {
 				ast_log(LOG_DEBUG, "Found no ringing trunk for station '%s' to answer!\n",
 					ringing_station->station->name);
 				break;
 			}
+			/* Track the channel that answered this trunk */
 			s_trunk_ref->chan = ast_dial_answered(ringing_station->station->dial);
+			/* Actually answer the trunk */
 			ast_answer(ringing_trunk->trunk->chan);
 			sla_change_trunk_state(ringing_trunk->trunk, SLA_TRUNK_STATE_UP, ALL_TRUNK_REFS);
+			/* Now, start a thread that will connect this station to the trunk.  The rest of
+			 * the code here sets up the thread and ensures that it is able to save the arguments
+			 * before they are no longer valid since they are allocated on the stack. */
 			args.trunk_ref = s_trunk_ref;
 			args.station = ringing_station->station;
 			args.cond = &cond;
@@ -3298,84 +3435,199 @@
 	AST_LIST_TRAVERSE_SAFE_END
 }
 
-static void sla_handle_ringing_trunk_event(void)
+/*! \brief Check to see if this station is already ringing 
+ * \note Assumes sla.lock is locked 
+ */
+static int sla_check_ringing_station(const struct sla_station *station)
+{
+	struct sla_ringing_station *ringing_station;
+
+	AST_LIST_TRAVERSE(&sla.ringing_stations, ringing_station, entry) {
+		if (station == ringing_station->station)
+			return 1;
+	}
+
+	return 0;
+}
+
+/*! \brief Check to see if this station has failed to be dialed in the past minute
+ * \note assumes sla.lock is locked
+ */
+static int sla_check_failed_station(const struct sla_station *station)
+{
+	struct sla_failed_station *failed_station;
+	int res = 0;
+
+	AST_LIST_TRAVERSE_SAFE_BEGIN(&sla.failed_stations, failed_station, entry) {
+		if (station != failed_station->station)
+			continue;
+		if (ast_tvdiff_ms(ast_tvnow(), failed_station->last_try) > 1000) {
+			AST_LIST_REMOVE_CURRENT(&sla.failed_stations, entry);
+			free(failed_station);
+			break;
+		}
+		res = 1;
+	}
+	AST_LIST_TRAVERSE_SAFE_END
+
+	return res;
+}
+
+/*! \brief Ring a station
+ * \note Assumes sla.lock is locked
+ */
+static int sla_ring_station(struct sla_ringing_trunk *ringing_trunk, struct sla_station *station)
+{
+	char *tech, *tech_data;
+	struct ast_dial *dial;
+	struct sla_ringing_station *ringing_station;
+
+	if (!(dial = ast_dial_create()))
+		return -1;
+
+	ast_dial_set_state_callback(dial, sla_dial_state_callback);
+	tech_data = ast_strdupa(station->device);
+	tech = strsep(&tech_data, "/");
+
+	if (ast_dial_append(dial, tech, tech_data) == -1) {
+		ast_dial_destroy(dial);
+		return -1;
+	}
+
+	if (ast_dial_run(dial, ringing_trunk->trunk->chan, 1) != AST_DIAL_RESULT_TRYING) {
+		struct sla_failed_station *failed_station;
+		ast_dial_destroy(dial);
+		if (!(failed_station = ast_calloc(1, sizeof(*failed_station))))
+			return -1;
+		failed_station->station = station;
+		failed_station->last_try = ast_tvnow();
+		AST_LIST_INSERT_HEAD(&sla.failed_stations, failed_station, entry);
+		return -1;
+	}
+	if (!(ringing_station = sla_create_ringing_station(station))) {
+		ast_dial_join(dial);
+		ast_dial_destroy(dial);
+		return -1;
+	}
+
+	station->dial = dial;
+
+	AST_LIST_INSERT_HEAD(&sla.ringing_stations, ringing_station, entry);
+
+	return 0;
+}
+
+/*! \brief Check to see if a station is in use
+ */
+static int sla_check_inuse_station(const struct sla_station *station)
 {

[... 3091 lines stripped ...]


More information about the svn-commits mailing list