[svn-commits] oej: branch oej/darjeeling-prack-1.8 r369790 - /team/oej/darjeeling-prack-1.8...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Jul 9 06:24:31 CDT 2012


Author: oej
Date: Mon Jul  9 06:24:29 2012
New Revision: 369790

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=369790
Log:
Update patch.

Modified:
    team/oej/darjeeling-prack-1.8/patches/darjeeling-prack-1.8.diff

Modified: team/oej/darjeeling-prack-1.8/patches/darjeeling-prack-1.8.diff
URL: http://svnview.digium.com/svn/asterisk/team/oej/darjeeling-prack-1.8/patches/darjeeling-prack-1.8.diff?view=diff&rev=369790&r1=369789&r2=369790
==============================================================================
--- team/oej/darjeeling-prack-1.8/patches/darjeeling-prack-1.8.diff (original)
+++ team/oej/darjeeling-prack-1.8/patches/darjeeling-prack-1.8.diff Mon Jul  9 06:24:29 2012
@@ -1,7 +1,7 @@
 Index: channels/chan_sip.c
 ===================================================================
---- channels/chan_sip.c	(.../branches/1.8)	(revision 369624)
-+++ channels/chan_sip.c	(.../team/oej/darjeeling-prack-1.8)	(revision 369624)
+--- channels/chan_sip.c	(.../branches/1.8)	(revision 369789)
++++ channels/chan_sip.c	(.../team/oej/darjeeling-prack-1.8)	(revision 369789)
 @@ -1242,10 +1242,10 @@
  static int __transmit_response(struct sip_pvt *p, const char *msg, const struct sip_request *req, enum xmittype reliable);
  static int retrans_pkt(const void *data);
@@ -66,7 +66,7 @@
  	}
 -	ast_debug(1, "Stopping retransmission on '%s' of %s %u: Match %s\n",
 -		p->callid, resp ? "Response" : "Request", seqno, msg);
-+	ast_debug(1, "Stopping retransmission on '%s' of %s %u: Match %s Rseq %d\n",
++	ast_debug(1, "Stopping retransmission on '%s' of %s %u: Match %s Rseq %u\n",
 +		p->callid, resp ? "Response" : "Request", seqno, msg, rseqno);
  	return res;
  }
@@ -144,6 +144,15 @@
  	finalize_content(req);
  	add_blank(req);
  	if (sip_debug_test_pvt(p)) {
+@@ -4187,7 +4248,7 @@
+ 	}
+ 
+ 	res = (reliable) ?
+-		 __sip_reliable_xmit(p, seqno, 1, req->data, (reliable == XMIT_CRITICAL), req->method) :
++		 __sip_reliable_xmit(p, seqno, 1, req->data, (reliable == XMIT_CRITICAL || reliable == XMIT_PRACK), req->method) :
+ 		__sip_xmit(p, req->data);
+ 	deinit_req(req);
+ 	if (res > 0) {
 @@ -6485,7 +6546,13 @@
  	struct sip_pvt *p = ast->tech_pvt;
  
@@ -159,7 +168,7 @@
  		try_suggested_sip_codec(p);	
  
  		ast_setstate(ast, AST_STATE_UP);
-@@ -9871,13 +9938,15 @@
+@@ -9873,13 +9940,15 @@
   *  is supported for this dialog. */
  static int add_supported_header(struct sip_pvt *pvt, struct sip_request *req)
  {
@@ -180,7 +189,7 @@
  }
  
  /*! \brief Add header to SIP message */
-@@ -10313,6 +10382,7 @@
+@@ -10315,6 +10384,7 @@
  		snprintf(se_hdr, sizeof(se_hdr), "%d;refresher=%s", p->stimer->st_interval,
  			strefresher2str(p->stimer->st_ref));
  		add_header(resp, "Session-Expires", se_hdr);
@@ -188,7 +197,7 @@
  	}
  
  	if (msg[0] == '2' && (p->method == SIP_SUBSCRIBE || p->method == SIP_REGISTER)) {
-@@ -10497,8 +10567,10 @@
+@@ -10499,8 +10569,10 @@
  {
  	struct sip_request resp;
  	uint32_t seqno = 0;
@@ -200,7 +209,7 @@
  		ast_log(LOG_WARNING, "Unable to determine sequence number from '%s'\n", get_header(req, "CSeq"));
  		return -1;
  	}
-@@ -10510,6 +10582,10 @@
+@@ -10512,6 +10584,10 @@
  		ast_clear_flag(&p->flags[1], SIP_PAGE2_CONNECTLINEUPDATE_PEND);
  		add_rpid(&resp, p);
  	}
@@ -211,7 +220,7 @@
  	if (ast_test_flag(&p->flags[0], SIP_OFFER_CC)) {
  		add_cc_call_info_to_response(p, &resp);
  	}
-@@ -10549,6 +10625,10 @@
+@@ -10551,6 +10627,10 @@
  			add_header(&resp, "X-Asterisk-HangupCauseCode", buf);
  		}
  	}
