DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Send Mixed: Voice And Tts Message Using Www.smsmatrix.com Gateway In Perl

08.08.2010
| 1697 views |
  • submit to reddit
        Voice/TTS Gateway - Send Combined: Voice plus TTS Message: Perl Example
See more details at <a href="http://www.smsmatrix.com/?sms-gateway">SMS Gateway</a> website.

use LWP::UserAgent;
use HTTP::Request::Common;
use JSON();

my $msg =
{
 username => 'user55@hotmail.com',
 password => 'mypass',
 phone    => '12502012503',    # comma delimited list
 language => 'us',             # optional
 gender   => 'male',           # optional
 callerid => '12501112233',    # optional
 response => 0,                # optional
 msg      => [ 'http://www.danielroyce.com/voices/welcome_prompt.wav',
               'This text will be converted to voice by TTS engine.',
               'http://www.danielroyce.com/voices/segment2.mp3' ]
};
my $ua = new LWP::UserAgent;
my $res = $ua->request
(
 POST 'http://www.smsmatrix.com/matrix_vtts',
      Content_Type => 'application/json',
      Content      => JSON::to_json ($msg)
);
if ($res->is_error) { die "HTTP Error\n"; }
print "Matrix API Response:\n" . $res->content . "\n\n";