[*] Asterisk, PHP, AGI, XML and WTF

Justin Davidow justin at xens.net
Fri Jan 25 17:39:50 CST 2013


Just tossed it on a PBX I have around:

2046668226

option 1 is the menu.   If you change the result of the XML,  you'll get
the updated result!  (no caching in the PHP,  so it's always what's
returned)


On 25 January 2013 17:26, Justin Davidow <justin at xens.net> wrote:

> Here's an alpha implementation:
>
>
> Drop this in your agi-bin (likely at /var/lib/asterisk/agi-bin )
>
> http://pastebin.com/RjgN8MHg
>
>
> and put this in your dialplan (likely extensions.conf,  or
> exensions_additional.conf under "from-internal-custom") somewhere:
>
> (you MAY want to put this in a [section],  and include=> section in your
> existing contexts)
>
> exten => 6543,1,Answer
>
> exten => 6543,n,AGI(lotto.php)
>
> exten => 6543,n,Noop(${ScriptResult})
>
> exten => 6543,n,Hangup
>
> When asterisk receives a call to that extension,  it will run the script,
>  which gets the XML results (only reads the first one), and sends
> "playnumber(number)"  to asterisk.
>
> (unfortunately,  asterisk treats numbers over 10 funny,  and you'll want
> to come up with something..  the number 35 is spoken "thirty, [pause] five"
>  which LOGICALLY works,  as the numbers should ALWAYS be in ascending
> order.)
>
> you could do something like,  take input from the user to select the date,
>  maybe even have it LIST the dates from the XML.  whatever you like!
>
>
>
> On 25 January 2013 16:07, Hernan Popper <hernanp at key.com.ar> wrote:
>
>> Dear gurues
>>
>> I'm trying to do a proof of concept, and I could use some help.
>>
>> I would like an Asterisk to be able to speak the lottery results. In a
>> nutshell, there is an xml feed (
>> http://www.wclc.com/scraped/main/winning_numbers.xml) <http://www.wclc.com/scraped/main/winning_numbers.xml)>with the winning numbers, and I want an asterisk to read out loud those
>> numbers using Allison's voice. Sounds simple.
>>
>> I've been looking at some php examples I got from PIAF (nv-news,
>> nv-stocks, etc), but I'm not a programmer nor expert in AGI, PHP or any
>> other of those amazing technologies.
>>
>> Any advise/clue/ideas?
>>
>> Hernan
>>
>>
>> _______________________________________________
>> Asterisk mailing list
>> Asterisk at muug.mb.ca
>> http://www.muug.mb.ca/mailman/listinfo/asterisk
>>
>>
>
>
> --
>  - Justin Davidow
> Unit #9 - 860 Westminster Ave
> Winnipeg, MB, Canada
> R3G1A9
> Work# 204.272.2942
> Home# 204.480.3896
> MSNID: phyrexian at shaw.ca
>



-- 
 - Justin Davidow
Unit #9 - 860 Westminster Ave
Winnipeg, MB, Canada
R3G1A9
Work# 204.272.2942
Home# 204.480.3896
MSNID: phyrexian at shaw.ca
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.muug.mb.ca/pipermail/asterisk/attachments/20130125/df8fc40f/attachment-0001.html>


More information about the Asterisk mailing list