0

I'm using Asterisk's AMI so that my Java app can receive events from the pbx. I'm currently relying on the NewChannelEvent to get the start time of the call.

However, when I reboot my system, I have no way to retrieve the start time of the call.

What is the most elegant way to solve this problem? Best case is I would like my Java app to receive an event with the call details.

mpmp
  • 2,409
  • 4
  • 33
  • 46
  • Possible duplicate of [Get application uptime](http://stackoverflow.com/questions/6431607/get-application-uptime) – BCartolo Feb 22 '17 at 20:12

2 Answers2

0

You can use the logs in the asterisk's Master.csv. it's in

/var/log/asterisk/cdr-csv/Master.csv 

It will give you more useful data.

0

Asterisk have two 3 mechanism for that

1) AMI

2) CEL https://wiki.asterisk.org/wiki/pages/viewpage.action?pageId=5242932 CEL allow you see multiple events, including start of call in database.

3) CDR https://wiki.asterisk.org/wiki/display/AST/Asterisk+12+CDR+Specification You will start of call too, but only after end of call.

Also you can change dialplan so it do func_odbc and mark start of call in your favorite table in dialplan.

---func_cdr.conf---
[put_active]
writesql=insert into active_calls(uniqueid,calldate,start,src,did,accountcode) values('${VAL1}','${VAL2}',1,'${VAL3}','${VAL4}','${VAL5}');
dsn=mysql_general

In extensions.conf

exten => _X.,1,Set(ODBC_put_active()=${CDR(uniqueid)},${CDR(start)},${CDR(src)},${CDR(did)},${CDR(accountcode)})
arheops
  • 15,544
  • 1
  • 21
  • 27