[asterisk-commits] russell: branch russell/chan_refcount r99690 - in /team/russell/chan_refcount...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jan 22 15:19:59 CST 2008


Author: russell
Date: Tue Jan 22 15:19:58 2008
New Revision: 99690

URL: http://svn.digium.com/view/asterisk?view=rev&rev=99690
Log:
sync with trunk

Added:
    team/russell/chan_refcount/configs/cli.conf.sample
      - copied unchanged from r99653, trunk/configs/cli.conf.sample
Modified:
    team/russell/chan_refcount/   (props changed)
    team/russell/chan_refcount/CHANGES
    team/russell/chan_refcount/channels/chan_sip.c
    team/russell/chan_refcount/doc/tex/channelvariables.tex
    team/russell/chan_refcount/include/asterisk/channel.h
    team/russell/chan_refcount/main/acl.c
    team/russell/chan_refcount/main/asterisk.c
    team/russell/chan_refcount/main/channel.c

Change Statistics:
 0 files changed

Propchange: team/russell/chan_refcount/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Propchange: team/russell/chan_refcount/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Tue Jan 22 15:19:58 2008
@@ -1,1 +1,1 @@
-/trunk:1-99633
+/trunk:1-99686

Modified: team/russell/chan_refcount/CHANGES
URL: http://svn.digium.com/view/asterisk/team/russell/chan_refcount/CHANGES?view=diff&rev=99690&r1=99689&r2=99690
==============================================================================
--- team/russell/chan_refcount/CHANGES (original)
+++ team/russell/chan_refcount/CHANGES Tue Jan 22 15:19:58 2008
@@ -66,6 +66,10 @@
      the existence of a dialplan target.
   * Added two new dialplan functions, TOUPPER and TOLOWER, which convert a string to
      upper and lower case, respectively.
+  * When bridging, Asterisk sets the BRIDGEPVTCALLID to the channel drivers unique
+     ID for the call (not the Asterisk call ID or unique ID), provided that the
+     channel driver supports this. For SIP, you get the SIP call-ID for the
+     bridged channel which you can store in the CDR with a custom field.
 
 CLI Changes
 -----------
@@ -80,8 +84,7 @@
   * New CLI commands "dialplan set extenpatternmatching true/false"
   * New CLI command: "core set chanvar" to set a channel variable from the CLI.
   * Added an easy way to execute Asterisk CLI commands at startup.  Any commands
-    listed in the startup_commands file in the Asterisk configuration directory
-    will get executed.
+    listed in the startup_commands section of cli.conf will get executed.
 
 SIP changes
 -----------

Modified: team/russell/chan_refcount/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/russell/chan_refcount/channels/chan_sip.c?view=diff&rev=99690&r1=99689&r2=99690
==============================================================================
--- team/russell/chan_refcount/channels/chan_sip.c (original)
+++ team/russell/chan_refcount/channels/chan_sip.c Tue Jan 22 15:19:58 2008
@@ -185,6 +185,8 @@
 #define TRUE     1
 #endif
 
+#define	SIPBUFSIZE		512
+
 #define XMIT_ERROR		-2
 
 /* #define VOCAL_DATA_HACK */
@@ -1103,9 +1105,9 @@
 	char referred_by[AST_MAX_EXTENSION];		/*!< Place to store REFERRED-BY extension */
 	char referred_by_name[AST_MAX_EXTENSION];	/*!< Place to store REFERRED-BY extension */
 	char refer_contact[AST_MAX_EXTENSION];		/*!< Place to store Contact info from a REFER extension */
-	char replaces_callid[BUFSIZ];			/*!< Replace info: callid */
-	char replaces_callid_totag[BUFSIZ/2];		/*!< Replace info: to-tag */
-	char replaces_callid_fromtag[BUFSIZ/2];		/*!< Replace info: from-tag */
+	char replaces_callid[SIPBUFSIZE];			/*!< Replace info: callid */
+	char replaces_callid_totag[SIPBUFSIZE/2];		/*!< Replace info: to-tag */
+	char replaces_callid_fromtag[SIPBUFSIZE/2];		/*!< Replace info: from-tag */
 	struct sip_pvt *refer_call;			/*!< Call we are referring. This is just a reference to a
 							 * dialog owned by someone else, so we should not destroy
 							 * it when the sip_refer object goes.
@@ -1676,6 +1678,7 @@
 static int sip_fixup(struct ast_channel *oldchan, struct ast_channel *newchan);
 static int sip_senddigit_begin(struct ast_channel *ast, char digit);
 static int sip_senddigit_end(struct ast_channel *ast, char digit, unsigned int duration);
+static char *sip_get_callid(struct ast_channel *chan);
 
 static int handle_request_do(struct sip_request *req, struct sockaddr_in *sin);
 static int sip_standard_port(struct sip_socket s);
@@ -2036,6 +2039,7 @@
 	.early_bridge = ast_rtp_early_bridge,
 	.send_text = sip_sendtext,		/* called with chan locked */
 	.func_channel_read = acf_channel_read,
+	.get_pvt_uniqueid = sip_get_callid,
 };
 
 /*! \brief This version of the sip channel tech has no send_digit_begin
@@ -3236,6 +3240,15 @@
 	}
 
 	return 0;
+}
+
+/*! \brief Deliver SIP call ID for the call */
+static char *sip_get_callid(struct ast_channel *chan)
+{
+	struct sip_pvt *p = chan->tech_pvt;
+	if (!p)
+		return "";
+	return ((char *)p->callid);
 }
 
 /*! \brief Send SIP MESSAGE text within a call
@@ -4026,7 +4039,7 @@
 	ast_set_flag(&p->flags[0], SIP_OUTGOING);
 
 	if (p->options->transfer) {
-		char buf[BUFSIZ/2];
+		char buf[SIPBUFSIZE/2];
 
 		if (referer) {
 			if (sipdebug)
@@ -5018,7 +5031,7 @@
 	int text;
 	int needvideo = 0;
 	int needtext = 0;
-	char buf[BUFSIZ];
+	char buf[SIPBUFSIZE];
 	char *decoded_exten;
 
 	{
@@ -5062,12 +5075,12 @@
 
 	/* Set the native formats for audio  and merge in video */
 	tmp->nativeformats = ast_codec_choose(&i->prefs, what, 1) | video | text;
-	ast_debug(3, "*** Our native formats are %s \n", ast_getformatname_multiple(buf, BUFSIZ, tmp->nativeformats));
-	ast_debug(3, "*** Joint capabilities are %s \n", ast_getformatname_multiple(buf, BUFSIZ, i->jointcapability));
-	ast_debug(3, "*** Our capabilities are %s \n", ast_getformatname_multiple(buf, BUFSIZ, i->capability));
-	ast_debug(3, "*** AST_CODEC_CHOOSE formats are %s \n", ast_getformatname_multiple(buf, BUFSIZ, ast_codec_choose(&i->prefs, what, 1)));
+	ast_debug(3, "*** Our native formats are %s \n", ast_getformatname_multiple(buf, SIPBUFSIZE, tmp->nativeformats));
+	ast_debug(3, "*** Joint capabilities are %s \n", ast_getformatname_multiple(buf, SIPBUFSIZE, i->jointcapability));
+	ast_debug(3, "*** Our capabilities are %s \n", ast_getformatname_multiple(buf, SIPBUFSIZE, i->capability));
+	ast_debug(3, "*** AST_CODEC_CHOOSE formats are %s \n", ast_getformatname_multiple(buf, SIPBUFSIZE, ast_codec_choose(&i->prefs, what, 1)));
 	if (i->prefcodec)
-		ast_debug(3, "*** Our preferred formats from the incoming channel are %s \n", ast_getformatname_multiple(buf, BUFSIZ, i->prefcodec));
+		ast_debug(3, "*** Our preferred formats from the incoming channel are %s \n", ast_getformatname_multiple(buf, SIPBUFSIZE, i->prefcodec));
 
 	/* XXX Why are we choosing a codec from the native formats?? */
 	fmt = ast_best_codec(tmp->nativeformats);
@@ -6112,7 +6125,7 @@
 	int found_rtpmap_codecs[32];
 	int last_rtpmap_codec=0;
 
