Search:
     
3CX Phone System for Windows Download the Free Edition

PodCast

Ok, so first up, you will need this or something similar in your extensions.conf:

[podcast]
exten => s,1,Answer()
exten => s,2,Background(podcast)
exten => s,3,goto(2)

; === Security
exten => 1,1,Set(url=http://SecurityWireWeekly.blogspot.com/atom.xml)
exten => 1,2,Agi(mytest)
exten => 1,3,Set(url=http://www.codesermon.org/portals/15/podcast.xml)
exten => 1,4,Agi(mytest)
exten => 1,5,Goto(s,2)

; === VoIP
exten => 2,1,Set(url=http://vonradio.pulver.com/podcasts/audiorss.xml)
exten => 2,2,Agi(mytest)
exten => 2,3,Goto(s,2)

; === Comedy
exten => 3,1,Set(url=http://extrafancy.net/blog/wp-rss2.php)
exten => 3,2,Agi(mytest)
exten => 3,3,Set(url=http://podcast.dailystupid.com/blueg/index.xml)
exten => 3,4,Agi(mytest)
exten => 3,5,Set(url=http://feeds.feedburner.com/TripleParadoxPodcast)
exten => 3,6,Agi(mytest)
exten => 3,7,Goto(s,2)

And you will also need the AGI file:

#!/usr/local/bin/php -q
<?
       require "phpagi.php";

       $agi = new AGI();

       function read() {
               global $in, $debug, $stdlog;
               $input = str_replace("\n", "", fgets($in, 4096));
               if ($debug) fputs($stdlog, "read: $input\n");
               return $input;
       }

       $url2 = $agi->get_var("url");

       require_once('/var/lib/asterisk/agi-bin/magpierss/rss_fetch.inc');

       echo "VERBOSE \"[" . $url2 . "]\"\n";
       $rss = fetch_rss($url2);
       $x=0;
       foreach ($rss->items as $item) {
               if ($x < 1) {
                       $x++;
                       $dat = $item['atom_content'];
                       $dat2= $item['guid'];
                       $dat3= $item['enclosure'][0]['url'];
                       $title = $item['title'];
                       echo "VERBOSE \"URL: ".$dat3."\"\n";
                       if (strlen($dat3) > 0){
                               $dom3 = $dat3;
                       } else  if (strpos($dat2,"mp3") > 0) {
                               $dom3 = $dat2;
                       } else {
                               $dom = stristr($dat, '<a href="');
                               $dom2 = stristr($dom, '"');
                               if (strlen($dom2) > 0) {
                                       if (strpos($dom2,'"',1) - 1 > 0) {
                                               $dom3 = substr($dom2, 1, strpos($dom2, '"', 1) - 1);
                                       } else {
                                               $x--;
                                       }
                               } else {
                                       $x--;
                               }
                       }
               }
       }

       if (strpos($title,"VONradio")>-1) {
               $title="VON Radio";
       }

       echo "SET VARIABLE mytest \"" . $dom3 . "\"\n";
       echo "EXEC MP3Player " . $dom3 . "\n";
?>


You will also need to install magpie rss into the /var/lib/asterisk/agi-bin/magpierss/ directory.
Created by: ZX81,Last modification on Wed 05 of Sep, 2007 [20:22 UTC] by sbright


Please update this page with new information, just login and click on the "Edit" or "Discussion" tab. Get a free login here: Register Thanks! - support@voip-info.org

Page Changes | Comments

 





Search: