LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 04-20-2011, 05:36 PM   #1
jlarsen
Member
 
Registered: Jan 2005
Location: Dallas, TX
Distribution: Slackware 14.1
Posts: 80

Rep: Reputation: 15
Asterisk - Want to listen to recorded call from phone - not from web interface


Maybe I'm not using the right search terms, but I can't find anything on this. I have a setup of Slackware with Asterisk and FreePBX. I am recording calls on demand and can get to the recordings from the Call Monitor (web interface). I would like to be able to access the recording from the phone (Aastra 57i), much like a voice mail is accessed.

Anyone know how to do this - or if it is possible?
Thanks in advance.

Last edited by jlarsen; 04-21-2011 at 08:50 AM. Reason: mispelled word
 
Old 04-20-2011, 10:50 PM   #2
newbie to linux
LQ Newbie
 
Registered: Feb 2009
Location: Kitchener, ON Canada
Distribution: Ubuntu 11.10 with KDE 4.7.4, Debian Squeeze on a server
Posts: 28

Rep: Reputation: 0
Asterisk - Listen to recorded call from phone

It is possible.
I'm not sure, however, how the calls are being recorded, so I can't give specifics.
You'll need to define an extension for the number and assign an application to play the recorded call, either in dialplan or an external program.

Have a look at these webpages

From the asterisk wiki:
https://wiki.asterisk.org/wiki/displ...nning+Asterisk
https://wiki.asterisk.org/wiki/displ...n+Architecture

Info for calling other programs
http://www.voip-info.org/wiki/view/Asterisk+AGI
 
Old 04-26-2011, 05:43 PM   #3
jlarsen
Member
 
Registered: Jan 2005
Location: Dallas, TX
Distribution: Slackware 14.1
Posts: 80

Original Poster
Rep: Reputation: 15
I am getting close, mostly due to the instructions here:
http://web.archiveorange.com/archive...bgSSwBqkhSX5SP
It depends on getting the extension to know which mailbox to put the message in. That works good on incoming calls. On outgoing calls the variable ${CALLERID(num)} gives the outside number instead of an extension. The documentation on the asterisk wiki makes it sound like the channel variable ${EXTEN} should give the extension number so I tried using that instead. In my case it gives 2, but my extension is 101. Not sure what I'm missing.

Anyone know how to get the extension of the user who is pressing the command to record the call?
 
Old 04-27-2011, 02:13 PM   #4
jlarsen
Member
 
Registered: Jan 2005
Location: Dallas, TX
Distribution: Slackware 14.1
Posts: 80

Original Poster
Rep: Reputation: 15
OK, here is the whole solution I ended up using. Most of this came from the link above - thanks to Ben Willcox for posting his solution.
Note - I used *3 so it would not interfere with the *1 Automon recording

In extensions.conf
Code:
[macro-recordtovm]
exten => s,1,Set(MONITOR_FILENAME=${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)}-${CALLERID(num)})
exten => s,n,Set(DYNAMIC_FEATURES=recordtovm)
exten => s,n,MixMonitor(${MONITOR_FILENAME}.wav,b,/etc/asterisk/recordtovm.pl ${CALLERID(num)} ${MONITOR_FILENAME}.wav "${STRFTIME(${EPOCH},,%a %b %d %T %p %Z %G)}" ${EPOCH})
In features_applicationmap_custom.conf
Code:
recordtovm =>*3,self,Macro,recordtovm
In globals_custom.conf
Code:
DYNAMIC_FEATURES=>recordtovm
And create /etc/asterisk/recordtovm.pl
Code:
#!/usr/bin/perl -w
#
use strict;

my $monitordir="/var/spool/asterisk/monitor/";
my $vmdir="/var/spool/asterisk/voicemail/default/";
my $vmfolder="INBOX";
my $vmbox=$ARGV[0];
my $vmpath=$vmdir."$vmbox/"."$vmfolder";
my $monitorfilename=$ARGV[1];
my $calldate=$ARGV[2];
my $origtime=$ARGV[3];

opendir (DIR, $vmpath);
my @files = grep(/\.txt$/,readdir(DIR));
closedir(DIR);
my @sortedfiles = sort {$b cmp $a} @files;
my $vmid;
if ($sortedfiles[0] =~ /^(msg)(\d\d\d\d)(.txt)/)
{
      $vmid=$2;
      $vmid++;
}
else
{
      $vmid="0000";
};

open VMFILE,"> $vmpath/msg$vmid.txt";
print VMFILE ";\n";
print VMFILE "; Message Information file\n";
print VMFILE ";\n";
print VMFILE "[message]\n";
print VMFILE "origmailbox=$vmbox\n";
print VMFILE "context=\n";
print VMFILE "macrocontext=\n";
print VMFILE "exten=s\n";
print VMFILE "priority=\n";
print VMFILE "callerchan=\n";
print VMFILE "callerid=\n";
print VMFILE "origdate=$calldate\n";
print VMFILE "origtime=$origtime\n";
print VMFILE "category=\n";
print VMFILE "duration=\n";
close VMFILE;

if ($ARGV[1])
{
      system("mv $monitordir"."$monitorfilename $vmpath/msg$vmid.wav");
};

The kicker for me was that on outbound calls it used the CID of the trunk in the variable ${CALLERID(num)}. Go to each extension and put the extension number as the outbound CID for the extension. This gives it the correct value for recording to work. On outbound calls the phone provider here seems to overwrite this value anyway.

Times may not be exact, I don't know if EPOCH is current (when the file gets copied over) or when the call started. AFIAK, only the origtime is really needed. I only left origdate in there since I took the time to figure out the formatting.

I may go back someday and figure out how to stamp the start and stop recording times to get a recording duration.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
asterisk call out script - help understanding call files winairmvs Linux - Software 0 10-28-2010 04:52 PM
CentOS-Asterisk- /var/spool/asterisk/monitor How to decipher who's call is who's? tananthulus Linux - Newbie 2 12-08-2009 04:50 AM
LXer: Installing The Asterisk PBX And The Asterisk Web-Based Provisioning GUI On Linu LXer Syndicated Linux News 0 09-25-2007 02:50 PM
asterisk configuration to make a call PC - PC through asterisk priya001 Linux - Server 0 11-08-2006 06:06 AM
?call log web interface pudhiyavan Linux - Networking 1 02-09-2004 01:37 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:15 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration