How to monitor Asterisk resource to make call

Hello all.

I have problem about outbound call.
I have one asterisk server and custom sometimes request over 1000 outbound calls.
If one asterisk server can handle 200 concurrent calls,
after 200 concurrent calls, A reqeust to make call seems to be dropped. I can see this in logs.

I think there is no resource to handle request. Is this right?

And I wondering if there is a queue for outbound or not.
Hmmm… I think there is no reason that asterisk has a queue for outbound call. but I’m not sure.
Is there a queue for outbound call?

I’m trying to develop a monitoring program that check asterisk is available to handle request to make call.
If asterisk doesn’t have any resource to make call, I’m waiting until it’s available.
Is this possible?

What should I monitor? Channels? Asterisk resource?

You probably want to use group counts (please Google).

You should already be aware that Asterisk is a fairly low level tool kit. If you want a queue, you must explicitly use the Queue application. (It is, however, not entirely clear that you don’t actually want a call files solution.)

This is a discussion forum, and should not be used for support questions.

What you are looking for is an outbound dialer application based on Asterisk, of which there are many, each with their own strong points and weaknesses. Asterisk just provides the low-level plumbing for one such solution. Tracking the number of outbound channels is just the beginning of your issues - see wombatdialer.com/manuals/WD_User … er_created for something we experienced firsthand (pardon the shameless plug :smile: )

Thanks for your reply. :smiley:
I’m going to check this. :wink:

Good Point. :smiley:
Thank for you reply :smile:

I have a question.

I searched something about ChanIsAvali().
the-asterisk-book.com/1.6/applik … avail.html

As the above link, I can check a status for channel.
AST_DEVICE_BUSY status means "The channel is busy"
When is channel busy? I mean What “The channel is busy” means?

I have only one sip account that registered with SIP Provider.
If I request to make one call with the sip account, at that time, is the channel busy?
Or
If I request to make 200 hundred concurrent call with the sip account, and there is no channel to handle a request any more, at that time, the channel is busy?

For SIP, channel busy means that you have reached the call limit in relation to outgoing calls. Asterisk has no idea of any limitation imposed by the ITSP, unless you tell it. The device would be “in use” if there was at least one call on it, although I think you may need to enable call limits for this to be monitored.

call limit is deprecated and group count is the currently preferred mechanism.

A busy status for an actual call would reflect the response code received from the remote side. 486 or 606 are likely to result in “busy”.

Note that there are no pre-allocated channels in SIP, although systems may limit concurrent sessions for various reasons, e.g. to avoid overloading a network connection, commercial reasons, and implementation limitations.

If you actually exceed such a limit on a call, one would expect Asterisk to report a congestion status, not a busy one. Chanisavail doesn’t try to make a call.

This is what I was wondering. thanks :smiley:

[quote=“david55”]call limit is deprecated and group count is the currently preferred mechanism.
A busy status for an actual call would reflect the response code received from the remote side. 486 or 606 are likely to result in “busy”.[/quote]

I don’t think I don’t use group(Actually, I don’t know :blush: )
I request to make one call just many times.

a. to make call I use extendsions.ael.

  • /etc/asterisk/extensions.ael
    context sendmessage {

    s => {
    AGI(sm_dial.php);
    Hangup();
    };
    _X. => {
    AGI(sm_callback.php);
    Hangup();
    };
    };

b. /var/lib/agi-bin/sm_dial.php
$dialstatus = $rateEngine->rate_engine_performcall($agi, $tru);

if (($dialstatus == “CHANUNAVAIL”) || ($dialstatus == “CONGESTION”)) {
$trumpia -> debug( VERBOSE | WRITELOG, $agi, FILE, LINE, $dialstatus);
$agi->set_callerid($callerid);
$rateEngine->rate_engine_performcall($agi, $trumpia,“appia”);
}

