How in AGI can I transfer the current call to another ext

I have made progress on my Order Confirmation line, using AGI scripts written in PHP. One feature I am going to need to allow is, if the order is on hold, * should transfer the call back to a person, or dial out to another office.

At first I thought maybe the .call files would do the trick, but after reading the docs, I’m not sure if that is the way. Anyone have any suggestions?

Are you using the class library? If not, I recommend it.

You may use phpagi-astmanager.php to connect to the Asterisk Manager portal and do call xfers. Specifically using the Redirect class.

Good luck!

It looks like that would work if the extension I need to transfer to is on a asterisk extension. The extension I would need to tranfer the call to is going to be on an extension on my Nortel pbx. It would be an outside call from the asterisk server. The server would need to dial “flash” then 21.

1 Like

An extension on Asterisk is configurable/programmable based on the context. Therefore, you would simply map an extension on the Asterisk to something like Dial(SIP/your_nortel_sip_address).

Is it possible to simulate a flash and DTMF tones in an AGI script? We have a centrex system, and in order to free up the original line, the script would need to dial [flash] + 9 + 216 to make the call ring in again on all of the nortel extensions. We don’t have any phones on our * server. Just a few fxo ports that go straight to our order confirmation script.

You may be getting into the realm of needing Zap channels and doing something like this: … apTransfer

(but not sure on this point, may anyone else comment?)

Also, you do have this: … d+SendDTMF

But not sure if you may invoke it from the AGI, it is not available in the pre-rolled PHPAGI class library. You may do combination of dropping it back to a context in Asterisk that plays a set of DTMF digits passed to it by the AGI script and then the context passes it back to another AGI.

Getting a bit tricky.

I have exactly the same problem. I have a FastAGI server written in Delphi. I cannot transfer a call by dialing the # although I can park the call which is also #700. The moment I transfer the call my phone goes dead and the caller just hear silence. Funny enough is when the caller hangs up then I see on the console that the call has been terminated and it actually shows the number it was transferred too. This tells me that it was transferred but the audio was lost for some reason. The connection to the FastAGI server stays conencted until the caller hangs up.

I have also noticed that when the “called person” hangs up (using a SIP phone) the Dial command doesn’t return until the caller hangs up although the documentation states that the parameter “g: When the called party hangs up, exit to execute more commands in the current context.”

I was able to solve this problem using the standard dialplan applications FLASH and SendDTMF in an AGI script, like this. In this scenario, 24 is the extension on the Nortel PBX.

So, in a AGI script I would send the following two commands

EXEC Flash
EXEC SendDTMF *7024

Works like a charm.

Thanks for the help, guys.