[asterisk-commits] rmudgett: branch rmudgett/dahdi_ccss r247888 - in /team/rmudgett/dahdi_ccss: ...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Feb 18 17:54:10 CST 2010


Author: rmudgett
Date: Thu Feb 18 17:54:05 2010
New Revision: 247888

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=247888
Log:
Restart automerge after conflict.

Added:
    team/rmudgett/dahdi_ccss/README-SERIOUSLY.bestpractices.txt
      - copied unchanged from r247887, team/group/CCSS/README-SERIOUSLY.bestpractices.txt
    team/rmudgett/dahdi_ccss/channels/sip/dialplan_functions.c
      - copied unchanged from r247887, team/group/CCSS/channels/sip/dialplan_functions.c
    team/rmudgett/dahdi_ccss/channels/sip/include/dialog.h
      - copied unchanged from r247887, team/group/CCSS/channels/sip/include/dialog.h
    team/rmudgett/dahdi_ccss/channels/sip/include/dialplan_functions.h
      - copied unchanged from r247887, team/group/CCSS/channels/sip/include/dialplan_functions.h
    team/rmudgett/dahdi_ccss/channels/sip/include/globals.h
      - copied unchanged from r247887, team/group/CCSS/channels/sip/include/globals.h
    team/rmudgett/dahdi_ccss/tests/test_app.c
      - copied unchanged from r247887, team/group/CCSS/tests/test_app.c
    team/rmudgett/dahdi_ccss/tests/test_devicestate.c
      - copied unchanged from r247887, team/group/CCSS/tests/test_devicestate.c
Modified:
    team/rmudgett/dahdi_ccss/   (props changed)
    team/rmudgett/dahdi_ccss/CHANGES
    team/rmudgett/dahdi_ccss/Makefile
    team/rmudgett/dahdi_ccss/apps/app_dial.c
    team/rmudgett/dahdi_ccss/apps/app_queue.c
    team/rmudgett/dahdi_ccss/bridges/bridge_softmix.c
    team/rmudgett/dahdi_ccss/channels/Makefile
    team/rmudgett/dahdi_ccss/channels/chan_sip.c
    team/rmudgett/dahdi_ccss/channels/sip/include/config_parser.h
    team/rmudgett/dahdi_ccss/channels/sip/include/sip_utils.h
    team/rmudgett/dahdi_ccss/configs/features.conf.sample
    team/rmudgett/dahdi_ccss/funcs/func_groupcount.c
    team/rmudgett/dahdi_ccss/include/asterisk/ccss.h
    team/rmudgett/dahdi_ccss/include/asterisk/strings.h
    team/rmudgett/dahdi_ccss/main/app.c
    team/rmudgett/dahdi_ccss/main/ccss.c
    team/rmudgett/dahdi_ccss/main/channel.c
    team/rmudgett/dahdi_ccss/main/features.c
    team/rmudgett/dahdi_ccss/main/loader.c
    team/rmudgett/dahdi_ccss/main/strings.c
    team/rmudgett/dahdi_ccss/main/test.c
    team/rmudgett/dahdi_ccss/res/res_jabber.c
    team/rmudgett/dahdi_ccss/res/res_speech.c
    team/rmudgett/dahdi_ccss/sounds/Makefile

Propchange: team/rmudgett/dahdi_ccss/
------------------------------------------------------------------------------
    automerge = *

Propchange: team/rmudgett/dahdi_ccss/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Propchange: team/rmudgett/dahdi_ccss/
------------------------------------------------------------------------------
--- dahdi_ccss-integrated (original)
+++ dahdi_ccss-integrated Thu Feb 18 17:54:05 2010
@@ -1,1 +1,1 @@
-/team/group/CCSS:1-247151
+/team/group/CCSS:1-247887

Propchange: team/rmudgett/dahdi_ccss/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Thu Feb 18 17:54:05 2010
@@ -1,1 +1,1 @@
-/trunk:1-247085
+/trunk:1-247848

Modified: team/rmudgett/dahdi_ccss/CHANGES
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/dahdi_ccss/CHANGES?view=diff&rev=247888&r1=247887&r2=247888
==============================================================================
--- team/rmudgett/dahdi_ccss/CHANGES (original)
+++ team/rmudgett/dahdi_ccss/CHANGES Thu Feb 18 17:54:05 2010
@@ -191,12 +191,22 @@
  * HASH-associated variables now can be inherited across channel creation, by
    prefixing the name of the hash at assignment with the appropriate number of
    underscores, just like variables.
+ * GROUP_MATCH_COUNT has been improved to allow regex matching on category
 
 Dialplan Variables
 ------------------
  * Added DYNAMIC_FEATURENAME which holds the last triggered dynamic feature.
  * Added DYNAMIC_PEERNAME which holds the unique channel name on the other side
    and is set when a dynamic feature is triggered.
+ * Added PARKINGLOT which can be used with parkeddynamic feature.conf option
+   to dynamically create a new parking lot matching the value this varible is
+   set to.
+ * Added PARKINGDYNAMIC which represents the template parkinglot defined in
+   features.conf that should be the base for dynamic parkinglots.
+ * Added PARKINGDYNCONTEXT which tells what context a newly created dynamic
+   parkinglot should have.
+ * Added PARKINGDYNPOS which holds what parking positions a dynamic parkinglot
+   should have.
 
 Queue changes
 -------------
@@ -329,6 +339,8 @@
  * The redirect command now has new parameters ExtraContext, ExtraExtension, 
    and ExtraPriority to allow redirecting the second channel to a different
    location than the first.
+ * Added new event "JabberStatus" in the Jabber module to monitor buddies
+   status.
 
 Channel Event Logging
 ---------------------
