[asterisk-commits] jpeeler: trunk r289841 - in /trunk: ./ channels/ include/asterisk/ main/ res/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Oct 1 21:46:48 CDT 2010


Author: jpeeler
Date: Fri Oct  1 21:46:43 2010
New Revision: 289841

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=289841
Log:
Merged revisions 289840 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.8

................
  r289840 | jpeeler | 2010-10-01 21:43:45 -0500 (Fri, 01 Oct 2010) | 29 lines
  
  Merged revisions 289798 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.6.2
  
  ................
    r289798 | jpeeler | 2010-10-01 18:01:31 -0500 (Fri, 01 Oct 2010) | 22 lines
    
    Merged revisions 289797 via svnmerge from 
    https://origsvn.digium.com/svn/asterisk/branches/1.4
    
    ........
      r289797 | jpeeler | 2010-10-01 17:58:38 -0500 (Fri, 01 Oct 2010) | 15 lines
      
      Change RFC2833 DTMF event duration on end to report actual elapsed time.
      
      The scenario here is with a non P2P early media session. The reported time
      length of DTMF presses are coming up short when sending to the remote side.
      Currently the event duration is a running total that is incremented when sending
      continuation packets. These continuation packets are only triggered upon
      incoming media from the remote side, which means that the running total probably
      is not going to end up matching the actual length of time Asterisk received
      DTMF. This patch changes the end event duration to be lengthened if it is
      detected that the end event is going to come up short.
      
      Review: https://reviewboard.asterisk.org/r/957/
      
      ABE-2476
    ........
  ................
................

Modified:
    trunk/   (props changed)
    trunk/channels/chan_sip.c
    trunk/include/asterisk/rtp_engine.h
    trunk/main/rtp_engine.c
    trunk/res/res_rtp_asterisk.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.8-merged' - no diff available.

Modified: trunk/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_sip.c?view=diff&rev=289841&r1=289840&r2=289841
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Fri Oct  1 21:46:43 2010
@@ -6224,7 +6224,7 @@
 		break;
 	case SIP_DTMF_RFC2833:
 		if (p->rtp)
