[asterisk-commits] mmichelson: branch group/CCSS r247175 - in /team/group/CCSS: ./ apps/ channel...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Feb 17 11:16:16 CST 2010


Author: mmichelson
Date: Wed Feb 17 11:16:12 2010
New Revision: 247175

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=247175
Log:
Resolve conflict and reset automerge.

Stop messing with chan_sip! GAWD! ;)


Added:
    team/group/CCSS/channels/sip/dialplan_functions.c
      - copied unchanged from r247169, trunk/channels/sip/dialplan_functions.c
    team/group/CCSS/channels/sip/include/dialog.h
      - copied unchanged from r247169, trunk/channels/sip/include/dialog.h
    team/group/CCSS/channels/sip/include/dialplan_functions.h
      - copied unchanged from r247169, trunk/channels/sip/include/dialplan_functions.h
    team/group/CCSS/channels/sip/include/globals.h
      - copied unchanged from r247169, trunk/channels/sip/include/globals.h
Modified:
    team/group/CCSS/   (props changed)
    team/group/CCSS/apps/app_queue.c
    team/group/CCSS/channels/Makefile
    team/group/CCSS/channels/chan_sip.c
    team/group/CCSS/channels/sip/include/config_parser.h
    team/group/CCSS/channels/sip/include/sip_utils.h
    team/group/CCSS/main/loader.c

Propchange: team/group/CCSS/
------------------------------------------------------------------------------
    automerge = *

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

Propchange: team/group/CCSS/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Wed Feb 17 11:16:12 2010
@@ -1,1 +1,1 @@
-/trunk:1-247085
+/trunk:1-247172

Modified: team/group/CCSS/apps/app_queue.c
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS/apps/app_queue.c?view=diff&rev=247175&r1=247174&r2=247175
==============================================================================
--- team/group/CCSS/apps/app_queue.c (original)
+++ team/group/CCSS/apps/app_queue.c Wed Feb 17 11:16:12 2010
@@ -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/group/CCSS/channels/Makefile
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS/channels/Makefile?view=diff&rev=247175&r1=247174&r2=247175
==============================================================================
--- team/group/CCSS/channels/Makefile (original)
+++ team/group/CCSS/channels/Makefile Wed Feb 17 11:16:12 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/group/CCSS/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS/channels/chan_sip.c?view=diff&rev=247175&r1=247174&r2=247175
==============================================================================
--- team/group/CCSS/channels/chan_sip.c (original)
+++ team/group/CCSS/channels/chan_sip.c Wed Feb 17 11:16:12 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;
@@ -21712,122 +21680,6 @@
 		transmit_response(p, "481 Call Leg Does Not Exist", req);
 		return 0;
 	}
-}
-
-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 */
@@ -27268,6 +27120,7 @@
 {
 	sip_config_parser_register_tests();
 	sip_request_parser_register_tests();
+	sip_dialplan_function_register_tests();
 }
 
 /*! \brief SIP test registration */
@@ -27275,6 +27128,7 @@
 {
 	sip_config_parser_unregister_tests();
 	sip_request_parser_unregister_tests();
+	sip_dialplan_function_unregister_tests();
 }
 
 /*! \brief PBX load module - initialization */

Modified: team/group/CCSS/channels/sip/include/config_parser.h
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS/channels/sip/include/config_parser.h?view=diff&rev=247175&r1=247174&r2=247175
==============================================================================
--- team/group/CCSS/channels/sip/include/config_parser.h (original)
+++ team/group/CCSS/channels/sip/include/config_parser.h Wed Feb 17 11:16:12 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/group/CCSS/channels/sip/include/sip_utils.h
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS/channels/sip/include/sip_utils.h?view=diff&rev=247175&r1=247174&r2=247175
==============================================================================
--- team/group/CCSS/channels/sip/include/sip_utils.h (original)
+++ team/group/CCSS/channels/sip/include/sip_utils.h Wed Feb 17 11:16:12 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/group/CCSS/main/loader.c
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS/main/loader.c?view=diff&rev=247175&r1=247174&r2=247175
==============================================================================
--- team/group/CCSS/main/loader.c (original)
+++ team/group/CCSS/main/loader.c Wed Feb 17 11:16:12 2010
@@ -1200,6 +1200,10 @@
 
 struct ast_module *ast_module_ref(struct ast_module *mod)
 {
+	if (!mod) {
+		return NULL;
+	}
+
 	ast_atomic_fetchadd_int(&mod->usecount, +1);
 	ast_update_use_count();
 
@@ -1208,6 +1212,10 @@
 
 void ast_module_unref(struct ast_module *mod)
 {
+	if (!mod) {
+		return;
+	}
+
 	ast_atomic_fetchadd_int(&mod->usecount, -1);
 	ast_update_use_count();
 }




More information about the asterisk-commits mailing list