What file to monitor for incoming call


I am trying to integrate my PBX with Smartthings at home, so that when I miss a call (or receive a call) , I will be notified through Smartthings.
What should I monitor on my linux CLI for incoming calls ? (a file, log, process , etc. ?)


There are many ways to complete this task, one of them is using AMI events


1 Like

I was not aware of AMI interface.

I’ve read some and I understand that this is an interface which writes all events to stdoutput when we connect with correct credentials.
Most of the examples I found, use expect (Tcl/Tk) to connect and wait for input.

So, I should wait for
"Event: Newchannel
Privilege: call,all"

In this event, variable “Exten” will give me the called number, and “CallerIDNum” will give the calling number.

Am I correct ?

ok. got it working. Great !


CDR might be easier. With CDR all calls would be logged into a CSV file, database, or wherever you want to with as much detail as possible. And it’s very simple to setup - http://www.asteriskdocs.org/en/3rd_Edition/asterisk-book-html-chunk/asterisk-SysAdmin-SECT-1.html

yeah. but CDR is only written after hangup. I prefer to be notified at setup state.

AMI is probably a good place to start. As you get more familiar with Asterisk and want to start building custom dial plan and/or dialplan applications you may want to look more into AGI and ARI.

Best of luck to you.

Matthew Fredrickosn

1 Like

An alternate solution may be to watch /var/log/asterisk/messages and parse the output there.

I use the LOG command to output a line on every incoming call.

exten => _X.,1,Log(NOTICE,Incoming call DID: ${EXTEN} from CallerID: ${CALLERID(num)} ${CALLERID(name)}

1 Like