@@ -222,7 +231,7 @@
  	return send_response(p, &resp, reliable, seqno);
  }
  
-@@ -10561,6 +10641,7 @@
+@@ -10563,6 +10643,7 @@
  	}
  	respprep(&resp, p, msg, req);
  	add_header(&resp, "SIP-ETag", esc_entry->entity_tag);
@@ -230,7 +239,7 @@
  
  	return send_response(p, &resp, 0, 0);
  }
-@@ -10648,6 +10729,7 @@
+@@ -10650,6 +10731,7 @@
  	respprep(&resp, p, msg, req);
  	append_date(&resp);
  	add_header(&resp, "Unsupported", unsupported);
@@ -238,7 +247,7 @@
  	return send_response(p, &resp, XMIT_UNRELIABLE, 0);
  }
  
-@@ -10701,6 +10783,7 @@
+@@ -10703,6 +10785,7 @@
  	struct sip_request resp;
  	respprep(&resp, p, msg, req);
  	append_date(&resp);
@@ -246,7 +255,7 @@
  	return send_response(p, &resp, XMIT_UNRELIABLE, 0);
  }
  
-@@ -10710,6 +10793,7 @@
+@@ -10712,6 +10795,7 @@
  	struct sip_request resp;
  	respprep(&resp, p, msg, req);
  	add_header(&resp, "Accept", "application/sdp");
@@ -254,7 +263,7 @@
  	return send_response(p, &resp, reliable, 0);
  }
  
-@@ -10722,6 +10806,7 @@
+@@ -10724,6 +10808,7 @@
  	snprintf(tmp, sizeof(tmp), "%d", min_expiry);
  	respprep(&resp, p, msg, req);
  	add_header(&resp, "Min-Expires", tmp);
@@ -262,7 +271,7 @@
  	return send_response(p, &resp, XMIT_UNRELIABLE, 0);
  }
  
-@@ -11803,6 +11888,16 @@
+@@ -11805,6 +11890,18 @@
  	if (rpid == TRUE) {
  		add_rpid(&resp, p);
  	}
@@ -271,15 +280,17 @@
 +		reliable = XMIT_PRACK;
 +	}
 +	if (strncmp(msg, "100", 3)) {
-+		/* If we send a resposne WITH sdp we are not allowed to respond before the PRACK is received */
-+		ast_set_flag(&p->flags[2], SIP_PAGE3_INVITE_WAIT_FOR_PRACK);
++		/* If we send a response WITH sdp we are not allowed to respond before the PRACK is received */
++		if (ast_test_flag(&p->flags[2], SIP_PAGE3_100REL)) {
++			ast_set_flag(&p->flags[2], SIP_PAGE3_INVITE_WAIT_FOR_PRACK);
++		}
 +		add_prack_respheader(p, &resp, reliable);
 +		add_required_respheader(&resp);
 +	}
  	if (ast_test_flag(&p->flags[0], SIP_OFFER_CC)) {
  		add_cc_call_info_to_response(p, &resp);
  	}
