[asterisk-commits] mjordan: branch 13 r424622 - in /branches/13: ./	channels/pjsip/
    SVN commits to the Asterisk project 
    asterisk-commits at lists.digium.com
       
    Sun Oct  5 19:52:22 CDT 2014
    
    
  
Author: mjordan
Date: Sun Oct  5 19:52:19 2014
New Revision: 424622
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=424622
Log:
pjsip/dialplan_functions: Handle PJSIP_MEDIA_OFFER called on non-PJSIP channels
Calling PJSIP_MEDIA_OFFER on a non-PJSIP channel is hazardous to your health.
It will treat the channels as a PJSIP channel, eventually hitting an ao2 error,
FRACKing on assertion error, and quite likely crashing.
This patch adds checks to the read/write callbacks that ensure that the channel
technology is of type 'PJSIP' before attempting to operate on the channel.
#SIPit31
ASTERISK-24382 #close
Reported by: Matt Jordan
........
Merged revisions 424621 from http://svn.asterisk.org/svn/asterisk/branches/12
Modified:
    branches/13/   (props changed)
    branches/13/channels/pjsip/dialplan_functions.c
Propchange: branches/13/
------------------------------------------------------------------------------
Binary property 'branch-12-merged' - no diff available.
Modified: branches/13/channels/pjsip/dialplan_functions.c
URL: http://svnview.digium.com/svn/asterisk/branches/13/channels/pjsip/dialplan_functions.c?view=diff&rev=424622&r1=424621&r2=424622
==============================================================================
--- branches/13/channels/pjsip/dialplan_functions.c (original)
+++ branches/13/channels/pjsip/dialplan_functions.c Sun Oct  5 19:52:19 2014
@@ -707,7 +707,7 @@
 
 	/* Sanity check */
 	if (strcmp(ast_channel_tech(chan)->type, "PJSIP")) {
-		ast_log(LOG_ERROR, "Cannot call %s on a non-PJSIP channel\n", cmd);
+		ast_log(LOG_WARNING, "Cannot call %s on a non-PJSIP channel\n", cmd);
 		return 0;
 	}
 
@@ -866,6 +866,11 @@
 		return -1;
 	}
 
+	if (strcmp(ast_channel_tech(chan)->type, "PJSIP")) {
+		ast_log(LOG_WARNING, "Cannot call %s on a non-PJSIP channel\n", cmd);
+		return -1;
+	}
+
 	channel = ast_channel_tech_pvt(chan);
 
 	if (!strcmp(data, "audio")) {
@@ -889,6 +894,11 @@
 		return -1;
 	}
 
+	if (strcmp(ast_channel_tech(chan)->type, "PJSIP")) {
+		ast_log(LOG_WARNING, "Cannot call %s on a non-PJSIP channel\n", cmd);
+		return -1;
+	}
+
 	channel = ast_channel_tech_pvt(chan);
 	mdata.session = channel->session;
 
    
    
More information about the asterisk-commits
mailing list