[asterisk-commits] murf: branch group/newcdr r176941 - in /team/group/newcdr: ./ apps/ channels/...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Feb 18 09:02:39 CST 2009


Author: murf
Date: Wed Feb 18 09:02:38 2009
New Revision: 176941

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=176941
Log:
Merged revisions 176556-176557,176592,176627,176631-176632,176635,176639,176642,176666,176669,176697,176705-176706 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

................
r176556 | oej | 2009-02-17 10:28:21 -0700 (Tue, 17 Feb 2009) | 2 lines

Typo

................
r176557 | russell | 2009-02-17 10:33:38 -0700 (Tue, 17 Feb 2009) | 12 lines

Fix a race condition that caused device states to become incorrect for hints.

The problem here is that the hint processing code was subscribed to the wrong
event type.  So, it started processing state for a hint too soon, before the
device state cache had been updated.

Also, fix a similar bug in app_queue, as it was also subscribed to the wrong
event type.

(closes issue #14461)
Reported by: alecdavis

................
r176592 | tilghman | 2009-02-17 11:49:20 -0700 (Tue, 17 Feb 2009) | 4 lines

Add assertions in the quest to track down a refcount leak.
(closes issue #14485)
 Reported by: davevg

................
r176627 | russell | 2009-02-17 13:41:24 -0700 (Tue, 17 Feb 2009) | 37 lines

Merge a large set of updates to the Asterisk indications API.

This patch includes a number of changes to the indications API.  The primary
motivation for this work was to improve stability.  The object management
in this API was significantly flawed, and a number of trivial situations could
cause crashes.

The changes included are:

1) Remove the module res_indications.  This included the critical functionality
   that actually loaded the indications configuration.  I have seen many people
   have Asterisk problems because they accidentally did not have an
   indications.conf present and loaded.  Now, this code is in the core,
   and Asterisk will fail to start without indications configuration.

   There was one part of res_indications, the dialplan applications, which did
   belong in a module, and have been moved to a new module, app_playtones.

2) Object management has been significantly changed.  Tone zones are now
   managed using astobj2, and it is no longer possible to crash Asterisk by
   issuing a reload that destroys tone zones while they are in use.

3) The API documentation has been filled out.

4) The API has been updated to follow our naming conventions.

5) Various bits of code throughout the tree have been updated to account
   for the API update.

6) Configuration parsing has been mostly re-written.

7) "Code cleanup"

The code is from svn/asterisk/team/russell/indications/.

Review: http://reviewboard.digium.com/r/149/

................
r176631 | oej | 2009-02-17 13:50:03 -0700 (Tue, 17 Feb 2009) | 2 lines

Typo

................
r176632 | russell | 2009-02-17 13:51:10 -0700 (Tue, 17 Feb 2009) | 8 lines

Add an implementation of the heap data structure.

A heap is a convenient data structure for implementing a priority queue.

Code from svn/asterisk/team/russell/heap/.

Review: http://reviewboard.digium.com/r/160/

................
r176635 | russell | 2009-02-17 13:56:26 -0700 (Tue, 17 Feb 2009) | 4 lines

Add a test module for the heap implementation.

Review: http://reviewboard.digium.com/r/160/

................
r176639 | russell | 2009-02-17 14:04:08 -0700 (Tue, 17 Feb 2009) | 9 lines

Significantly improve scheduler performance under high load.

This patch changes the scheduler to use a max-heap to store pending scheduler
entries instead of a fully sorted doubly linked list.  When the number of
entries in the scheduler gets large, this will perform much better.  For much
more detailed information on this change, see the review request.

Review: http://reviewboard.digium.com/r/160/

................
r176642 | tilghman | 2009-02-17 14:14:18 -0700 (Tue, 17 Feb 2009) | 8 lines

Prior to masquerade, move the group definitions to the channel performing the
masq, so that the group count lingers past the bridge.
(closes issue #14275)
 Reported by: kowalma
 Patches: 
       20090216__bug14275.diff.txt uploaded by Corydon76 (license 14)
 Tested by: kowalma

................
r176666 | russell | 2009-02-17 14:22:40 -0700 (Tue, 17 Feb 2009) | 16 lines

Update the timing API to have better support for multiple timing interfaces.

1) Add module use count handling so that timing modules can be unloaded.

2) Implement unload_module() functions for the timing interface modules.

3) Allow multiple timing modules to be loaded, and use the one with the
   highest priority value.

4) Report which timing module is being use in the "timing test" CLI command.

