[asterisk-commits] oej: branch oej/videocaps r54863 - in /team/oej/videocaps: ./ apps/ channels/...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Fri Feb 16 07:35:00 MST 2007


Author: oej
Date: Fri Feb 16 08:34:59 2007
New Revision: 54863

URL: http://svn.digium.com/view/asterisk?view=rev&rev=54863
Log:
Resolve conflicts and reset automerge

Modified:
    team/oej/videocaps/   (props changed)
    team/oej/videocaps/CHANGES
    team/oej/videocaps/CREDITS
    team/oej/videocaps/apps/app_voicemail.c
    team/oej/videocaps/channels/chan_sip.c
    team/oej/videocaps/main/rtp.c

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

Propchange: team/oej/videocaps/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Fri Feb 16 08:34:59 2007
@@ -1,1 +1,1 @@
-/trunk:1-54811
+/trunk:1-54861

Modified: team/oej/videocaps/CHANGES
URL: http://svn.digium.com/view/asterisk/team/oej/videocaps/CHANGES?view=diff&rev=54863&r1=54862&r2=54863
==============================================================================
--- team/oej/videocaps/CHANGES (original)
+++ team/oej/videocaps/CHANGES Fri Feb 16 08:34:59 2007
@@ -101,3 +101,4 @@
     "sipregs" for registrations. If it's not defined, "sippeers" will be used for
     registration data, as before.
   * The SIPPEER function have new options for port address, call and pickup groups
+  * Added support for T.140 realtime text in SIP/RTP

Modified: team/oej/videocaps/CREDITS
URL: http://svn.digium.com/view/asterisk/team/oej/videocaps/CREDITS?view=diff&rev=54863&r1=54862&r2=54863
==============================================================================
--- team/oej/videocaps/CREDITS (original)
+++ team/oej/videocaps/CREDITS Fri Feb 16 08:34:59 2007
@@ -137,6 +137,7 @@
 	INRIA, http://www.inria.fr/
 
 John Martin, Aupix - Improved video support in the SIP channel
+	T.140 text support in RTP/SIP
 
 Steve Underwood - Provided T.38 pass through support.
 

Modified: team/oej/videocaps/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/oej/videocaps/apps/app_voicemail.c?view=diff&rev=54863&r1=54862&r2=54863
==============================================================================
--- team/oej/videocaps/apps/app_voicemail.c (original)
+++ team/oej/videocaps/apps/app_voicemail.c Fri Feb 16 08:34:59 2007
@@ -3926,17 +3926,17 @@
 	char todir[PATH_MAX], fn[PATH_MAX], ext_context[PATH_MAX], *stringp;
 	int newmsgs = 0, oldmsgs = 0;
 	const char *category = pbx_builtin_getvar_helper(chan, "VM_CATEGORY");
+	char *myserveremail = serveremail;
 
 	make_dir(todir, sizeof(todir), vmu->context, vmu->mailbox, "INBOX");
 	make_file(fn, sizeof(fn), todir, msgnum);
 	snprintf(ext_context, sizeof(ext_context), "%s@%s", vmu->mailbox, vmu->context);
 
 	if (!ast_strlen_zero(vmu->attachfmt)) {
-		if (strstr(fmt, vmu->attachfmt)) {
+		if (strstr(fmt, vmu->attachfmt))
 			fmt = vmu->attachfmt;
-		} else {
+		 else
 			ast_log(LOG_WARNING, "Attachment format '%s' is not one of the recorded formats '%s'.  Falling back to default format for '%s@%s'.\n", vmu->attachfmt, fmt, vmu->mailbox, vmu->context);
-		}
 	}
 
 	/* Attach only the first format */
@@ -3944,34 +3944,31 @@
 	stringp = fmt;
 	strsep(&stringp, "|");
 
