[svn-commits] branch group/sip-threading r26803 - in /team/group/sip-threading: ./ channels/

svn-commits at lists.digium.com svn-commits at lists.digium.com
Thu May 11 02:36:21 MST 2006


Author: file
Date: Thu May 11 04:36:21 2006
New Revision: 26803

URL: http://svn.digium.com/view/asterisk?rev=26803&view=rev
Log:
Merged revisions 26755-26759,26764,26781,26799-26800 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

................
r26755 | oej | 2006-05-11 03:08:54 -0500 (Thu, 11 May 2006) | 3 lines

Issue #OEJ12399.3 - Set default maxcallbitrate for users too. 
(Well, could have opened a branch for this, but felt community pressure not to... ;-)

................
r26756 | oej | 2006-05-11 03:20:59 -0500 (Thu, 11 May 2006) | 2 lines

Small formatting fixes

................
r26757 | oej | 2006-05-11 03:25:20 -0500 (Thu, 11 May 2006) | 2 lines

Ignore CANCEL on call that is already answered

................
r26758 | markster | 2006-05-11 03:28:16 -0500 (Thu, 11 May 2006) | 2 lines

Make sure we handle long information elements (bug #6654)

................
r26759 | markster | 2006-05-11 03:47:37 -0500 (Thu, 11 May 2006) | 2 lines

Set "MARK" whenever SSRC changes (bug #6934)

................
r26764 | kpfleming | 2006-05-11 04:01:53 -0500 (Thu, 11 May 2006) | 10 lines

Merged revisions 26760 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r26760 | kpfleming | 2006-05-11 03:52:46 -0500 (Thu, 11 May 2006) | 2 lines

ensure that we send a response to REGISTER requests that are successfully authenticated but contain invalid Contact URIs

........

................
r26781 | kpfleming | 2006-05-11 04:07:45 -0500 (Thu, 11 May 2006) | 2 lines

block revision for fix that was committed here before 1.2

................
r26799 | rizzo | 2006-05-11 04:24:35 -0500 (Thu, 11 May 2006) | 4 lines

simplify sip_pretend_ack also removing a bug in the existing
code which called ast_skip_blanks erroneously.


................
r26800 | rizzo | 2006-05-11 04:29:37 -0500 (Thu, 11 May 2006) | 5 lines

replace list unlinking with UNLINK macro
(when the list becomes an astobj this will be revisited;
however at the moment the change would be too intrusive).


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

Modified:
    team/group/sip-threading/   (props changed)
    team/group/sip-threading/channels/chan_sip.c
    team/group/sip-threading/enum.c
    team/group/sip-threading/rtp.c

Propchange: team/group/sip-threading/
------------------------------------------------------------------------------
    automerge = AstriDevConOMG

Propchange: team/group/sip-threading/
------------------------------------------------------------------------------
Binary property 'branch-1.2-blocked' - no diff available.

Propchange: team/group/sip-threading/
------------------------------------------------------------------------------
Binary property 'branch-1.2-merged' - no diff available.

Propchange: team/group/sip-threading/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Thu May 11 04:36:21 2006
@@ -1,1 +1,1 @@
-/trunk:1-26723
+/trunk:1-26800

Modified: team/group/sip-threading/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/group/sip-threading/channels/chan_sip.c?rev=26803&r1=26802&r2=26803&view=diff
==============================================================================
--- team/group/sip-threading/channels/chan_sip.c (original)
+++ team/group/sip-threading/channels/chan_sip.c Thu May 11 04:36:21 2006
@@ -1277,6 +1277,15 @@
 	.send_text = sip_sendtext,
 };
 
+/**--- some list management macros. **/
+ 
+#define UNLINK(element, head, prev) do {	\
+	if (prev)				\
+		(prev)->next = (element)->next;	\
+	else					\
+		(head) = (element)->next;	\
+	} while (0)
+
 /*! \brief Interface structure with callbacks used to connect to RTP module */
 static struct ast_rtp_protocol sip_rtp = {
 	type: "SIP",
@@ -1744,27 +1753,20 @@
 }
 
 /*! \brief Pretend to ack all packets */
