[asterisk-users] Simple Queue Problem

Danny Nicholas danny at debsinc.com
Mon Jun 15 08:03:22 CDT 2009


I posted a simple PERL agi that uses hints to do a similar thing to Devstate
last week.  Here it is:

#!/usr/bin/perl

 

use     strict;

use     warnings;

 

# define variables

# show hints will get hint information from the dialplan

my $cmda = '/usr/sbin/asterisk -rx "show hints" ';

my $towatch = $ARGV[0];

 

# turn off I/O buffering

$| = 1;

 

# read the AGI environment

while (<STDIN>) {

   chomp($_);

   last if 0 == length($_);

   }

 

# assume idle

print STDOUT "SET VARIABLE LINESTAT \"Idle\"\n";

<STDIN>;

 

# get trunk information

$SIG{'PIPE'} = 'IGNORE';

open (my $trunk_info, $cmda) or exit;

while   (<$trunk_info>) {

   if (($_ =~ /internal/) && ($_ =~ /$towatch/)) {

      my $c = unpack("x74 a16", $_);

      $c =~ s/\s//gx;

      print STDOUT "SET VARIABLE LINESTAT \"$c\"\n";

      <STDIN>;

      }

   }

close $trunk_info;

 

Dialplan: exten => 2100,1,Noop(dial 102 after checking sippeer)

exten => 2100,n,Set(LINESTAT=Idle)

exten => 2100,n,AGI(steve.agi|102)

exten => 2100,n,Wait(3)

exten => 2100,n,Verbose(status is ${LINESTAT})

exten => 2100,n,Gotoif($["${LINESTAT}" != "Idle"]?inuse)

exten => 2100,n,Dial(SIP/102,20,m)

exten => 2100,n,Background(vm-goodbye)

exten => 2100,n,Hangup

exten => 2100,n(inuse),Voicemail(102 at default)

exten => 2100,n,Background(vm-goodbye)

 

just change 102 to your receptionists number

 

  _____  

From: asterisk-users-bounces at lists.digium.com
[mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of Lenz Emilitri
Sent: Monday, June 15, 2009 5:10 AM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: Re: [asterisk-users] Simple Queue Problem

 

You could try this one:
http://www.voip-info.org/wiki/view/Asterisk+func+Devstate

If I can add a warning, be wary of having both ACD (Queue) and non-ACD
traffic on the same operator - you risk having awful performance.

Just my two eurocents,

l.

 

2009/6/12 Lee, John (Sydney) <John.Lee at compuware.com>

I am running Asterisk 1.4.21.2

For reception, I defined a simple queue with one SIP phone as the only
member.

When I receive an incoming call, I test QUEUE_WAITING_COUNT to see if it
is > 0.
If it is > 0, then I will playback a message to tell the caller to be
patient and then do a Queue(<queue-name>).
If QUEUE_WAITING_COUNT is zero, then I will just Queue(<queue-name>, r)
to ring the receptionist phone without playing any message.

A problem arises if the receptionist is talking to someone on the phone.
In this scenario, QUEUE_WAITING_COUNT is also zero but I will need to
playback a pls-be-patient message as well.

So, I need to find out whether the receptionist phone is busy even if
QUEUE_WAITING_COUNT = 0.

Do you know if there is anyway, without dialling a SIP channel, I can
check if a SIP extension is engaged or not?




_______________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
  http://lists.digium.com/mailman/listinfo/asterisk-users




-- 
Loway - home of QueueMetrics - http://queuemetrics.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20090615/be6d308d/attachment-0001.htm 


More information about the asterisk-users mailing list