-@@ -12212,7 +12307,34 @@
+@@ -12214,7 +12311,69 @@
  }
  
  /*! 
@@ -288,26 +299,61 @@
 + */
 +static int transmit_prack(struct sip_pvt *p, uint32_t their_rseq)
 +{
-+	if (their_rseq == p->irseq) {
-+		ast_debug(3, "!?!?!?!?!? This is a retransmit of the previous response. %u \n", their_rseq);
-+		/* RFC 3262: In particular, a UAC SHOULD NOT retransmit the PRACK request
-+   		   	when it receives a retransmission of the provisional response being
-+   		   	acknowledged, although doing so does not create a protocol error.*/
-+		return -2;	/* Not used by transmit_invite et al */
-+	}
-+	if (p->irseq > 0 && their_rseq != p->irseq + 1) {
-+		ast_debug(3, "!?!?!?!?!? This is a response out of sequence! ignored. %u \n", their_rseq);
-+		/* RFC 3262: if the UAC receives another reliable provisional
-+   			response to the same request, and its RSeq value is not one higher
-+   			than the value of the sequence number, that response MUST NOT be
-+   			acknowledged with a PRACK, and MUST NOT be processed further by the
-+   			UAC.  An implementation MAY discard the response, or MAY cache the
-+   			response in the hopes of receiving the missing responses.
++	int res;
++	int comparerseq = TRUE;
++	uint32_t focus_rseq = p->irseq;
++
++	/* During the early media phase, we could have a situation where we get provisional
++	   responses from multiple devices, in separate early dialogs. In this case, this 
++	   code focuses on the FIRST early media response as the one in focus where we 
++	   check the rseq sequence numbers for retransmits and act upon them.
++	*/
++
++	if (!ast_strlen_zero(p->theirtag_prack) && strcmp(p->theirtag, p->theirtag_prack)) {
++		/* We have already sent a PRACK in this dialog, but to a different device.
++		   In this code, we focus on the first response that requires PRACK and do not check
++		   the validity of rseq in responses in other early dialogs by controlling
++		   the PRACK sequence numbers ordering.
++
++		   To be 100% RFC correct, we should have a sip_pvt structure for each early dialog
++		   and terminate them if we get a 199 response in that early dialog. these should
++		   be organized in a tree-like structure based on the original
++		   INVITE callid, cseq and from-tag.
 +		*/
-+		return -3;
++		comparerseq = FALSE;
++	}
++	
++	if (comparerseq) {
++		if (their_rseq == p->irseq) {
++			ast_debug(3, "!?!?!?!?!? This is a retransmit of the previous response. %u \n", their_rseq);
++			/* RFC 3262: In particular, a UAC SHOULD NOT retransmit the PRACK request
++   		   		when it receives a retransmission of the provisional response being
++   		   		acknowledged, although doing so does not create a protocol error.*/
++			return -2;	/* Not used by transmit_invite et al */
++		}
++		if (p->irseq > 0 && their_rseq != p->irseq + 1) {
++			ast_debug(3, "!?!?!?!?!? This is a response out of sequence! ignored. %u \n", their_rseq);
++			/* RFC 3262: if the UAC receives another reliable provisional
++   				response to the same request, and its RSeq value is not one higher
++   				than the value of the sequence number, that response MUST NOT be
++   				acknowledged with a PRACK, and MUST NOT be processed further by the
++   				UAC.  An implementation MAY discard the response, or MAY cache the
++   				response in the hopes of receiving the missing responses.
++			*/
++			return -3;
++		}
 +	}
 +	p->irseq = their_rseq;
-+	return transmit_invite(p, SIP_PRACK, 0, 1, NULL);
++	res = transmit_invite(p, SIP_PRACK, 0, 1, NULL);
++
++	if (ast_strlen_zero(p->theirtag_prack)) {
++		p->irseq = their_rseq;
++		ast_string_field_set(p, theirtag_prack, p->tag);		/* Save this tag as a PRACK focus for this dialog */
++	} else {
++		p->irseq = focus_rseq;
++	}
++
++	return res;
 +}
 +
 +/*! 
@@ -315,7 +361,7 @@
   * \param p sip_pvt structure
   * \param sipmethod
   * \param sdp unknown
-@@ -12228,7 +12350,9 @@
+@@ -12230,7 +12389,9 @@
  	req.method = sipmethod;
  	if (init) {/* Bump branch even on initial requests */
  		p->branch ^= ast_random();
@@ -326,7 +372,7 @@
  		build_via(p);
  	}
  	if (init > 1) {
-@@ -12264,17 +12388,24 @@
+@@ -12266,17 +12427,24 @@
  		}
  		snprintf(buf, sizeof(buf), "%d", p->expiry);
  		add_header(&req, "Expires", buf);