+/* maybe the lock on p is not strictly necessary but there might be a race */
 static int __sip_pretend_ack(struct sip_pvt *p)
 {
 	struct sip_pkt *cur = NULL;
-
+	
 	while (!AST_LIST_EMPTY(&p->packets)) {
+		int method;
 		if (cur == AST_LIST_FIRST(&p->packets)) {
 			ast_log(LOG_WARNING, "Have a packet that doesn't want to give up! %s\n", sip_methods[cur->method].text);
 			return -1;
 		}
 		cur = AST_LIST_FIRST(&p->packets);
-		if (cur->method)
-			__sip_ack(p, cur->seqno, (ast_test_flag(cur, FLAG_RESPONSE)), cur->method, FALSE);
-		else {	/* Unknown packet type */
-			char *c;
-			char method[128];
-
-			ast_copy_string(method, cur->data, sizeof(method));
-			c = ast_skip_blanks(method); /* XXX what ? */
-			*c = '\0';
-			__sip_ack(p, cur->seqno, (ast_test_flag(cur, FLAG_RESPONSE)), find_sip_method(method), FALSE);
-		}
+		method = (cur->method) ? cur->method : find_sip_method(cur->data);
+		__sip_ack(p, cur->seqno, ast_test_flag(cur, FLAG_RESPONSE), method, FALSE);
 	}
 	return 0;
 }
@@ -2837,7 +2839,7 @@
 				__sip_pretend_ack(p);
 
 				/* Send a new request: CANCEL */
-				transmit_request_with_auth(p, SIP_CANCEL, p->ocseq, XMIT_RELIABLE, 0);
+				transmit_request_with_auth(p, SIP_CANCEL, p->ocseq, XMIT_RELIABLE, FALSE);
 				/* Actually don't destroy us yet, wait for the 487 on our original 
 				   INVITE, but do set an autodestruct just in case we never get it. */
 				ast_clear_flag(&locflags, SIP_NEEDDESTROY);
