• Idefisk
  • Tools
  • Tutorials
  • Reviews
  • VoIP Providers
  • Archives
ZOIPER softphone
Back to Tutorials

6.1.2.13. ChanIsAvail (dialplan application)

1. ChanIsAvail - this application allows you to check whether the channel is available or not.

NOTE: This application is valid for Asterisk version 1.0.9 and above.

 


Syntax:

ChanIsAvail(Technology/resource[&Technology2/resource2]....)


If none of the requested channels are available the new priority will be n+101 (unless such a priority does not exist or on error, in which case ChanIsAvail will return -1).

If there is an available channel the execution will continue with the execution of the n+1 priority extension and also the variable ${AVAILCHAN} will be set with the name of the available channel. The ChanIsAvail application will return 0.

 


Purpose and usage

With this application you can check your channels to see whether there is a free one. If an available channel exists, its name will be set in the variable ${AVAILCHAN}.So you can use this variable for different purposes in your next extensions. For example you can use it to dial a user through the available channel.

 


Prerequisites

To use this application you need a working Asterisk PBX with registered users in iax.conf, sip.conf or mgcp.conf(It depends on which protocol you would like to use) and made extensions.

To see how the application works we recommend to use our IAX softphone Idefisk. You can download it from here. Please also read our tutorial to learn how to configure it to work with Asterisk PBX.

 


Asterisk PBX configurations

NOTE: This is only an example of what for you can use this application. Of course you can use it and for other things.

We need three registered users in iax.conf file. This is because we are going to use the IAX2 protocol. If you want to use other protocol such as SIP or MGCP, you have to do the configurations below respectively in sip.conf or mgcp.conf.



So, we have registered the users anatoliy, user1 and user2.

Type=friend means that this user can make and receive calls. Host=dynamic means that the IP is not static but dynamic through a DHCP server. Allow=all means that the line which this user will use, could support all audio codecs. Context=test - this shows that this user is working with the extensions in this context of the configuration file extensions.conf.



NOTE: Currently supported channels are ZAP, SIP, mISDN and IAX2. The MGCP channel is not supported.

When somebody dials 111 the Asterisk PBX will answer the cal. The the ChanIsAvail application will be executed. This application will check first the channel IAX2/1 and if it is not available will check IAX2/2.

When one of the channels is available the special variable ${AVAILCHAN} will be set with the name of this channel.

However, the name will contain also the channel’s session ID. You can see this with the Read application.
So, we need to cut this session ID in order to use the variable with the application Dial.

For the purpose we will use the application Cut. In the brackets of Cut you have to write the name of new variable then "=" and then AVAILCHAN. As you can see the variable AVAILCHAN is without ${}. For example: exten => 111,4,Cut(NewVar=AVAILCHAN,,1).

${NewVar} will contain only the name of the channel. Now you can use it with the Dial application. For example: exten => 111,5,Dial($(NewVar)/anatoliy).

If there is no available channel the ChanIsAvail application will continue with the execution of the extension with priority n+101. So, we have made such extension with the application SendText and the message Sorry there are no available channels! Please try again later!. This message will be send to the caller.

 


2. Additional information

For more information about extensions.conf you can check here.
For more information about iax.conf you can check here.
For more information about indications.cong you can check here.
For more information about the SendText application you can check here.

This application is tested with our IAX softphone Idefisk. You can download it from here. For more information about this softphone please read our tutorial.

If you would like to test this application with the SIP channel you can read our tutorials about the SIP Softphones to learn how to configure them to work with Asterisk PBX

 


3. Uploaded files

extensions.conf
iax.conf

 

 
User Comments
cost of cephalexin (dannyleasoncofurv at lobumisan dot gq)
19 August 2020 02:24:55
cost of cephalexin https://keflex.webbfenix.com/
albuterol sulfate dosage for adults (trudy dot parra62 at welcore dot ml)
17 August 2020 11:28:54
albuterol sulfate dosage for adults https://amstyles.com/
Ajay Mansingka (ajay dot mansingka at gmail dot com)
22 November 2019 11:53:49
Hi everyone,

can somebody help? its been 12 years and I am waiting to configure call forwarding.

Still awaiting kindly
Ajay Mansingka (ajay dot mansingka at gmail dot com)
14 August 2007 12:22:51
Hi everyone,

Can anyone of u provide me with sample dialplan consisting of call forwarding faetures?

I shall be highly obliged for ur early response
Ajay Mansingka (ajay dot mansingka at gmail dot com)
14 August 2007 12:22:31
Hi everyone,

Can anyone of u provide me with sample dialplan consisting of call forwarding faetures?

I shall be highly obliged for ur early response
 
Add Comment
Name:
Email:
Comment:
In order to prevent automatic posting on our website, we kindly request you to type in the number you see in the picture below.
Image Verification:
 

Latest Headlines:

  • T.38 faxing with Zoiper 2.15 is now easier than ever
    section: voip software
  • Asterisk 1.4.21 Released
    section: Asterisk
  • Asterisk 1.4.20 Released
    section: Asterisk
  • Asterisk 1.4.20-rc2 Released
    section: Asterisk
  • Asterisk 1.4.20-rc1 Now Available
    section: Asterisk
  • News Archives (older news)

Latest Tutorials:

  • Sending Fax from Zoiper to Zoiper using T.38
    added 08/Dec/2008 18:16
  • VMAuthenticate (dialplan application)
    added 01/Mar/2008 15:57
  • Siptronic ST-530
    added 06/Nov/2007 17:57
  • Siemens C455 IP hardphone
    added 05/Nov/2007 10:24
  • Zoiper
    added 22/Oct/2007 17:53

Latest Comments:

  • https://v4visa.ca/wp-content/uploads/for...
    tutorial: SIP with NAT or Firewalls
  • https://v4visa.ca/wp-content/uploads/for...
    tutorial: SIP with NAT or Firewalls
  • https://sites.google.com/view/british-ai...
    tutorial: SIP with NAT or Firewalls
  • https://aspireeducation.org/wp-content/u...
    tutorial: SIP with NAT or Firewalls
  • Primal Compound Shilajit Gummies Review...
    tutorial: Basic Information
 
contact us at: support@asteriskguru.com - asterisKGuru.com © all rights reserved   |   *asterisk is registered trademark of © Digium™