(closes issue #14489)
Reported by: russell

Review: http://reviewboard.digium.com/r/162/

................
r176669 | tilghman | 2009-02-17 14:23:10 -0700 (Tue, 17 Feb 2009) | 16 lines

Recorded merge of revisions 176661 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r176661 | tilghman | 2009-02-17 15:21:41 -0600 (Tue, 17 Feb 2009) | 9 lines
  
  Backport change to 1.4:
    Prior to masquerade, move the group definitions to the channel performing the
    masq, so that the group count lingers past the bridge.
    (closes issue #14275)
     Reported by: kowalma
     Patches: 
           20090216__bug14275.diff.txt uploaded by Corydon76 (license 14)
     Tested by: kowalma
........

................
r176697 | mmichelson | 2009-02-17 14:40:09 -0700 (Tue, 17 Feb 2009) | 3 lines

Clear up documentation of AST_FRIENDLY_OFFSET in frame.h


................
r176705 | dhubbard | 2009-02-17 14:59:38 -0700 (Tue, 17 Feb 2009) | 11 lines

create a UDPTL structure in create_addr_from_peer() if it does not already exist for T38

This is required to create a UDPTL structure in create_addr_from_peer() to handle the
scenario where 't38pt_udptl=yes' is not defined in the [general] section of sip.conf but 
is defined the peer's context.  I tested this patch by enabling t38pt_udptl in the 
[general] section on one system and only enabling t38pt_udptl in a peer's context on
the system sending a fax.  Without the patch, the sending system will fail to initiate
T38 negotiation with the warning message, "No way to add SDP without an UDPTL structure".
When this patch is applied the sending side will successfully initiate T38 negotiation.


................
r176706 | mmichelson | 2009-02-17 15:02:42 -0700 (Tue, 17 Feb 2009) | 3 lines

Use constants from inttypes.h to clear up 32-bit compilation errors


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

Added:
    team/group/newcdr/apps/app_playtones.c
      - copied unchanged from r176706, trunk/apps/app_playtones.c
    team/group/newcdr/include/asterisk/heap.h
      - copied unchanged from r176706, trunk/include/asterisk/heap.h
    team/group/newcdr/main/heap.c
      - copied unchanged from r176706, trunk/main/heap.c
    team/group/newcdr/tests/test_heap.c
      - copied unchanged from r176706, trunk/tests/test_heap.c
    team/group/newcdr/tests/test_sched.c
      - copied unchanged from r176706, trunk/tests/test_sched.c
Removed:
    team/group/newcdr/res/res_indications.c
Modified:
    team/group/newcdr/   (props changed)
    team/group/newcdr/UPGRADE.txt
    team/group/newcdr/apps/app_disa.c
    team/group/newcdr/apps/app_read.c
    team/group/newcdr/apps/app_readexten.c
    team/group/newcdr/channels/chan_local.c
    team/group/newcdr/channels/chan_misdn.c
    team/group/newcdr/channels/chan_sip.c
    team/group/newcdr/channels/chan_skinny.c
    team/group/newcdr/channels/chan_unistim.c
    team/group/newcdr/configs/extconfig.conf.sample
    team/group/newcdr/configs/indications.conf.sample
    team/group/newcdr/funcs/func_channel.c
    team/group/newcdr/funcs/func_odbc.c
    team/group/newcdr/include/asterisk/_private.h
    team/group/newcdr/include/asterisk/channel.h
    team/group/newcdr/include/asterisk/config.h
    team/group/newcdr/include/asterisk/frame.h
    team/group/newcdr/include/asterisk/indications.h
    team/group/newcdr/include/asterisk/timing.h
    team/group/newcdr/main/Makefile
    team/group/newcdr/main/app.c
    team/group/newcdr/main/asterisk.c
    team/group/newcdr/main/channel.c
    team/group/newcdr/main/indications.c
    team/group/newcdr/main/loader.c
    team/group/newcdr/main/pbx.c
    team/group/newcdr/main/sched.c
    team/group/newcdr/main/timing.c
    team/group/newcdr/res/res_odbc.c
    team/group/newcdr/res/res_timing_dahdi.c
    team/group/newcdr/res/res_timing_pthread.c
    team/group/newcdr/res/res_timing_timerfd.c
    team/group/newcdr/res/snmp/agent.c

Propchange: team/group/newcdr/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Propchange: team/group/newcdr/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Wed Feb 18 09:02:38 2009
@@ -1,1 +1,1 @@
-/trunk:1-176514
+/trunk:1-176707

Modified: team/group/newcdr/UPGRADE.txt
URL: http://svn.digium.com/svn-view/asterisk/team/group/newcdr/UPGRADE.txt?view=diff&rev=176941&r1=176940&r2=176941
==============================================================================
--- team/group/newcdr/UPGRADE.txt (original)
+++ team/group/newcdr/UPGRADE.txt Wed Feb 18 09:02:38 2009
@@ -17,6 +17,13 @@
 === UPGRADE-1.6.txt -- Upgrade info for 1.4 to 1.6
 ===
 ===========================================================
+
+From 1.6.1 to 1.6.2:
+
+* The res_indications module has been removed.  Its functionality was important
+  enough that most of it has been moved into the Asterisk core.
+  Two applications previously provided by res_indications, PlayTones and
+  StopPlayTones, have been moved into a new module, app_playtones.
 
 From 1.6.0.1 to 1.6.1:
 

Modified: team/group/newcdr/apps/app_disa.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/newcdr/apps/app_disa.c?view=diff&rev=176941&r1=176940&r2=176941
==============================================================================
--- team/group/newcdr/apps/app_disa.c (original)
+++ team/group/newcdr/apps/app_disa.c Wed Feb 18 09:02:38 2009
@@ -124,15 +124,20 @@
 
 static void play_dialtone(struct ast_channel *chan, char *mailbox)
 {
-	const struct tone_zone_sound *ts = NULL;
-	if(ast_app_has_voicemail(mailbox, NULL))
+	struct ast_tone_zone_sound *ts = NULL;
+
+	if (ast_app_has_voicemail(mailbox, NULL)) {
 		ts = ast_get_indication_tone(chan->zone, "dialrecall");
-	else
+	} else {
 		ts = ast_get_indication_tone(chan->zone, "dial");
-	if (ts)
+	}
+
+	if (ts) {
 		ast_playtones_start(chan, 0, ts->data, 0);
-	else
+		ts = ast_tone_zone_sound_unref(ts);
+	} else {
 		ast_tonepair_start(chan, 350, 440, 0, 0);
+	}
 }
 
 static int disa_exec(struct ast_channel *chan, void *data)

Modified: team/group/newcdr/apps/app_read.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/newcdr/apps/app_read.c?view=diff&rev=176941&r1=176940&r2=176941
==============================================================================
--- team/group/newcdr/apps/app_read.c (original)
+++ team/group/newcdr/apps/app_read.c Wed Feb 18 09:02:38 2009
@@ -132,7 +132,7 @@
 	int tries = 1, to = 0, x = 0;
 	double tosec;
 	char *argcopy = NULL;
-	struct tone_zone_sound *ts = NULL;
+	struct ast_tone_zone_sound *ts = NULL;
 	struct ast_flags flags = {0};
 	const char *status = "ERROR";
 
@@ -188,7 +188,7 @@
 		return 0;
 	}
 	if (ast_test_flag(&flags, OPT_INDICATION)) {
-		if (! ast_strlen_zero(arglist.filename)) {
+		if (!ast_strlen_zero(arglist.filename)) {
 			ts = ast_get_indication_tone(chan->zone, arglist.filename);
 		}
 	}
@@ -258,6 +258,10 @@
 		}
 	}
 
