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 Voice Phone Call Via Voice Gateway At Www.smsmatrix.com

07.09.2010
| 3323 views |
  • submit to reddit
        Send voice phone call via voice gateway at <a href="http://www.smsmatrix.com/?sms-gateway">www.smsmatrix.com - voice gateway</a>.

use LWP::UserAgent;
use HTTP::Request::Common;

# The voice file provided must be in mp3 or wave format.
# It will be converted to: 16Bit 8kHz mono wave format.

my $ua = LWP::UserAgent->new();
my $res = $ua->request
(
 POST 'http://www.smsmatrix.com/matrix_voice',
      Content_Type => 'form-data',
      Content      => [ username  => 'user@hotmail.com',
                        password  => 'pass8988',
                        phone     => '12502771720',  ## comma delimited list
                        voicefile => ['/tmp/november_sale.wav'],
                        response  => 1,  ## optional
                        callerid  => '16307791722'  ## optional
                      ]
);

if ($res->is_error) { die "HTTP Error\n"; }
print "Matrix API Response1: " . $res->content . "\n\n";