*Try Risk Free for first month and know the DIDforSale SIP Trunking difference*

asterisk sip trunk provider

Some of our key SIP Trunking features:-

Special Intro Offer

FREE First Month

Scale as per your need
Flexible Pricing options to choose
 Reliable service & support
 Easy account management
 Multiple compatible platforms

Largest Phone Number inventory
SMS/MMS enabled Phone Numbers
 Number Portability
 Easy Integration
 30-day money back guarantee

Originating Calls from a Webpage using Asterisk

Asterisk can be used to originate calls from a web page. Asterisk Manager Interface (AMI) allows you to manage call origination. AMI also allows external programs to control Asterisk.

For doing this, you should have

  • A working Asterisk server
  • A SIP termination provider for sending calls out
  • A webpage for entering phone numbers

You have to first create a manager user in Asterisk.  This is created inside /etc/asterisk/manager.conf file

Move the existing manager file using the command

mv /etc/asterisk/manager.conf /etc/asterisk/manager-bk.conf

Create a new manager file

touch /etc/asterisk/manager.conf

Add the below contents to the newly created manager.conf file

[general] enabled = yes
port = 5038
bindaddr =
[clicktocall] secret = password
read = system,call,log,verbose,agent,user,config,dtmf,reporting,cdr,dialplan
write = system,call,agent,user,config,command,reporting,originate,message

Now, create a php script,  and the following contents to it. Your webpage will be posting numbers to this php script. It will then connect to Asterisk using AMI. Send calls to the entered number and connect it to an extension 1000 in the system.

$host = “”;
$user = “clicktocall”;
$secret = “password”;
$context = “dial”;
$waitTime = “30”;
$priority = “1”;
$number = $_POST[“number”];
$oSocket = fsockopen($host, 5038, $errnum, $errdesc) or die(“Connection to host failed”);
fputs($oSocket, “Action: loginrn”);
fputs($oSocket, “Events: offrn”);
fputs($oSocket, “Username: $userrn”);
fputs($oSocket, “Secret: $secretrnrn”);
fputs($oSocket, “Action: originatern”);
fputs($oSocket, “Channel: SIP/didforsale/$numberrn”);
fputs($oSocket, “WaitTime: $waitTimern”);
fputs($oSocket, “exten: 1000rn”);
fputs($oSocket, “Context: $contextrn”);
fputs($oSocket, “Async: Truern”);
fputs($oSocket, “Priority: $priorityrnrn”);
fputs($oSocket, “Action: Logoffrnrn”);

Create a dialplan entry now to send calls to extension 1000 in the system when the number answers. Open your /etc/asterisk/extensions.conf file and add the following to it

[dial] exten => 1000,1,Dial(SIP/1000)
Same => n,Hangup

Now create your webpage, add a number field in the webpage to enter the number. When someone enters a number in this field, post it to the php script we just created.

That is it and now someone enters a number in the webpage, he will get a call immediately and when he answers the call, extension 1000 will ring and they will get connected.

Why to manage a phone system

when you can get for free.

Check Out

Asterisk one way audio issue

Are you having an audio issues in your Asterisk? 
Well it’s a common issue with PBX to have audio issues like one way audio or no audio. Sometimes only caller can hear remote party or remote party only can hear the caller. You must be wondering what causes this issue? This problem in audio is mainly because of the NAT issues. We recommend to use NAT with enabling 10000-20000 UDP ports on firewalls and also to enable natting on trunks

read more

How to limit the number of calls in asterisk

Learn how you can limit number of simultaneous calls on Asterisk based SIP Trunk. If you want to limit the number calls for your SIP peer or friend in Asterisk use call-limit in your trunk configuration.

read more

Asterisk time based routing

This is a very common requirement that route the calls to Voice-mail after office hours. Or you can transfer the calls to your cell phone after certain time say 6:00pm. In Asterisk you can also control the call location based on time and date.

read more

Asterisk Most frequently used commands

Find most frequently used asterisk commands. This is simple cheat sheet to view what’s happening inside your asterisk server. You can see how many calls, how many users who is communicating with your system.

read more

Learn more about our Products



Visit SIP Trunking Pricing to see which plan suits your business!

With so many options to pick from it can often be hard to decide what’s best.
Our plans have been packaged together to give you optimum output.

Our SIP Trunks are Compatible with wide range of PBX & Platforms.

Share This