-	char buf[BUFSIZ];
+	char buf[SIPBUFSIZE];
 	int rua_version;
 
 	if (!p->rtp) {
@@ -6614,19 +6627,19 @@
 		
 	if (debug) {
 		/* shame on whoever coded this.... */
-		char s1[BUFSIZ], s2[BUFSIZ], s3[BUFSIZ], s4[BUFSIZ], s5[BUFSIZ];
+		char s1[SIPBUFSIZE], s2[SIPBUFSIZE], s3[SIPBUFSIZE], s4[SIPBUFSIZE], s5[SIPBUFSIZE];
 
 		ast_verbose("Capabilities: us - %s, peer - audio=%s/video=%s/text=%s, combined - %s\n",
-			    ast_getformatname_multiple(s1, BUFSIZ, p->capability),
-			    ast_getformatname_multiple(s2, BUFSIZ, peercapability),
-			    ast_getformatname_multiple(s3, BUFSIZ, vpeercapability),
-			    ast_getformatname_multiple(s4, BUFSIZ, tpeercapability),
-			    ast_getformatname_multiple(s5, BUFSIZ, newjointcapability));
+			    ast_getformatname_multiple(s1, SIPBUFSIZE, p->capability),
+			    ast_getformatname_multiple(s2, SIPBUFSIZE, peercapability),
+			    ast_getformatname_multiple(s3, SIPBUFSIZE, vpeercapability),
+			    ast_getformatname_multiple(s4, SIPBUFSIZE, tpeercapability),
+			    ast_getformatname_multiple(s5, SIPBUFSIZE, newjointcapability));
 
 		ast_verbose("Non-codec capabilities (dtmf): us - %s, peer - %s, combined - %s\n",
-			    ast_rtp_lookup_mime_multiple(s1, BUFSIZ, p->noncodeccapability, 0, 0),
-			    ast_rtp_lookup_mime_multiple(s2, BUFSIZ, peernoncodeccapability, 0, 0),
-			    ast_rtp_lookup_mime_multiple(s3, BUFSIZ, newnoncodeccapability, 0, 0));
+			    ast_rtp_lookup_mime_multiple(s1, SIPBUFSIZE, p->noncodeccapability, 0, 0),
+			    ast_rtp_lookup_mime_multiple(s2, SIPBUFSIZE, peernoncodeccapability, 0, 0),
+			    ast_rtp_lookup_mime_multiple(s3, SIPBUFSIZE, newnoncodeccapability, 0, 0));
 	}
 	if (!newjointcapability) {
 		/* If T.38 was not negotiated either, totally bail out... */
@@ -6687,7 +6700,7 @@
 	}
 
 	/* Ok, we're going with this offer */
-	ast_debug(2, "We're settling with these formats: %s\n", ast_getformatname_multiple(buf, BUFSIZ, p->jointcapability));
+	ast_debug(2, "We're settling with these formats: %s\n", ast_getformatname_multiple(buf, SIPBUFSIZE, p->jointcapability));
 
 	if (!p->owner) 	/* There's no open channel owning us so we can return here. For a re-invite or so, we proceed */
 		return 0;
@@ -6696,10 +6709,10 @@
 
 	if (!(p->owner->nativeformats & p->jointcapability) && (p->jointcapability & AST_FORMAT_AUDIO_MASK)) {
 		if (debug) {
-			char s1[BUFSIZ], s2[BUFSIZ];
+			char s1[SIPBUFSIZE], s2[SIPBUFSIZE];
 			ast_debug(1, "Oooh, we need to change our audio formats since our peer supports only %s and not %s\n", 
-				ast_getformatname_multiple(s1, BUFSIZ, p->jointcapability),
-				ast_getformatname_multiple(s2, BUFSIZ, p->owner->nativeformats));
+				ast_getformatname_multiple(s1, SIPBUFSIZE, p->jointcapability),
+				ast_getformatname_multiple(s2, SIPBUFSIZE, p->owner->nativeformats));
 		}
 		p->owner->nativeformats = ast_codec_choose(&p->prefs, p->jointcapability, 1) | (p->capability & vpeercapability) | (p->capability & tpeercapability);
 		ast_set_read_format(p->owner, p->owner->readformat);
