Perl With Asterisk PBX

->Perl is most supporive language for Asterisk P.B.X
->There are many function which are used in Asterisk P.B.X only some of the function are written in following lines:


::::::THIS PAGE CONTAIN FOLLOWING TOPICS:::::

  • GET OPTION
  • GET DATA
  • STREAM FILE
  • RECORD FILE

-->First starting Perl Scripting with LINUX O.S in Asterisk P.B.X.We just write following firt lines and make an object for A.G.I


#!/usr/bin/perl
$|=1;
use Asterisk::AGI;
$AGI=new Asterisk::AGI;
#use DBI;


###GET OPTION#######
$PromptPath="/home/sharjeel/ServiceName/prompts/english/";      #Complete path of prompts
$language=$AGI->get_option("/home/sharjeel/horlics/prompts/english/language","1,2,3,4,5,6,7,8,9,0,*,#",5000);


Now value contain in  $language variable is in ascii formate

######GET DATA############
$p_no=$AGI->get_data("$p_path",5000,11);
Here $p_no variable contain 11 digit value
print (STDERR "\nP_NO IS-->$p_no&& A_IS-->$a\n");

here STDERR use for printing ERROR on Asterisk Console


##########STREAM FILE###########

Stream File is an Asterisk function which is used to play a voice file.
$AGI->stream_file("$p_path","1,2,3,4,5,6,7,8,9,0,*,#");


#########RECORD FILE##########
Here in $FileRecordPath contain the location where we want to record file from cell phone And then Record_File function record file as per given location with given termination digit and time period. 
$FileRecordPath="/home/sharjeel/ServiceName/recording/".$ARGV[0]."_".$CurrentDate;
$AGI->record_file("$FileRecordPath","wav","0","60000");
$p_path=$path."beep";
$AGI->stream_file("$p_path","1,2,3,4,5,6,7,8,9,0,*,#");

Comments

Popular posts from this blog

Error : DependencyManagement.dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: com.adobe.aem:uber-jar:jar:apis -> version 6.3.0 vs 6.4.0

Operators in Asterisk with Linux

ERROR Exception while handling event Sitecore.Eventing.Remote.PublishEndRemoteEventException: System.AggregateExceptionMessage: One or more exceptions occurred while processing the subscribers to the 'publish:end:remote'