c. class.rateengine.php
function rate_engine_performcall ($agi, $trumpia, $proxy=“xxxxx”){

      $dialstr = "SIP/$tru->destination@" . $proxy;
      $myres = $agi->exec("Dial $dialstr|60");    
          
      $answeredtime = $agi->get_variable("ANSWEREDTIME");
      $this->answeredtime = $answeredtime['data'];           
      $dialstatus = $agi->get_variable("DIALSTATUS");
      $this->dialstatus = $dialstatus['data'];
          
      $trumpia -> debug( VERBOSE | WRITELOG, $agi, __FILE__, __LINE__, "dial status : " . $this->dialstatus);

      //# Ooh, something actually happened!
      if ($this->dialstatus  == "BUSY") {         
           $this->answeredtime=0;
      } elseif ($this->dialstatus == "NOANSWER") {         
           $this->answeredtime=0;
      } elseif ($this->dialstatus == "CANCEL") {
           $this->answeredtime=0;
      } elseif (($this->dialstatus  == "CHANUNAVAIL") || ($this->dialstatus  == "CONGESTION")) {
           $this->answeredtime=0;
      } elseif ($this->dialstatus == "ANSWER") {
           $trumpia -> debug( VERBOSE | WRITELOG, $agi, __FILE__, __LINE__,
                "-> dialstatus : " . $this->dialstatus .
                ", answered time is ".$this->answeredtime." \n");
      }
      return $this->dialstatus;

}

I tried to make call with PHP AGI and debug channels with “show channels verbose” command.
The result is the below.

Every 2.0s: asterisk -vvvvvrx ‘show channels verbose’ Mon May 20 18:41:53 2013

Asterisk 1.4.30, Copyright © 1999 - 2010 Digium, Inc. and others.
Created by Mark Spencer markster@digium.com
Asterisk comes with ABSOLUTELY NO WARRANTY; type ‘core show warranty’ for details.
This is free software, with components licensed under the GNU General Public
License version 2 and other licenses; you are welcome to redistribute it under
certain conditions. Type ‘core show license’ for details.

== Parsing ‘/etc/asterisk/asterisk.conf’: Found
== Parsing ‘/etc/asterisk/extconfig.conf’: Found
Connected to Asterisk 1.4.30 currently running on Attweb11 (pid = 27158)
Channel Context Extension Prio State Application Data CallerID Duration Accountcode BridgedTo
SIP/innodial-00001e2 default s 1 Down AppDial (Outgoing Line) s 00:00:20 7980 (None)
Local/s@tru-send tru-sendmessage s 1 Ring Dial SIP/17146601001@innodial| 00:00:21 7980 (None)
Local/s@tru-send tru-sendmessage s 1 Down (None) (None) 7146601001 00:00:21 7980 (None)
3 active channels
1 active call

Executing last minute cleanups

Why does Asterisk have 3 channels for one call?


And I tried to make call with Asterisk-java. OriginatedAction.
But I couldn’t catch any result with ‘show channels verbose’ command.
(the above result is with PHP AGI.)
I got a call but could not see anything.
Is something different between both?

originateAction = new OriginateAction();
originateAction.setChannel(“SIP/1xxxxxx1001@innodial”);
originateAction.setContext(“tru-sendmessage”);
originateAction.setCallerId(“Logankim-CallerId”);
originateAction.setExten(“s”);
originateAction.setPriority(new Integer(1));
originateAction.setTimeout(30000L);

this.managerConnection.login();
originateResponse = this.managerConnection.sendAction(originateAction);

[quote=“logankim”]Channel Context Extension Prio State Application Data CallerID Duration Accountcode BridgedTo
SIP/innodial-00001e2 default s 1 Down AppDial (Outgoing Line) s 00:00:20 7980 (None)
Local/s@tru-send tru-sendmessage s 1 Ring Dial SIP/17146601001@innodial| 00:00:21 7980 (None)
Local/s@tru-send tru-sendmessage s 1 Down (None) (None) 7146601001 00:00:21 7980 (None)
3 active channels
1 active call

Executing last minute cleanups

Why does Asterisk have 3 channels for one call? [/quote]

Local channel incoming side. Local channel outgoing side. Real channel actually being called.