[svn-commits] mjordan: trunk r424623 - in /trunk: ./ channels/pjsip/dialplan_functions.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Sun Oct 5 19:53:40 CDT 2014


Author: mjordan
Date: Sun Oct  5 19:53:37 2014
New Revision: 424623

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

Merged revisions 424622 from http://svn.asterisk.org/svn/asterisk/branches/13

Modified:
    trunk/   (props changed)
    trunk/channels/pjsip/dialplan_functions.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-13-merged' - no diff available.

Modified: trunk/channels/pjsip/dialplan_functions.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/pjsip/dialplan_functions.c?view=diff&rev=424623&r1=424622&r2=424623
==============================================================================
--- trunk/channels/pjsip/dialplan_functions.c (original)
+++ trunk/channels/pjsip/dialplan_functions.c Sun Oct  5 19:53:37 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 svn-commits mailing list