@@ -6923,7 +6936,7 @@
 /*! \brief Add route header into request per learned route */
 static void add_route(struct sip_request *req, struct sip_route *route)
 {
-	char r[BUFSIZ*2], *p;
+	char r[SIPBUFSIZE*2], *p;
 	int n, rem = sizeof(r);
 
 	if (!route)
@@ -7087,7 +7100,7 @@
 		snprintf(tmp, sizeof(tmp), "%d", p->expiry);
 		add_header(resp, "Expires", tmp);
 		if (p->expiry) {	/* Only add contact if we have an expiry time */
-			char contact[BUFSIZ];
+			char contact[SIPBUFSIZE];
 			snprintf(contact, sizeof(contact), "%s;expires=%d", p->our_contact, p->expiry);
 			add_header(resp, "Contact", contact);	/* Not when we unregister */
 		}
@@ -7779,8 +7792,8 @@
 	int min_video_packet_size = 0;
 	int min_text_packet_size = 0;
 
-	char codecbuf[BUFSIZ];
-	char buf[BUFSIZ];
+	char codecbuf[SIPBUFSIZE];
+	char buf[SIPBUFSIZE];
 
 	/* Set the SDP session name */
 	snprintf(subject, sizeof(subject), "s=%s\r\n", ast_strlen_zero(global_sdpsession) ? "-" : global_sdpsession);
@@ -8015,7 +8028,7 @@
 	/* Update lastrtprx when we send our SDP */
 	p->lastrtprx = p->lastrtptx = time(NULL); /* XXX why both ? */
 
-	ast_debug(3, "Done building SDP. Settling with this capability: %s\n", ast_getformatname_multiple(buf, BUFSIZ, capability));
+	ast_debug(3, "Done building SDP. Settling with this capability: %s\n", ast_getformatname_multiple(buf, SIPBUFSIZE, capability));
 
 	return AST_SUCCESS;
 }
