Asterisk time based routing

*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

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.

[AutoAttendant]
exten => start,1,Verbose(2,Entering our auto-attedant)
same => n,Answer()
same => n,Playback(silence/1)
; We’re closed on New Years Eve, New Years Day, Christmas Eve, and Christmas Day
same => n,GotoIfTime(*,*,31,dec?holiday,1)
same => n,GotoIfTime(*,*,1,jan?holiday,1)
same => n,GotoIfTime(*,*,24,dec?holiday,1)
same => n,GotoIfTime(*,*,25,dec?holiday,1);
We can set auto-attendant dialplan to check for national holidays, if that is true,jump to “exten => holiday,1,Verbose(2,We’re closed for a holiday.)”
; Our operational hours are Monday-Friday, 9:00am to 5:00pm.
same => n,GotoIfTime(0900-1700,mon-fri,*,*?open,1:closed,1) ; It true jump to exten open, else jump to exten closed.
exten => open,1,Verbose(2,We’re open!)
same => n,Background(custom/open-greeting)
exten => closed,1,Verbose(2,We’re closed.)
same => n,Playback(custom/closed-greeting)
same => n,Voicemail(general-mailbox@default,u)
same => n,Hangup()
exten => holiday,1,Verbose(2,We’re closed for a holiday.)
same => n,Playback(custom/closed-holiday)
same => n,Voicemail(general-mailbox@default,u)
same => n,Hangup()
GotoIfTime() application is not only good for an auto-attendant but it can be used anywhere in the dialplan. For example sometimes we just want to forward calls to different people based on time, such as when support staff is not in the office on weekends, but are on call:
[support]
exten => 100,1,Verbose(2,Calling Support Staff.)
same => n,GotoIfTime(*,sat&sun,*,*?on_call,1)
same => n,Dial(SIP/support,30)
same => n,Voicemail(support@default,u)
same => n,Hangup()
exten => on_call,1,Verbose(2,Calling On-Call Support Staff.)
same => n,Dial(SIP/didforsale/8888888888&SIP/didforsale/8555555555,30)
same => n,Voicemail(support@default,u)
same => n,Hangup()

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

Learn more about our Products

SIP TRUNKING

PHONE NUMBERS

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.

 

Originating calls from a webpage using asterisk

*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 = 0.0.0.0
[clicktocall] secret = password
deny=0.0.0.0/0.0.0.0
permit=127.0.0.1/255.255.255.0
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.

<?php
$host = “127.0.0.1”;
$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”);
sleep(1);
fclose($oSocket);
?>

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

Learn more about our Products

SIP TRUNKING

PHONE NUMBERS

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.

Count Calls From Asterisk Dialplan

*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

Count Calls From Asterisk Dialplan

For counting the calls in Asterisk , you can use the Group() dialplan function from Asterisk dialplan.

To add a call to the group function, use this dialplan application

Set(GROUP()=call_count)

To view the call count, use following dialplan application

Noop(${GROUP_COUNT(call_count)})

Below dialplan example shows you how to use the group function to limit the total call count to 10 in your asterisk box

exten => _X.,1,Set(GROUP()=call_count)
exten => _X.,n, Noop(Total number of calls : ${GROUP_COUNT(call_count)})
exten => _X.,n,GotoIf($[${GROUP_COUNT(call_count)} < 11]?continue:hang)
exten => _X.,n(continue),Noop()

Add your dialplan here to handle calls when the call count is below 11

exten => _X.,n(hang),Hangup

Checkout

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

Learn more about our Products

SIP TRUNKING

PHONE NUMBERS

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.

FreePBX SIP Trunk Configuration

FREEPBX SIP TRUNK CONFIGURATION

For creating a sip trunk between didforsale and your FreePBX system, first create a sip account from your didforsale account. For creating the sip account, log in to your didforsale dashboard, go to Interconnection > Manage SIP Accounts and then click Add New SIP Account button.  Fill the details and click add. This will create a sip account in your didforsale account and send you an email to activate. You can use this sip account to create the sip trunk between didforsale and your FreePBX system.

For adding the SIP account to your FreePBX system, log in to your FreePBX, go to Connectivity, click trunks, then click Add SIP Trunks

Inside the Outgoing Settings, add the below parameters in the PEER Details box

type=friend

secret=sip account password*

username=sip username*

qualify=no

host=sip.la1.didforsale.com*

dtmfmode=rfc2833

context=from-trunk

canreinvite=no

allow=ulaw

insecure=port,invite

fromdomain=sip.la1.didforsale.com*

Also, add the register string as shown below

username:password@sip.la1.didforsale.com*

Save and Apply Config

For making outgoing calls using this trunk, go to Outbound Routes and create a new route. Select the trunk for this route as the newly created sip trunk

* Note – Please use the username, password and domain received via email after creating SIP account.

New Posts

How to troubleshoot common SIP problems?

How to troubleshoot common SIP problems? SIP, or Session Initiation Protocol, is a popular protocol used for VoIP communications. As with any technology, issues can arise with SIP, which can impact the quality and reliability of your communications. Here are some...

read more

Learn more about our Products

SIP TRUNKING

PHONE NUMBERS

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.

Calculate Difference between two Time Values from Asterisk Dialplan

*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

Calculate Difference between two Time Values from Asterisk Dialplan

For calculating the difference between two times, the time values should be converted to an epoch value first. This  can be done using the Asterisk function STRFTIME. Use the below dialplan to convert current time to an epoch value

Set(time=${STRFTIME(${EPOCH},,%s)})

Below dialplan shows, asterisk setting two variables starttime and endtime with the current time in an interval of 10 seconds and then calculating the difference between the variables and saving to variable diff. The output of variable diff will always be 10 in the below dialplan

exten => 1000,1,Set(starttime=${STRFTIME(${EPOCH},,%s)})

same => n,Wait(10)

same => n,Set(endtime=${STRFTIME(${EPOCH},,%s)})

same => n,Set(diff=$[${endtime} -${starttime}])

same => n,Hangup

Checkout !

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

Learn more about our Products

SIP TRUNKING

PHONE NUMBERS

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.