+	if (ts) {
+		ts = ast_tone_zone_sound_unref(ts);
+	}
+
 	if (ast_check_hangup(chan))
 		status = "HANGUP";
 	pbx_builtin_setvar_helper(chan, "READSTATUS", status);

Modified: team/group/newcdr/apps/app_readexten.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/newcdr/apps/app_readexten.c?view=diff&rev=176941&r1=176940&r2=176941
==============================================================================
--- team/group/newcdr/apps/app_readexten.c (original)
+++ team/group/newcdr/apps/app_readexten.c Wed Feb 18 09:02:38 2009
@@ -132,7 +132,7 @@
 	int maxdigits = sizeof(exten) - 1;
 	int timeout = 0, digit_timeout = 0, x = 0;
 	char *argcopy = NULL, *status = "";
-	struct tone_zone_sound *ts = NULL;
+	struct ast_tone_zone_sound *ts = NULL;
 	struct ast_flags flags = {0};
 
 	 AST_DECLARE_APP_ARGS(arglist,
@@ -179,8 +179,9 @@
 	if (digit_timeout <= 0)
 		digit_timeout = chan->pbx ? chan->pbx->dtimeoutms : 5000;
 
-	if (ast_test_flag(&flags, OPT_INDICATION) && !ast_strlen_zero(arglist.filename))
+	if (ast_test_flag(&flags, OPT_INDICATION) && !ast_strlen_zero(arglist.filename)) {
 		ts = ast_get_indication_tone(chan->zone, arglist.filename);
+	}
 
 	do {
 		if (chan->_state != AST_STATE_UP) {
@@ -250,6 +251,10 @@
 		}
 	} while (0);
 
+	if (ts) {
+		ts = ast_tone_zone_sound_unref(ts);
+	}
+
 	pbx_builtin_setvar_helper(chan, "READEXTENSTATUS", status);
 
 	return status[0] == 'H' ? -1 : 0;

Modified: team/group/newcdr/channels/chan_local.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/newcdr/channels/chan_local.c?view=diff&rev=176941&r1=176940&r2=176941
==============================================================================
--- team/group/newcdr/channels/chan_local.c (original)
+++ team/group/newcdr/channels/chan_local.c Wed Feb 18 09:02:38 2009
@@ -106,8 +106,8 @@
 	char exten[AST_MAX_EXTENSION];		/* Extension to call */
 	int reqformat;				/* Requested format */
 	struct ast_jb_conf jb_conf;		/*!< jitterbuffer configuration for this local channel */
-	struct ast_channel *owner;		/* Master Channel */
-	struct ast_channel *chan;		/* Outbound channel */
+	struct ast_channel *owner;		/* Master Channel - Bridging happens here */
+	struct ast_channel *chan;		/* Outbound channel - PBX is run here */
 	struct ast_module_user *u_owner;	/*! reference to keep the module loaded while in use */
 	struct ast_module_user *u_chan;		/*! reference to keep the module loaded while in use */
 	AST_LIST_ENTRY(local_pvt) list;		/* Next entity */
@@ -303,6 +303,7 @@
 							p->chan->audiohooks = p->owner->audiohooks;
 							p->owner->audiohooks = audiohooks_swapper;
 						}
+						ast_app_group_update(p->chan, p->owner);
 						ast_channel_masquerade(p->owner, p->chan->_bridge);
 						ast_set_flag(p, LOCAL_ALREADY_MASQED);
 					}

Modified: team/group/newcdr/channels/chan_misdn.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/newcdr/channels/chan_misdn.c?view=diff&rev=176941&r1=176940&r2=176941
==============================================================================
--- team/group/newcdr/channels/chan_misdn.c (original)
+++ team/group/newcdr/channels/chan_misdn.c Wed Feb 18 09:02:38 2009
@@ -379,7 +379,7 @@
 	 * \brief Tone zone sound used for dialtone generation.
 	 * \note Used as a boolean.  Non-NULL to prod generation if enabled. 
 	 */
-	const struct tone_zone_sound *ts;
+	struct ast_tone_zone_sound *ts;
 	
 	/*!
 	 * \brief Enables overlap dialing for the set amount of seconds.  (0 = Disabled)
@@ -3357,7 +3357,6 @@
 
 static int dialtone_indicate(struct chan_list *cl)
 {
-	const struct tone_zone_sound *ts = NULL;
 	struct ast_channel *ast = cl->ast;
 	int nd = 0;
 
@@ -3374,14 +3373,14 @@
 	}
 	
 	chan_misdn_log(3, cl->bc->port, " --> Dial\n");
-	ts = ast_get_indication_tone(ast->zone, "dial");
-	cl->ts = ts;	
-	
-	if (ts) {
+
+	cl->ts = ast_get_indication_tone(ast->zone, "dial");
+	
+	if (cl->ts) {
 		cl->notxtone = 0;
 		cl->norxtone = 0;
 		/* This prods us in misdn_write */