+	if (!ast_strlen_zero(vmu->serveremail))
+		myserveremail = vmu->serveremail;
+
 	if (!ast_strlen_zero(vmu->email)) {
-		int attach_user_voicemail = ast_test_flag((&globalflags), VM_ATTACH);
-		char *myserveremail = serveremail;
-		attach_user_voicemail = ast_test_flag(vmu, VM_ATTACH);
-		if (!ast_strlen_zero(vmu->serveremail))
-			myserveremail = vmu->serveremail;
+		int attach_user_voicemail = ast_test_flag(vmu, VM_ATTACH);
+		if (!attach_user_voicemail)
+			attach_user_voicemail = ast_test_flag((&globalflags), VM_ATTACH);
+
 		/*XXX possible imap issue, should category be NULL XXX*/
 		sendmail(myserveremail, vmu, msgnum, vmu->context, vmu->mailbox, cidnum, cidname, fn, fmt, duration, attach_user_voicemail, chan, category);
 	}
 
-	if (!ast_strlen_zero(vmu->pager)) {
-		char *myserveremail = serveremail;
-		if (!ast_strlen_zero(vmu->serveremail))
-			myserveremail = vmu->serveremail;
+	if (!ast_strlen_zero(vmu->pager))
 		sendpage(myserveremail, vmu->pager, msgnum, vmu->context, vmu->mailbox, cidnum, cidname, duration, vmu, category);
-	}
-
-	if (ast_test_flag(vmu, VM_DELETE)) {
+
+	if (ast_test_flag(vmu, VM_DELETE))
 		DELETE(todir, msgnum, fn);
-	}
 
 #ifdef IMAP_STORAGE
 	DELETE(todir, msgnum, fn);
 #endif
 	/* Leave voicemail for someone */
-	if (ast_app_has_voicemail(ext_context, NULL)) {
+	if (ast_app_has_voicemail(ext_context, NULL)) 
 		ast_app_inboxcount(ext_context, &newmsgs, &oldmsgs);
-	}
+
 	manager_event(EVENT_FLAG_CALL, "MessageWaiting", "Mailbox: %s@%s\r\nWaiting: %d\r\nNew: %d\r\nOld: %d\r\n", vmu->mailbox, vmu->context, ast_app_has_voicemail(ext_context, NULL), newmsgs, oldmsgs);
 	run_externnotify(vmu->context, vmu->mailbox);
 	return 0;

Modified: team/oej/videocaps/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/oej/videocaps/channels/chan_sip.c?view=diff&rev=54863&r1=54862&r2=54863
==============================================================================
--- team/oej/videocaps/channels/chan_sip.c (original)
+++ team/oej/videocaps/channels/chan_sip.c Fri Feb 16 08:34:59 2007
@@ -805,15 +805,15 @@
 #define SIP_PAGE2_CALL_ONHOLD_INACTIVE	(1 << 24)	/*!< 24: Inactive  */
 #define SIP_PAGE2_RFC2833_COMPENSATE    (1 << 25)	/*!< 25: ???? */
 #define SIP_PAGE2_BUGGY_MWI		(1 << 26)	/*!< 26: Buggy CISCO MWI fix */
-#define SIP_PAGE2_DEBUG_CAPS		(1 << 27)	/*!< 27: Debug Caps  */
-#define SIP_PAGE2_NOTEXT		(1 << 28)	/*!< 28: Text not supported  */
-#define SIP_PAGE2_TEXTSUPPORT		(1 << 29)	/*!< 29: Global text enable */
-#define SIP_PAGE2_DEBUG_TEXT		(1 << 30)	/*!< 30: Global text debug */
+#define SIP_PAGE2_NOTEXT		(1 << 27)	/*!< 28: Text not supported  */
+#define SIP_PAGE2_TEXTSUPPORT		(1 << 28)	/*!< 29: Global text enable */
+#define SIP_PAGE2_DEBUG_TEXT		(1 << 29)	/*!< 30: Global text debug */
+#define SIP_PAGE2_DEBUG_CAPS		(1 << 30)	/*!< 27: Debug Caps  */
 
 #define SIP_PAGE2_FLAGS_TO_COPY \
 	(SIP_PAGE2_ALLOWSUBSCRIBE | SIP_PAGE2_ALLOWOVERLAP | SIP_PAGE2_VIDEOSUPPORT | \
 	SIP_PAGE2_T38SUPPORT | SIP_PAGE2_RFC2833_COMPENSATE | SIP_PAGE2_BUGGY_MWI | \
-	SIP_PAGE2_TEXTSUPPORT)
+	SIP_PAGE2_TEXTSUPPORT )
 
 /* SIP packet flags */
 #define SIP_PKT_DEBUG		(1 << 0)	/*!< Debug this packet */