@@ -8184,7 +8197,7 @@
 /*! \brief Check Contact: URI of SIP message */
 static void extract_uri(struct sip_pvt *p, struct sip_request *req)
 {
-	char stripped[BUFSIZ];
+	char stripped[SIPBUFSIZE];
 	char *c;
 
 	ast_copy_string(stripped, get_header(req, "Contact"), sizeof(stripped));
@@ -8294,8 +8307,8 @@
 	struct ast_str *invite = ast_str_alloca(256);
 	char from[256];
 	char to[256];
-	char tmp_n[BUFSIZ/2];	/* build a local copy of 'n' if needed */
-	char tmp_l[BUFSIZ/2];	/* build a local copy of 'l' if needed */
+	char tmp_n[SIPBUFSIZE/2];	/* build a local copy of 'n' if needed */
+	char tmp_l[SIPBUFSIZE/2];	/* build a local copy of 'l' if needed */
 	const char *l = NULL;	/* XXX what is this, exactly ? */
 	const char *n = NULL;	/* XXX what is this, exactly ? */
 	const char *urioptions = "";
@@ -8462,7 +8475,7 @@
 	append_date(&req);
 	if (sipmethod == SIP_REFER) {	/* Call transfer */
 		if (p->refer) {
-			char buf[BUFSIZ];
+			char buf[SIPBUFSIZE];
 			if (!ast_strlen_zero(p->refer->refer_to))
 				add_header(&req, "Refer-To", p->refer->refer_to);
 			if (!ast_strlen_zero(p->refer->referred_by)) {
@@ -8783,7 +8796,7 @@
 static int transmit_notify_with_sipfrag(struct sip_pvt *p, int cseq, char *message, int terminate)
 {
 	struct sip_request req;
-	char tmp[BUFSIZ/2];
+	char tmp[SIPBUFSIZE/2];
 
 	reqprep(&req, p, SIP_NOTIFY, 0, 1);
 	snprintf(tmp, sizeof(tmp), "refer;id=%d", cseq);
@@ -9411,7 +9424,7 @@
 /*! \brief Save contact header for 200 OK on INVITE */
 static int parse_ok_contact(struct sip_pvt *pvt, struct sip_request *req)
 {
-	char contact[BUFSIZ]; 
+	char contact[SIPBUFSIZE]; 
 	char *c;
 
 	/* Look for brackets */
@@ -9484,8 +9497,8 @@
 /*! \brief Parse contact header and save registration (peer registration) */
 static enum parse_register_result parse_register_contact(struct sip_pvt *pvt, struct sip_peer *peer, struct sip_request *req)
 {
-	char contact[BUFSIZ]; 
-	char data[BUFSIZ];
+	char contact[SIPBUFSIZE]; 
+	char data[SIPBUFSIZE];
 	const char *expires = get_header(req, "Expires");
 	int expiry = atoi(expires);
 	char *curi, *host, *pt, *curi2;
@@ -12625,7 +12638,7 @@
 	int realtimepeers;
 	int realtimeusers;
 	int realtimeregs;
-	char codec_buf[BUFSIZ];
+	char codec_buf[SIPBUFSIZE];
 	const char *msg;	/* temporary msg pointer */
 
 	switch (cmd) {
@@ -12855,7 +12868,7 @@
 		if (cur->subscribed == NONE && !arg->subscriptions) {
 			/* set if SIP transfer in progress */
 			const char *referstatus = cur->refer ? referstatus2str(cur->refer->status) : "";
-			char formatbuf[BUFSIZ/2];
+			char formatbuf[SIPBUFSIZE/2];
 
 			ast_cli(arg->fd, FORMAT, ast_inet_ntoa(dst->sin_addr), 
 				S_OR(cur->username, S_OR(cur->cid_num, "(None)")),
@@ -13101,7 +13114,7 @@
 	dialoglist_lock();
 	for (cur = dialoglist; cur; cur = cur->next) {
 		if (!strncasecmp(cur->callid, a->argv[3], len)) {
-			char formatbuf[BUFSIZ/2];
+			char formatbuf[SIPBUFSIZE/2];
 			ast_cli(a->fd,"\n");
 			if (cur->subscribed != NONE)
 				ast_cli(a->fd, "  * Subscription (type: %s)\n", subscription_type2str(cur->subscribed));
@@ -14115,7 +14128,7 @@
 /*! \brief Parse 302 Moved temporalily response */
 static void parse_moved_contact(struct sip_pvt *p, struct sip_request *req)
 {
-	char tmp[BUFSIZ];
+	char tmp[SIPBUFSIZE];
 	char *s, *e, *t;
 	char *domain;
 
@@ -14381,6 +14394,10 @@
 					manager_event(EVENT_FLAG_SYSTEM, "ChannelUpdate",
 						"Channel: %s\r\nChanneltype: %s\r\nUniqueid: %s\r\nSIPcallid: %s\r\nSIPfullcontact: %s\r\nPeername: %s\r\n",
 						p->owner->name, p->owner->uniqueid, "SIP", p->callid, p->fullcontact, p->peername);
+				/* Set bridged channel variable */
+				bridgepeer = ast_bridged_channel(p->owner);
+				if (bridgepeer)
+					pbx_builtin_setvar_helper(bridgepeer, "SIP_BRIDGED_CALLID", p->callid);
 			} else {	/* RE-invite */
 				ast_queue_frame(p->owner, &ast_null_frame);
 			}
@@ -16867,7 +16884,7 @@
 	}
 	/* Generate a Replaces string to be used in the INVITE during attended transfer */
 	if (!ast_strlen_zero(p->refer->replaces_callid)) {
-		char tempheader[BUFSIZ];
+		char tempheader[SIPBUFSIZE];
 		snprintf(tempheader, sizeof(tempheader), "%s%s%s%s%s", p->refer->replaces_callid, 
 				p->refer->replaces_callid_totag ? ";to-tag=" : "", 
 				p->refer->replaces_callid_totag, 

Modified: team/russell/chan_refcount/doc/tex/channelvariables.tex
URL: http://svn.digium.com/view/asterisk/team/russell/chan_refcount/doc/tex/channelvariables.tex?view=diff&rev=99690&r1=99689&r2=99690
==============================================================================
--- team/russell/chan_refcount/doc/tex/channelvariables.tex (original)
+++ team/russell/chan_refcount/doc/tex/channelvariables.tex Tue Jan 22 15:19:58 2008
@@ -736,6 +736,7 @@
 ${CDR(accountcode)}    * Account code (if specified)
 ${BLINDTRANSFER}         The name of the channel on the other side of a blind transfer
 ${BRIDGEPEER}            Bridged peer
+${BRIDGEPVTCALLID}       Bridged peer PVT call ID (SIP Call ID if a SIP call)
 ${CALLERID(ani)}       * Caller ANI (PRI channels)
 ${CALLERID(ani2)}      * ANI2 (Info digits) also called Originating line information or OLI
 ${CALLERID(all)}       * Caller ID
@@ -777,8 +778,9 @@
 
 \subsection{Application return values}
 
-In Asterisk 1.2, many applications return the result in a variable
-instead of, as in Asterisk 1.0, changing the dial plan priority (+101).
+Many applications return the result in a variable that you read to
+get the result of the application. These status fields are unique
+for each application.
 For the various status values, see each application's help text.
 \begin{verbatim}
 ${AGISTATUS}         * agi()

Modified: team/russell/chan_refcount/include/asterisk/channel.h
URL: http://svn.digium.com/view/asterisk/team/russell/chan_refcount/include/asterisk/channel.h?view=diff&rev=99690&r1=99689&r2=99690
==============================================================================
--- team/russell/chan_refcount/include/asterisk/channel.h (original)
+++ team/russell/chan_refcount/include/asterisk/channel.h Tue Jan 22 15:19:58 2008
@@ -339,6 +339,9 @@
 	
 	/*! \brief Set base channel (agent and local) */
 	int (* set_base_channel)(struct ast_channel *chan, struct ast_channel *base);
+
+	/*! \brief Get the unique identifier for the PVT, i.e. SIP call-ID for SIP */
+	char * (* get_pvt_uniqueid)(struct ast_channel *chan);
 };
 
 struct ast_epoll_data;

Modified: team/russell/chan_refcount/main/acl.c
URL: http://svn.digium.com/view/asterisk/team/russell/chan_refcount/main/acl.c?view=diff&rev=99690&r1=99689&r2=99690
==============================================================================
--- team/russell/chan_refcount/main/acl.c (original)
+++ team/russell/chan_refcount/main/acl.c Tue Jan 22 15:19:58 2008
@@ -29,11 +29,16 @@
 
 #include "asterisk/network.h"
 
+#if defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__) || defined(__Darwin__)
+#include <fcntl.h>
+#include <net/route.h>
+#endif
+
 #if defined(SOLARIS)
 #include <sys/sockio.h>
 #endif
 
-#if defined(__linux__)
+#if defined(__Darwin__) || defined(__linux__)
 #include <ifaddrs.h>
 #endif
 
@@ -103,23 +108,23 @@
 static int get_local_address(struct in_addr *ourip)
 {
 	int s, res = -1;
-#ifdef _SOLARIS
+#ifdef SOLARIS
 	struct lifreq *ifr = NULL;
 	struct lifnum ifn;
 	struct lifconf ifc;
 	struct sockaddr_in *sa;
 	char *buf = NULL;
 	int bufsz, x;
-#endif /* _SOLARIS */
-#if defined(_BSD) || defined(__linux__)
+#endif /* SOLARIS */
+#if defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__) || defined(__linux__) || defined(__Darwin__)
 	struct ifaddrs *ifap, *ifaphead;
 	int rtnerr;
 	const struct sockaddr_in *sin;
-#endif /* defined(_BSD) || defined(_LINUX) */
+#endif /* BSD_OR_LINUX */
 	struct in_addr best_addr = { 0, };
 	int best_score = -100;
 
-#if defined(_BSD) || defined(__linux__)
+#if defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__) || defined(__linux__) || defined(__Darwin__)
 	rtnerr = getifaddrs(&ifaphead);
 	if (rtnerr) {
 		perror(NULL);
@@ -130,7 +135,7 @@
 	s = socket(AF_INET, SOCK_STREAM, 0);
 
 	if (s > 0) {
-#if defined(_BSD) || defined(__linux__)
+#if defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__) || defined(__linux__) || defined(__Darwin__)
 		for (ifap = ifaphead; ifap; ifap = ifap->ifa_next) {
 
 			if (ifap->ifa_addr->sa_family == AF_INET) {
@@ -142,10 +147,10 @@
 					break;
 			}
 		}
-#endif /* _BSD */
+#endif /* BSD_OR_LINUX */
 
 		/* There is no reason whatsoever that this shouldn't work on Linux or BSD also. */
-#ifdef _SOLARIS
+#ifdef SOLARIS
 		/* Get a count of interfaces on the machine */
 		ifn.lifn_family = AF_INET;
 		ifn.lifn_flags = 0;
@@ -183,13 +188,13 @@
 		}
 
 		free(buf);
-#endif /* _SOLARIS */
+#endif /* SOLARIS */
 		
 		close(s);
 	}
-#if defined(_BSD) || defined(__linux__)
+#if defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__) || defined(__linux__) || defined(__Darwin__)
 	freeifaddrs(ifaphead);
-#endif
+#endif /* BSD_OR_LINUX */
 
 	if (res == 0 && ourip)
 		memcpy(ourip, &best_addr, sizeof(*ourip));

Modified: team/russell/chan_refcount/main/asterisk.c
URL: http://svn.digium.com/view/asterisk/team/russell/chan_refcount/main/asterisk.c?view=diff&rev=99690&r1=99689&r2=99690
==============================================================================
--- team/russell/chan_refcount/main/asterisk.c (original)
+++ team/russell/chan_refcount/main/asterisk.c Tue Jan 22 15:19:58 2008
@@ -2683,36 +2683,25 @@
 
 static void run_startup_commands(void)
 {
-	char filename[PATH_MAX];
-	char buf[256];
-	FILE *f;
 	int fd;
-	
+	struct ast_config *cfg;
+	struct ast_flags cfg_flags = { 0 };
+	struct ast_variable *v;
+
+	if (!(cfg = ast_config_load("cli.conf", cfg_flags)))
+		return;
+
 	fd = open("/dev/null", O_RDWR);
 	if (fd < 0)
 		return;
 
-	snprintf(filename, sizeof(filename), "%s/startup_commands", ast_config_AST_CONFIG_DIR);
-
-	if (!(f = fopen(filename, "r"))) {
-		close(fd);
-		return;
-	}
-
-	while (fgets(buf, sizeof(buf), f)) {
-		size_t res = strlen(buf);
-
-		if (!res)
-			continue;
-
-		if (buf[res - 1] == '\n')
-			buf[res - 1] = '\0';
-
-		ast_cli_command(fd, buf);
-	}
-
-	fclose(f);
+	for (v = ast_variable_browse(cfg, "startup_commands"); v; v = v->next) {
+		if (ast_true(v->value))
+			ast_cli_command(fd, v->name);
+	}
+
 	close(fd);
+	ast_config_destroy(cfg);
 }
 
 int main(int argc, char *argv[])

Modified: team/russell/chan_refcount/main/channel.c
URL: http://svn.digium.com/view/asterisk/team/russell/chan_refcount/main/channel.c?view=diff&rev=99690&r1=99689&r2=99690
==============================================================================
--- team/russell/chan_refcount/main/channel.c (original)
+++ team/russell/chan_refcount/main/channel.c Tue Jan 22 15:19:58 2008
@@ -4199,6 +4199,10 @@
 			pbx_builtin_setvar_helper(c0, "BRIDGEPEER", c1->name);
 		if (!ast_strlen_zero(pbx_builtin_getvar_helper(c1, "BRIDGEPEER")))
 			pbx_builtin_setvar_helper(c1, "BRIDGEPEER", c0->name);
+		if (c0->tech->get_pvt_uniqueid)
+			pbx_builtin_setvar_helper(c1, "BRIDGEPVTCALLID", c0->tech->get_pvt_uniqueid(c0));
+		if (c1->tech->get_pvt_uniqueid)
+			pbx_builtin_setvar_helper(c0, "BRIDGEPVTCALLID", c1->tech->get_pvt_uniqueid(c1));
 		
 		if (c0->tech->bridge &&
 		    (config->timelimit == 0) &&




More information about the asterisk-commits mailing list