-			ast_rtp_instance_dtmf_end(p->rtp, digit);
+			ast_rtp_instance_dtmf_end_with_duration(p->rtp, digit, duration);
 		break;
 	case SIP_DTMF_INBAND:
 		if (p->rtp && ast_rtp_instance_dtmf_mode_get(p->rtp) == AST_RTP_DTMF_MODE_INBAND) {

Modified: trunk/include/asterisk/rtp_engine.h
URL: http://svnview.digium.com/svn/asterisk/trunk/include/asterisk/rtp_engine.h?view=diff&rev=289841&r1=289840&r2=289841
==============================================================================
--- trunk/include/asterisk/rtp_engine.h (original)
+++ trunk/include/asterisk/rtp_engine.h Fri Oct  1 21:46:43 2010
@@ -324,6 +324,7 @@
 	int (*dtmf_begin)(struct ast_rtp_instance *instance, char digit);
 	/*! Callback for stopping RFC2833 DTMF transmission */
 	int (*dtmf_end)(struct ast_rtp_instance *instance, char digit);
+	int (*dtmf_end_with_duration)(struct ast_rtp_instance *instance, char digit, unsigned int duration);
 	/*! Callback to indicate that we should update the marker bit */
 	void (*update_source)(struct ast_rtp_instance *instance);
 	/*! Callback to indicate that we should update the marker bit and ssrc */
@@ -1162,6 +1163,7 @@
  * \since 1.8
  */
 int ast_rtp_instance_dtmf_end(struct ast_rtp_instance *instance, char digit);
+int ast_rtp_instance_dtmf_end_with_duration(struct ast_rtp_instance *instance, char digit, unsigned int duration);
 
 /*!
  * \brief Set the DTMF mode that should be used

Modified: trunk/main/rtp_engine.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/rtp_engine.c?view=diff&rev=289841&r1=289840&r2=289841
==============================================================================
--- trunk/main/rtp_engine.c (original)
+++ trunk/main/rtp_engine.c Fri Oct  1 21:46:43 2010
@@ -723,6 +723,10 @@
 int ast_rtp_instance_dtmf_end(struct ast_rtp_instance *instance, char digit)
 {
 	return instance->engine->dtmf_end ? instance->engine->dtmf_end(instance, digit) : -1;
+}
+int ast_rtp_instance_dtmf_end_with_duration(struct ast_rtp_instance *instance, char digit, unsigned int duration)
+{
+	return instance->engine->dtmf_end_with_duration ? instance->engine->dtmf_end_with_duration(instance, digit, duration) : -1;
 }
 
 int ast_rtp_instance_dtmf_mode_set(struct ast_rtp_instance *instance, enum ast_rtp_dtmf_mode dtmf_mode)

Modified: trunk/res/res_rtp_asterisk.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/res_rtp_asterisk.c?view=diff&rev=289841&r1=289840&r2=289841
==============================================================================
--- trunk/res/res_rtp_asterisk.c (original)
+++ trunk/res/res_rtp_asterisk.c Fri Oct  1 21:46:43 2010
@@ -255,6 +255,7 @@
 static int ast_rtp_destroy(struct ast_rtp_instance *instance);
 static int ast_rtp_dtmf_begin(struct ast_rtp_instance *instance, char digit);
 static int ast_rtp_dtmf_end(struct ast_rtp_instance *instance, char digit);
+static int ast_rtp_dtmf_end_with_duration(struct ast_rtp_instance *instance, char digit, unsigned int duration);
 static void ast_rtp_update_source(struct ast_rtp_instance *instance);
 static void ast_rtp_change_source(struct ast_rtp_instance *instance);
 static int ast_rtp_write(struct ast_rtp_instance *instance, struct ast_frame *frame);
@@ -279,6 +280,7 @@
 	.destroy = ast_rtp_destroy,
 	.dtmf_begin = ast_rtp_dtmf_begin,
 	.dtmf_end = ast_rtp_dtmf_end,
+	.dtmf_end_with_duration = ast_rtp_dtmf_end_with_duration,
 	.update_source = ast_rtp_update_source,
 	.change_source = ast_rtp_change_source,
 	.write = ast_rtp_write,
@@ -639,13 +641,14 @@
 	return 0;
 }
 
-static int ast_rtp_dtmf_end(struct ast_rtp_instance *instance, char digit)
+static int ast_rtp_dtmf_end_with_duration(struct ast_rtp_instance *instance, char digit, unsigned int duration)
 {
 	struct ast_rtp *rtp = ast_rtp_instance_get_data(instance);
 	struct ast_sockaddr remote_address = { {0,} };
 	int hdrlen = 12, res = 0, i = 0;
 	char data[256];
 	unsigned int *rtpheader = (unsigned int*)data;
+	unsigned int measured_samples;
 
 	ast_rtp_instance_get_remote_address(instance, &remote_address);
 
@@ -672,6 +675,11 @@
 
 	rtp->dtmfmute = ast_tvadd(ast_tvnow(), ast_tv(0, 500000));
 
+	if (duration > 0 && (measured_samples = duration * rtp_get_rate(rtp->f.subclass.codec) / 1000) > rtp->send_duration) {
+		ast_debug(2, "Adjusting final end duration from %u to %u\n", rtp->send_duration, measured_samples);
+		rtp->send_duration = measured_samples;
+	}
+
 	/* Construct the packet we are going to send */
 	rtpheader[0] = htonl((2 << 30) | (1 << 23) | (rtp->send_payload << 16) | (rtp->seqno));
 	rtpheader[1] = htonl(rtp->lastdigitts);
@@ -701,6 +709,11 @@
 	rtp->send_digit = 0;
 
 	return 0;
+}
+
+static int ast_rtp_dtmf_end(struct ast_rtp_instance *instance, char digit)
+{
+	return ast_rtp_dtmf_end_with_duration(instance, digit, 0);
 }
 
 static void ast_rtp_update_source(struct ast_rtp_instance *instance)




More information about the asterisk-commits mailing list