@@ -352,7 +398,7 @@
  		char i2astr[10];
  
  		if (!p->stimer->st_interval) {
-@@ -17602,6 +17733,7 @@
+@@ -17604,6 +17772,7 @@
  		ast_cli(fd, "  DirectMedia  : %s\n", AST_CLI_YESNO(ast_test_flag(&peer->flags[0], SIP_DIRECT_MEDIA)));
  		ast_cli(fd, "  PromiscRedir : %s\n", AST_CLI_YESNO(ast_test_flag(&peer->flags[0], SIP_PROMISCREDIR)));
  		ast_cli(fd, "  User=Phone   : %s\n", AST_CLI_YESNO(ast_test_flag(&peer->flags[0], SIP_USEREQPHONE)));
@@ -360,7 +406,7 @@
  		ast_cli(fd, "  Video Support: %s\n", AST_CLI_YESNO(ast_test_flag(&peer->flags[1], SIP_PAGE2_VIDEOSUPPORT) || ast_test_flag(&peer->flags[1], SIP_PAGE2_VIDEOSUPPORT_ALWAYS)));
  		ast_cli(fd, "  Text Support : %s\n", AST_CLI_YESNO(ast_test_flag(&peer->flags[1], SIP_PAGE2_TEXTSUPPORT)));
  		ast_cli(fd, "  Ign SDP ver  : %s\n", AST_CLI_YESNO(ast_test_flag(&peer->flags[1], SIP_PAGE2_IGNORESDPVERSION)));
-@@ -17725,6 +17857,7 @@
+@@ -17727,6 +17896,7 @@
  
  		/* - is enumerated */
  		astman_append(s, "SIP-DTMFmode: %s\r\n", dtmfmode2str(ast_test_flag(&peer->flags[0], SIP_DTMF)));
@@ -368,15 +414,17 @@
  		astman_append(s, "ToHost: %s\r\n", peer->tohost);
  		astman_append(s, "Address-IP: %s\r\nAddress-Port: %d\r\n", ast_sockaddr_stringify_addr(&peer->addr), ast_sockaddr_port(&peer->addr));
  		astman_append(s, "Default-addr-IP: %s\r\nDefault-addr-port: %d\r\n", ast_sockaddr_stringify_addr(&peer->defaddr), ast_sockaddr_port(&peer->defaddr));
-@@ -18308,6 +18441,7 @@
+@@ -18309,7 +18479,9 @@
+ 	ast_cli(a->fd, "  Timer T1 minimum:       %d\n", global_t1min);
   	ast_cli(a->fd, "  Timer B:                %d\n", global_timer_b);
  	ast_cli(a->fd, "  No premature media:     %s\n", AST_CLI_YESNO(global_prematuremediafilter));
++	ast_cli(a->fd, "  Early media focus:      %s\n", AST_CLI_YESNO(sip_cfg.early_media_focus));
  	ast_cli(a->fd, "  Max forwards:           %d\n", sip_cfg.default_max_forwards);
 +	ast_cli(a->fd, "  PRACK support:          %s\n", AST_CLI_YESNO(ast_test_flag(&global_flags[2], SIP_PAGE3_PRACK)));
  
  	ast_cli(a->fd, "\nDefault Settings:\n");
  	ast_cli(a->fd, "-----------------\n");
-@@ -18679,10 +18813,14 @@
+@@ -18681,10 +18853,14 @@
  			ast_cli(a->fd, "  Format:                 %s\n", ast_getformatname_multiple(formatbuf, sizeof(formatbuf), cur->owner ? cur->owner->nativeformats : 0) );
  			ast_cli(a->fd, "  T.38 support            %s\n", AST_CLI_YESNO(cur->udptl != NULL));
  			ast_cli(a->fd, "  Video support           %s\n", AST_CLI_YESNO(cur->vrtp != NULL));
@@ -391,7 +439,7 @@
  			ast_cli(a->fd, "  Force rport:            %s\n", AST_CLI_YESNO(ast_test_flag(&cur->flags[0], SIP_NAT_FORCE_RPORT)));
  			if (ast_sockaddr_isnull(&cur->redirip)) {
  				ast_cli(a->fd,
-@@ -19928,6 +20066,48 @@
+@@ -19933,6 +20109,48 @@
  	return 0;
  }
  
@@ -440,7 +488,45 @@
  /*!
   * \brief Handle authentication challenge for SIP UPDATE
   *
-@@ -20366,6 +20546,10 @@
+@@ -20188,7 +20406,7 @@
+ 				ast_setstate(p->owner, AST_STATE_RINGING);
+ 			}
+ 		}
+-		if (find_sdp(req)) {
++		if (!req->ignoresdp && find_sdp(req)) {
+ 			if (p->invitestate != INV_CANCELLED)
+ 				p->invitestate = INV_EARLY_MEDIA;
+ 			res = process_sdp(p, req, SDP_T38_NONE);
+@@ -20197,6 +20415,9 @@
+ 				ast_queue_control(p->owner, AST_CONTROL_PROGRESS);
+ 			}
+ 			ast_rtp_instance_activate(p->rtp);
++			if (sip_cfg.early_media_focus && ast_strlen_zero(p->theirtag_early)) {
++				ast_string_field_set(p, theirtag_early, p->tag);
++			}
+ 		}
+ 		check_pendings(p);
+ 		break;
+@@ -20260,7 +20481,7 @@
+ 			}
+ 			sip_handle_cc(p, req, AST_CC_CCNR);
+ 		}
+-		if (find_sdp(req)) {
++		if (!req->ignoresdp && find_sdp(req)) {
+ 			if (p->invitestate != INV_CANCELLED)
+ 				p->invitestate = INV_EARLY_MEDIA;
+ 			res = process_sdp(p, req, SDP_T38_NONE);
+@@ -20268,6 +20489,9 @@
+ 				/* Queue a progress frame */
+ 				ast_queue_control(p->owner, AST_CONTROL_PROGRESS);
+ 			}
++			if (sip_cfg.early_media_focus && ast_strlen_zero(p->theirtag_early)) {
++				ast_string_field_set(p, theirtag_early, p->tag);
++			}
+ 			ast_rtp_instance_activate(p->rtp);
+ 		} else {
+ 			/* Alcatel PBXs are known to send 183s with no SDP after sending
+@@ -20371,6 +20595,10 @@
  
  		/* Check for Session-Timers related headers */
  		if (st_get_mode(p, 0) != SESSION_TIMER_MODE_REFUSE && p->outgoing_call == TRUE && !reinvite) {
@@ -451,16 +537,17 @@
  			p_hdrval = (char*)get_header(req, "Session-Expires");
  			if (!ast_strlen_zero(p_hdrval)) {
  				/* UAS supports Session-Timers */
-@@ -21068,6 +21252,8 @@
+@@ -21073,6 +21301,9 @@
  	struct ast_channel *owner;
  	int sipmethod;
  	const char *c = get_header(req, "Cseq");
 +	const char *required = get_header(req, "Require");
++	char tag[128];
 +
  	/* GCC 4.2 complains if I try to cast c as a char * when passing it to ast_skip_nonblanks, so make a copy of it */
  	char *c_copy = ast_strdupa(c);
  	/* Skip the Cseq and its subsequent spaces */
-@@ -21109,7 +21295,7 @@
+@@ -21114,7 +21345,7 @@
  				ack_res = __sip_semi_ack(p, seqno, 0, sipmethod);
  			}
  		} else {
@@ -469,15 +556,28 @@
  		}
  
  		if (ack_res == FALSE) {
-@@ -21135,6 +21321,7 @@
- 		gettag(req, "To", tag, sizeof(tag));
- 		ast_string_field_set(p, theirtag, tag);
- 	}
-+
+@@ -21133,13 +21364,14 @@
+ 		p->pendinginvite = 0;
+ 	}
+ 
+-	/* Get their tag if we haven't already */
+-	if (ast_strlen_zero(p->theirtag) || (resp >= 200)) {
+-		char tag[128];
++	
++	/* Always get the tag. Find_call will filter out after we have an established dialog,
++	   so that we don't update the tag after a 200 or other final response. 
++	   Provided that SIP pedantic checking is turned on of course.
++	*/
++	gettag(req, "To", tag, sizeof(tag));
++	ast_string_field_set(p, theirtag, tag);
+ 
+-		gettag(req, "To", tag, sizeof(tag));
+-		ast_string_field_set(p, theirtag, tag);
+-	}
  	/* This needs to be configurable on a channel/peer level,
  	   not mandatory for all communication. Sadly enough, NAT implementations
  	   are not so stable so we can always rely on these headers.
-@@ -21154,7 +21341,44 @@
+@@ -21159,7 +21391,50 @@
  		pvt_set_needdestroy(p, "received 4XX response to a BYE");
  		return;
  	}
@@ -519,10 +619,16 @@
 +		}
 +	}
 +
++	if (sip_cfg.early_media_focus && !ast_strlen_zero(p->theirtag_early) && strcmp(p->theirtag_early, p->theirtag)) {
++		/* If we already are in early media phase, and have a response from a new device in this call we should
++	   	ignore the SDP. */
++		req->ignoresdp = TRUE;
++	}
++
  	if (p->relatedpeer && sipmethod == SIP_OPTIONS) {
  		/* We don't really care what the response is, just that it replied back.
  		   Well, as long as it's not a 100 response...  since we might
-@@ -21171,6 +21395,9 @@
+@@ -21176,6 +21451,9 @@
  	} else if (sipmethod == SIP_INFO) {
  		/* More good gravy! */
  		handle_response_info(p, resp, rest, req, seqno);
@@ -532,7 +638,7 @@
  	} else if (sipmethod == SIP_MESSAGE) {
  		/* More good gravy! */
  		handle_response_message(p, resp, rest, req, seqno);
-@@ -22318,6 +22545,37 @@
+@@ -22323,6 +22601,37 @@
  	return 0;
  }
  
