L
L
lVlOzART2016-08-25 16:15:27
Asterisk
lVlOzART, 2016-08-25 16:15:27

Script to send the phone number of a missed call to the mail from the name of the call recording file?

There is an asterisk, writes all calls in the format /var/spool/asterisk/monitor/YYYY/MM/DD/in (or out) script which is at the beginning of the working! of the day, for example at 8:00 a.m., it generated a list from the caller_number_in_89******** format for the previous day from 17:00 p.m. to the script execution time, and if it was Monday, then from Friday 5:00 p.m. to the script execution time and sent it to e-mail.3a80ecd186ba46898c475eea4b091416.jpgOn the picture, I tested sending the ls output of this folder to the mail, I assume that either by searching the entire folder to look for a file containing the current date or stepping through the folders, I can’t imagine how to do this, the task was set recently, I smoke mana and along the way I ask a question here. 2 main questions are how to search for the desired file depending on the date and how to sort the output, if it is more detailed, then just do it. Thanks in advance!

Answer the question

In order to leave comments, you need to log in

4 answer(s)
L
lVlOzART, 2016-08-31
@lVlOzART

I finally got my hands on it - here is a ready-made solution for my needs, maybe it will come in handy for someone:
Crontab -e:
#bash
#path to the bash #on
Monday (1) 8:00 run the weekly script #on
Tue Wed Thu Fri (2-5) 8:00 AM execute daily script
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
00 8 * * 1 /bin/bash .bin/crontab.weekly
00 8 * * 2- 5 /bin/bash .bin/crontab.daily
crontab.weekly !!! +x
#search in the records folder for all the wavs for the past 3780 minutes (Friday 17:00 to Monday 08:00) | select by incoming prefix | cut off piece with number | helmet # by mail
find /var/spool/asterisk/monitor/ -name *.wav -cmin -3780 | grep 'in'| cut -c43-74 | mail -s "Missed since Friday 17:00" [email protected] -t [email protected] , [email protected]
crontab.daily !!! +х #same
, only 900 minutes
find /var/spool/asterisk/monitor/ -name *.wav -cmin -900 | grep 'in'| cut -c43-74 | mail -s "Missed since 17:00 yesterday" [email protected] -t [email protected] , [email protected]
Saboteur thanks for the tip, otherwise I would have searched for the file names, wedged. As a result, we have a modest picture, the conclusion can still be finished, but this is quite satisfactory:
d1d5c7c8b2d6404c927a045bff706042.jpg

S
Saboteur, 2016-08-25
@saboteur_kiev

Smoke mana on the find command.
But you don't have a question, you have the task "someone give me a script".
Contact the exchange, someone will do this for 100-200 rubles.

S
silverjoe, 2016-08-25
@silverjoe

It is easier to integrate Aster with CRM and there will be no need to make such crutches.

L
Leks, 2016-08-26
@Leksnsk

Install Asterisk-CDR-Viewer-Mod:

https://github.com/prog-it/Asterisk-CDR-Viewer-Mod

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question