-		ast_playtones_start(ast, 0, ts->data, 0);
+		ast_playtones_start(ast, 0, cl->ts->data, 0);
 	}
 
 	return 0;
@@ -3406,8 +3405,9 @@
 	misdn_lib_tone_generator_stop(cl->bc);
 	ast_playtones_stop(ast);
 
-	cl->ts = NULL;
-	/*ast_deactivate_generator(ast);*/
+	if (cl->ts) {
+		cl->ts = ast_tone_zone_sound_unref(cl->ts);
+	}
 
 	return 0;
 }

Modified: team/group/newcdr/channels/chan_sip.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/newcdr/channels/chan_sip.c?view=diff&rev=176941&r1=176940&r2=176941
==============================================================================
--- team/group/newcdr/channels/chan_sip.c (original)
+++ team/group/newcdr/channels/chan_sip.c Wed Feb 18 09:02:38 2009
@@ -4709,6 +4709,10 @@
 	}
 	dialog->prefs = peer->prefs;
 	if (ast_test_flag(&dialog->flags[1], SIP_PAGE2_T38SUPPORT)) {
+		if (!dialog->udptl) {
+			/* t38pt_udptl was enabled in the peer and not in [general] */
+			dialog->udptl = ast_udptl_new_with_bindaddr(sched, io, 0, bindaddr.sin_addr);
+		}
 		ast_copy_flags(&dialog->t38.t38support, &peer->flags[1], SIP_PAGE2_T38SUPPORT);
 		set_t38_capabilities(dialog);
 		dialog->t38.jointcapability = dialog->t38.capability;

Modified: team/group/newcdr/channels/chan_skinny.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/newcdr/channels/chan_skinny.c?view=diff&rev=176941&r1=176940&r2=176941
==============================================================================
--- team/group/newcdr/channels/chan_skinny.c (original)
+++ team/group/newcdr/channels/chan_skinny.c Wed Feb 18 09:02:38 2009
@@ -3751,7 +3751,7 @@
 {
 	struct skinny_subchannel *xferor; /* the sub doing the transferring */
 	struct skinny_subchannel *xferee; /* the sub being transferred */
-	const struct tone_zone_sound *ts = NULL;
+	struct ast_tone_zone_sound *ts = NULL;
 		
 	if (ast_bridged_channel(sub->owner) || ast_bridged_channel(sub->related->owner)) {
 		if (sub->xferor) {
@@ -3774,8 +3774,10 @@
 			}
 			if (xferor->owner->_state == AST_STATE_RING) {
 				/* play ringing inband */
-				ts = ast_get_indication_tone(xferor->owner->zone, "ring");
-				ast_playtones_start(xferor->owner, 0, ts->data, 1);
+				if ((ts = ast_get_indication_tone(xferor->owner->zone, "ring"))) {
+					ast_playtones_start(xferor->owner, 0, ts->data, 1);
+					ts = ast_tone_zone_sound_unref(ts);
+				}
 			}
 			if (skinnydebug)
 				ast_debug(1, "Transfer Masquerading %s to %s\n",
@@ -3789,8 +3791,10 @@
 			ast_queue_control(xferee->owner, AST_CONTROL_UNHOLD);
 			if (xferor->owner->_state == AST_STATE_RING) {
 				/* play ringing inband */
-				ts = ast_get_indication_tone(xferor->owner->zone, "ring");
-				ast_playtones_start(xferor->owner, 0, ts->data, 1);
+				if ((ts = ast_get_indication_tone(xferor->owner->zone, "ring"))) {
+					ast_playtones_start(xferor->owner, 0, ts->data, 1);
+					ts = ast_tone_zone_sound_unref(ts);
+				}
 			}
 			if (skinnydebug)
 				ast_debug(1, "Transfer Masquerading %s to %s\n",

Modified: team/group/newcdr/channels/chan_unistim.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/newcdr/channels/chan_unistim.c?view=diff&rev=176941&r1=176940&r2=176941
==============================================================================
--- team/group/newcdr/channels/chan_unistim.c (original)
+++ team/group/newcdr/channels/chan_unistim.c Wed Feb 18 09:02:38 2009
@@ -439,7 +439,7 @@
 	char datetimeformat;	    /*!< format used for displaying time/date */
 	char contrast;			  /*!< contrast */
 	char country[3];			/*!< country used for dial tone frequency */
-	struct tone_zone *tz;	       /*!< Tone zone for res_indications (ring, busy, congestion) */
+	struct ast_tone_zone *tz;	       /*!< Tone zone for res_indications (ring, busy, congestion) */
 	char ringvolume;			/*!< Ring volume */
 	char ringstyle;			 /*!< Ring melody */
 	int rtp_port;			   /*!< RTP port used by the phone */
@@ -4057,17 +4057,17 @@
 	return "UNKNOWN";
 }
 
-static void in_band_indication(struct ast_channel *ast, const struct tone_zone *tz,
+static void in_band_indication(struct ast_channel *ast, const struct ast_tone_zone *tz,
 	const char *indication)
 {
-	const struct tone_zone_sound *ts = NULL;
-
-	ts = ast_get_indication_tone(tz, indication);
-
-	if (ts && ts->data[0])
+	struct ast_tone_zone_sound *ts = NULL;
+
+	if ((ts = ast_get_indication_tone(tz, indication))) {
 		ast_playtones_start(ast, 0, ts->data, 1);
-	else
+		ts = ast_tone_zone_sound_unref(ts);
+	} else {
 		ast_log(LOG_WARNING, "Unable to get indication tone for %s\n", indication);
+	}
 }
 
 static int unistim_indicate(struct ast_channel *ast, int ind, const void *data, 
@@ -5223,6 +5223,9 @@
 		ast_log(LOG_ERROR, "An Unistim device must have at least one line!\n");
 		ast_mutex_destroy(&l->lock);
 		ast_free(l);
+		if (d->tz) {
+			d->tz = ast_tone_zone_unref(d->tz);
+		}
 		ast_free(d);
 		return NULL;
 	}
@@ -5240,6 +5243,9 @@
 			ast_log(LOG_ERROR, "You must specify the mac address with device=\n");
 			ast_mutex_destroy(&l->lock);
 			ast_free(l);
+			if (d->tz) {
+				d->tz = ast_tone_zone_unref(d->tz);
+			}
 			ast_free(d);
 			return NULL;
 		} else
@@ -5461,6 +5467,9 @@
 					d2 = d2->next;
 				}
 			}
+			if (d->tz) {
+				d->tz = ast_tone_zone_unref(d->tz);
+			}
 			ast_free(d);
 			d = devices;
 			continue;

Modified: team/group/newcdr/configs/extconfig.conf.sample
URL: http://svn.digium.com/svn-view/asterisk/team/group/newcdr/configs/extconfig.conf.sample?view=diff&rev=176941&r1=176940&r2=176941
==============================================================================
--- team/group/newcdr/configs/extconfig.conf.sample (original)
+++ team/group/newcdr/configs/extconfig.conf.sample Wed Feb 18 09:02:38 2009
@@ -60,7 +60,7 @@
 ;queues => odbc,asterisk
 ;queue_members => odbc,asterisk
 ;musiconhold => mysql,asterisk
-;queue_log => mysql,aasterisk
+;queue_log => mysql,asterisk
 ;
 ;
 ; While most dynamic realtime engines are automatically used when defined in

Modified: team/group/newcdr/configs/indications.conf.sample
URL: http://svn.digium.com/svn-view/asterisk/team/group/newcdr/configs/indications.conf.sample?view=diff&rev=176941&r1=176940&r2=176941
==============================================================================
--- team/group/newcdr/configs/indications.conf.sample (original)
+++ team/group/newcdr/configs/indications.conf.sample Wed Feb 18 09:02:38 2009
@@ -1,6 +1,9 @@
+;
 ; indications.conf
+;
 ; Configuration file for location specific tone indications
-; used by the pbx_indications module.
+;
+
 ;
 ; NOTE:
 ;    When adding countries to this file, please keep them in alphabetical
@@ -9,7 +12,7 @@
 ; The [general] category is for certain global variables.
 ; All other categories are interpreted as location specific indications
 ;
-;
+
 [general]
 country=us		; default location
 
@@ -17,9 +20,6 @@
 ; [example]
 ; description = string
 ;      The full name of your country, in English.
-; alias = iso[,iso]*
-;      List of other countries 2-letter iso codes, which have the same
-;      tone indications.
 ; ringcadence = num[,num]*
 ;      List of durations the physical bell rings.
 ; dial = tonelist
@@ -55,8 +55,6 @@
 ; concisely:
 ;   element = [!]freq[+|*freq2][/duration]
 ;   tonelist = element[,element]*
-;
-; Please note that SPACES ARE NOT ALLOWED in tone lists!
 ;
 
 [at]

Modified: team/group/newcdr/funcs/func_channel.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/newcdr/funcs/func_channel.c?view=diff&rev=176941&r1=176940&r2=176941
==============================================================================
--- team/group/newcdr/funcs/func_channel.c (original)
+++ team/group/newcdr/funcs/func_channel.c Wed Feb 18 09:02:38 2009
@@ -367,12 +367,19 @@
 	}
 #endif
 	else if (!strcasecmp(data, "tonezone")) {
-		struct tone_zone *new_zone;
+		struct ast_tone_zone *new_zone;
 		if (!(new_zone = ast_get_indication_zone(value))) {
 			ast_log(LOG_ERROR, "Unknown country code '%s' for tonezone. Check indications.conf for available country codes.\n", value);
 			ret = -1;	
-		} else 
-			chan->zone = new_zone;
+		} else {
+			ast_channel_lock(chan);
+			if (chan->zone) {
+				chan->zone = ast_tone_zone_unref(chan->zone);
+			}
+			chan->zone = ast_tone_zone_ref(new_zone);
+			ast_channel_unlock(chan);
+			new_zone = ast_tone_zone_unref(new_zone);
+		}
 	} else if (!strcasecmp(data, "callgroup"))
 		chan->callgroup = ast_get_group(value);
 	else if (!strcasecmp(data, "txgain")) {

Modified: team/group/newcdr/funcs/func_odbc.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/newcdr/funcs/func_odbc.c?view=diff&rev=176941&r1=176940&r2=176941
==============================================================================
--- team/group/newcdr/funcs/func_odbc.c (original)
+++ team/group/newcdr/funcs/func_odbc.c Wed Feb 18 09:02:38 2009
@@ -338,8 +338,10 @@
 		SQLCloseCursor(stmt);
 		SQLFreeHandle(SQL_HANDLE_STMT, stmt);
 	}
