[asterisk-commits] branch bweschke/bug_5374 - r7530 in /team/bweschke/bug_5374: ./ apps/ build_t...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Mon Dec 19 18:17:13 CST 2005


Author: bweschke
Date: Mon Dec 19 18:17:08 2005
New Revision: 7530

URL: http://svn.digium.com/view/asterisk?rev=7530&view=rev
Log:
 Bringing the branch up to date with /trunk again.


Added:
    team/bweschke/bug_5374/funcs/func_cut.c
      - copied unchanged from r7529, trunk/funcs/func_cut.c
Removed:
    team/bweschke/bug_5374/apps/app_cut.c
Modified:
    team/bweschke/bug_5374/   (props changed)
    team/bweschke/bug_5374/apps/app_chanspy.c
    team/bweschke/bug_5374/build_tools/make_svn_branch_name
    team/bweschke/bug_5374/cdr.c
    team/bweschke/bug_5374/channels/chan_sip.c
    team/bweschke/bug_5374/doc/README.ael
    team/bweschke/bug_5374/file.c
    team/bweschke/bug_5374/include/asterisk/linkedlists.h

Propchange: team/bweschke/bug_5374/
------------------------------------------------------------------------------
    svnmerge-blocked = /branches/1.2:7497

Propchange: team/bweschke/bug_5374/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Mon Dec 19 18:17:08 2005
@@ -1,2 +1,2 @@
 /branches/1.2:1-7351
-/trunk:1-7484
+/trunk:1-7529

Modified: team/bweschke/bug_5374/apps/app_chanspy.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/bug_5374/apps/app_chanspy.c?rev=7530&r1=7529&r2=7530&view=diff
==============================================================================
--- team/bweschke/bug_5374/apps/app_chanspy.c (original)
+++ team/bweschke/bug_5374/apps/app_chanspy.c Mon Dec 19 18:17:08 2005
@@ -482,7 +482,7 @@
 					}
 				}
 				