@@ -570,7 +676,7 @@
  /*!
   * \brief Handle incoming INVITE request
   * \note If the INVITE has a Replaces header, it is part of an
-@@ -22379,7 +22637,7 @@
+@@ -22384,7 +22693,7 @@
  			p->invitestate = INV_COMPLETED;
  			if (!p->lastinvite)
  				sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT);
@@ -579,7 +685,7 @@
  			goto request_invite_cleanup;
  		}
  	}
-@@ -22389,6 +22647,22 @@
+@@ -22394,6 +22703,23 @@
  	p->sipoptions |= required_profile;
  	p->reqsipoptions = required_profile;
  
@@ -587,6 +693,7 @@
 +	if (p->reqsipoptions & SIP_OPT_100REL || p->sipoptions & SIP_OPT_100REL) {
 +		if (ast_test_flag(&p->flags[2], SIP_PAGE3_PRACK)) {	/* Is PRACK enabled for this dialog? */
 +			ast_set_flag(&p->flags[2], SIP_PAGE3_100REL);	/* Mark PRACK as active for this dialog */
++			ast_debug(2, "--#-#-#-#- Adding PRACK support for this dialog \n");
 +		} else if (p->reqsipoptions & SIP_OPT_100REL) {
 +			/* If PRACK was required but is disabled in configuration, don't play */
 +			transmit_response(p, "420 Bad extension (unsupported)", req);
@@ -602,7 +709,7 @@
  	/* Check if this is a loop */
  	if (ast_test_flag(&p->flags[0], SIP_OUTGOING) && p->owner && (p->invitestate != INV_TERMINATED && p->invitestate != INV_CONFIRMED) && p->owner->_state != AST_STATE_UP) {
  		/* This is a call to ourself.  Send ourselves an error code and stop
-@@ -22451,7 +22725,7 @@
+@@ -22456,7 +22782,7 @@
  			 * transaction. Calling __sip_ack will take care of this by clearing the p->pendinginvite and removing the response
  			 * from the previous transaction from the list of outstanding packets.
  			 */
@@ -611,7 +718,7 @@
  		} else {
  			/* We already have a pending invite. Sorry. You are on hold. */
  			p->glareinvite = seqno;
-@@ -24547,7 +24821,7 @@
+@@ -24552,7 +24878,7 @@
  		return 0;
  	} else if (auth_result == AUTH_SUCCESSFUL && p->lastinvite) {
  		/* We need to stop retransmitting the 401 */
@@ -620,7 +727,7 @@
  	}
  
  	publish_type = determine_sip_publish_type(req, event, etag, expires_str, &expires_int);
-@@ -25374,12 +25648,15 @@
+@@ -25379,12 +25705,15 @@
  	case SIP_UPDATE:
  		res = handle_request_update(p, req);
  		break;
@@ -637,7 +744,7 @@
  			if (find_sdp(req)) {
  				if (process_sdp(p, req, SDP_T38_NONE))
  					return -1;
-@@ -25388,7 +25665,7 @@
+@@ -25393,7 +25722,7 @@
  		} else if (p->glareinvite == seqno) {
  			/* handle ack for the 491 pending sent for glareinvite */
  			p->glareinvite = 0;
@@ -646,7 +753,7 @@
  		}
  		if (!acked) {
  			/* Got an ACK that did not match anything. Ignore
-@@ -27032,6 +27309,9 @@
+@@ -27037,6 +27366,9 @@
  	} else if (!strcasecmp(v->name, "buggymwi")) {
  		ast_set_flag(&mask[1], SIP_PAGE2_BUGGY_MWI);
  		ast_set2_flag(&flags[1], ast_true(v->value), SIP_PAGE2_BUGGY_MWI);
@@ -656,10 +763,27 @@
  	} else
  		res = 0;
  
+@@ -28244,6 +28576,7 @@
+ 	externtcpport = STANDARD_SIP_PORT;
+ 	externtlsport = STANDARD_TLS_PORT;
+ 	sip_cfg.srvlookup = DEFAULT_SRVLOOKUP;
++	sip_cfg.early_media_focus = DEFAULT_EARLY_MEDIA_FOCUS;
+ 	global_tos_sip = DEFAULT_TOS_SIP;
+ 	global_tos_audio = DEFAULT_TOS_AUDIO;
+ 	global_tos_video = DEFAULT_TOS_VIDEO;
+@@ -28597,6 +28930,8 @@
+ 			global_match_auth_username = ast_true(v->value);
+ 		} else if (!strcasecmp(v->name, "srvlookup")) {
+ 			sip_cfg.srvlookup = ast_true(v->value);
++		} else if (!strcasecmp(v->name, "earlymediafocus")) {
++			sip_cfg.early_media_focus = ast_true(v->value);
+ 		} else if (!strcasecmp(v->name, "pedantic")) {
+ 			sip_cfg.pedanticsipchecking = ast_true(v->value);
+ 		} else if (!strcasecmp(v->name, "maxexpirey") || !strcasecmp(v->name, "maxexpiry")) {
 Index: channels/sip/include/sip.h
 ===================================================================
---- channels/sip/include/sip.h	(.../branches/1.8)	(revision 369624)
-+++ channels/sip/include/sip.h	(.../team/oej/darjeeling-prack-1.8)	(revision 369624)
+--- channels/sip/include/sip.h	(.../branches/1.8)	(revision 369789)
++++ channels/sip/include/sip.h	(.../team/oej/darjeeling-prack-1.8)	(revision 369789)
 @@ -155,7 +155,7 @@
   *  \todo This string should be set dynamically. We only support REFER and SUBSCRIBE if we have
   *  allowsubscribe and allowrefer on in sip.conf.
@@ -669,7 +793,15 @@
  
  /*! \brief Standard SIP unsecure port for UDP and TCP from RFC 3261. DO NOT CHANGE THIS */
  #define STANDARD_SIP_PORT	5060
-@@ -223,6 +223,7 @@
+@@ -187,6 +187,7 @@
+ #define DEFAULT_MWI_FROM       ""
+ #define DEFAULT_NOTIFYMIME     "application/simple-message-summary"
+ #define DEFAULT_ALLOWGUEST     TRUE
++#define DEFAULT_EARLY_MEDIA_FOCUS	FALSE;	/*!< Focus on a single early media stream */
+ #define DEFAULT_RTPKEEPALIVE   0      /*!< Default RTPkeepalive setting */
+ #define DEFAULT_CALLCOUNTER    FALSE   /*!< Do not enable call counters by default */
+ #define DEFAULT_SRVLOOKUP      TRUE    /*!< Recommended setting is ON */
+@@ -223,6 +224,7 @@
  #define DEFAULT_CAPABILITY (AST_FORMAT_ULAW | AST_FORMAT_TESTLAW | AST_FORMAT_ALAW | AST_FORMAT_GSM | AST_FORMAT_H263);
  #define DEFAULT_STORE_SIP_CAUSE FALSE      /*!< Don't store HASH(SIP_CAUSE,<channel name>) for channels by default */
  #endif
@@ -677,7 +809,7 @@
  /*@}*/
  
  /*! \name SIPflags
-@@ -356,10 +357,14 @@
+@@ -356,10 +358,14 @@
  	SIP_PAGE2_Q850_REASON | SIP_PAGE2_HAVEPEERCONTEXT | SIP_PAGE2_USE_SRTP)
  
  
@@ -694,7 +826,7 @@
  
  /*@}*/
  
-@@ -403,6 +408,7 @@
+@@ -403,6 +409,7 @@
   * where the original response would be sent RELIABLE in an INVITE transaction
   */
  enum xmittype {
@@ -702,7 +834,7 @@
  	XMIT_CRITICAL = 2,    /*!< Transmit critical SIP message reliably, with re-transmits.
  	                       *   If it fails, it's critical and will cause a teardown of the session */
  	XMIT_RELIABLE = 1,    /*!< Transmit SIP message reliably, with re-transmits */
-@@ -560,7 +566,7 @@
+@@ -560,7 +567,7 @@
  	SIP_NOTIFY,     /*!< Status update, Part of the event package standard, result of a SUBSCRIBE or a REFER */
  	SIP_INVITE,     /*!< Set up a session */
  	SIP_ACK,        /*!< End of a three-way handshake started with INVITE. */
@@ -711,7 +843,15 @@
  	SIP_BYE,        /*!< End of a session */
  	SIP_REFER,      /*!< Refer to another URI (transfer) */
  	SIP_SUBSCRIBE,  /*!< Subscribe for updates (voicemail, session status, device status, presence) */
-@@ -749,6 +755,8 @@
+@@ -675,6 +682,7 @@
+ 	      be applied to devices (trunks, services, phones)
+ */
+ struct sip_settings {
++	int early_media_focus;		/*!< G: Focus on the first early media stream received, ignore the rest */
+ 	int peer_rtupdate;          /*!< G: Update database with registration data for peer? */
+ 	int rtsave_sysname;         /*!< G: Save system name at registration? */
+ 	int ignore_regexpire;       /*!< G: Ignore expiration of peer  */
+@@ -749,12 +757,15 @@
  	int headers;            /*!< # of SIP Headers */
  	int method;             /*!< Method of this request */
  	int lines;              /*!< Body Content */
@@ -720,7 +860,23 @@
  	unsigned int sdp_start; /*!< the line number where the SDP begins */
  	unsigned int sdp_count; /*!< the number of lines of SDP */
  	char debug;             /*!< print extra debugging if non zero */
-@@ -985,6 +993,8 @@
+ 	char has_to_tag;        /*!< non-zero if packet has To: tag */
+ 	char ignore;            /*!< if non-zero This is a re-transmit, ignore it */
+ 	char authenticated;     /*!< non-zero if this request was authenticated */
++	char ignoresdp;		/*!< In some cases, we have to ignore the SDP in responses */
+ 	ptrdiff_t header[SIP_MAX_HEADERS]; /*!< Array of offsets into the request string of each SIP header*/
+ 	ptrdiff_t line[SIP_MAX_LINES];     /*!< Array of offsets into the request string of each SDP line*/
+ 	struct ast_str *data;	
+@@ -959,6 +970,8 @@
+ 		AST_STRING_FIELD(rdnis);        /*!< Referring DNIS */
+ 		AST_STRING_FIELD(redircause);   /*!< Referring cause */
+ 		AST_STRING_FIELD(theirtag);     /*!< Their tag */
++		AST_STRING_FIELD(theirtag_prack);  /*!< Current tag focus for PRACK handling */
++		AST_STRING_FIELD(theirtag_early);  /*!< Current tag focus for early media handling */
+ 		AST_STRING_FIELD(tag);          /*!< Our tag for this session */
+ 		AST_STRING_FIELD(username);     /*!< [user] name */
+ 		AST_STRING_FIELD(peername);     /*!< [peer] name, not set if [user] */
+@@ -985,6 +998,8 @@
  	uint32_t ocseq;                         /*!< Current outgoing seqno */
  	uint32_t icseq;                         /*!< Current incoming seqno */
  	uint32_t init_icseq;                    /*!< Initial incoming seqno from first request */
@@ -729,7 +885,7 @@
  	ast_group_t callgroup;                  /*!< Call group */
  	ast_group_t pickupgroup;                /*!< Pickup group */
  	uint32_t lastinvite;                    /*!< Last seqno of invite */
-@@ -1142,6 +1152,7 @@
+@@ -1142,6 +1157,7 @@
  	int retrans;              /*!< Retransmission number */
  	int method;               /*!< SIP method for this packet */
  	uint32_t seqno;           /*!< Sequence number */
@@ -737,7 +893,7 @@
  	char is_resp;             /*!< 1 if this is a response packet (e.g. 200 OK), 0 if it is a request */
  	char is_fatal;            /*!< non-zero if there is a fatal error */
  	int response_code;        /*!< If this is a response, the response code */
-@@ -1751,7 +1762,7 @@
+@@ -1751,7 +1767,7 @@
  	char * const text;  /*!< Text id, as in standard */
  } sip_options[] = {	/* XXX used in 3 places */
  	/* RFC3262: PRACK 100% reliability */
@@ -748,8 +904,8 @@
  	/* SIMPLE events:  RFC4662 */
 Index: channels/sip/include/reqresp_parser.h
 ===================================================================
---- channels/sip/include/reqresp_parser.h	(.../branches/1.8)	(revision 369624)
-+++ channels/sip/include/reqresp_parser.h	(.../team/oej/darjeeling-prack-1.8)	(revision 369624)
+--- channels/sip/include/reqresp_parser.h	(.../branches/1.8)	(revision 369789)
++++ channels/sip/include/reqresp_parser.h	(.../team/oej/darjeeling-prack-1.8)	(revision 369789)
 @@ -145,6 +145,14 @@
  unsigned int parse_sip_options(const char *options, char *unsupported, size_t unsupported_len);
  
@@ -767,8 +923,8 @@
   * \param input1 First URI
 Index: channels/sip/include/dialog.h
 ===================================================================
---- channels/sip/include/dialog.h	(.../branches/1.8)	(revision 369624)
-+++ channels/sip/include/dialog.h	(.../team/oej/darjeeling-prack-1.8)	(revision 369624)
+--- channels/sip/include/dialog.h	(.../branches/1.8)	(revision 369789)
++++ channels/sip/include/dialog.h	(.../team/oej/darjeeling-prack-1.8)	(revision 369789)
 @@ -67,7 +67,7 @@
  
  /*! \brief Acknowledges receipt of a packet and stops retransmission
@@ -780,8 +936,8 @@
   * called with p locked */
 Index: channels/sip/reqresp_parser.c
 ===================================================================
---- channels/sip/reqresp_parser.c	(.../branches/1.8)	(revision 369624)
-+++ channels/sip/reqresp_parser.c	(.../team/oej/darjeeling-prack-1.8)	(revision 369624)
+--- channels/sip/reqresp_parser.c	(.../branches/1.8)	(revision 369789)
++++ channels/sip/reqresp_parser.c	(.../team/oej/darjeeling-prack-1.8)	(revision 369789)
 @@ -1516,18 +1516,13 @@
  }
  
@@ -852,7 +1008,7 @@
 Index: README.darjeeling
 ===================================================================
 --- README.darjeeling	(.../branches/1.8)	(revision 0)
-+++ README.darjeeling	(.../team/oej/darjeeling-prack-1.8)	(revision 369624)
++++ README.darjeeling	(.../team/oej/darjeeling-prack-1.8)	(revision 369789)
 @@ -0,0 +1,130 @@
 +Edvina AB
 +Olle E. Johansson
@@ -996,25 +1152,40 @@
 
 Index: configs/sip.conf.sample
 ===================================================================
---- configs/sip.conf.sample	(.../branches/1.8)	(revision 369624)
-+++ configs/sip.conf.sample	(.../team/oej/darjeeling-prack-1.8)	(revision 369624)
+--- configs/sip.conf.sample	(.../branches/1.8)	(revision 369789)
++++ configs/sip.conf.sample	(.../team/oej/darjeeling-prack-1.8)	(revision 369789)
 @@ -241,6 +241,9 @@
                                  ; and multiline formatted headers for strict
                                  ; SIP compatibility (defaults to "yes")
  
-+;prack=yes			; Enable PRACK support. (defaults to "no")
++;prack=yes			; Enable PRACK (SIP option 100rel)  support. (defaults to "no")
 +				; Can also be set on a per device basis.
 +
  ; See https://wiki.asterisk.org/wiki/display/AST/IP+Quality+of+Service for a description of these parameters.
  ;tos_sip=cs3                    ; Sets TOS for SIP packets.
  ;tos_audio=ef                   ; Sets TOS for RTP audio packets.
+@@ -346,6 +349,14 @@
+                                 ;
+                                 ; In order for "noanswer" applications to work, you need to run
+                                 ; the progress() application in the priority before the app.
++;earlymediafocus=yes		; If you have a forking SIP proxy in the call, Asterisk may get multiple
++				; 183/180 responses with SDP from *different* devices. The default is that 
++				; Asterisk jumps on to each one. There's no *correct* solution to this
++				; problem. Turning this on means that Asterisk focuses on the *first*
++				; early media response and ignores the rest. This might mean that the
++				; user gets a ring tone and stays with that even if the service provider
++				; from a different media server plays a very important message.
++				; Default is "no" - jump to the latest one.
+ 
+ ;progressinband=never           ; If we should generate in-band ringing always
+                                 ; use 'never' to never use in-band signalling, even in cases
 
 Egenskapsändringar för: .
 ___________________________________________________________________
 Added: automerge
    + *
 Added: svnmerge-integrated
-   + /branches/1.8:1-369590
+   + /branches/1.8:1-369757
 Added: automerge-email
    + oej at edvina.net
 




More information about the svn-commits mailing list