Showing posts with label Asterisk. Show all posts
Showing posts with label Asterisk. Show all posts

Wednesday, January 26, 2011

Audio Format Converter For Asterisk

you can convert audio format for asterisk ivr from the following links.

http://www.digium.com/en/products/ivr/audio-converter.php

other option is to use imagic audio editor or sox


Monday, May 31, 2010

TrixBox Web Authentication

/etc/trixbox/httpdconf/trixbox.conf is the trixbox webauthentication file. its sample is given below you can modify it according to your requirement. it use htaccess method to restrict the contents.


cat  /etc/trixbox/httpdconf/trixbox.conf
#Password protect /var/www/html/admin


AuthType Basic
AuthName "Restricted Area"
AuthUserFile /usr/local/apache/passwd/wwwpasswd
Require user wwwadmin maint

 #Password protect /var/www/html/maint

AuthType Basic
AuthName "Restricted Area"
AuthUserFile /usr/local/apache/passwd/wwwpasswd
Require user maint



AllowOverride All

Wednesday, May 19, 2010

Asterisk Perl AGI

Below is the sample AGI scrip written in per perl.
In This Script You will learn the following
1. How to write AGI concept.
2. Some Perl Programming.(Variables, Arithmetic Operator, IF/ELSE/ELSIF , comparision operators, Labels etc.
3. How to use mysql queries in AGI using perl.
4. Asterisk Application Used( NoOp, SayDigits, SayNumber, Channel Variables, SayUnixTimeStamp etc)

#!/usr/bin/perl
# MODULE
use Time::Local;
use Asterisk::AGI;
use Mysql;

# CONFIG VARIABLES
$host = "localhost";
$database = "testdb";
$user = "root";
$pw = "JustForFun";

# MYSQL CONNECT
$connect = Mysql->connect($host, $database, $user, $pw);

# SELECT A DATABASE
$connect->selectdb($database);

# create agi instance
$AGI = new Asterisk::AGI;

$AGI->exec("NoOP","\----OnlineInquirySystem----\"");
$AGI->exec("Playback","custom/inquiry-thankyou");
Repeapt1:
$AGI->exec("Read","\option,custom/inquiry-tocheck,1,,,\"");
$option = $AGI->get_variable(option);

if ($option == 1 or $option == 2)
{
    EnterCheque:
    $AGI->exec("Read","cheque,custom/inquiry-pleaseenter,15,,,");
    $cheque = $AGI->get_variable(cheque);
    AfterCheque:
    $AGI->exec("NoOP","**$cheque**");
    if (length($cheque) == 10)
    {
    $AGI->exec("Playback","custom/inquiry-waitforinformation");
    $query="Select evttype_fk, issue_dtt,amount,inst_pk from lpsinst where check_no='$cheque'";
    $execute= $connect->query($query);
    @results=$execute->fetchrow();
    $AGI->exec("NoOP","=====================================");
    $AGI->exec("NoOP","**$results[0]**");
    $AGI->exec("NoOP","=====================================");
    if ($results[0] > 0)
    {
    $AGI->exec("NoOP","**CheckFound**");
    $evttype=$results[0];
    $issuedtt=$results[1];
    $amount=$results[2];
    $inst_pk=$results[3];
    $issueyear=substr $issuedtt,0,4;
    $issuemonth=substr $issuedtt,5,2;
    $issueday=substr $issuedtt,8,2;
    $issuehour=substr $issuedtt,11,2;
    $issueminute=substr $issuedtt,14,2;
    $issuesecond=substr $issuedtt,17,2;
    $AGI->exec("NoOP","$issuedtt");
    $AGI->exec("NoOP","$issueyear-$issuemonth-$issueday-$issuehour:$issueminute:$issuesecond");
    $issueutc=timelocal($issuesecond,$issueminute,$issuehour,$issueday,$issuemonth,$issueyear);
    $AGI->exec("NoOP","$issueutc");
    $bfd=length($amount) - 3;
        $afd= $bfd + 1;
        $dollars=substr $amount,0,$bfd;
        $cents=substr $amount,$afd,2;
    $AGI->exec("NoOP","D-$dollars");
    $AGI->exec("NoOP","C-$cents");
  
        if ($evttype == 3)
        {
        $AGI->exec("Playback","custom/inquiry-chequenumber");
        $AGI->exec("SayDigits","$cheque");
        $AGI->exec("Playback","custom/inquiry-wasissuedon");
        $AGI->exec("SayUnixTime","$issueutc,CET,BdY");
        $AGI->exec("Playback","custom/inquiry-amountof");
        $AGI->exec("SayNumber","$dollars");
        $AGI->exec("Playback","dollars");
        $AGI->exec("SayNumber","$cents");
        $AGI->exec("Playback","cents");
        $AGI->exec("PlayBack","custom/inquiry-nofurtherinfo");
        SecondOption:
                $AGI->exec("Read","\option,custom/inquiry-tocheck-2,1,,,\"");
                $option = $AGI->get_variable(option);
            if ($option == 1 or $option == 2)
                {
                goto Repeapt1;
                } elsif ($option == 3)
                    {
                    goto TalkToSupport;
                    } elsif($option == 4)
                        {
                        goto SecondOption;  
                        } elsif($option == 5)
                                                    {
                            EndCall:
                            $AGI->exec("Playback","custom/inquiry-thankforcalling");
                                                    goto END;
                                                    } else
                                {
                                $AGI->exec("Playback","custom/inquiry-invalidoption");
                                goto SecondOption;
                                }
      
      
        } elsif ($evttype == 4)
        {
        $query="select evt_dtt from lpshistory where inst_fk='$inst_pk' and evttype_fk=4";
            $execute= $connect->query($query);
            @results=$execute->fetchrow();
            $evtdtt=$results[0];
        $evtyear=substr $evtdtt,0,4;
            $evtmonth=substr $evtdtt,5,2;
            $evtday=substr $evtdtt,8,2;
            $evthour=substr $evtdtt,11,2;
            $evtminute=substr $evtdtt,14,2;
            $evtsecond=substr $evtdtt,17,2;
            $AGI->exec("NoOP","$issuedtt");
            $AGI->exec("NoOP","$evtsecond-$evtminute-$evthour-$evtday-$evtmonth-$evtyear");
            $evtutc=timelocal($evtsecond,$evtminute,$evthour,$evtday,$evtmonth,$evtyear);
        $AGI->exec("Playback","custom/inquiry-chequenumber");
                $AGI->exec("SayDigits","$cheque");
                $AGI->exec("Playback","custom/inquiry-wasissuedon");
                $AGI->exec("SayUnixTime","$issueutc,CET,BdY");
                $AGI->exec("Playback","custom/inquiry-amountof");
                $AGI->exec("SayNumber","$dollars");
                $AGI->exec("Playback","dollars");
                $AGI->exec("SayNumber","$cents");
                $AGI->exec("Playback","cents");
        $AGI->exec("Playback","custom/inquiry-wasvoidedon");
        $AGI->exec("SayUnixTime","$evtutc,CET,BdY");
        goto SecondOption;
        } elsif ($evttype == 5)
                {
                $query="select evt_dtt from lpshistory where inst_fk='$inst_pk' and evttype_fk=5";
                $execute= $connect->query($query);
                @results=$execute->fetchrow();
                $evtdtt=$results[0];
                $evtyear=substr $evtdtt,0,4;
                $evtmonth=substr $evtdtt,5,2;
                $evtday=substr $evtdtt,8,2;
                $evthour=substr $evtdtt,11,2;
                $evtminute=substr $evtdtt,14,2;
                $evtsecond=substr $evtdtt,17,2;
                $AGI->exec("NoOP","$issuedtt");
                $AGI->exec("NoOP","$evtsecond-$evtminute-$evthour-$evtday-$evtmonth-$evtyear");
                $evtutc=timelocal($evtsecond,$evtminute,$evthour,$evtday,$evtmonth,$evtyear);
                $AGI->exec("Playback","custom/inquiry-chequenumber");
                $AGI->exec("SayDigits","$cheque");
                $AGI->exec("Playback","custom/inquiry-wasissuedon");
                $AGI->exec("SayUnixTime","$issueutc,CET,BdY");
                $AGI->exec("Playback","custom/inquiry-amountof");
                $AGI->exec("SayNumber","$dollars");
                $AGI->exec("Playback","dollars");
                $AGI->exec("SayNumber","$cents");
                $AGI->exec("Playback","cents");
                $AGI->exec("Playback","custom/inquiry-wasredeemedon");
                $AGI->exec("SayUnixTime","$evtutc,CET,BdY");
        goto SecondOption;
                } elsif ($evttype == 6)
        {
        $query="select evt_dtt from lpshistory where inst_fk='$inst_pk' and evttype_fk=6";
                $execute= $connect->query($query);
                @results=$execute->fetchrow();
                $evtdtt=$results[0];
                $evtyear=substr $evtdtt,0,4;
                $evtmonth=substr $evtdtt,5,2;
                $evtday=substr $evtdtt,8,2;
                $evthour=substr $evtdtt,11,2;
                $evtminute=substr $evtdtt,14,2;
                $evtsecond=substr $evtdtt,17,2;
                $AGI->exec("NoOP","$issuedtt");
                $AGI->exec("NoOP","$evtsecond-$evtminute-$evthour-$evtday-$evtmonth-$evtyear");
                $evtutc=timelocal($evtsecond,$evtminute,$evthour,$evtday,$evtmonth,$evtyear);
                $AGI->exec("Playback","custom/inquiry-chequenumber");
                $AGI->exec("SayDigits","$cheque");
                $AGI->exec("Playback","custom/inquiry-wasissuedon");
                $AGI->exec("SayUnixTime","$issueutc,CET,BdY");
                $AGI->exec("Playback","custom/inquiry-amountof");
                $AGI->exec("SayNumber","$dollars");
                $AGI->exec("Playback","dollars");
                $AGI->exec("SayNumber","$cents");
                $AGI->exec("Playback","cents");
                $AGI->exec("Playback","custom/inquiry-wasstopedon");
                $AGI->exec("SayUnixTime","$evtutc,CET,BdY");
        goto SecondOption;
                } elsif ($evttype == 7)
                {
        $query="select evt_dtt from lpshistory where inst_fk='$inst_pk' and evttype_fk=7";
                $execute= $connect->query($query);
                @results=$execute->fetchrow();
                $evtdtt=$results[0];
                $evtyear=substr $evtdtt,0,4;
                $evtmonth=substr $evtdtt,5,2;
                $evtday=substr $evtdtt,8,2;
                $evthour=substr $evtdtt,11,2;
                $evtminute=substr $evtdtt,14,2;
                $evtsecond=substr $evtdtt,17,2;
                $AGI->exec("NoOP","$issuedtt");
                $AGI->exec("NoOP","$evtsecond-$evtminute-$evthour-$evtday-$evtmonth-$evtyear");
                $evtutc=timelocal($evtsecond,$evtminute,$evthour,$evtday,$evtmonth,$evtyear);
                $AGI->exec("Playback","custom/inquiry-chequenumber");
                $AGI->exec("SayDigits","$cheque");
                $AGI->exec("Playback","custom/inquiry-wasissuedon");
                $AGI->exec("SayUnixTime","$issueutc,CET,BdY");
                $AGI->exec("Playback","custom/inquiry-amountof");
                $AGI->exec("SayNumber","$dollars");
                $AGI->exec("Playback","dollars");
                $AGI->exec("SayNumber","$cents");
                $AGI->exec("Playback","cents");
                $AGI->exec("Playback","custom/inquiry-wasstopedandvoidedon");
                $AGI->exec("SayUnixTime","$evtutc,CET,BdY");
        goto SecondOption;
                } elsif ($evttype == 11 or $evttype == 12)
                {
        $query="select evt_dtt from lpshistory where inst_fk='$inst_pk' and evttype_fk=11 or evttype_fk=12";
                $execute= $connect->query($query);
                @results=$execute->fetchrow();
                $evtdtt=$results[0];
                $evtyear=substr $evtdtt,0,4;
                $evtmonth=substr $evtdtt,5,2;
                $evtday=substr $evtdtt,8,2;
                $evthour=substr $evtdtt,11,2;
                $evtminute=substr $evtdtt,14,2;
                $evtsecond=substr $evtdtt,17,2;
                $AGI->exec("NoOP","$issuedtt");
                $AGI->exec("NoOP","$evtsecond-$evtminute-$evthour-$evtday-$evtmonth-$evtyear");
                $evtutc=timelocal($evtsecond,$evtminute,$evthour,$evtday,$evtmonth,$evtyear);
                $AGI->exec("Playback","custom/inquiry-chequenumber");
                $AGI->exec("SayDigits","$cheque");
                $AGI->exec("Playback","custom/inquiry-wasissuedon");
                $AGI->exec("SayUnixTime","$issueutc,CET,BdY");
                $AGI->exec("Playback","custom/inquiry-amountof");
                $AGI->exec("SayNumber","$dollars");
                $AGI->exec("Playback","dollars");
                $AGI->exec("SayNumber","$cents");
                $AGI->exec("Playback","cents");
                $AGI->exec("Playback","custom/inquiry-wasescheatedon");
                $AGI->exec("SayUnixTime","$evtutc,CET,BdY");
        goto SecondOption;
                } else
        {
        $AGI->exec("Playback","custom/inquiry-chequenumber");
        $AGI->exec("SayDigits","$cheque");
        $AGI->exec("NoOP","**$cheque**");
        NoValidStatus:
        $AGI->exec("Read","\option,custom/inquiry-wasnotfoundtry,1,,,\"");
        $option = $AGI->get_variable(option);
        if ($option == 1)
            {
            goto EnterCheque;
            } elsif ($option == 2)
            {
            goto TalkToSupport;
            }  elsif ($option == 3)
                        {
                        goto EndCall;
                        } else
            {
            $AGI->exec("Playback","custom/inquiry-invalidoption");
            goto  NoValidStatus;
            }
      
        }

    } else
            {
        $AGI->exec("NoOP","**====CheckNotFound====**");
        $AGI->exec("Playback","custom/inquiry-chequenumber");
            $AGI->exec("SayDigits","$cheque");
            $AGI->exec("NoOP","**$cheque**");
            RepeatNotFound:
            $AGI->exec("Read","option,custom/inquiry-wasnotfoundtry,1,,,");
            $option = $AGI->get_variable(option);
            if ($option == 1)
            {
                goto EnterCheque;
                } elsif ($option == 2)
                    {
                        goto TalkToSupport;
                        }  elsif ($option == 3)
                            {
                            goto EndCall;
                            } else
                                {
                            $AGI->exec("Playback","custom/inquiry-invalidoption");
                            goto  RepeatNotFound;
                                }

  
        }

    } else
    {
    $AGI->exec("Read","cheque,custom/inquiry-rentercheque,15,,,");
    $cheque = $AGI->get_variable(cheque);
    goto AfterCheque;
    }

} elsif ($option == 3)
    {
    TalkToSupport:
    $AGI->exec("Playback","custom/inquiry-pleasehold");
    goto END;
    } elsif ($option == 4)
        {
        goto Repeapt1;
        } else
            {
            $AGI->exec("Playback","custom/inquiry-invalidoption");
            goto Repeapt1;
            }
      
END:

Saturday, February 20, 2010

SS7 BOX Software Installation

1. Install CentOS-5.4 Operating System on the system.
2. download source of asterisk,dahdi,libpri,asterisk-adons from www.asterisk.org
3. untar the sources one by one.
4. compile and install the sources one by one.


for compilation and installation go to each source directory and run the following command
1-  ./configure
2-  make
3-  make install
4-  follow on screen instructions.


in next chapter will will configure it as a IP PBX with single PRI card and then in next chapter will configure this is SS7 Box/ Signalling Gateway

Thursday, February 18, 2010

SS7 BOX Hardware and Price

1. Intel ATOM Dual Core .................6500
2. RAM 512 MB.................................1300
3. USB Stick(Kinston 8-GB).................850
4. Casing (Mini ATX).........................1880
-----------------------------------------------------------------------------
Total.................................................10530 PKR
------------------------------------------------------------------------------
Digiup TE100P Card........................45000
------------------------------------------------------------------------------
Grand Total......................................55530 PRK
------------------------------------------------------------------------------



Operating System.............................CentOS 5.4

What is SS7 BOX

SS7 Box is a computer running Linux OS(CentOS-5.4) and Asterisk from 4GB usb, on intel ATOM process with TE100p Digium Single PRI Card. this is realy low cost ss7 box / Signalling Gateway. It will cost you about 60K PKR. i will discuss its complete hardware and software configuration and installation process in my later posts. This can also be use as IP PBX with a single pri card. guys it would be a great box with low cost and enriched featured. Comming Soon...............

Wednesday, November 25, 2009

What is A2Billing


A2Billing combined with Asterisk now gives any Telecom company a very good reason to consider the A2Billing Soft-Switch over the traditional offerings for TDM and VoIP Soft-Switches as well as wholesale and IP PBX billing, particularly when you consider the cost of A2Billing – FREE! If you want to launch any of the following services, then A2Billing may be the system for you:
  • Traditional Calling Card services – A2Billing can be configured to provide standard calling card services via traditional “dial through”, with PIN or CID authentication.
  • Callback services, A2Billing supports a number of call-back methods including ANI, DID and web based call-backs.
  • VoIP residential services – Customers can be issued with a softphone or hard phone and be billed for calls made via Voice over IP.
  • VoIP wholesale termination - A2Billing and Asterisk can be used as a softswitch to terminate and bill large numbers of VoIP minutes from a number of sources such as resellers and distributors of your services.
  • VoIP termination for Asterisk and FreePBX systems. – With the growth of IP based PBX systems, as well as the asterisk based systems, A2Billing can be used to provide services and billing to IP PBX resellers and Asterisk system integrators.
  • DID termination and redirection. DID can be redirected to any SIP, IAX or PSTN destination with monthly charges and duration based charges.
Its is fair to say that A2Billing when combined with Asterisk is is now a full featured telecom platform and softswitch providing converged services, with self contained billing (pre or post-paid), reporting and statistics for IP and TDM based voice networks and can be configured to supply a wide range of services, rate calls, prepare and send out invoices, as well as accept payments via a number of payment service providers.
The A2Billing solution comprises of the following components: -
  • Server: The computer to run the system.
  • Line Interface Cards: The Digium hardware (optional)to connect to the TDM network (PRI, BRI, Analogue)
  • Linux: The base operating system
  • Asterisk: The telephony engine
  • Apache: The web server
  • MySQL/Postgresql: The back end database
  • A2Billing: The Billing engine handling Authentication, Authorisation and Accounting.
The platform can be fitted with a TDM cards to interconnect with the PSTN, and can support in excess of 120 concurrent calls given the right hardware. If more capacity is required, then more Asterisk servers can be added as necessary.
The A2Billing Platform has been deployed in a number of commercial environments by both traditional TDM based telecoms companies wishing to move into the VoIP market, and calling card and call-shop businesses. Additionally, there has been a lot of interest from IT and networking companies who are beginning to deploy VoIP PBXs in addition to their traditional business, and wish to enjoy an ongoing income by terminating their customer’s calls using A2Billing as their Wholesale Billing Platform.
A2Billing is licenced under the AGPL – this means that you have the freedom to modify the system to suit your own needs, within the rules of the AGPL.

official website for a2billing is www.a2billing.org.

Asterisk Installation

download asterisk source from http://www.asterisk.org/downloads on you local system. as it is *.tar.gz file you have to decompress it using the following command
tar -zxf  asterisk-1.XXX.tar.gz. >>> out put would be the directory with the name asterisk-1.XXX
go the that directory using the "cd asterisk-1.XXX" command and run the following commands.

make clean
make
make all
make install

and thats it.

for more details follow instruction given on below link.

http://www.voip-info.org/wiki/view/Asterisk+installation+for+CentOS+4.x

Monday, November 9, 2009

What is Asterisk?


Asterisk is the world's most popular open source telephony project. Under development since 1999, Asterisk is free, open source software that turns an ordinary computer into a feature-rich voice communications server. Asterisk makes it simple to create and deploy a wide range of telephony applications and services. Code for Asterisk, originally written by Mark Spencer of Digium, Inc., has been contributed from open source software engineers around the world. Currently boasting over two million users, Asterisk supports a wide range of telephony protocols. It includes rich support for the handling and transmission of voice over traditional telephony interfaces including analog lines, ISDN-BRI lines and digital T1/E1 trunks. Asterisk also features support for a wide range of VoIP protocols including SIP, IAX and H.323 among others. It supports U.S. and European standard signaling types used in business phone systems, allowing it to bridge between next-generation voice-data integrated networks and existing infrastructure.
Asterisk is released as open source under the GNU General Public License (GPL), and it is available for download free of charge. Asterisk® is the leading open source telephony project and the Asterisk community has been ranked as a key factor in the growth of VoIP.