[asterisk-commits] mjordan: branch 12 r424621 - /branches/12/channels/pjsip/dialplan_functions.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sun Oct 5 19:51:47 CDT 2014


Author: mjordan
Date: Sun Oct  5 19:51:43 2014
New Revision: 424621

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=424621
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

Modified:
    branches/12/channels/pjsip/dialplan_functions.c

Modified: branches/12/channels/pjsip/dialplan_functions.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/channels/pjsip/dialplan_functions.c?view=diff&rev=424621&r1=424620&r2=424621
==============================================================================
--- branches/12/channels/pjsip/dialplan_functions.c (original)
+++ branches/12/channels/pjsip/dialplan_functions.c Sun Oct  5 19:51:43 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;
 	}
 
@@ -876,6 +876,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")) {
@@ -899,6 +904,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