-				if (igrp && (!spec || ((strlen(spec) < strlen(peer->name) &&
+				if (igrp && (!spec || ((strlen(spec) <= strlen(peer->name) &&
 							!strncasecmp(peer->name, spec, strlen(spec)))))) {
 					if (peer && (!bronly || ast_bridged_channel(peer)) &&
 					    !ast_check_hangup(peer) && !ast_test_flag(peer, AST_FLAG_SPYING)) {

Modified: team/bweschke/bug_5374/build_tools/make_svn_branch_name
URL: http://svn.digium.com/view/asterisk/team/bweschke/bug_5374/build_tools/make_svn_branch_name?rev=7530&r1=7529&r2=7530&view=diff
==============================================================================
--- team/bweschke/bug_5374/build_tools/make_svn_branch_name (original)
+++ team/bweschke/bug_5374/build_tools/make_svn_branch_name Mon Dec 19 18:17:08 2005
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-PARTS=`LANG=C svn info | grep URL | awk '{print $2;}' | sed -e s:^.*/svn/asterisk/:: | sed -e 's:/: :'`
+PARTS=`LANG=C svn info | grep URL | awk '{print $2;}' | sed -e s:^.*/svn/asterisk/:: | sed -e 's:/: :g'`
 BRANCH=0
 TEAM=0
 
@@ -47,4 +47,4 @@
   fi
 done
 
-echo ${RESULT}-r${REV}
+echo ${RESULT##-}-r${REV}

Modified: team/bweschke/bug_5374/cdr.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/bug_5374/cdr.c?rev=7530&r1=7529&r2=7530&view=diff
==============================================================================
--- team/bweschke/bug_5374/cdr.c (original)
+++ team/bweschke/bug_5374/cdr.c Mon Dec 19 18:17:08 2005
@@ -691,12 +691,15 @@
 
 int ast_cdr_setamaflags(struct ast_channel *chan, const char *flag)
 {
-	struct ast_cdr *cdr = chan->cdr;
+	struct ast_cdr *cdr;
 	int newflag;
 
 	newflag = ast_cdr_amaflags2int(flag);
-	if (newflag)
-		cdr->amaflags = newflag;
+	if (newflag) {
+		for (cdr = chan->cdr; cdr; cdr = cdr->next) {
+			cdr->amaflags = newflag;
+		}
+	}
 
 	return 0;
 }

Modified: team/bweschke/bug_5374/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/bug_5374/channels/chan_sip.c?rev=7530&r1=7529&r2=7530&view=diff
==============================================================================
--- team/bweschke/bug_5374/channels/chan_sip.c (original)
+++ team/bweschke/bug_5374/channels/chan_sip.c Mon Dec 19 18:17:08 2005
@@ -202,6 +202,7 @@
 	WWW_AUTH,
 };
 
+/*! XXX Note that sip_methods[i].id == i must hold or the code breaks */
 static const struct  cfsip_methods { 
 	enum sipmethod id;
 	int need_rtp;		/*!< when this is the 'primary' use for a pvt structure, does it need RTP? */
@@ -878,7 +879,6 @@
 static struct sip_auth *authl;          /*!< Authentication list */
 
 
-static struct ast_frame  *sip_read(struct ast_channel *ast);
 static int transmit_response(struct sip_pvt *p, char *msg, struct sip_request *req);
 static int transmit_response_with_sdp(struct sip_pvt *p, char *msg, struct sip_request *req, int retrans);
 static int transmit_response_with_unsupported(struct sip_pvt *p, char *msg, struct sip_request *req, char *unsupported);
@@ -2734,7 +2734,6 @@
 	tmp->tech = &sip_tech;
 	/* Select our native format based on codec preference until we receive
 	   something from another device to the contrary. */
-	ast_mutex_lock(&i->lock);
 	if (i->jointcapability)
 		tmp->nativeformats = ast_codec_choose(&i->prefs, i->jointcapability, 1);
 	else if (i->capability)
@@ -3993,7 +3992,6 @@
 	copy_header(resp, req, "CSeq");
 	add_header(resp, "User-Agent", default_useragent);
 	add_header(resp, "Allow", ALLOWED_METHODS);
-	add_header(resp, "Max-Forwards", DEFAULT_MAX_FORWARDS);
 	if (msg[0] == '2' && (p->method == SIP_SUBSCRIBE || p->method == SIP_REGISTER)) {
 		/* For registration responses, we also need expiry and
 		   contact info */
@@ -10800,12 +10798,40 @@
 			ast_set_flag(p, SIP_NEEDDESTROY);	
 			return 0;
 		} else {
+			struct sip_pvt *p_old;
+
 			transmit_response(p, "200 OK", req);
 			transmit_state_notify(p, firststate, 1, 1);	/* Send first notification */
 			append_history(p, "Subscribestatus", ast_extension_state2str(firststate));
+
+			/* remove any old subscription from this peer for the same exten/context,
+			   as the peer has obviously forgotten about it and it's wasteful to wait
+			   for it to expire and send NOTIFY messages to the peer only to have them
+			   ignored (or generate errors)
+			*/
+			ast_mutex_lock(&iflock);
+			for (p_old = iflist; p_old; p_old = p_old->next) {
+				if (p_old == p)
+					continue;
+				if (p_old->initreq.method != SIP_SUBSCRIBE)
+					continue;
+				if (p_old->subscribed == NONE)
+					continue;
+				ast_mutex_lock(&p_old->lock);
+				if (!strcmp(p_old->username, p->username)) {
+					if (!strcmp(p_old->exten, p->exten) &&
+					    !strcmp(p_old->context, p->context)) {
+						ast_set_flag(p_old, SIP_NEEDDESTROY);
+						ast_mutex_unlock(&p_old->lock);
+						break;
+					}
+				}
+				ast_mutex_unlock(&p_old->lock);
+			}
+			ast_mutex_unlock(&iflock);
 		}
 		if (!p->expiry)
-			ast_set_flag(p, SIP_NEEDDESTROY);	
+			ast_set_flag(p, SIP_NEEDDESTROY);
 	}
 	return 1;
 }

Modified: team/bweschke/bug_5374/doc/README.ael
URL: http://svn.digium.com/view/asterisk/team/bweschke/bug_5374/doc/README.ael?rev=7530&r1=7529&r2=7530&view=diff
==============================================================================
--- team/bweschke/bug_5374/doc/README.ael (original)
+++ team/bweschke/bug_5374/doc/README.ael Mon Dec 19 18:17:08 2005
@@ -263,3 +263,11 @@
 	i => Playback(invalid);
 };
 
+
+Syntax Note
+------------------------
+Please note that all opening {'s are on the same line as the keyword.  For
+the time being, that syntax is mandatory.  We are looking at ways to allow
+other syntax in the future for flexibility, but for now, that is the way
+you must write AEL clauses.
+

Modified: team/bweschke/bug_5374/file.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/bug_5374/file.c?rev=7530&r1=7529&r2=7530&view=diff
==============================================================================
--- team/bweschke/bug_5374/file.c (original)
+++ team/bweschke/bug_5374/file.c Mon Dec 19 18:17:08 2005
@@ -955,6 +955,8 @@
 					fs->filename = strdup(filename);
 				}
 				fs->vfs = NULL;
+				/* If truncated, we'll be at the beginning; if not truncated, then append */
+				f->seek(fs, 0, SEEK_END);
 			} else {
 				ast_log(LOG_WARNING, "Unable to rewrite %s\n", fn);
 				close(fd);

Modified: team/bweschke/bug_5374/include/asterisk/linkedlists.h
URL: http://svn.digium.com/view/asterisk/team/bweschke/bug_5374/include/asterisk/linkedlists.h?rev=7530&r1=7529&r2=7530&view=diff
==============================================================================
--- team/bweschke/bug_5374/include/asterisk/linkedlists.h (original)
+++ team/bweschke/bug_5374/include/asterisk/linkedlists.h Mon Dec 19 18:17:08 2005
@@ -381,7 +381,8 @@
   used to link entries of this list together.
 
   Note: The link field in the appended entry is \b not modified, so if it is
-  actually the head of a list itself, the entire list will be appended.
+  actually the head of a list itself, the entire list will be appended
+  temporarily (until the next AST_LIST_INSERT_TAIL is performed).
  */
 #define AST_LIST_INSERT_TAIL(head, elm, field) do {			\
       if (!(head)->first) {						\
@@ -431,7 +432,7 @@
 		while (curelm->field.next != (elm))			\
 			curelm = curelm->field.next;			\
 		curelm->field.next = (elm)->field.next;			\
-		if ((head)->last == curelm->field.next)			\
+		if ((head)->last == (elm))				\
 			(head)->last = curelm;				\
 	}								\
 } while (0)



More information about the asterisk-commits mailing list