@@ -403,6 +415,8 @@
  * jabber.conf supports a new option auth_policy that toggles auto user registration.
  * A new lockconfdir option has been added to asterisk.conf to protect the
    configuration directory (/etc/asterisk by default) during reloads.
+ * The parkeddynamic option has been added to features.conf to enable the creation
+   of dynamic parkinglots.
 
 ------------------------------------------------------------------------------
 --- Functionality changes from Asterisk 1.6.1 to Asterisk 1.6.2  -------------

Modified: team/rmudgett/dahdi_ccss/Makefile
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/dahdi_ccss/Makefile?view=diff&rev=247888&r1=247887&r2=247888
==============================================================================
--- team/rmudgett/dahdi_ccss/Makefile (original)
+++ team/rmudgett/dahdi_ccss/Makefile Thu Feb 18 17:54:05 2010
@@ -87,6 +87,7 @@
 export GREP
 export ID
 export MD5
+export WGET_EXTRA_ARGS
 
 # even though we could use '-include makeopts' here, use a wildcard
 # lookup anyway, so that make won't try to build makeopts if it doesn't

Modified: team/rmudgett/dahdi_ccss/apps/app_dial.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/dahdi_ccss/apps/app_dial.c?view=diff&rev=247888&r1=247887&r2=247888
==============================================================================
--- team/rmudgett/dahdi_ccss/apps/app_dial.c (original)
+++ team/rmudgett/dahdi_ccss/apps/app_dial.c Thu Feb 18 17:54:05 2010
@@ -1726,6 +1726,7 @@
 	struct ast_datastore *datastore = NULL;
 	int fulldial = 0, num_dialed = 0;
 	int ignore_cc = 0;
+	char device_name[AST_CHANNEL_NAME];
 
 	/* Reset all DIAL variables back to blank, to prevent confusion (in case we don't reset all of them). */
 	pbx_builtin_setvar_helper(chan, "DIALSTATUS", "");
@@ -1946,9 +1947,15 @@
 				chan->hangupcause = cause;
 			chanlist_free(tmp);
 			if (cause == AST_CAUSE_BUSY || cause == AST_CAUSE_CONGESTION) {
-				ast_cc_callback(chan, tech, numsubst, ast_cc_busy_interface);
+				if (!ast_cc_callback(chan, tech, numsubst, ast_cc_busy_interface)) {
+					ast_cc_extension_monitor_add_dialstring(chan, interface, "");
+				}
 			}
 			continue;
+		}
+		ast_channel_get_device_name(tc, device_name, sizeof(device_name));
+		if (!ignore_cc) {
+			ast_cc_extension_monitor_add_dialstring(chan, interface, device_name);
 		}
 		pbx_builtin_setvar_helper(tc, "DIALEDPEERNUMBER", numsubst);
 

