v20 Linux Programmatically Call

NJohnson

Premier Customer
Joined
Jan 30, 2021
Messages
28
Reaction score
13
This is probably a cray idea but curious if anyone has ever actually done anything similar. Short version is I'd like 3CX to programmatically place a call and if that call fails, send a notification email.

What's happening is that the SIP gateway from our local telco just stops sending/receiving calls. It returns a "server internal error (500)" when this happens but only on outbound calls from 3CX and I get an email notification on it. Inbound calls just get dropped on the telco side, so there's no way to know their gateway has goofed up unless an outbound call is made. The fix is a simple power cycle of their gateway and in 30 seconds, everything is back to normal.

My thought is that if I can have 3CX or some kind of script run every 15 minutes to programmatically dial an outside number and if it errors out, I can get a notification to remotely power cycle their sip gateway which I can do with our Eaton UPS at that office, thus keeping me from a one hour drive and no telling how many missed calls into the office. I'm pretty good with Powershell and we have a network/server monitoring system (OpManager) I can leverage too. Even if I can just get 3CX to make a test call every 15 minutes, I can have OpManager to search the correct 3CX log file for that entry and alert me if needed. I can even have it remotely power cycle that port on the UPS via SNMP and make it 100% automated. The question is how can I programmatically place a call?

Thoughts?
 
Hello @NJohnson,

Well, I think SIP Caller can help in this case. You can create a dynamic campaign that runs continuously (no end date), and then:
1) From an external script, you can request a call to SIP Caller every 15 minutes. We provide a REST API to do this.
2) SIP Caller will trigger a webhook when the call ends, including the result. So if the gateway returns a 500 Internal Server Error, we can send an HTTP request to your monitoring system, so you can see the alarm.

Let me know if you want to give it a try, you can start a free 14 days trial.

Kind regards.
 
  • Like
Reactions: Evolute IT
First of all, Ernesto is the "All-Knowing". Talk to him about his approach.

I was going to suggest something similar to what @edossantos_sipcaller proposed. I would create a service/daemon that places a call every X minutes using the 3CX Call Control API. My assumption is that if the gateway is working the call will be in a ringing state. If the gateway is not working, the call will fail fairly quickly. Here is my outline:
  1. Place the call using MakeCall
  2. Wait X seconds
  3. If the call exists (ringing state) in 3CX
    1. Drop the call
  4. if call does not exist
    1. Send email notification
Did you have an idea about what phone number you would call? Obviously, it cannot be a internal extension because that would not go through the gateway. So... what phone are you going to call? Are you expecting someone to answer this call?

More than once I have pondered the idea of doing this the other way around. Spin-up a AWS VM. Install a 4SC 3CX. Have the AWS 3CX place an inbound call to your PBX and monitor the success or failure of the call. If you wanted to get fancy, you could record the call on both ends and then analyze the audio to confirm audio is passing both ways.

I suppose it depends on how deep down the rabbit hole you want to go :)
 
  • Like
Reactions: Evolute IT

Forum statistics

Threads
111,956
Messages
589,927
Members
164,859
Latest member
MichaelRussell3