[asterisk-commits] dvossel: branch 1.6.2 r266293 - in /branches/1.6.2: ./ channels/chan_sip.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri May 28 12:57:42 CDT 2010


Author: dvossel
Date: Fri May 28 12:57:40 2010
New Revision: 266293

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=266293
Log:
Merged revisions 266292 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

........
  r266292 | dvossel | 2010-05-28 12:55:38 -0500 (Fri, 28 May 2010) | 9 lines
  
  fixes crash when creation of UDPTL fails
  
  (closes issue #17264)
  Reported by: falves11
  Patches:
        issue_17264_reviewboard_fix.diff uploaded by dvossel (license 671)
        issue_17264_1.6.2_reviewboard_fix.diff uploaded by dvossel (license 671)
  Tested by: falves11
........

Modified:
    branches/1.6.2/   (props changed)
    branches/1.6.2/channels/chan_sip.c

Propchange: branches/1.6.2/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.

Modified: branches/1.6.2/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.6.2/channels/chan_sip.c?view=diff&rev=266293&r1=266292&r2=266293
==============================================================================
--- branches/1.6.2/channels/chan_sip.c (original)
+++ branches/1.6.2/channels/chan_sip.c Fri May 28 12:57:40 2010
@@ -5145,12 +5145,15 @@
 	}
 	dialog->prefs = peer->prefs;
 	if (ast_test_flag(&dialog->flags[1], SIP_PAGE2_T38SUPPORT)) {
-		if (!dialog->udptl) {
-			/* t38pt_udptl was enabled in the peer and not in [general] */
-			dialog->udptl = ast_udptl_new_with_bindaddr(sched, io, 0, bindaddr.sin_addr);
-		}
-		dialog->t38_maxdatagram = peer->t38_maxdatagram;
-		set_t38_capabilities(dialog);
+		/* t38pt_udptl was enabled in the peer and not in [general] */
+		if (dialog->udptl || (!dialog->udptl && (dialog->udptl = ast_udptl_new_with_bindaddr(sched, io, 0, bindaddr.sin_addr)))) {
+			dialog->t38_maxdatagram = peer->t38_maxdatagram;
+			set_t38_capabilities(dialog);
+		} else {
+			/* It is impossible to support T38 without udptl */
+			ast_debug(1, "UDPTL creation failed on dialog.\n");
+			ast_clear_flag(&dialog->flags[1], SIP_PAGE2_T38SUPPORT);
+		}
 	} else if (dialog->udptl) {
 		ast_udptl_destroy(dialog->udptl);
 		dialog->udptl = NULL;
@@ -6437,7 +6440,7 @@
 {
 	int res = 0;
 
-	if (!ast_test_flag(&p->flags[1], SIP_PAGE2_T38SUPPORT)) {
+	if (!ast_test_flag(&p->flags[1], SIP_PAGE2_T38SUPPORT) || !p->udptl) {
 		return -1;
 	}
 	switch (parameters->request_response) {
@@ -7249,8 +7252,13 @@
 			p->vrtp = ast_rtp_new_with_bindaddr(sched, io, 1, 0, bindaddr.sin_addr);
  		if (ast_test_flag(&p->flags[1], SIP_PAGE2_TEXTSUPPORT))
  			p->trtp = ast_rtp_new_with_bindaddr(sched, io, 1, 0, bindaddr.sin_addr);
-		if (ast_test_flag(&p->flags[1], SIP_PAGE2_T38SUPPORT))
-			p->udptl = ast_udptl_new_with_bindaddr(sched, io, 0, bindaddr.sin_addr);
+		if (ast_test_flag(&p->flags[1], SIP_PAGE2_T38SUPPORT)) {
+			if (!(p->udptl = ast_udptl_new_with_bindaddr(sched, io, 0, bindaddr.sin_addr))) {
+				/* udptl creation failed, T38 can not be supported on this dialog */
+				ast_log(LOG_ERROR, "UDPTL creation failed\n");
+				ast_clear_flag(&p->flags[1], SIP_PAGE2_T38SUPPORT);
+			}
+		}
  		if (!p->rtp|| (ast_test_flag(&p->flags[1], SIP_PAGE2_VIDEOSUPPORT) && !p->vrtp) 
 				|| (ast_test_flag(&p->flags[1], SIP_PAGE2_TEXTSUPPORT) && !p->trtp)) {
  			ast_log(LOG_WARNING, "Unable to create RTP audio %s%ssession: %s\n",
@@ -20073,9 +20081,15 @@
 		}
 
 		/* If T38 is needed but not present, then make it magically appear */
-		if (ast_test_flag(&p->flags[1], SIP_PAGE2_T38SUPPORT) && !p->udptl && (p->udptl = ast_udptl_new_with_bindaddr(sched, io, 0, bindaddr.sin_addr))) {
-			p->t38_maxdatagram = global_t38_maxdatagram;
-			set_t38_capabilities(p);
+		if (ast_test_flag(&p->flags[1], SIP_PAGE2_T38SUPPORT) && !p->udptl) {
+			if ((p->udptl = ast_udptl_new_with_bindaddr(sched, io, 0, bindaddr.sin_addr))) {
+				p->t38_maxdatagram = global_t38_maxdatagram;
+				set_t38_capabilities(p);
+			} else {
+				/* udptl creation failed, T38 can not be supported on this dialog */
+				ast_debug(1, "UDPTL creation failed on dialog.\n");
+				ast_clear_flag(&p->flags[1], SIP_PAGE2_T38SUPPORT);
+			}
 		}
 
 		/* We have a succesful authentication, process the SDP portion if there is one */




More information about the asterisk-commits mailing list