[Asterisk-Dev] Queues observations

Stephan A. Edelman sedelman at newace.com
Tue Apr 26 21:12:45 MST 2005


Unless I'm mistaken, you need to loop on Queue() in your dialplan until
the caller is connected to an Agent. After the caller is connected and
either the agent or caller hangs up, Queue() jumps to the hangup
extension. Otherwise, Queue() returns and the next step in your dialplan
is executed.

Therefore, whether there are agents or not in a particular queue,
Queue() is going to perform the next step in your dial plan if it can't
connect to an agent within the timeout period specified (last argument
to Queue()).

Perhaps, Queue() may return more quickly if joinwhenempty=no (i.e., it
won't bother waiting for the timeout), but it certainly does not jump to
the hangup extension. 

At any rate, in an effort to resolve this problem for myself, I've
patched the app_queue.c file to include the AgentIsAvail() function, so
I can dump someone into voicemail right away.

This is probably becoming a asterisk-user question, but if someone sees
the problem with my reasoning, please let me know so I can use the
"established" method instead of my hack.

Regards,

Stephan.

--
static int agent_is_avail(char *queuename)
{
        struct ast_call_queue *q;
        enum queue_member_status stat;

        ast_mutex_lock(&qlock);

        for (q = queues; q; q = q->next)
                {
                if (!strcasecmp(q->name, queuename))
                        {
                        /* This is our one */
                        ast_mutex_lock(&q->lock);

                        stat = get_member_status(q);

                        ast_mutex_unlock(&q->lock);

                        ast_mutex_unlock(&qlock);

                        return (stat == QUEUE_NORMAL ? 0 : -1);
                        }
                }

        ast_mutex_unlock(&qlock);

        return (-1);
}

static int aia_exec(struct ast_channel *chan, void *data)
{
        struct localuser *u;
        char *queuename;

        if (!data) {
                ast_log(LOG_WARNING, "AgentIsAvail requires an argument
(queuename)\n");
                return -1;
        }

        queuename = ast_strdupa((char *)data);
        if (!queuename) {
                ast_log(LOG_ERROR, "Out of memory\n");
                return -1;
        }

        LOCAL_USER_ADD(u);

        if (agent_is_avail(queuename)) {
                ast_log(LOG_WARNING, "No agents in queue or queue %s not
found\n", queuename);
                if (ast_exists_extension(chan, chan->context,
chan->exten, chan->priority + 101, chan->cid.cid_num)) {
                        chan->priority += 100;
                        LOCAL_USER_REMOVE(u);
                        return 0;
                }
                return -1;
        }

        LOCAL_USER_REMOVE(u);

        return 0;
}

-----Original Message-----
From: asterisk-dev-bounces at lists.digium.com
[mailto:asterisk-dev-bounces at lists.digium.com] On Behalf Of Adam
Goryachev
Sent: Tuesday, April 26, 2005 10:55 PM
To: Asterisk Developers Mailing List
Subject: Re: [Asterisk-Dev] Queues observations

On Tue, 2005-04-26 at 22:06 -0400, Stephan A. Edelman wrote:
> We've implemented the call Queuing using asterisk and have the 
> following observations:
>  
> (1) The Queue() application returns zero when there is no agent 
> available to take the call (busy on another call, for example) but 
> also when there is no agent logged in for that queue. The latter is 
> fairly problematic. I would prefer to have the caller dumped into 
> voicemail rather than waiting for an agent to eventually login.
>  
> For this purpose, it looks like we need an AgentIsAvail(queuename) 
> function, or something similar on which we can branch in the dialplan.

I think there is an option joinwhenempty in queues.conf or similar. I
know my callers won't join the queue if there is no agent logged in (but
they will join the queue if there is agents logged in but they are all
busy).
 
> (2) When the caller is eventually connected to an agent, the MOH 
> disappears and then immediately the agent is heard. The caller gets no

> prior indication / warning that his call is now connected. I think we 
> need an option in the Queue() to create a 2-second ringback prior to 
> being connected.
>  
> Any thoughts?

This isn't such a bad option... I thought about playing a beep etc, but
that isn't really obvious enough, a short one/two ring burst would help
wake up the caller and tell them to get ready for something to happen. 

Would probably need to adjust the app_queue or app_agent or both??
Sorry, I can't help do anything, but perhaps a bounty on the wiki would
get someone involved?

Regards,
Adam
--
 --
Adam Goryachev
Website Managers
Ph:  +61 2 8304 0000                        adam at websitemanagers.com.au
Fax: +61 2 9345 4396                        www.websitemanagers.com.au

_______________________________________________
Asterisk-Dev mailing list
Asterisk-Dev at lists.digium.com
http://lists.digium.com/mailman/listinfo/asterisk-dev
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-dev




More information about the asterisk-dev mailing list