Recorded phone calls in iTunes via RSS

calls in itunes via rss

I setup my Asterisk PBX to use the monitor() application to record phone calls. Then I wrote some perl code that generates an iTunes compatible RSS feed, embedding the recorded phone calls as media enclosures.

The result is an archive of my phone calls in iTunes updating automatically via RSS. I think I’ll create a second RSS feed for voicemails…

Update: I’ve had a few requests for the perl that did this for me. Follow on through for the goodies.

This should probably use a RSS library instead of manually printing the feed, but who cares?


#!/usr/bin/perl
use File::stat;
use Time::localtime;
use strict;
use warnings;

my $dirname = ".";
my $size;
my $date;

# print some rss header junk
print < < "EOF";



  
https://jstownsley.com/
    My Phonecalls, woowah
    Perl Glue Baby!
    http://blogs.law.harvard.edu/tech/rss
    en-us
Sun, 27 Nov 2005 00:02:19 -0800
    Sun, 27 Nov 2005 00:02:19 -0800
    J. S. Townsley
    no
    
      J. S. Townsley
      jst\@jstownsley.com

    no
    
      
    
EOF

opendir(DIR, $dirname) or die "can't opendir $dirname: $!";
while (defined(my $file = readdir(DIR))) {
    if ($file =~ /^\./) { next; }
    $size = -s "$dirname/$file";
    next if $size < = 321324;
    $date = ctime(stat("$dirname/$file")->mtime);

    # PRINT THE ITEM TO RSS

    print < < "EOF";
    

      < ![CDATA[$file]]>
$date
      
      J. S. Townsley
      no

EOF

}
closedir(DIR);

print "  \n";
print "\n"; # END RSS FEED