Want email with Call Log info sent to extension user's email for each incoming call

Looking to know which file to modify and what context to be used.

I believe it will be extensions.conf, but not sure on exact code.

What I would like is for every call that dials an extension (or is passed to extension via timeout of IVR) to generate an email.

Then, when a call is disconnected (regardless of any extension), I would like an additional email of the call log sent to the same email address. (ie: especially if someone calls and simply hangs up)

We are only talking about 3-5 email addresses total, so not a substantial amount of coding.

The purpose of this is to help us track who is calling, what extensions they are dialing, and length of calls (for billing/tracking purposes).

Any advice/assistance is greatly appreciated!

Why don’t you use the call reports?


The call report is great to look at, but we use the email messages to respond to for billing purposes. It also gives us proof of call that we can show the client with their CID, times, options dialed, etc.

Before we would get an initial email on the call-in, and then a second email on call-disconnect.

Here is an example of what we had setup before on a different Asterisk system:

Call From: xxxxxxxxxx NAME [caller info / CID]
Call To: xxxxxxxxxx [number dialed / DID]
Call Time: 15:28:47 on 09/26/2011

Call Progress:
Main Menu
Transferring Call to Reception/Virtual Office
Office is Open
Transferring Caller to All Techs

ring_all_ has 0 calls (max unlimited) in ‘ringall’ strategy (9s holdtime), W:0, C:4, A:0, SL:0.0% within 0s
(dynamic) (Invalid) has taken no calls yet
SIP/[email protected]_outbound (Unknown) has taken 2 calls (last was 21242 secs ago)
SIP/[email protected]_outbound (Unknown) has taken no calls yet
SIP/user_ext1 (Unavailable) has taken no calls yet
SIP/FM50013139-2 (Invalid) has taken no calls yet
SIP/8885551212-3 (Not in use) has taken no calls yet
SIP/8885551212-2 (Not in use) has taken 2 calls (last was 9040 secs ago)
SIP/8885551212-1 (Unavailable) has taken no calls yet
No Callers

Verbosity is at least 6

Call Ended at: 15:29:45 on 09/26/2011
– AGENT: SIP/8885551212-2-0ad0

For example, if this were a billable call, we would forward to accounting with notes on what was done during the call. Then, if the client were to ever dispute the charge, we would have a record of their call times with CID, followed by notes as documentation.

We used this setup for ~3 years before having to reload Asterisk; just trying to get it reconfigured.