-	if (obj)
+	if (obj) {
 		ast_odbc_release_obj(obj);
+		obj = NULL;
+	}
 
 	if (chan)
 		ast_autoservice_stop(chan);
@@ -443,6 +445,7 @@
 		ast_log(LOG_ERROR, "Unable to execute query [%s]\n", ast_str_buffer(sql));
 		if (obj) {
 			ast_odbc_release_obj(obj);
+			obj = NULL;
 		}
 		pbx_builtin_setvar_helper(chan, "ODBCROWS", rowcount);
 		if (chan) {
@@ -460,6 +463,7 @@
 		SQLCloseCursor(stmt);
 		SQLFreeHandle (SQL_HANDLE_STMT, stmt);
 		ast_odbc_release_obj(obj);
+		obj = NULL;
 		pbx_builtin_setvar_helper(chan, "ODBCROWS", rowcount);
 		if (chan) {
 			ast_autoservice_stop(chan);
@@ -486,6 +490,7 @@
 		SQLCloseCursor(stmt);
 		SQLFreeHandle(SQL_HANDLE_STMT, stmt);
 		ast_odbc_release_obj(obj);
+		obj = NULL;
 		pbx_builtin_setvar_helper(chan, "ODBCROWS", rowcount);
 		pbx_builtin_setvar_helper(chan, "ODBCSTATUS", status);
 		if (chan)
@@ -528,6 +533,7 @@
 						SQLCloseCursor(stmt);
 						SQLFreeHandle(SQL_HANDLE_STMT, stmt);
 						ast_odbc_release_obj(obj);
+						obj = NULL;
 						pbx_builtin_setvar_helper(chan, "ODBCROWS", rowcount);
 						pbx_builtin_setvar_helper(chan, "ODBCSTATUS", "MEMERROR");
 						if (chan)
@@ -625,6 +631,7 @@
 			SQLCloseCursor(stmt);
 			SQLFreeHandle(SQL_HANDLE_STMT, stmt);
 			ast_odbc_release_obj(obj);
+			obj = NULL;
 			if (chan)
 				ast_autoservice_stop(chan);
 			if (bogus_chan)
@@ -637,6 +644,7 @@
 	SQLCloseCursor(stmt);
 	SQLFreeHandle(SQL_HANDLE_STMT, stmt);
 	ast_odbc_release_obj(obj);
+	obj = NULL;
 	if (chan)
 		ast_autoservice_stop(chan);
 	if (bogus_chan)
@@ -1056,6 +1064,7 @@
 			ast_debug(1, "Got obj\n");
 			if (!(stmt = ast_odbc_direct_execute(obj, generic_execute, ast_str_buffer(sql)))) {
 				ast_odbc_release_obj(obj);
+				obj = NULL;
 				continue;
 			}
 
@@ -1067,6 +1076,7 @@
 				SQLCloseCursor(stmt);
 				SQLFreeHandle (SQL_HANDLE_STMT, stmt);
 				ast_odbc_release_obj(obj);
+				obj = NULL;
 				AST_RWLIST_UNLOCK(&queries);
 				return CLI_SUCCESS;
 			}
@@ -1076,6 +1086,7 @@
 				SQLCloseCursor(stmt);
 				SQLFreeHandle(SQL_HANDLE_STMT, stmt);
 				ast_odbc_release_obj(obj);
+				obj = NULL;
 				if (res == SQL_NO_DATA) {
 					ast_cli(a->fd, "Returned %d rows.  Query executed on handle %d:%s [%s]\n", rows, dsn, query->readhandle[dsn], ast_str_buffer(sql));
 					break;
@@ -1103,27 +1114,33 @@
 						SQLCloseCursor(stmt);
 						SQLFreeHandle(SQL_HANDLE_STMT, stmt);
 						ast_odbc_release_obj(obj);
+						obj = NULL;
 						AST_RWLIST_UNLOCK(&queries);
 						return CLI_SUCCESS;
 					}
 
 					ast_cli(a->fd, "%-20.20s  %s\n", colname, ast_str_buffer(coldata));
 				}
