From: Terry Wilson Date: Fri, 22 Jun 2012 19:28:04 +0000 (+0000) Subject: Don't crash on a guest directmedia call X-Git-Tag: 1.8.15.0-rc1~30 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4151dff715051e19170f223c7ceae9c7719c51cd;p=thirdparty%2Fasterisk.git Don't crash on a guest directmedia call A sip_pvt may not have relatedpeer set if a call doesn't match up with a peer. If there is no relatedpeer, there is no direct media ACL to apply, so just return that it is allowed. (closes issue ASTERISK-20040) Reported by: Terry Wilson git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@369214 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 48dcea7f2f..992f2d5ef2 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -29159,6 +29159,12 @@ static int apply_directmedia_ha(struct sip_pvt *p1, struct sip_pvt *p2, const ch ast_rtp_instance_get_remote_address(p1->rtp, &them); ast_rtp_instance_get_local_address(p1->rtp, &us); + /* If p2 is a guest call, there will be no peer. If there is no peer, there + * is no directmediaha, so go ahead and allow it */ + if (!p2->relatedpeer) { + return res; + } + if ((res = ast_apply_ha(p2->relatedpeer->directmediaha, &them)) == AST_SENSE_DENY) { const char *us_addr = ast_strdupa(ast_sockaddr_stringify(&us)); const char *them_addr = ast_strdupa(ast_sockaddr_stringify(&them));