Outbound Call Automation Help Please


I have a need to automate an outbound call. I simply need it to do the following …

  1. Dial a phone number that I give it.
  2. Check the status of the call. If the call was successful, great write it to a simple text log. If it was not successful the write it to a simple text log and then email me.
  3. I would like for this to occur on a regular basis … for example every 5 minutes maybe.

I don’t need it to play a recording or anything like that, just simply attempting to create a system to test my servers ability to make phone calls successfully.

I would be happy to do this within Asterisk and FreePBX server itself, but that is really not necessary either.

If someone has a Windows VOIP app that I can automate to perform the above 2 tasks I can check my FreePBX servers this way as well.

Yes I help folks on this site often however I am no programmer in any way so the easier the better.

Any ideas you may have would be greatly appreciated.

A call file, a cron job and a custom context for the call file to place a call and email it’s completion status.

It sounds like you are creating a War Dialer. Google that and you should be good to go.

Lots of scammers and con artists use War Dialers to access phone numbers that they normally wouldn’t have access to (like unlisted numbers, for example).

Just thought you’d like to know you just self-identified with this group of esteemed telephone “professionals”.

Hi @dicko and @cynjut thanks for the responses.

As I had stated I am no programmer. Since the replies I have been researching this however. I believe I have found the correct info regarding the call file and cron tab scripting however I’m not finding the info I need for the custom context.

I need to make the call and if the status of the call was anything other than “answered successfully” I need an immediate email.

I’m going to set this up so it calls my primary production server every so many minutes. My train of thought here is that if this system cannot successfully call my production server that there would be a problem that I can intercept and resolve before my customer knows of the problem.

Any tips or tricks you can provide regarding the creation of the custom context to accomplish this?

@dickson you did such an amazing job on the survey project " FPBX/Asterisk option to replace Avaya IPO “Campaigns”" that I was hoping you would consider helping with this project as well.

As u can see above I am attempting to crest a solution where I can create a call file. Check status of the call. If it was not successful to email me. I would like to use this as a cron job that is scheduled to run every 5 min.

I want to know when my carrier is down hopefully before my clients so that I can get it fixed immediately and not get a bad reputation.

@dickson - No good deed goes unpunished.

There are lots of better ways to handle a trunk down situation.

  • Install a system like Nagios which can monitor both IPs and trunks. This way, in addition to knowing the trunk is down, you can identify where.
  • Use the “trunk down” script part of the trunk definition.

My mom always said “the reward of work well done is usually more work”. :slight_smile:
My question is, what kind of carrier you dealing with that has such lousy up time?

As @cynjut says, in your trunk down situation, there might be better ways than constantly calling…but i guess could be done. Whats the chances of just monitoring the peer connection for stability? Or do you actually have to call a number to make sure it works?

1 Like

No real problem with the carrier. Normally down only a few times a year. I’m just trying to crest a solution that will provide me the insight before clients call me. We are getting a large number of clients and our reputation is very important to our success.

Sip trunk. Sorry Dave I have no experience in nagios and I’ve attempted that before without success. I wish there was an easy “how to” that I could follow.

I will be using the new sangoma monitoring RMS as soon as it is available. Will this tell me when my sip provider is not successfully making and or receiving calls over my sip trunks possibly??

Here’s one way you could do it that is quick and dirty.

If you had a cron job, you could drop a file into the outgoing directory in asterisk that would generate the call.
When its done, you could grep the same file, as it will give you an updated status of ‘completed’ or failed (should the far end answer)

So, for example:

create a file called test.call on your pbx
then in that file put in the following below. The adjustments you have to make for now are 'channel" section.
So, assuming its a SIP trunk, you’d just put in SIP/TrunkNameInFreePBX/5551234
If you aren’t sure about the syntax, make a test call (i called 5554130), then take a look at the log file and search for the phone number. You’ll see something like this in the log “Called IAX2/Gateway_100/5554130”.

Put that in the .call file.

Channel: IAX2/Gateway_100/5554130
Application: Playback
Data: hello-world
Archive: yes

Save that file and exit.
now make the file read/writeable by the system

chmod 777 test.call

Now test the call by MOVING that file to /var/spool/asterisk/outgoing/ Very important to move the file and not copy it. The outgoing folder is monitored my asterisk and it will grab partial files that result in a COPY command resulting in bad calls.

mv test.call /var/spool/asterisk/outgoing/

The system SHOULD make a call.

Now, check /var/spool/asterisk/outgoing_done/

Your call file will be in there, but asterisk will have added a couple of lines to it at the end. Specifically a “STATUS” line which will indicate if it was a successful call or a failed call. Expired|Completed|Failed

Status: Completed

You could grep that file (it will have the same name as your original file) and look for that status.
You can create the original .call file chmod it, then just send a copy of it to the outoing folder ever few minutes.

1 Like

Wow you make it seem so easy I will give that a try when I get back to the office thank you so much for your time and your effort’s