+				rows++;
+
 				/* Get next row */
 				res = SQLFetch(stmt);
 				if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
 					break;
 				}
 				ast_cli(a->fd, "%-20.20s  %s\n", "----------", "----------");
-				rows++;
 			}
 			SQLCloseCursor(stmt);
 			SQLFreeHandle(SQL_HANDLE_STMT, stmt);
 			ast_odbc_release_obj(obj);
-			ast_cli(a->fd, "Returned %d rows.  Query executed on handle %d [%s]\n", rows, dsn, query->readhandle[dsn]);
+			obj = NULL;
+			ast_cli(a->fd, "Returned %d row%s.  Query executed on handle %d [%s]\n", rows, rows == 1 ? "" : "s", dsn, query->readhandle[dsn]);
 			break;
 		}
-		ast_odbc_release_obj(obj);
+		if (obj) {
+			ast_odbc_release_obj(obj);
+			obj = NULL;
+		}
 
 		if (!executed) {
 			ast_cli(a->fd, "Failed to execute query. [%s]\n", ast_str_buffer(sql));
@@ -1252,6 +1269,7 @@
 			}
 			if (!(stmt = ast_odbc_direct_execute(obj, generic_execute, ast_str_buffer(sql)))) {
 				ast_odbc_release_obj(obj);
+				obj = NULL;
 				continue;
 			}
 
@@ -1259,6 +1277,7 @@
 			SQLCloseCursor(stmt);
 			SQLFreeHandle(SQL_HANDLE_STMT, stmt);
 			ast_odbc_release_obj(obj);
+			obj = NULL;
 			ast_cli(a->fd, "Affected %d rows.  Query executed on handle %d [%s]\n", (int)rows, dsn, query->writehandle[dsn]);
 			executed = 1;
 			break;

