VoIP Cookbook: An interesting Extension Examples
Asterisk is able to transfer calls. This can be done by adding the parameter “t” (lowercaps) to the user context, such as in the following syntax:
exten => 250,1,Dial(SIP/alrac,10,rt)
This way, the call transfer can be done by pressing "#", followed by the extension number. Asterisk will say "transfer" when you press "#" and sounds a dial tone until we enter the extension number to which we wish to call.
Asterisk has twenty parking spaces, number 701-720. Transfer the call that you want to park at extension # 700 and Asterisk will automatically park it at any empty lot and provide you with extension of where it is parked. To retrieve the call, you only have to dial the extension number. tempar extension mendial enough parking.
The steps necessary for parking calls are as the following:
- Add include => parkedcalls to the default context, or the one that you wish to have park call facility.
- You should have the file /etc/asterisk/features.conf which was created during installation. Make sure that you have the following syntax:
[general] parkext => 700 parkpos => 701-720 context => parkedcalls parkingtime => 180
You need to restart your Asterisk server through the console, as reloading is not sufficient. You can attempt it in the internal extension. So if there is an incoming call, the call can be parked by pressing #700, and Asterisk will say the extension number of where the call is parked. The caller will hear a beautiful music played through Music On Hold. When the parking time is up, then our extension number first dialed will be dialed again and we have the option whether to receive the call or not to receive and forward the call to voicemail.
The parameter "t" (lowercase) means that only the recipient of the call can transfer calls. This means we can only park a call just once. But if we add the parameter "T" (capitalized), such as:
exten => 250,1,Dial(SIP/alrac,10,rT)
then we can transfer the calls, whether as someone who receive the calls or as the caller. All this also means that we can unpark a call, park the call and transfer the call.
Asterisk can be configured for hunting telephone numbers. A hunt group is a list of phone numbers which will be rang consecutively until we pick up the phone. The example shows two phone extensions and a mobile phone number. The caller simply call extension 100 and Asterisk will do the rest of the tasks. Each phone will ring for 20 seconds, and when nobody pick it up, Asterisk will dial the next phone.
[alrac-followme] exten => 100,1,Dial(SIP/350,20,r) exten => 100,2,Dial(SIP/351,20,r) exten => 100,3,Dial(Zap/1/1231234567,20,r) exten => 100,4,VoiceMail(u350) exten => 100,dial+101,VoiceMail(b350)
Other variation of the hunting technique above is that all numbers could ring at the same time. This is known as group ring. You can ring all the phones in a department if you wish them to do so. The sample configuration is:
[customer service] exten => 666.1,Dial(SIP/605&SIP/604&SIP/606,40,tr) exten => 666.2,Voicemail(s699)
In the example, extension 604, 605, and 606 will be rang simultaneously when someone place a call to extension 666 from the Customer Service Department. If there is no one to answer the call within 40 seconds, the call will be forwarded to Voicemail.