S
S
Sergey2014-07-23 01:24:17
Asterisk
Sergey, 2014-07-23 01:24:17

Asterisk: Queues on your own, how?

It would be desirable to make queues more flexible or something. Is it possible?
Task:
1. Incoming call -> IVR "Greeting".
2. Music plays with possible random insertions of prepared word templates.
3. In the meantime, AGI is running. Tries to call one ext. numbers, if 10 seconds no answer, then another ext. room. If busy, then immediately another extension number. If both are busy, then wait until someone is free. During business hours, if both do not answer, then forwarding to the cell. During non-working hours, do not redirect.
In general, point 3 can be further complicated, and the problem is that all this can change dynamically through the AGI script and the database. Here's how, at the same time, the client simply plays music, and when picking up the handset from the inside, immediately connect.
Probyval:
background(demo);
agi(incoming.agi,${CALLERID(num)},${EXTEN});
But with Background, as well as with Playback and MusicOnHold, the scripts are not processed further until the playback is completed.

Answer the question

In order to leave comments, you need to log in

6 answer(s)
S
Sergey, 2014-07-23
@Celebro

It seems like I found a solution. Maybe someone will come in handy.
AGI is there just for the test, it goes through a couple of numbers in an endless loop. It can be complicated.
and, when you pick up the handset, the hold is automatically interrupted.
There is one more problem left, if I hang up a call from the mobile phone, the client is immediately dropped. Although the client still plays hold until I pick up the phone. Maybe you can somehow catch the status, and continue calling further down the list ??

context Incoming {
      _X. =>  {
                Answer();
                Ringing();
                Wait(2);
                agi(incoming.agi,${CALLERID(num)},${EXTEN});
       };

#!/usr/bin/env perl
use Asterisk::AGI;

my $AGI = new Asterisk::AGI;
$|=1;
my ($callerid, $exten) = @ARGV;

print STDOUT "SET MUSIC ON HOLD DEFAULT\n"  # Запускаем музочку
while(1){
    $AGI->exec("Dial","SIP/1001,15,Ttgm");
    my $availstat1 = $AGI->get_variable('DIALSTATUS');
    $AGI->exec("Dial","SIP/1002,15,Ttgm");
    my $availstat2 = $AGI->get_variable('DIALSTATUS');
    $AGI->exec("Wait","7");
    $AGI->exec("Background","message_try_again");
    print STDOUT "SET MUSIC ON HOLD DEFAULT\n";
};

Yes, you can also turn off MoH.
print STDOUT "SET MUSIC ON HOLD OFF\n";

F
falsebyte, 2014-07-23
@falsebyte

Background should immediately give control, in your case verbose 5 and see what happens when a call arrives

R
Rsa97, 2014-07-23
@Rsa97

Try putting the incoming call on hold using BridgeWait(,participant), then start dialing and connect via Bridge()

I
Ivan Baidin, 2014-07-24
@zeronice

use macros on Answer. is there any need for AGI at all, if a wooden asterisk-mysql and one or two tables with rules and 10 lines of a dialplan of native asterisk-functions are enough?

V
Vladislav Gasanov, 2014-08-21
@kosmoflyko

I confirm, the Background command immediately returns control.
As for the queues, I don’t understand a little why the standard Asterisk queues didn’t suit you. Agents can also dynamically register in them.

O
Ovoshlook, 2014-09-29
@Ovoshlook

ARI can be used. We wrote our own Queue on it. Very convenient and fast. AGI is the last century. But! This solution works on versions of asterisk 12 and higher.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question