Nicholas Skinner

Freelance website and web application developer

Transferring Inbound Calls Manually Before Pickup Using Asterisk PBX

Cisco Service, Transfer CallWhen I first started using Asterisk PBX I setup a few small but useful Perl scripts (run via dialling extensions) to do tasks such as:

  • Transfer an incoming call to an external mobile number without needing to answer the call (i.e. call comes in, and based on the Caller ID I could manually choose to answer or forward it).
  • Forced remote call transfer / local pickup an active call (i.e. call comes in on another phone and the person who answered is unable to remember how to transfer it, to save having to physically go to the other phone and transfer the call).
  • Transfer a ringing call to voicemail immediately without waiting for a delay.

After switching to the Rowetel IP04 IP-PBX I could not work out a simple way to port over the scripts (IP04 does not have Perl support by default) so lived without the functionality for a few years.

Recently I also had another requirement come up, the ability to based on Caller ID either decide to pickup the call or to transfer it (without needing to answer it) to an external answering service. After this I started looking into the options and came up with using the Cisco 7960’s mini XML browser.

When a call comes I can not press “Services” on the phone, this loads a PHP script running from a server which shows a list of the transfer options. I then choose an option and the PHP script connects to the Asterisk AGI gateway and transfers the call to the specified party (i.e. voicemail, external mobile, call answering service, or the local phone itself). It also has the advantage of providing a text menu of options rather than needing to remember an extension to dial.


Note: Script assumes calls come in externally on the line “Zap/1-1″, and internal extensions are in the context “myinternal”. Change these in the transfer_call() function if required.

Leave a Reply