[asterisk-commits] oej: branch oej/obproxy r58819 - in /team/oej/obproxy: ./ channels/ configs/ ...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Mon Mar 12 00:39:37 MST 2007


Author: oej
Date: Mon Mar 12 02:39:36 2007
New Revision: 58819

URL: http://svn.digium.com/view/asterisk?view=rev&rev=58819
Log:
Reset automerge

Modified:
    team/oej/obproxy/   (props changed)
    team/oej/obproxy/channels/chan_sip.c
    team/oej/obproxy/configs/sip.conf.sample
    team/oej/obproxy/main/rtp.c

Propchange: team/oej/obproxy/
------------------------------------------------------------------------------
    automerge = http://edvina.net/training/

Propchange: team/oej/obproxy/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Mon Mar 12 02:39:36 2007
@@ -1,1 +1,1 @@
-/branches/1.4:1-58730
+/branches/1.4:1-58818

Modified: team/oej/obproxy/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/oej/obproxy/channels/chan_sip.c?view=diff&rev=58819&r1=58818&r2=58819
==============================================================================
--- team/oej/obproxy/channels/chan_sip.c (original)
+++ team/oej/obproxy/channels/chan_sip.c Mon Mar 12 02:39:36 2007
@@ -572,6 +572,8 @@
 static int global_autoframing;          /*!< Turn autoframing on or off. */
 static enum transfermodes global_allowtransfer;	/*!< SIP Refer restriction scheme */
 static struct sip_proxy global_outboundproxy;	/*!< Outbound proxy */
+
+static int global_matchexterniplocally; /*!< Match externip/externhost setting against localnet setting */
 
 /*! \brief Codecs that we support by default: */
 static int global_capability = AST_FORMAT_ULAW | AST_FORMAT_ALAW | AST_FORMAT_GSM | AST_FORMAT_H263;
@@ -1860,7 +1862,7 @@
 
 	if (localaddr && externip.sin_addr.s_addr &&
 	    (ast_apply_ha(localaddr, &theirs)) &&
-	    (!ast_apply_ha(localaddr, &ours))) {
+	    (!global_matchexterniplocally || !ast_apply_ha(localaddr, &ours))) {
 		if (externexpire && time(NULL) >= externexpire) {
 			struct ast_hostent ahp;
 			struct hostent *hp;
@@ -16321,6 +16323,8 @@
 	global_callevents = FALSE;
 	global_t1min = DEFAULT_T1MIN;		
 
+	global_matchexterniplocally = FALSE;
+
 	/* Copy the default jb config over global_jbconf */
 	memcpy(&global_jbconf, &default_jbconf, sizeof(struct ast_jb_conf));
 
@@ -16568,6 +16572,8 @@
 			default_maxcallbitrate = atoi(v->value);
 			if (default_maxcallbitrate < 0)
 				default_maxcallbitrate = DEFAULT_MAX_CALL_BITRATE;
+		} else if (!strcasecmp(v->name, "matchexterniplocally")) {
+			global_matchexterniplocally = ast_true(v->value);
 		}
 	}
 

Modified: team/oej/obproxy/configs/sip.conf.sample
URL: http://svn.digium.com/view/asterisk/team/oej/obproxy/configs/sip.conf.sample?view=diff&rev=58819&r1=58818&r2=58819
==============================================================================
--- team/oej/obproxy/configs/sip.conf.sample (original)
+++ team/oej/obproxy/configs/sip.conf.sample Mon Mar 12 02:39:36 2007
@@ -139,6 +139,10 @@
 ;outboundproxy=proxy.provider.domain	   	; send outbound signaling to this proxy, not directly to the devices
 ;outboundproxy=proxy.provider.domain:8080       ; send outbound signaling to this proxy, not directly to the devices
 ;outboundproxy=proxy.provider.domain,force      ; Send ALL outbound signalling to proxy, ignoring route: headers
+
+;matchexterniplocally = yes     ; Only substitute the externip or externhost setting if it matches
+                                ; your localnet setting. Unless you have some sort of strange network
+                                ; setup you will not need to enable this.
 
 ;
 ; If regcontext is specified, Asterisk will dynamically create and destroy a

Modified: team/oej/obproxy/main/rtp.c
URL: http://svn.digium.com/view/asterisk/team/oej/obproxy/main/rtp.c?view=diff&rev=58819&r1=58818&r2=58819
==============================================================================
--- team/oej/obproxy/main/rtp.c (original)
+++ team/oej/obproxy/main/rtp.c Mon Mar 12 02:39:36 2007
@@ -138,7 +138,7 @@
 
 	/* DTMF Reception Variables */
 	char resp;
-	unsigned int lasteventendseqn;
+	unsigned int lastevent;
 	int dtmfcount;
 	unsigned int dtmfsamples;
 	/* DTMF Transmission Variables */
