Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Asterisk Call Back

Posted on 2011-10-12
Medium Priority
Last Modified: 2013-12-21
Hi guys,

I hope you can help i have a asterisk 1.6 box and i want to enable a callback where if one of my people phones the pabx it gives the engaged signal and then phones them back.

I have seen and tried many guides to do this but just cant seem to get it working. Do you have any suggestions / examples.

Thanks very much

Question by:frankie_jnr
  • 2
LVL 36

Expert Comment

ID: 36969007
What methods have you tried?

Personally the way I prefer to do it is have the dialplan call an AGI program whicl then creates a corresponding .call file. Asterisk then sees this .call file and dials the appropiate number.
These solutions are normally a little more complex as the caller may be witholding their callerid so asterisk will need to detect this and ask for a number to be called back on.
Also some callers may be phoning from a company where the general company switchboard number is provided so they may want to provide an alternative direct dial number or leave a recorded message for you telling you who to ask for when you get through.

Lets get the basic functionality working first and then you can add the extra feature later.
LVL 36

Accepted Solution

grblades earned 2000 total points
ID: 36969088
Here is an example AGI script. You simple call it from the dialplan using the AGI command and pass it the number to be dialled.
It then creates a call file telling it to dial the given number in the 'outgoingcall' contest and then once answered connect the call to the 'agents' extension in the 'callback' context which could then pass the call onto one of your agents.
You can swap it around aswell so your agent is called first and then it tries to call the person asking for the callback. It all depends on how busy your agents are.

$agivars = array();
while (!feof(STDIN))
   $agivar = trim(fgets(STDIN));
   if ($agivar === '')
   $agivar = explode(':', $agivar);
   $agivars[$agivar[0]] = trim($agivar[1]);

# write new call file here
$myFile = "/tmp/" .$callerid .".call";
$fh = fopen($myFile, 'w') or die("can't open file");
fwrite($fh, "Channel: Local/agent1@callback\n");
fwrite($fh, "MaxRetries: 0\n");
fwrite($fh, "RetryTime: 15\n");
fwrite($fh, "WaitTime: 15\n");
fwrite($fh, "Context: outgoingcall\n");
fwrite($fh, "Extension: " .$callerid ."\n");
rename("/tmp/" .$callerid .".call","/var/spool/asterisk/outgoing/" .$callerid .".call");

Open in new window


Author Closing Comment

ID: 36994519
Thank you so much

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Almost all Internet protocol telephones have built-in switches at the back that allow you to connect your personal computer to one port and use the other port to connect your phone to to a Cisco switch.   Why we need to connect the PC to the pho…
Moving your enterprise fax infrastructure from in-house fax machines and servers to the cloud makes sense — from both an efficiency and productivity standpoint. But does migrating to a cloud fax solution mean you will no longer be able to send or re…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…
Suggested Courses

578 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question