Soft Hangup Issue

I’m trying to upgrade a production system using Asterisk version to version 11. The production system’s hardware is aging out and replacement hardware has been procured and I’ve installed the FreePBX distro 6.12.65 on it. I then setup a lab environment mimicking the productions systems as best I could. Upon testing I discovered an issue with Soft Hangup not identifying the resource the same way.

Configuration on current system:

exten => 17,1,MeetMe(logger-17,d1Fq)
exten => 17,2,MeetMe(logger-17,d1Fq)
exten => h,1,SoftHangup(DAHDI/25-1)
exten => h,n,Hangup

exten => s,1,Dial(local/${CALLERID(dnid):-2}@custom-szeto-oper/nj)
exten => 17,1,Dial(DAHDI/25/1000002017,,G(custom-szeto-17^${EXTEN}^1))


; Span 2: TE8/0/2 "T8XXP (PCI) Card 0 Span 2" B8ZS/ESF
switchtype = national
signalling = pri_net
channel => 25

What’s supposed to happen is that when the call is hung up the channel on the PRI is hung up as well via Soft Hangup function referencing the channel number on the PRI. It seems that in newer versions of Asterisk the resource is referenced dynamically (the “g” example below changes with each call made).

Old Asterisk: DAHDI/25-1
New Asterisk: DAHDI/i1/1000002017-g

How do I grab this channel resource name so I can hang up this leg of the call when it’s dynamically named?