Get Channel with from extension or CID in AMI

IN PHP, using “include ‘/etc/freepbx.conf’;” what is the best way to find the inbound channel and agent is talking to if I have the inbound CID and agent extension? My goal is a webform button that uses AMI to transfer a call.

Using AMI for this (in PHP) is probably the right solution. Not sure that including the FreePBX Configuration file is going to do anything for you, though.