Modified: team/rmudgett/dahdi_ccss/apps/app_queue.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/dahdi_ccss/apps/app_queue.c?view=diff&rev=247888&r1=247887&r2=247888
==============================================================================
--- team/rmudgett/dahdi_ccss/apps/app_queue.c (original)
+++ team/rmudgett/dahdi_ccss/apps/app_queue.c Thu Feb 18 17:54:05 2010
@@ -2584,7 +2584,7 @@
 	while (outgoing) {
 		/* If someone else answered the call we should indicate this in the CANCEL */
 		/* Hangup any existing lines we have open */
-		if (outgoing->chan && (outgoing->chan != exception || cancel_answered_elsewhere)) {
+		if (outgoing->chan && (outgoing->chan != exception)) {
 			if (exception || cancel_answered_elsewhere)
 				ast_set_flag(outgoing->chan, AST_FLAG_ANSWERED_ELSEWHERE);
 			ast_hangup(outgoing->chan);
@@ -3545,9 +3545,11 @@
 	}
 
 	ao2_unlock(qe->parent);
-
-	/* If the queue entry is within avl [the number of available members] calls from the top ... */
-	if (ch && idx < avl) {
+	/* If the queue entry is within avl [the number of available members] calls from the top ... 
+	 * Autofill and position check added to support autofill=no (as only calls
+	 * from the front of the queue are valid when autofill is disabled)
+	 */
+	if (ch && idx < avl && (qe->parent->autofill || qe->pos == 1)) {
 		ast_debug(1, "It's our turn (%s).\n", qe->chan->name);
 		res = 1;
 	} else {

Modified: team/rmudgett/dahdi_ccss/bridges/bridge_softmix.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/dahdi_ccss/bridges/bridge_softmix.c?view=diff&rev=247888&r1=247887&r2=247888
==============================================================================
--- team/rmudgett/dahdi_ccss/bridges/bridge_softmix.c (original)
+++ team/rmudgett/dahdi_ccss/bridges/bridge_softmix.c Thu Feb 18 17:54:05 2010
@@ -99,6 +99,9 @@
 /*! \brief Function called when a bridge is destroyed */
 static int softmix_bridge_destroy(struct ast_bridge *bridge)
 {
+	if (!bridge->bridge_pvt) {
+		return -1;
+	}
 	ast_timer_close((struct ast_timer *) bridge->bridge_pvt);
 
 	return 0;

Modified: team/rmudgett/dahdi_ccss/channels/Makefile
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/dahdi_ccss/channels/Makefile?view=diff&rev=247888&r1=247887&r2=247888
==============================================================================
--- team/rmudgett/dahdi_ccss/channels/Makefile (original)
+++ team/rmudgett/dahdi_ccss/channels/Makefile Thu Feb 18 17:54:05 2010
@@ -70,7 +70,7 @@
 	rm -f h323/Makefile
 
 $(if $(filter chan_iax2,$(EMBEDDED_MODS)),modules.link,chan_iax2.so): iax2-parser.o iax2-provision.o
-$(if $(filter chan_sip,$(EMBEDDED_MODS)),modules.link,chan_sip.so): sip/config_parser.o sip/reqresp_parser.o
+$(if $(filter chan_sip,$(EMBEDDED_MODS)),modules.link,chan_sip.so): $(subst .c,.o,$(wildcard sip/*.c))
 $(if $(filter chan_dahdi,$(EMBEDDED_MODS)),modules.link,chan_dahdi.so): sig_analog.o sig_pri.o
 
 ifneq ($(filter chan_h323,$(EMBEDDED_MODS)),)

Modified: team/rmudgett/dahdi_ccss/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/dahdi_ccss/channels/chan_sip.c?view=diff&rev=247888&r1=247887&r2=247888
==============================================================================
--- team/rmudgett/dahdi_ccss/channels/chan_sip.c (original)
+++ team/rmudgett/dahdi_ccss/channels/chan_sip.c Thu Feb 18 17:54:05 2010
@@ -262,11 +262,14 @@
 #include "asterisk/stun.h"
 #include "asterisk/cel.h"
 #include "sip/include/sip.h"
+#include "sip/include/globals.h"
 #include "sip/include/config_parser.h"
 #include "sip/include/reqresp_parser.h"
 #include "sip/include/sip_utils.h"
 #include "asterisk/ccss.h"
 #include "asterisk/xml.h"
+#include "sip/include/dialog.h"
+#include "sip/include/dialplan_functions.h"
 
 /*** DOCUMENTATION
 	<application name="SIPDtmfMode" language="en_US">
@@ -819,7 +822,7 @@
 static int sip_reloading = FALSE;                       /*!< Flag for avoiding multiple reloads at the same time */
 static enum channelreloadreason sip_reloadreason;       /*!< Reason for last reload/load of configuration */
 
-static struct sched_context *sched;     /*!< The scheduling context */
+struct sched_context *sched;     /*!< The scheduling context */
 static struct io_context *io;           /*!< The IO context */
 static int *sipsock_read_id;            /*!< ID of IO entry for sipsock FD */
 struct sip_pkt;
@@ -1446,7 +1449,7 @@
  */
 static int sipsock  = -1;
 
-static struct sockaddr_in bindaddr;	/*!< UDP: The address we bind to */
+struct sockaddr_in bindaddr;	/*!< UDP: The address we bind to */
 
 /*! \brief our (internal) default address/port to put in SIP/SDP messages
  *  internip is initialized picking a suitable address from one of the
@@ -1571,23 +1574,11 @@
 static void parse_moved_contact(struct sip_pvt *p, struct sip_request *req, char **name, char **number, int set_call_forward);
 static int sip_send_mwi_to_peer(struct sip_peer *peer, const struct ast_event *event, int cache_only);
 
-/*--- Dialog management */
-static struct sip_pvt *sip_alloc(ast_string_field callid, struct sockaddr_in *sin,
-				 int useglobal_nat, const int intended_method, struct sip_request *req);
+/* Misc dialog routines */
 static int __sip_autodestruct(const void *data);
-static void sip_scheddestroy(struct sip_pvt *p, int ms);
-static int sip_cancel_destroy(struct sip_pvt *p);
-static struct sip_pvt *sip_destroy(struct sip_pvt *p);
-static void *dialog_unlink_all(struct sip_pvt *dialog, int lockowner, int lockdialoglist);
 static void *registry_unref(struct sip_registry *reg, char *tag);
-static void __sip_destroy(struct sip_pvt *p, int lockowner, int lockdialoglist);
-static int __sip_ack(struct sip_pvt *p, int seqno, int resp, int sipmethod);
-static void __sip_pretend_ack(struct sip_pvt *p);
-static int __sip_semi_ack(struct sip_pvt *p, int seqno, int resp, int sipmethod);
+static int update_call_counter(struct sip_pvt *fup, int event);
 static int auto_congest(const void *arg);
-static int update_call_counter(struct sip_pvt *fup, int event);
-static int hangup_sip2cause(int cause);
-static const char *hangup_cause2sip(int cause);
 static struct sip_pvt *find_call(struct sip_request *req, struct sockaddr_in *sin, const int intended_method);
 static void free_old_route(struct sip_route *route);
 static void list_route(struct sip_route *route);
@@ -1715,7 +1706,6 @@
 static int sip_addheader(struct ast_channel *chan, const char *data);
 static int sip_do_reload(enum channelreloadreason reason);
 static char *sip_reload(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a);
-static int acf_channel_read(struct ast_channel *chan, const char *funcname, char *preparse, char *buf, size_t buflen);
 
 /*--- Debugging
 	Functions for enabling debug per IP or fully, or enabling history logging for
@@ -1889,7 +1879,7 @@
 static int __sip_subscribe_mwi_do(struct sip_subscription_mwi *mwi);
 
 /*! \brief Definition of this channel for PBX channel registration */
-static const struct ast_channel_tech sip_tech = {
+const struct ast_channel_tech sip_tech = {
 	.type = "SIP",
 	.description = "Session Initiation Protocol (SIP)",
 	.capabilities = AST_FORMAT_AUDIO_MASK,	/* all audio formats */
@@ -1912,48 +1902,11 @@
 	.bridge = ast_rtp_instance_bridge,			/* XXX chan unlocked ? */
 	.early_bridge = ast_rtp_instance_early_bridge,
 	.send_text = sip_sendtext,		/* called with chan locked */
-	.func_channel_read = acf_channel_read,
+	.func_channel_read = sip_acf_channel_read,
 	.setoption = sip_setoption,
 	.queryoption = sip_queryoption,
 	.get_pvt_uniqueid = sip_get_callid,
 };
-
-#ifdef REF_DEBUG
-#define dialog_ref(arg1,arg2) dialog_ref_debug((arg1),(arg2), __FILE__, __LINE__, __PRETTY_FUNCTION__)
-#define dialog_unref(arg1,arg2) dialog_unref_debug((arg1),(arg2), __FILE__, __LINE__, __PRETTY_FUNCTION__)
-
-static struct sip_pvt *dialog_ref_debug(struct sip_pvt *p, char *tag, char *file, int line, const char *func)
-{
-	if (p)
-		__ao2_ref_debug(p, 1, tag, file, line, func);
-	else
-		ast_log(LOG_ERROR, "Attempt to Ref a null pointer\n");
-	return p;
-}
-
-static struct sip_pvt *dialog_unref_debug(struct sip_pvt *p, char *tag, char *file, int line, const char *func)
-{
-	if (p)
-		__ao2_ref_debug(p, -1, tag, file, line, func);
-	return NULL;
-}
-#else
-static struct sip_pvt *dialog_ref(struct sip_pvt *p, char *tag)
-{
-	if (p)
-		ao2_ref(p, 1);
-	else
-		ast_log(LOG_ERROR, "Attempt to Ref a null pointer\n");
-	return p;
-}
-
-static struct sip_pvt *dialog_unref(struct sip_pvt *p, char *tag)
-{
-	if (p)
-		ao2_ref(p, -1);
-	return NULL;
-}
-#endif
 
 /*! \brief This version of the sip channel tech has no send_digit_begin
  * callback so that the core knows that the channel does not want
@@ -1961,7 +1914,7 @@
  * The struct is initialized just before registering the channel driver,
  * and is for use with channels using SIP INFO DTMF.
  */
-static struct ast_channel_tech sip_tech_info;
+struct ast_channel_tech sip_tech_info;
 
 static int sip_cc_agent_init(struct ast_cc_agent *agent, struct ast_channel *chan);
 static int sip_cc_agent_start_offer_timer(struct ast_cc_agent *agent);
@@ -2579,18 +2532,33 @@
 	.worker_fn = sip_tcp_worker_fn,
 };
 
-/* wrapper macro to tell whether t points to one of the sip_tech descriptors */
-#define IS_SIP_TECH(t)  ((t) == &sip_tech || (t) == &sip_tech_info)
-
 /*! \brief Append to SIP dialog history
 	\return Always returns 0 */
 #define append_history(p, event, fmt , args... )	append_history_full(p, "%-15s " fmt, event, ## args)
 
-/*! \brief
- * when we create or delete references, make sure to use these
- * functions so we keep track of the refcounts.
- * To simplify the code, we allow a NULL to be passed to dialog_unref().
- */
+struct sip_pvt *dialog_ref_debug(struct sip_pvt *p, char *tag, char *file, int line, const char *func)
+{
+	if (p)
+#ifdef REF_DEBUG
+		__ao2_ref_debug(p, 1, tag, file, line, func);
+#else
+		ao2_ref(p, 1);
+#endif
+	else
+		ast_log(LOG_ERROR, "Attempt to Ref a null pointer\n");
+	return p;
+}
+
+struct sip_pvt *dialog_unref_debug(struct sip_pvt *p, char *tag, char *file, int line, const char *func)
+{
+	if (p)
+#ifdef REF_DEBUG
+		__ao2_ref_debug(p, -1, tag, file, line, func);
+#else
+		ao2_ref(p, -1);
+#endif
+	return NULL;
+}
 
 /*! \brief map from an integer value to a string.
  * If no match is found, return errorstring
@@ -3074,7 +3042,7 @@
  * \note A reference to the dialog must be held before calling this function, and this
  * function does not release that reference.
  */
-static void *dialog_unlink_all(struct sip_pvt *dialog, int lockowner, int lockdialoglist)
+void *dialog_unlink_all(struct sip_pvt *dialog, int lockowner, int lockdialoglist)
 {
 	struct sip_pkt *cp;
 
@@ -3139,7 +3107,7 @@
 	return NULL;
 }
 
-static void *registry_unref(struct sip_registry *reg, char *tag)
+void *registry_unref(struct sip_registry *reg, char *tag)
 {
 	ast_debug(3, "SIP Registry %s: refcount now %d\n", reg->hostname, reg->refcount - 1);
 	ASTOBJ_UNREF(reg, sip_registry_destroy);
@@ -3920,7 +3888,7 @@
 }
 
 /*! \brief Schedule destruction of SIP dialog */
-static void sip_scheddestroy(struct sip_pvt *p, int ms)
+void sip_scheddestroy(struct sip_pvt *p, int ms)
 {
 	if (ms < 0) {
 		if (p->timer_t1 == 0) {
@@ -3948,7 +3916,7 @@
  * Be careful as this also absorbs the reference - if you call it
  * from within the scheduler, this might be the last reference.
  */
-static int sip_cancel_destroy(struct sip_pvt *p)
+int sip_cancel_destroy(struct sip_pvt *p)
 {
 	int res = 0;
 	if (p->autokillid > -1) {
@@ -3965,7 +3933,7 @@
 
 /*! \brief Acknowledges receipt of a packet and stops retransmission
  * called with p locked*/
-static int __sip_ack(struct sip_pvt *p, int seqno, int resp, int sipmethod)
+int __sip_ack(struct sip_pvt *p, int seqno, int resp, int sipmethod)
 {
 	struct sip_pkt *cur, *prev = NULL;
 	const char *msg = "Not Found";	/* used only for debugging */
@@ -4030,7 +3998,7 @@
 
 /*! \brief Pretend to ack all packets
  * called with p locked */
-static void __sip_pretend_ack(struct sip_pvt *p)
+void __sip_pretend_ack(struct sip_pvt *p)
 {
 	struct sip_pkt *cur = NULL;
 
@@ -4047,7 +4015,7 @@
 }
 
 /*! \brief Acks receipt of packet, keep it around (used for provisional responses) */
-static int __sip_semi_ack(struct sip_pvt *p, int seqno, int resp, int sipmethod)
+int __sip_semi_ack(struct sip_pvt *p, int seqno, int resp, int sipmethod)
 {
 	struct sip_pkt *cur;
 	int res = FALSE;
@@ -5442,7 +5410,7 @@
 }
 
 /*! \brief Execute destruction of SIP dialog structure, release memory */
-static void __sip_destroy(struct sip_pvt *p, int lockowner, int lockdialoglist)
+void __sip_destroy(struct sip_pvt *p, int lockowner, int lockdialoglist)
 {
 	struct sip_request *req;
 
@@ -5582,7 +5550,7 @@
  *
  * \return 0 if call is ok (no call limit, below threshold)
  *	-1 on rejection of call
- *		
+ *
  */
 static int update_call_counter(struct sip_pvt *fup, int event)
 {
@@ -5736,7 +5704,7 @@
  *	foo = sip_destroy(foo);
  * and reduce the chance of bugs due to dangling pointers.
  */
-static struct sip_pvt * sip_destroy(struct sip_pvt *p)
+struct sip_pvt *sip_destroy(struct sip_pvt *p)
 {
 	ast_debug(3, "Destroying SIP dialog %s\n", p->callid);
 	__sip_destroy(p, TRUE, TRUE);
@@ -5744,7 +5712,7 @@
 }
 
 /*! \brief Convert SIP hangup causes to Asterisk hangup causes */
-static int hangup_sip2cause(int cause)
+int hangup_sip2cause(int cause)
 {
 	/* Possible values taken from causes.h */
 
@@ -5801,7 +5769,7 @@
 			return AST_CAUSE_FAILURE;
 		case 501:	/* Call rejected */
 			return AST_CAUSE_FACILITY_REJECTED;
-		case 502:	
+		case 502:
 			return AST_CAUSE_DESTINATION_OUT_OF_ORDER;
 		case 503:	/* Service unavailable */
 			return AST_CAUSE_CONGESTION;
@@ -5842,7 +5810,7 @@
 
 	In addition to these, a lot of PRI codes is defined in causes.h
 	...should we take care of them too ?
-	
+
 	Quote RFC 3398
 
    ISUP Cause value                        SIP response
@@ -5866,7 +5834,7 @@
    31 normal unspecified                   480 Temporarily unavailable
 \endverbatim
 */
-static const char *hangup_cause2sip(int cause)
+const char *hangup_cause2sip(int cause)
 {
 	switch (cause) {
 		case AST_CAUSE_UNALLOCATED:		/* 1 */
@@ -7145,7 +7113,7 @@
  * Returns a reference to the object so whoever uses it later must
  * remember to release the reference.
  */
-static struct sip_pvt *sip_alloc(ast_string_field callid, struct sockaddr_in *sin,
+struct sip_pvt *sip_alloc(ast_string_field callid, struct sockaddr_in *sin,
 				 int useglobal_nat, const int intended_method, struct sip_request *req)
 {
 	struct sip_pvt *p;
@@ -21714,122 +21682,6 @@
 	}
 }
 
-static int acf_channel_read(struct ast_channel *chan, const char *funcname, char *preparse, char *buf, size_t buflen)
-{
-	struct sip_pvt *p = chan->tech_pvt;
-	char *parse = ast_strdupa(preparse);
-	int res = 0;
-	AST_DECLARE_APP_ARGS(args,
-		AST_APP_ARG(param);
-		AST_APP_ARG(type);
-		AST_APP_ARG(field);
-	);
-	AST_STANDARD_APP_ARGS(args, parse);
-
-	/* Sanity check */
-	if (!IS_SIP_TECH(chan->tech)) {
-		ast_log(LOG_ERROR, "Cannot call %s on a non-SIP channel\n", funcname);
-		return 0;
-	}
-
-	memset(buf, 0, buflen);
-
-	if (p == NULL) {
-		return -1;
-	}
-
-	if (!strcasecmp(args.param, "peerip")) {
-		ast_copy_string(buf, p->sa.sin_addr.s_addr ? ast_inet_ntoa(p->sa.sin_addr) : "", buflen);
-	} else if (!strcasecmp(args.param, "recvip")) {
-		ast_copy_string(buf, p->recv.sin_addr.s_addr ? ast_inet_ntoa(p->recv.sin_addr) : "", buflen);
-	} else if (!strcasecmp(args.param, "from")) {
-		ast_copy_string(buf, p->from, buflen);
-	} else if (!strcasecmp(args.param, "uri")) {
-		ast_copy_string(buf, p->uri, buflen);
-	} else if (!strcasecmp(args.param, "useragent")) {
-		ast_copy_string(buf, p->useragent, buflen);
-	} else if (!strcasecmp(args.param, "peername")) {
-		ast_copy_string(buf, p->peername, buflen);
-	} else if (!strcasecmp(args.param, "t38passthrough")) {
-		ast_copy_string(buf, (p->t38.state == T38_DISABLED) ? "0" : "1", buflen);
-	} else if (!strcasecmp(args.param, "rtpdest")) {
-		struct sockaddr_in sin;
-
-		if (ast_strlen_zero(args.type))
-			args.type = "audio";
-
-		if (!strcasecmp(args.type, "audio"))
-			ast_rtp_instance_get_remote_address(p->rtp, &sin);
-		else if (!strcasecmp(args.type, "video"))
-			ast_rtp_instance_get_remote_address(p->vrtp, &sin);
-		else if (!strcasecmp(args.type, "text"))
-			ast_rtp_instance_get_remote_address(p->trtp, &sin);
-		else
-			return -1;
-
-		snprintf(buf, buflen, "%s:%d", ast_inet_ntoa(sin.sin_addr), ntohs(sin.sin_port));
-	} else if (!strcasecmp(args.param, "rtpqos")) {
-		struct ast_rtp_instance *rtp = NULL;
-
-		if (ast_strlen_zero(args.type)) {
-			args.type = "audio";
-		}
-
-		if (!strcasecmp(args.type, "audio")) {
-			rtp = p->rtp;
-		} else if (!strcasecmp(args.type, "video")) {
-			rtp = p->vrtp;
-		} else if (!strcasecmp(args.type, "text")) {
-			rtp = p->trtp;
-		} else {
-		        return -1;
-		}
-
-		if (ast_strlen_zero(args.field) || !strcasecmp(args.field, "all")) {
-			char quality_buf[AST_MAX_USER_FIELD], *quality;
-
-			if (!(quality = ast_rtp_instance_get_quality(rtp, AST_RTP_INSTANCE_STAT_FIELD_QUALITY, quality_buf, sizeof(quality_buf)))) {
-				return -1;
-			}
-
-			ast_copy_string(buf, quality_buf, buflen);
-			return res;
-		} else {
-			struct ast_rtp_instance_stats stats;
-
-			if (ast_rtp_instance_get_stats(rtp, &stats, AST_RTP_INSTANCE_STAT_ALL)) {
-				return -1;
-			}
-
-			if (!strcasecmp(args.field, "local_ssrc")) {
-				snprintf(buf, buflen, "%u", stats.local_ssrc);
-			} else if (!strcasecmp(args.field, "local_lostpackets")) {
-				snprintf(buf, buflen, "%u", stats.rxploss);
-			} else if (!strcasecmp(args.field, "local_jitter")) {
-				snprintf(buf, buflen, "%u", stats.rxjitter);
-			} else if (!strcasecmp(args.field, "local_count")) {
-				snprintf(buf, buflen, "%u", stats.rxcount);
-			} else if (!strcasecmp(args.field, "remote_ssrc")) {
-				snprintf(buf, buflen, "%u", stats.remote_ssrc);
-			} else if (!strcasecmp(args.field, "remote_lostpackets")) {
-				snprintf(buf, buflen, "%u", stats.txploss);
-			} else if (!strcasecmp(args.field, "remote_jitter")) {
-				snprintf(buf, buflen, "%u", stats.txjitter);
-			} else if (!strcasecmp(args.field, "remote_count")) {
-				snprintf(buf, buflen, "%u", stats.txcount);
-			} else if (!strcasecmp(args.field, "rtt")) {
-				snprintf(buf, buflen, "%u", stats.rtt);
-			} else {
-				ast_log(LOG_WARNING, "Unrecognized argument '%s' to %s\n", preparse, funcname);
-				return -1;
-			}
-		}
-	} else {
-		res = -1;
-	}
-	return res;
-}
-
 /*! \brief Handle incoming BYE request */
 static int handle_request_bye(struct sip_pvt *p, struct sip_request *req)
 {
@@ -25247,7 +25099,12 @@
 			} else if (!strcasecmp(v->name, "port")) {
 				peer->portinuri = 1;
 				if (!(port = port_str2int(v->value, 0))) {
-					ast_log(LOG_WARNING, "Invalid peer port configuration at line %d : %s\n", v->lineno, v->value);
+					if (realtime) {
+						/* If stored as integer, could be 0 for some DBs (notably MySQL) */
+						peer->portinuri = 0;
+					} else {
+						ast_log(LOG_WARNING, "Invalid peer port configuration at line %d : %s\n", v->lineno, v->value);
+					}
 				}
 			} else if (!strcasecmp(v->name, "callingpres")) {
 				peer->callingpres = ast_parse_caller_presentation(v->value);
@@ -27268,6 +27125,7 @@
 {
 	sip_config_parser_register_tests();
 	sip_request_parser_register_tests();
+	sip_dialplan_function_register_tests();
 }
 
 /*! \brief SIP test registration */
@@ -27275,6 +27133,7 @@
 {
 	sip_config_parser_unregister_tests();
 	sip_request_parser_unregister_tests();
+	sip_dialplan_function_unregister_tests();
 }
 
 /*! \brief PBX load module - initialization */

Modified: team/rmudgett/dahdi_ccss/channels/sip/include/config_parser.h
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/dahdi_ccss/channels/sip/include/config_parser.h?view=diff&rev=247888&r1=247887&r2=247888
==============================================================================
--- team/rmudgett/dahdi_ccss/channels/sip/include/config_parser.h (original)
+++ team/rmudgett/dahdi_ccss/channels/sip/include/config_parser.h Thu Feb 18 17:54:05 2010
@@ -43,7 +43,7 @@
  */
 int sip_parse_host(char *line, int lineno, char **hostname, int *portnum, enum sip_transport *transport);
 
-/*! 
+/*!
  * \brief register config parsing tests
  */
 void sip_config_parser_register_tests(void);

Modified: team/rmudgett/dahdi_ccss/channels/sip/include/sip_utils.h
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/dahdi_ccss/channels/sip/include/sip_utils.h?view=diff&rev=247888&r1=247887&r2=247888
==============================================================================
--- team/rmudgett/dahdi_ccss/channels/sip/include/sip_utils.h (original)
+++ team/rmudgett/dahdi_ccss/channels/sip/include/sip_utils.h Thu Feb 18 17:54:05 2010
@@ -22,8 +22,11 @@
 #ifndef _SIP_UTILS_H
 #define _SIP_UTILS_H
 
-/*! 
- * \brief converts ascii port to int representation. 
+/* wrapper macro to tell whether t points to one of the sip_tech descriptors */
+#define IS_SIP_TECH(t)  ((t) == &sip_tech || (t) == &sip_tech_info)
+
+/*!
+ * \brief converts ascii port to int representation.
  *
  * \arg pt[in] string that contains a port.
  * \arg standard[in] port to return in case the port string input is NULL
@@ -40,4 +43,41 @@
 const char *find_closing_quote(const char *start, const char *lim);
 
 
+/*! \brief Convert SIP hangup causes to Asterisk hangup causes */
+int hangup_sip2cause(int cause);
+
+/*! \brief Convert Asterisk hangup causes to SIP codes
+\verbatim
+ Possible values from causes.h
+        AST_CAUSE_NOTDEFINED    AST_CAUSE_NORMAL        AST_CAUSE_BUSY
+        AST_CAUSE_FAILURE       AST_CAUSE_CONGESTION    AST_CAUSE_UNALLOCATED
+
+	In addition to these, a lot of PRI codes is defined in causes.h
+	...should we take care of them too ?
+
+	Quote RFC 3398
+
+   ISUP Cause value                        SIP response
+   ----------------                        ------------
+   1  unallocated number                   404 Not Found
+   2  no route to network                  404 Not found
+   3  no route to destination              404 Not found
+   16 normal call clearing                 --- (*)
+   17 user busy                            486 Busy here
+   18 no user responding                   408 Request Timeout
+   19 no answer from the user              480 Temporarily unavailable
+   20 subscriber absent                    480 Temporarily unavailable
+   21 call rejected                        403 Forbidden (+)
+   22 number changed (w/o diagnostic)      410 Gone
+   22 number changed (w/ diagnostic)       301 Moved Permanently
+   23 redirection to new destination       410 Gone
+   26 non-selected user clearing           404 Not Found (=)
+   27 destination out of order             502 Bad Gateway
+   28 address incomplete                   484 Address incomplete
+   29 facility rejected                    501 Not implemented
+   31 normal unspecified                   480 Temporarily unavailable
+\endverbatim
+*/
+const char *hangup_cause2sip(int cause);
+
 #endif

Modified: team/rmudgett/dahdi_ccss/configs/features.conf.sample
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/dahdi_ccss/configs/features.conf.sample?view=diff&rev=247888&r1=247887&r2=247888
==============================================================================
--- team/rmudgett/dahdi_ccss/configs/features.conf.sample (original)
+++ team/rmudgett/dahdi_ccss/configs/features.conf.sample Thu Feb 18 17:54:05 2010
@@ -27,6 +27,7 @@
                                 ; one of: callee, caller, both, no (default is no)
 ;parkedcallrecording = caller   ; Enables or disables DTMF based one-touch recording when picking up a parked call.
                                 ; one of: callee, caller, both, no (default is no)
+;parkeddynamic = yes            ; Enables dynamically created parkinglots. (default is no)
 ;adsipark = yes			; if you want ADSI parking announcements
 ;findslot => next		; Continue to the 'next' free parking space.
 				; Defaults to 'first' available

Modified: team/rmudgett/dahdi_ccss/funcs/func_groupcount.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/dahdi_ccss/funcs/func_groupcount.c?view=diff&rev=247888&r1=247887&r2=247888
==============================================================================
--- team/rmudgett/dahdi_ccss/funcs/func_groupcount.c (original)
+++ team/rmudgett/dahdi_ccss/funcs/func_groupcount.c Thu Feb 18 17:54:05 2010
@@ -58,12 +58,13 @@
 				<para>A standard regular expression used to match a group name.</para>
 			</parameter>
 			<parameter name="category">
-				<para>Category name.</para>
+				<para>A standard regular expression used to match a category name.</para>
 			</parameter>
 		</syntax>
 		<description>
 			<para>Calculates the group count for all groups that match the specified pattern.
-			Uses standard regular expression matching (see regex(7)).</para>
+			Note: category matching is applied after matching based on group.
+			Uses standard regular expression matching on both (see regex(7)).</para>
 		</description>
 	</function>
 	<function name="GROUP" language="en_US">

Modified: team/rmudgett/dahdi_ccss/include/asterisk/ccss.h
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/dahdi_ccss/include/asterisk/ccss.h?view=diff&rev=247888&r1=247887&r2=247888
==============================================================================
--- team/rmudgett/dahdi_ccss/include/asterisk/ccss.h (original)
+++ team/rmudgett/dahdi_ccss/include/asterisk/ccss.h Thu Feb 18 17:54:05 2010
@@ -519,6 +519,17 @@
 	AST_DLLIST_ENTRY(ast_cc_monitor) next;
 };
 
+/*!
+ * \brief Callbacks defined by CC monitors
+ *
+ * \note
+ * Every callback is called with the list of monitors locked. There
+ * are several public API calls that also will try to lock this lock.
+ * These public functions have a note in their doxygen stating so.
+ * As such, pay attention to the lock order you establish in these callbacks
+ * to ensure that you do not violate the lock order when calling
+ * the functions in this file with lock order notices.
+ */
 struct ast_cc_monitor_callbacks {
 	/*!
 	 * \brief Type of monitor the callbacks belong to.
@@ -537,7 +548,7 @@
 	 * \details
 	 * Perform whatever steps are necessary in order to request CC.
 	 * In addition, the monitor implementation is responsible for
-	 * starting the available timer in this callback. 
+	 * starting the available timer in this callback.
 	 *
 	 * \retval 0 on success
 	 * \retval -1 on failure.
@@ -704,6 +715,23 @@
  * \retval -1 Failure
  */
 int ast_cc_call_init(struct ast_channel *chan, int *ignore_cc);
+
+/*!
+ * \since 1.8
+ *
+ * \brief Add a child dialstring to an extension monitor
+ *
+ * Whenever we request a channel, the parent extension monitor needs
+ * to store the dialstring of the device requested. The reason is so
+ * that we can call the device back during the recall even if we are
+ * not monitoring the device.
+ *
+ * \param incoming The caller's channel
+ * \param dialstring The dialstring used when requesting the outbound channel
+ * \param device_name The device name associated with the requested outbound channel
+ * \retval void
+ */
+void ast_cc_extension_monitor_add_dialstring(struct ast_channel *incoming, const char * const dialstring, const char * const device_name);
 
 /*!
  * \since 1.8
@@ -1285,6 +1313,11 @@
  * \since 1.8
  * \brief Return the number of outstanding CC requests to a specific device
  *
+ * \note
+ * This function will lock the list of monitors stored on every instance of
+ * the CC core. Callers of this function should be aware of this and avoid
+ * any potential lock ordering problems.
+ *
  * \param name The name of the monitored device
  * \param type The type of the monitored device (e.g. "generic")
  * \return The number of CC requests for the monitor
@@ -1346,8 +1379,14 @@
  * channel were passed into this function, then the return would be 0 since
  * SIP/2000 was not one of the original devices dialed.
  *
- * \note This function may be called on a calling channel as well to
+ * \note
+ * This function may be called on a calling channel as well to
  * determine if it is part of a CC recall.
+ *
+ * \note
+ * This function will lock the channel as well as the list of monitors
+ * on the channel datastore, though the locks are not held at the same time. Be
+ * sure that you have no potential lock order issues here.
  *
  * \param chan The channel to check
  * \param core_id[out] If this is a valid CC recall, the core_id of the failed call
@@ -1370,6 +1409,11 @@
  * within the associated monitor. This function is what one uses to get
  * that monitor.
  *
+ * \note
+ * This function locks the list of monitors that correspond to the core_id
+ * passed in. Be sure that you have no potential lock order issues when
+ * calling this function.
+ *
  * \param core_id The core ID to which this recall corresponds. This likely will
  * have been obtained using the ast_cc_is_recall function
  * \param device_name Which device to find the monitor for.
@@ -1386,6 +1430,12 @@
  * \note
  * Implementers of protocol-specific CC agents should call this function after
  * calling ast_setup_cc_recall_datastore.
+ *
+ * \note
+ * This function will lock the channel as well as the list of monitors stored
+ * on the channel's CC recall datastore, though neither are held at the same
+ * time. Callers of this function should be aware of potential lock ordering
+ * problems that may arise.
  *
  * \details
  * The CC_INTERFACES channel variable will have the interfaces that should be
@@ -1405,6 +1455,12 @@
  * called back for a specific PBX instance. This version of the function is used
  * mainly by chan_local, wherein we need to set CC_INTERFACES based on an extension
  * and context that appear in the middle of the tree of dialed interfaces
+ *
+ * \note
+ * This function will lock the channel as well as the list of monitors stored
+ * on the channel's CC recall datastore, though neither are held at the same
+ * time. Callers of this function should be aware of potential lock ordering
+ * problems that may arise.
  *
  * \param chan The channel to set the CC_INTERFACES variable on
  * \param extension The name of the extension for which we're setting the variable.

Modified: team/rmudgett/dahdi_ccss/include/asterisk/strings.h
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/dahdi_ccss/include/asterisk/strings.h?view=diff&rev=247888&r1=247887&r2=247888
==============================================================================
--- team/rmudgett/dahdi_ccss/include/asterisk/strings.h (original)
+++ team/rmudgett/dahdi_ccss/include/asterisk/strings.h Thu Feb 18 17:54:05 2010
@@ -708,14 +708,14 @@
  *       file.
  */
 #if (defined(MALLOC_DEBUG) && !defined(STANDALONE))
-int __attribute__((format(printf, 4, 0))) __ast_debug_str_helper(struct ast_str **buf, size_t max_len,
+int __attribute__((format(printf, 4, 0))) __ast_debug_str_helper(struct ast_str **buf, ssize_t max_len,
 							   int append, const char *fmt, va_list ap, const char *file, int lineno, const char *func);
 #define __ast_str_helper(a,b,c,d,e)	__ast_debug_str_helper(a,b,c,d,e,__FILE__,__LINE__,__PRETTY_FUNCTION__)
 #else
-int __attribute__((format(printf, 4, 0))) __ast_str_helper(struct ast_str **buf, size_t max_len,
+int __attribute__((format(printf, 4, 0))) __ast_str_helper(struct ast_str **buf, ssize_t max_len,
 							   int append, const char *fmt, va_list ap);
 #endif
-char *__ast_str_helper2(struct ast_str **buf, size_t max_len,
+char *__ast_str_helper2(struct ast_str **buf, ssize_t max_len,
 	const char *src, size_t maxsrc, int append, int escapecommas);
 
 /*!
@@ -756,7 +756,7 @@
  * }
  * \endcode
  */
-AST_INLINE_API(int __attribute__((format(printf, 3, 0))) ast_str_set_va(struct ast_str **buf, size_t max_len, const char *fmt, va_list ap),
+AST_INLINE_API(int __attribute__((format(printf, 3, 0))) ast_str_set_va(struct ast_str **buf, ssize_t max_len, const char *fmt, va_list ap),
 {
 	return __ast_str_helper(buf, max_len, 0, fmt, ap);
 }
@@ -767,35 +767,35 @@
  *
  * Same as ast_str_set_va(), but append to the current content.
  */
-AST_INLINE_API(int __attribute__((format(printf, 3, 0))) ast_str_append_va(struct ast_str **buf, size_t max_len, const char *fmt, va_list ap),

[... 1849 lines stripped ...]



More information about the asterisk-commits mailing list