Asterisk Call Back

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

Who is Participating?
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

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.
frankie_jnrAuthor Commented:
Thank you so much
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.