@@ -705,7 +705,7 @@
  * \param seqno
  * \returns
  */
-static struct ast_frame *process_rfc2833(struct ast_rtp *rtp, unsigned char *data, int len, unsigned int seqno)
+static struct ast_frame *process_rfc2833(struct ast_rtp *rtp, unsigned char *data, int len, unsigned int seqno, unsigned int timestamp)
 {
 	unsigned int event;
 	unsigned int event_end;
@@ -739,21 +739,23 @@
 		resp = 'X';	
 	}
 
-	if ((!(rtp->resp) && (!(event_end & 0x80))) || (rtp->resp && rtp->resp != resp)) {
-		rtp->resp = resp;
-		if (!ast_test_flag(rtp, FLAG_DTMF_COMPENSATE))
+	if (ast_test_flag(rtp, FLAG_DTMF_COMPENSATE)) {
+		if ((rtp->lastevent != timestamp) || (rtp->resp && rtp->resp != resp)) {
+			rtp->resp = resp;
+			f = send_dtmf(rtp, AST_FRAME_DTMF_END);
+			f->len = 0;
+			rtp->lastevent = timestamp;
+		}
+	} else {
+		if ((!(rtp->resp) && (!(event_end & 0x80))) || (rtp->resp && rtp->resp != resp)) {
+			rtp->resp = resp;
 			f = send_dtmf(rtp, AST_FRAME_DTMF_BEGIN);
-	} else if (event_end & 0x80 && rtp->lasteventendseqn != seqno && rtp->resp) {
-		f = send_dtmf(rtp, AST_FRAME_DTMF_END);
-		f->len = ast_tvdiff_ms(ast_samp2tv(samples, 8000), ast_tv(0, 0)); /* XXX hard coded 8kHz */
-		rtp->resp = 0;
-		rtp->lasteventendseqn = seqno;
-	} else if (ast_test_flag(rtp, FLAG_DTMF_COMPENSATE) && event_end & 0x80 && rtp->lasteventendseqn != seqno) {
-		rtp->resp = resp;
-		f = send_dtmf(rtp, AST_FRAME_DTMF_END);
-		f->len = ast_tvdiff_ms(ast_samp2tv(samples, 8000), ast_tv(0, 0)); /* XXX hard coded 8kHz */
-		rtp->resp = 0;
-		rtp->lasteventendseqn = seqno;
+		} else if ((event_end & 0x80) && (rtp->lastevent != seqno) && rtp->resp) {
+			f = send_dtmf(rtp, AST_FRAME_DTMF_END);
+			f->len = ast_tvdiff_ms(ast_samp2tv(samples, 8000), ast_tv(0, 0)); /* XXX hard coded 8kHz */
+			rtp->resp = 0;
+			rtp->lastevent = seqno;
+		}
 	}
 
 	rtp->dtmfcount = dtmftimeout;
@@ -1240,12 +1242,12 @@
 				duration &= 0xFFFF;
 				ast_verbose("Got  RTP RFC2833 from   %s:%u (type %-2.2d, seq %-6.6u, ts %-6.6u, len %-6.6u, mark %d, event %08x, end %d, duration %-5.5d) \n", ast_inet_ntoa(sin.sin_addr), ntohs(sin.sin_port), payloadtype, seqno, timestamp, res - hdrlen, (mark?1:0), event, ((event_end & 0x80)?1:0), duration);
 			}
-			f = process_rfc2833(rtp, rtp->rawdata + AST_FRIENDLY_OFFSET + hdrlen, res - hdrlen, seqno);
+			f = process_rfc2833(rtp, rtp->rawdata + AST_FRIENDLY_OFFSET + hdrlen, res - hdrlen, seqno, timestamp);
 		} else if (rtpPT.code == AST_RTP_CISCO_DTMF) {
 			/* It's really special -- process it the Cisco way */
-			if (rtp->lasteventseqn <= seqno || (rtp->lasteventseqn >= 65530 && seqno <= 6)) {
+			if (rtp->lastevent <= seqno || (rtp->lastevent >= 65530 && seqno <= 6)) {
 				f = process_cisco_dtmf(rtp, rtp->rawdata + AST_FRIENDLY_OFFSET + hdrlen, res - hdrlen);
-				rtp->lasteventseqn = seqno;
+				rtp->lastevent = seqno;
 			}
 		} else if (rtpPT.code == AST_RTP_CN) {
 			/* Comfort Noise */
@@ -2013,7 +2015,7 @@
 	rtp->lastividtimestamp = 0;
 	rtp->lastovidtimestamp = 0;
 	rtp->lasteventseqn = 0;
-	rtp->lasteventendseqn = 0;
+	rtp->lastevent = 0;
 	rtp->lasttxformat = 0;
 	rtp->lastrxformat = 0;
 	rtp->dtmfcount = 0;



More information about the asterisk-commits mailing list