@@ -2944,6 +2944,9 @@
 	if (dialog->trtp) {
 		ast_rtp_setdtmf(dialog->trtp, 0);
 		ast_rtp_setdtmfcompensate(dialog->trtp, 0);
+		ast_rtp_set_rtptimeout(dialog->trtp, peer->rtptimeout);
+		ast_rtp_set_rtpholdtimeout(dialog->trtp, peer->rtpholdtimeout);
+		ast_rtp_set_rtpkeepalive(dialog->trtp, peer->rtpkeepalive);
 	}
 
 	ast_string_field_set(dialog, peername, peer->username);
@@ -4168,7 +4171,6 @@
 	int text;
 	int needvideo = 0;
 	int needtext = 0;
-	
 	{
 		const char *my_name;	/* pick a good name */
 	
@@ -4231,7 +4233,7 @@
 		ast_dump_caps(&tmp->channelcaps);
 	}
 
-	if (sipdebug) {
+	if (sipdebug && option_debug > 2) {
 		char buf[BUFSIZ];
 		ast_log(LOG_DEBUG, "*** Our native formats are %s \n", ast_getformatname_multiple(buf, BUFSIZ, tmp->nativeformats));
 		ast_log(LOG_DEBUG, "*** Joint capabilities are %s \n", ast_getformatname_multiple(buf, BUFSIZ, i->jointcapability));
@@ -4261,14 +4263,21 @@
 			needtext = i->jointcapability & AST_FORMAT_TEXT_MASK;	/* Inbound call */
 	}
 
-	if (sipdebug_caps) {
+	if (i->trtp) {
+		if (i->prefcodec)
+			needtext = i->prefcodec & AST_FORMAT_TEXT_MASK;	/* Outbound call */
+ 		else
+			needtext = i->jointcapability & AST_FORMAT_TEXT_MASK;	/* Inbound call */
+	}
+
+	if (sipdebug &&option_debug > 2) {
 		if (needvideo) 
 			ast_log(LOG_DEBUG, "This channel can handle video! HOLLYWOOD next!\n");
 		else
 			ast_log(LOG_DEBUG, "This channel will not be able to handle video.\n");
 	}
 
-	if (sipdebug_caps) {
+	if (sipdebug) {
 		if (needtext) 
 			ast_log(LOG_DEBUG, "This channel can handle text! Shakespeare next!\n");
 		else
@@ -5376,6 +5385,7 @@
 
 	newtextrtp = alloca(ast_rtp_alloc_size());
 	memset(newtextrtp, 0, ast_rtp_alloc_size());
+	ast_rtp_new_init(newtextrtp);
 	ast_rtp_pt_clear(newtextrtp);
 
 	/* Update our last rtprx when we receive an SDP, too */
@@ -5433,6 +5443,9 @@
 
 	if (p->vrtp)
 		ast_rtp_pt_clear(newvideortp);  /* Must be cleared in case no m=video line exists */
+ 
+	if (p->trtp)
+		ast_rtp_pt_clear(newtextrtp);  /* Must be cleared in case no m=text line exists */
 
 	if (p->trtp)
 		ast_rtp_pt_clear(newtextrtp);  /* Must be cleared in case no m=text line exists */
@@ -5443,7 +5456,7 @@
 		int audio = FALSE;
 		int video = FALSE;
 		int text = FALSE;
-		
+
 		numberofports = 1;
 		if ((sscanf(m, "audio %d/%d RTP/AVP %n", &x, &numberofports, &len) == 2) ||
 		    (sscanf(m, "audio %d RTP/AVP %n", &x, &len) == 1)) {
@@ -5554,7 +5567,7 @@
 		memcpy(&vsin.sin_addr, vhp->h_addr, sizeof(vsin.sin_addr));
 	if (thp)
 		memcpy(&tsin.sin_addr, thp->h_addr, sizeof(tsin.sin_addr));
-		
+
 	/* Setup UDPTL port number */
 	if (p->udptl) {
 		if (udptlportno > 0) {
@@ -5907,7 +5920,7 @@
 	ast_rtp_get_current_formats(newaudiortp, &peercapability, &peernoncodeccapability);
 	ast_rtp_get_current_formats(newvideortp, &vpeercapability, &vpeernoncodeccapability);
 	ast_rtp_get_current_formats(newtextrtp, &tpeercapability, &tpeernoncodeccapability);
-
+ 
 	newjointcapability = p->capability & (peercapability | vpeercapability | tpeercapability);
 	newpeercapability = (peercapability | vpeercapability | tpeercapability);
 	newnoncodeccapability = p->noncodeccapability & peernoncodeccapability;
@@ -6818,7 +6831,7 @@
 
 }
 
-/*! \brief Add video codec offer to SDP offer/answer body in INVITE or 200 OK */
+/*! \brief Add text codec offer to SDP offer/answer body in INVITE or 200 OK */
 static void add_tcodec_to_sdp(const struct sip_pvt *p, int codec, int sample_rate,
 			     char **m_buf, size_t *m_size, char **a_buf, size_t *a_size,
 			     int debug, int *min_packet_size)
@@ -6839,6 +6852,7 @@
 			 ast_rtp_lookup_mime_subtype(1, codec, 0), sample_rate);
 	/* Add fmtp code here */
 }
+
 
 /*! \brief Get Max T.38 Transmission rate from T38 capabilities */
 static int t38_get_rate(int t38cap)
@@ -7127,6 +7141,9 @@
 	/* Get our media addresses */
 	get_our_media_address(p, needvideo, &sin, &vsin, &tsin, &dest, &vdest);
 		
+	if (debug) 
+		ast_verbose("Audio is at %s port %d\n", ast_inet_ntoa(p->ourip), ntohs(sin.sin_port));	
+
 	/* Ok, we need video. Let's add what we need for video and set codecs.
 	   Video is handled differently than audio since we can not transcode. */
 	if (needvideo) {
@@ -7195,33 +7212,7 @@
 		if (debug) 
 			ast_verbose("Text is at %s port %d\n", ast_inet_ntoa(p->ourip), ntohs(tsin.sin_port));	
 
-#if 0
-		/* For text, we can't negotiate text offers. Let's compare the incoming call with what we got. */
-		if (p->prefcodec) {
-			textcapability = (capability & p->prefcodec) & AST_FORMAT_TEXT_MASK; /* Outbound call */
-		
-			/* Now, merge this video capability into capability while removing unsupported codecs */
-			if (!textcapability) {
-				needtext = FALSE;
-				if (option_debug > 2)
-					ast_log(LOG_DEBUG, "** No compatible text codecs... Disabling text.\n");
-			} 
-
-			/* Replace text capabilities with the new videocapability */
-			capability = (capability & AST_FORMAT_AUDIO_MASK) | (videocapability & AST_FORMAT_VIDEO_MASK) | textcapability;
-
-			if (option_debug > 4) {
-				char codecbuf[BUFSIZ];
-				if (textcapability)
-					ast_log(LOG_DEBUG, "** Our text codec selection is: %s \n", ast_getformatname_multiple(codecbuf, sizeof(codecbuf), textcapability));
-				ast_log(LOG_DEBUG, "** Capability now set to : %s \n", ast_getformatname_multiple(codecbuf, sizeof(codecbuf), capability));
-			}
-		}
-#endif
-	}
-
-	if (debug) 
-		ast_verbose("Audio is at %s port %d\n", ast_inet_ntoa(p->ourip), ntohs(sin.sin_port));	
+	}
 
 	/* Start building generic SDP headers */
 
@@ -7347,6 +7338,33 @@
   	len = strlen(version) + strlen(subject) + strlen(owner) + strlen(connection) + strlen(stime) + strlen(m_audio) + strlen(a_audio) + strlen(hold);
   	if (needvideo) /* only if video response is appropriate */
   		len += strlen(m_video) + strlen(a_video) + strlen(bandwidth) + strlen(hold);
+ 	if (needtext) /* only if text response is appropriate */
+ 		len += strlen(m_text) + strlen(a_text) + strlen(hold);
+
+  if (min_audio_packet_size)
+  	ast_build_string(&a_audio_next, &a_audio_left, "a=ptime:%d\r\n", min_audio_packet_size);
+  
+ 	/* XXX don't think you can have ptime for video */
+  if (min_video_packet_size)
+  	ast_build_string(&a_video_next, &a_video_left, "a=ptime:%d\r\n", min_video_packet_size);
+  
+ 	/* XXX don't think you can have ptime for text */
+ 	if (min_text_packet_size)
+ 		ast_build_string(&a_text_next, &a_text_left, "a=ptime:%d\r\n", min_text_packet_size);
+ 
+ 	if ((m_audio_left < 2) || (m_video_left < 2) || (m_text_left < 2) || 
+ 		  (a_audio_left == 0) || (a_video_left == 0) || (a_text_left == 0))
+  		ast_log(LOG_WARNING, "SIP SDP may be truncated due to undersized buffer!!\n");
+  
+ 	ast_build_string(&m_audio_next, &m_audio_left, "\r\n");
+ 	if (needvideo)
+ 		ast_build_string(&m_video_next, &m_video_left, "\r\n");
+ 	if (needtext)
+ 		ast_build_string(&m_text_next, &m_text_left, "\r\n");
+  
+ 	len = strlen(version) + strlen(subject) + strlen(owner) + strlen(connection) + strlen(stime) + strlen(m_audio) + strlen(a_audio) + strlen(hold);
+ 	if (needvideo) /* only if video response is appropriate */
+ 		len += strlen(m_video) + strlen(a_video) + strlen(bandwidth) + strlen(hold);
  	if (needtext) /* only if text response is appropriate */
  		len += strlen(m_text) + strlen(a_text) + strlen(hold);
 
@@ -10273,6 +10291,10 @@
 			ast_rtp_destroy(p->trtp);
 			p->trtp = NULL;
 		}
+		if ((!ast_test_flag(&p->flags[1], SIP_PAGE2_TEXTSUPPORT) || !(p->capability & AST_FORMAT_TEXT_MASK)) && p->trtp) {
+			ast_rtp_destroy(p->trtp);
+			p->trtp = NULL;
+ 		}
 		if ((ast_test_flag(&p->flags[0], SIP_DTMF) == SIP_DTMF_RFC2833) ||
 		    (ast_test_flag(&p->flags[0], SIP_DTMF) == SIP_DTMF_AUTO))
 			p->noncodeccapability |= AST_RTP_DTMF;

Modified: team/oej/videocaps/main/rtp.c
URL: http://svn.digium.com/view/asterisk/team/oej/videocaps/main/rtp.c?view=diff&rev=54863&r1=54862&r2=54863
==============================================================================
--- team/oej/videocaps/main/rtp.c (original)
+++ team/oej/videocaps/main/rtp.c Fri Feb 16 08:34:59 2007
@@ -1373,7 +1373,6 @@
 		rtp->f.delivery.tv_usec = 0;
 		if (mark)
 			rtp->f.subclass |= 0x1;
-		
 	} else {
 		/* TEXT -- samples is # of samples vs. 1000 */
 		if (!rtp->lastitexttimestamp)



More information about the asterisk-commits mailing list