@@ -6812,6 +6814,9 @@
 				switch (parse_register_contact(p, peer, req)) {
 				case PARSE_REGISTER_FAILED:
 					ast_log(LOG_WARNING, "Failed to parse contact info\n");
+					transmit_response_with_date(p, "400 Bad Request", req);
+					peer->lastmsgssent = -1;
+					res = 0;
 					break;
 				case PARSE_REGISTER_QUERY:
 					transmit_response_with_date(p, "200 OK", req);
@@ -6835,11 +6840,13 @@
 		peer = temp_peer(name);
 		if (peer) {
 			ASTOBJ_CONTAINER_LINK(&peerl, peer);
-			peer->lastmsgssent = -1;
 			sip_cancel_destroy(p);
 			switch (parse_register_contact(p, peer, req)) {
 			case PARSE_REGISTER_FAILED:
 				ast_log(LOG_WARNING, "Failed to parse contact info\n");
+				transmit_response_with_date(p, "400 Bad Request", req);
+				peer->lastmsgssent = -1;
+				res = 0;
 				break;
 			case PARSE_REGISTER_QUERY:
 				transmit_response_with_date(p, "200 OK", req);
@@ -9936,7 +9943,7 @@
 {
 	/* Go ahead and send bye at this point */
 	if (ast_test_flag(&p->flags[0], SIP_PENDINGBYE)) {
-		transmit_request_with_auth(p, SIP_BYE, 0, XMIT_RELIABLE, 1);
+		transmit_request_with_auth(p, SIP_BYE, 0, XMIT_RELIABLE, TRUE);
 		ast_set_flag(&p->flags[0], SIP_NEEDDESTROY);	
 		ast_clear_flag(&p->flags[0], SIP_NEEDREINVITE);	
 	} else if (ast_test_flag(&p->flags[0], SIP_NEEDREINVITE)) {
@@ -10048,13 +10055,13 @@
 				ast_set_flag(&p->flags[0], SIP_PENDINGBYE);	
 		}
 		/* If I understand this right, the branch is different for a non-200 ACK only */
-		transmit_request(p, SIP_ACK, seqno, XMIT_UNRELIABLE, 1);
+		transmit_request(p, SIP_ACK, seqno, XMIT_UNRELIABLE, TRUE);
 		check_pendings(p);
 		break;
 	case 407: /* Proxy authentication */
 	case 401: /* Www auth */
 		/* First we ACK */
-		transmit_request(p, SIP_ACK, seqno, XMIT_UNRELIABLE, 0);
+		transmit_request(p, SIP_ACK, seqno, XMIT_UNRELIABLE, FALSE);
 		if (p->options)
 			p->options->auth_type = (resp == 401 ? WWW_AUTH : PROXY_AUTH);
 
@@ -10074,7 +10081,7 @@
 		break;
 	case 403: /* Forbidden */
 		/* First we ACK */
-		transmit_request(p, SIP_ACK, seqno, XMIT_UNRELIABLE, 0);
+		transmit_request(p, SIP_ACK, seqno, XMIT_UNRELIABLE, FALSE);
 		ast_log(LOG_WARNING, "Received response: \"Forbidden\" from '%s'\n", get_header(&p->initreq, "From"));
 		if (!ast_test_flag(req, SIP_PKT_IGNORE) && p->owner)
 			ast_queue_control(p->owner, AST_CONTROL_CONGESTION);
@@ -10082,7 +10089,7 @@
 		ast_set_flag(&p->flags[0], SIP_ALREADYGONE);	
 		break;
 	case 404: /* Not found */
-		transmit_request(p, SIP_ACK, seqno, XMIT_UNRELIABLE, 0);
+		transmit_request(p, SIP_ACK, seqno, XMIT_UNRELIABLE, FALSE);
 		if (p->owner && !ast_test_flag(req, SIP_PKT_IGNORE))
 			ast_queue_control(p->owner, AST_CONTROL_CONGESTION);
 		ast_set_flag(&p->flags[0], SIP_ALREADYGONE);	
@@ -10090,7 +10097,7 @@
 	case 481: /* Call leg does not exist */
 		/* Could be REFER or INVITE */
 		ast_log(LOG_WARNING, "Re-invite to non-existing call leg on other UA. SIP dialog '%s'. Giving up.\n", p->callid);
-		transmit_request(p, SIP_ACK, seqno, XMIT_UNRELIABLE, 0);
+		transmit_request(p, SIP_ACK, seqno, XMIT_UNRELIABLE, FALSE);
 		break;
 	case 491: /* Pending */
 		/* we have to wait a while, then retransmit */
@@ -10458,7 +10465,7 @@
 		case 481: /* Call leg does not exist */
 			if (sipmethod == SIP_INVITE) {
 				/* First we ACK */
-				transmit_request(p, SIP_ACK, seqno, 0, 0);
+				transmit_request(p, SIP_ACK, seqno, XMIT_UNRELIABLE, FALSE);
 					ast_log(LOG_WARNING, "INVITE with REPLACEs failed to '%s'\n", get_header(&p->initreq, "From"));
 				if (owner)
 					ast_queue_control(p->owner, AST_CONTROL_CONGESTION);
@@ -10571,7 +10578,7 @@
 				}
 				/* ACK on invite */
 				if (sipmethod == SIP_INVITE) 
-					transmit_request(p, SIP_ACK, seqno, XMIT_UNRELIABLE, 0);
+					transmit_request(p, SIP_ACK, seqno, XMIT_UNRELIABLE, FALSE);
 				ast_set_flag(&p->flags[0], SIP_ALREADYGONE);	
 				if (!p->owner)
 					ast_set_flag(&p->flags[0], SIP_NEEDDESTROY);	
@@ -11427,7 +11434,7 @@
 			transmit_notify_with_sipfrag(p, seqno, "200 OK", 1);
 			/* Always increment on a BYE */
 			if (!nobye) {
-				transmit_request_with_auth(p, SIP_BYE, 0, XMIT_RELIABLE, 1);
+				transmit_request_with_auth(p, SIP_BYE, 0, XMIT_RELIABLE, TRUE);
 				ast_set_flag(&p->flags[0], SIP_ALREADYGONE);	
 			}
 		}
@@ -11440,6 +11447,14 @@
 		
 	check_via(p, req);
 	ast_set_flag(&p->flags[0], SIP_ALREADYGONE);	
+	
+	if (p->owner && p->owner->_state == AST_STATE_UP) {
+		/* This call is up, cancel is ignored, we need a bye */
+		transmit_response(p, "200 OK", req);
+		if (option_debug)
+			ast_log(LOG_DEBUG, "Got CANCEL on an answered call. Ignoring... \n");
+		return 0;
+	}
 	if (p->rtp) {
 		/* Immediately stop RTP */
 		ast_rtp_stop(p->rtp);
@@ -12881,6 +12896,7 @@
 	ast_copy_flags(&user->flags[1], &global_flags[1], SIP_PAGE2_FLAGS_TO_COPY);
 	user->capability = global_capability;
 	user->allowtransfer = global_allowtransfer;
+	user->maxcallbitrate = default_maxcallbitrate;
 	user->prefs = default_prefs;
 	/* set default context */
 	strcpy(user->context, default_context);

Modified: team/group/sip-threading/enum.c
URL: http://svn.digium.com/view/asterisk/team/group/sip-threading/enum.c?rev=26803&r1=26802&r2=26803&view=diff
==============================================================================
--- team/group/sip-threading/enum.c (original)
+++ team/group/sip-threading/enum.c Thu May 11 04:36:21 2006
@@ -95,7 +95,7 @@
 } __attribute__ ((__packed__));
 
 /*! \brief Parse NAPTR record information elements */
-static int parse_ie(char *data, int maxdatalen, char *src, int srclen)
+static int parse_ie(unsigned char *data, int maxdatalen, unsigned char *src, int srclen)
 {
 	int len, olen;
 
@@ -113,7 +113,7 @@
 }
 
 /*! \brief Parse DNS NAPTR record used in ENUM ---*/
-static int parse_naptr(char *dst, int dstsize, char *tech, int techsize, char *answer, int len, char *naptrinput)
+static int parse_naptr(unsigned char *dst, int dstsize, char *tech, int techsize, unsigned char *answer, int len, unsigned char *naptrinput)
 {
 
 	char tech_return[80];

Modified: team/group/sip-threading/rtp.c
URL: http://svn.digium.com/view/asterisk/team/group/sip-threading/rtp.c?rev=26803&r1=26802&r2=26803&view=diff
==============================================================================
--- team/group/sip-threading/rtp.c (original)
+++ team/group/sip-threading/rtp.c Thu May 11 04:36:21 2006
@@ -93,6 +93,7 @@
 	struct ast_frame f;
 	unsigned char rawdata[8192 + AST_FRIENDLY_OFFSET];
 	unsigned int ssrc;		/*!< Synchronization source, RFC 3550, page 10. */
+	unsigned int rxssrc;
 	unsigned int lastts;
 	unsigned int lastdigitts;
 	unsigned int lastrxts;
@@ -430,6 +431,7 @@
 	int ext;
 	int x;
 	char iabuf[INET_ADDRSTRLEN];
+	unsigned int ssrc;
 	unsigned int timestamp;
 	unsigned int *rtpheader;
 	struct rtpPayloadType rtpPT;
@@ -485,6 +487,14 @@
 	ext = seqno & (1 << 28);
 	seqno &= 0xffff;
 	timestamp = ntohl(rtpheader[1]);
+	ssrc = ntohl(rtpheader[2]);
+	
+	if (!mark && rtp->rxssrc && rtp->rxssrc != ssrc) {
+		ast_log(LOG_WARNING, "Forcing Marker bit, because SSRC has changed\n");
+		mark = 1;
+	}
+
+	rtp->rxssrc = ssrc;
 	
 	if (padding) {
 		/* Remove padding bytes */



More information about the svn-commits mailing list