Call fowarding using perl AGI Script

Hello everyone,

Greetings of the day!

I have written perl AGI script towards a simple requirement of call forwarding to agent sitting outside the premise (Dial Out)

my AGI Script is ------------
$AGI-> exec(‘Playback’,’/usr/prompts/calltransfer’);
$AGI-> exec(‘Wait’,‘1’);
$AGI-> exec(‘DIAL’,‘DAHDI/16-1/$(9320607885)’)

I am able to dial out to the above mentioned number but the problem is when the caller disconnects the Dahdi Channel does not hangup

Do i need to pass any parameters? for hangup

When i execute - hangup request i am able to see two channels
One on which the primary call landed Dahdi/1-1 and second using which i am dialing the external party Dahdi/16-1. What i noticed is that when i execute hangup request for Dahdi/16-1 both channels get hangup which is what needed but through AGI script.

Could somebody provide help on the same?