Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

VoiceXML Chatterbox Listener

by saskaqueer (Friar)
on May 23, 2004 at 02:59 UTC ( #355682=monkdiscuss: print w/replies, xml ) Need Help??

My interest in the chatterbox, as well as my interest in VoiceXML, as well as my boredom, have made me create a very simple VoiceXML application that reads the contents of the public chatterbox to any listeners. You connect to the application and it simply enters an inifinite loop, checking the public chatterbox for new messages. New messages are read out loud using text-to-speech. I even included the use of 2 simple sound files to spruce things up a bit.

To tune in to the chatterbox from anywhere in the United States or Canada, call 1-800-289-5570 and enter 9991420869 as the application PIN. If you download the software available on, you can also access the application using a broadband connection rather than a phone line. The freeworlddialup 'phone #' you call to directly access the VoiceXML chatterbox listener at is **86919991420869. Code follows readmore below.

update: As per request, the perl script that produces the VoiceXML document is below. I was having problems using a .pl extension (even though I output a text/xml content-type header), so I finally gave up and renamed it to /chat.xml and tweaked Apache to make .xml a perl script in the root directory of my virtual host. The code:

update: Fixed typo s!baregin!bargein! in one of the prompts. Thanks to herveus for that one.

#!c:/perl/bin/perl -w $| = 1; use strict; use CGI; use LWP::Simple; use XML::Simple (); my $q = CGI->new(); print $q->header( { Cache_control => 'no-cache', Expires => '-1y', Content_type => 'text/xml' } ), qq{ <?xml version="1.0" encoding="UTF-8"?> <vxml version = "2.0" > <var name="skipintro" expr="0" /> <var name="last_id" expr="0" /> <var name="doc_count" expr="0" /> <form id="main"> }; my $xml = XML::Simple->new(); my $chatter = get( '' +); my $chat = $xml->XMLin( $chatter, ForceArray => [ 'message' ] ); my $last_id = $q->param('last_id') || 0; my $doc_count = $q->param('doc_count') || 0; ++$doc_count; unless ( $q->param('skipintro') ) { print qq{ <block> <prompt bargein="false"> Welcome to the purl-munks voice XML chatterbox listene +r. Whenever you hear the <audio src="/audio/ding.wav" /> sound, it means that new messages are about to be read + out loud. The <audio src="/audio/buzzer.wav" /> sound mean +s that no new messages are available on the public chatt +erbox. Note that this phone call runs in an infinite loop to +make sure you catch all the chatter! \\!p2000 </prompt> </block> }; } if ( $doc_count == 19 ) { print qq{ <field name="keepgoing" type="boolean"> <prompt bargein="true"> User input required. Press <emphasis>one</emphasis> to continue listening. </prompt> <filled> <prompt>Thank you. \\!p1000 </prompt> <assign name="skipintro" expr="1" /> <assign name="doc_count" expr="0" /> </filled> </field> }; } else { print qq{ <block> <assign name="doc_count" expr="'$doc_count'" /> </block> }; } if ( grep { $_->{message_id} > $last_id } @{ $chat->{message} } ) { print qq{ <block> <prompt><audio src="/audio/ding.wav" /> \\!p2500 </prompt> </block> }; } else { print qq{ <block> <prompt><audio src="/audio/buzzer.wav" /></prompt> </block> }; } for my $msg ( @{ $chat->{message} } ) { next if ( $msg->{message_id} <= $last_id ); my $txt = $msg->{text}; # Fix up output to sound better in oral speech. # This could use a _heck_ of a lot of work. # strip out links $txt =~ s!\[[^\|]+\|([^\]]+)\]!$1!g; $txt =~ s!\[([^\]]+)\]!$1!g; # remove html tags. 1 while $txt =~ s!<[^>]+>!!g; # remove smileys :) $txt =~ s![:;]\-?[\(\)\|]!!g; # remove [tye]-type smileys (: $txt =~ s![\(\)\|]\-?[:;]!!g; if ( $txt =~ s!\A/me!! ) { print qq{ <block> <prompt> <emphasis>$msg->{author}</emphasis> <![CDATA[ $txt ]]> \\!p2000 </prompt> </block> }; } else { print qq{ <block> <prompt> <emphasis>$msg->{author}</emphasis> says: \\!p500 <![CDATA[ $txt ]]> \\!p2000 </prompt> </block> }; } $last_id = $msg->{message_id}; } print qq{ <block> <prompt> \\!p35000 </prompt> <assign name="last_id" expr="'$last_id'" /> <assign name="skipintro" expr="1" /> <submit next="/chat.xml" fetchhint="safe" method="get" namelist="last_id skipintro doc_count" /> </block> </form> </vxml> };

Replies are listed 'Best First'.
Re: VoiceXML Chatterbox Listener
by rjray (Chaplain) on May 23, 2004 at 10:36 UTC

    I'm curious-- who is the application host for this? I only ask because VoiceXML is a core part of what my company does (though my area of expertise is elsewhere).


Re: VoiceXML Chatterbox Listener
by jZed (Prior) on May 23, 2004 at 16:05 UTC
    Drifting OT, here, but what's the deal with freeworldialup? Is it a Good Thing (tm)? For example, what is their privacy policy? I can't find a single word about it on their website.

      The links to their privacy policy and terms of service are located on their site map.

      I wouldn't actually use FreeWorldDialup for actual phone calls due to term #7 of their terms of service: "We retain the unlimited, perpetual right to access, collect, compile, market, sell or otherwise use any information that we collect or process through or in connection with the Service.". To me, this basically equates to "We are allowed to record your phone calls and do whatever we please with them, including selling them".

      ++ $freeworlddialup for ( 'cool', 'service' ); $freeworlddialup -= 2**999 for ( 'privacy', 'invasion' );

        this basically equates to "We are allowed to record your phone calls and do whatever we please with them, including selling them"

        Does this mean that by relaying the chatterbox through them, you're giving away these rights on behalf of anyone who uses the CB? If so, I think it might be a good idea to find a provider with a less onerous privacy policy. Perhaps I am misunderstanding how you have this thing set up, though.

Warning! Three way calling feature!
by Anonymous Monk on May 25, 2004 at 17:43 UTC
    In some of the US, this: **86919991420869 Translates to: **86 (Engage three way calling) 9 (Exit my PBX) 1-999-142-0869 (Dial a number) Seems unhelpful. Have an url:

      One should be careful about dialling phone numbers found on the internet.

      Another url: may be useful.

      Additional Supplement: Refining comments we made during the Workshop, the FTC and the FCC should coordinate the assignment of geographic area code (NPA) overlays specifically for use by Pay-per-Call, Caller-Paid, and/or Premium services.

      The area codes could be:

      • a geographic intra-NANP International area code (NPA) overlay of 999 .
      • Geographic area codes (NPAs) from 990 through 999, such as:
        • Pay-per-Call (no International routing)
        • USA Pay-per-Call (International routing)
        • Canada Pay-per-Call (International Routing)
        • Caribbean Pay-Per-Call (International Routing)
        • Pay-Per-Call outside USA, Canada, Caribbean, Pay-Per-Call (International)
      • Reserved for expansion (such as other Premium or Caller-Paid Services) or 989 Billing Inquiries in form 1-999-NPA-NXXx.

      Yes, except that the program that this runs on uses a broadband connection, not a modem. So in this particular case, I don't think it is possible for this to apply. For regular phones, you use the 1-800 number I provided. On freeworlddialup, you can also use the 1-800 number but it takes more key entries to get there than the shortcut method.

Re: VoiceXML Chatterbox Listener
by Anonymous Monk on May 24, 2004 at 05:25 UTC
    have u used perl to do the application .. if it is perl can u share the code with the community ??

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: monkdiscuss [id://355682]
Front-paged by diotalevi
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (1)
As of 2017-03-26 03:41 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (313 votes). Check out past polls.