Modified: team/group/newcdr/include/asterisk/_private.h
URL: http://svn.digium.com/svn-view/asterisk/team/group/newcdr/include/asterisk/_private.h?view=diff&rev=176941&r1=176940&r2=176941
==============================================================================
--- team/group/newcdr/include/asterisk/_private.h (original)
+++ team/group/newcdr/include/asterisk/_private.h Wed Feb 18 09:02:38 2009
@@ -39,6 +39,8 @@
 int ast_http_reload(void);		/*!< Provided by http.c */
 int ast_tps_init(void); 		/*!< Provided by taskprocessor.c */
 int ast_timing_init(void);		/*!< Provided by timing.c */
+int ast_indications_init(void); /*!< Provided by indications.c */
+int ast_indications_reload(void);/*!< Provided by indications.c */
 
 /*!
  * \brief Reload asterisk modules.

Modified: team/group/newcdr/include/asterisk/channel.h
URL: http://svn.digium.com/svn-view/asterisk/team/group/newcdr/include/asterisk/channel.h?view=diff&rev=176941&r1=176940&r2=176941
==============================================================================
--- team/group/newcdr/include/asterisk/channel.h (original)
+++ team/group/newcdr/include/asterisk/channel.h Wed Feb 18 09:02:38 2009
@@ -425,7 +425,7 @@
 	struct ast_trans_pvt *readtrans;		/*!< Read translation path */
 	struct ast_audiohook_list *audiohooks;
 	struct ast_cdr *cdr;				/*!< Call Detail Record */
-	struct tone_zone *zone;			/*!< Tone zone as set in indications.conf or
+	struct ast_tone_zone *zone;			/*!< Tone zone as set in indications.conf or
 							     in the CHANNEL dialplan function */
 	struct ast_channel_monitor *monitor;		/*!< Channel monitoring */
 #ifdef HAVE_EPOLL

Modified: team/group/newcdr/include/asterisk/config.h
URL: http://svn.digium.com/svn-view/asterisk/team/group/newcdr/include/asterisk/config.h?view=diff&rev=176941&r1=176940&r2=176941
==============================================================================
--- team/group/newcdr/include/asterisk/config.h (original)
+++ team/group/newcdr/include/asterisk/config.h Wed Feb 18 09:02:38 2009
@@ -257,10 +257,11 @@
 /*! 
  * \brief Retrieve realtime configuration 
  * \param family which family/config to lookup
+ *
  * This will use builtin configuration backends to look up a particular 
  * entity in realtime and return a variable list of its parameters. Unlike
  * the ast_load_realtime, this function can return more than one entry and
- * is thus stored inside a taditional ast_config structure rather than 
+ * is thus stored inside a traditional ast_config structure rather than 
  * just returning a linked list of variables.
  *
  * Note that you should use the constant SENTINEL to terminate arguments, in

Modified: team/group/newcdr/include/asterisk/frame.h
URL: http://svn.digium.com/svn-view/asterisk/team/group/newcdr/include/asterisk/frame.h?view=diff&rev=176941&r1=176940&r2=176941
==============================================================================
--- team/group/newcdr/include/asterisk/frame.h (original)
+++ team/group/newcdr/include/asterisk/frame.h Wed Feb 18 09:02:38 2009
@@ -194,9 +194,17 @@
     for this purpose instead of having to declare one on the stack */
 extern struct ast_frame ast_null_frame;
 
-#define AST_FRIENDLY_OFFSET 	64	/*! It's polite for a a new frame to
-					  have this number of bytes for additional
-					  headers.  */
+/*! \brief Offset into a frame's data buffer.
+ *
+ * By providing some "empty" space prior to the actual data of an ast_frame,
+ * this gives any consumer of the frame ample space to prepend other necessary
+ * information without having to create a new buffer.
+ *
+ * As an example, RTP can use the data from an ast_frame and simply prepend the
+ * RTP header information into the space provided by AST_FRIENDLY_OFFSET instead
+ * of having to create a new buffer with the necessary space allocated.
+ */
+#define AST_FRIENDLY_OFFSET 	64	
 #define AST_MIN_OFFSET 		32	/*! Make sure we keep at least this much handy */
 
 /*! Need the header be free'd? */

Modified: team/group/newcdr/include/asterisk/indications.h
URL: http://svn.digium.com/svn-view/asterisk/team/group/newcdr/include/asterisk/indications.h?view=diff&rev=176941&r1=176940&r2=176941
==============================================================================
--- team/group/newcdr/include/asterisk/indications.h (original)
+++ team/group/newcdr/include/asterisk/indications.h Wed Feb 18 09:02:38 2009
@@ -1,91 +1,251 @@
 /*
  * Asterisk -- An open source telephony toolkit.
+ *
+ * Copyright (C) 2002, Pauline Middelink
+ * Copyright (C) 2009, Digium, Inc.
  *
  * See http://www.asterisk.org for more information about
  * the Asterisk project. Please do not directly contact
  * any of the maintainers of this project for assistance;
  * the project provides a web site, mailing lists and IRC
  * channels for your use.
- */
-
-/*! \file
- * \brief BSD Telephony Of Mexico "Tormenta" Tone Zone Support 2/22/01
- * 
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- * 
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 
- *
- * Primary Author: Pauline Middelink <middelink at polyware.nl>
- *
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE file
+ * at the top of the source tree.
+ */
+
+/*!
+ * \file
+ * \brief Tone Indication Support
+ *
+ * \author Pauline Middelink <middelink at polyware.nl>
+ * \author Russell Bryant <russell at digium.com>
  */
 
 #ifndef _ASTERISK_INDICATIONS_H
 #define _ASTERISK_INDICATIONS_H
 
-#include "asterisk/lock.h"
-
-/*! \brief Description is a series of tones of the format:
-	   [!]freq1[+freq2][/duration] separated by commas.  There
-	   are no spaces.  The sequence is repeated back to the 
-	   first tone description not preceeded by !. Duration is
-	   specified in milliseconds */
-struct tone_zone_sound {
-	const char *name;			/*!< Identifing name */
-	const char *data;			/*!< Actual zone description */
-	AST_LIST_ENTRY(tone_zone_sound) list;
+#include "asterisk/astobj2.h"
+
+/*!
+ * \brief Description of a tone
+ */
+struct ast_tone_zone_sound {
+	/*! \brief Name of the tone.  For example, "busy". */
+	const char *name;
+	/*!
+	 * \brief Description of a tone
+	 *
+	 * The format is a comma separated list of tone parts in the following format:
+	 *
+	 * Format: [!][M]freq[<+|*>freq2][/duration]
+	 *  - '!' - means that the element is NOT repeated
+	 *  - 'M' - interpret the frequencies as midi notes instead of frequencies
+	 *  - freq - The first frequency
+	 *  - freq2 - The second frequency (optional)
+	 *  - '*' - modulate freq by freq2 at a fixed depth of 90%
+	 *  - '+' - combine the frequencies
+	 *  - duration - the length of the tone part (optional, forever if not specified)
+	 */
+	const char *data;
+	/*! \brief Linked list fields for including in the list on an ast_tone_zone */
+	AST_LIST_ENTRY(ast_tone_zone_sound) entry;
+	/*! \brief Flags only used internally */
+	union {
+		uint32_t __padding;
+		struct {
+			unsigned int killme:1;
+		};
+	};
 };
 
-struct tone_zone {
-	AST_RWLIST_ENTRY(tone_zone) list;
-	char country[5];				/*!< Country code */
-	char alias[5];					/*!< is this an alias? */
-	char description[40];				/*!< Description */
-	int  nrringcadence;				/*!< # registered ringcadence elements */
-	int *ringcadence;				/*!< Ring cadence */
-	AST_LIST_HEAD_NOLOCK(, tone_zone_sound) tones;		/*!< The known tones for this zone */
+/*!
+ * \brief A set of tones for a given locale
+ *
+ * \note If a reference to this tone zone is held, then the country
+ *       is guaranteed not to change.  It is safe to read it without
+ *       locking the tone zone.  This is not the case for any other
+ *       field.
+ */
+struct ast_tone_zone {
+	/*! \brief Country code that this set of tones is for */
+	char country[5];
+	/*! 
+	 * \brief Text description of the given country.
+	 *
+	 * This is for nothing more than friendly display to a human.
+	 */
+	char description[40];
+	/*! \brief Number of ring cadence elements in the ringcadence array */
+	unsigned int  nrringcadence;
+	/*! 
+	 * \brief Array of ring cadence parts
+	 *
+	 * Each element is an amount of time in milliseconds.  The first element
+	 * is for time on, and from there it alternates between on and off.
+	 */
+	int *ringcadence;
+	/*! \brief A list of tones for this locale */
+	AST_LIST_HEAD_NOLOCK(, ast_tone_zone_sound) tones;
+	/*! \brief Flags only used internally */
+	union {
+		uint32_t __padding;
+		struct {
+			unsigned int killme:1;
+		};
+	};
 };
 
-/*! \brief set the default tone country */
-int ast_set_indication_country(const char *country);
-
-/*! \brief locate tone_zone, given the country. if country == NULL, use the default country */
-struct tone_zone *ast_get_indication_zone(const char *country);
-/*! \brief locate a tone_zone_sound, given the tone_zone. if tone_zone == NULL, use the default tone_zone */
-struct tone_zone_sound *ast_get_indication_tone(const struct tone_zone *zone, const char *indication);
-/*! \brief deallocate the passed tone zone */
-void ast_destroy_indication_zone(struct tone_zone *zone);
-
-/*! \brief add a new country, if country exists, it will be replaced. */
-int ast_register_indication_country(struct tone_zone *country);
-/*! \brief remove an existing country and all its indications, country must exist */
-int ast_unregister_indication_country(const char *country);
-/*! \brief add a new indication to a tone_zone. tone_zone must exist. if the indication already
- * exists, it will be replaced. */
-int ast_register_indication(struct tone_zone *zone, const char *indication, const char *tonelist);
-/*! \brief remove an existing tone_zone's indication. tone_zone must exist */
-int ast_unregister_indication(struct tone_zone *zone, const char *indication);
-
-/*! \brief Start a tone-list going */
-int ast_playtones_start(struct ast_channel *chan, int vol, const char* tonelist, int interruptible);
-/*! \brief Stop the tones from playing */
+/*!
+ * \brief A description of a part of a tone
+ *
+ * The elements in this structure map to the format described for the data
+ * part of the ast_tone_zone_sound struct.
+ */
+struct ast_tone_zone_part {
+	unsigned int freq1;
+	unsigned int freq2;
+	unsigned int time;
+	unsigned int modulate:1;
+	unsigned int midinote:1;
+};
+
+/*!
+ * \brief Parse a tone part
+ *
+ * \param s The part of a tone to parse.  This should be in the form described for
+ *        the data part of ast_tone_zone_sound.  '!' should be removed if present.
+ * \param tone_data An output parameter that contains the result of the parsing.
+ *
+ * \retval 0 success
+ * \retval -1 failure, and the contents of tone_data are undefined
+ */
+int ast_tone_zone_part_parse(const char *s, struct ast_tone_zone_part *tone_data);
+
+/*!
+ * \brief locate ast_tone_zone
+ *
+ * \param country country to find.  If NULL is provided, get the default.
+ *
+ * \return a reference to the specified country if found or NULL if not found
+ */

[... 2945 lines stripped ...]



More information about the asterisk-commits mailing list