Review Board 1.7.16


app_queue: support a 'logged in and available' hint on queue

Review Request #2121 - Created Sept. 18, 2012 and submitted

Alec Davis
trunk
Reviewers
asterisk-dev
Asterisk
Receptionist will love this.

The ability to see via a BLF that some members are logged in and free to take the calls. "I'll just put you through now", with less chance that the call goes to voicemail or what ever dialplan logic then followed.


When all agents are logged out, the BLF goes INUSE.
When agents are logged in, but are all busy, the BLF goes INUSE.
   Like any BLF, if INUSE the call may go to Voicemail, at least the Operator can warn the caller.

When an agent is free to take a call the BLF goes NOT_IN_USE, IE. can put a call through.
 


Related to https://reviewboard.asterisk.org/r/1619/

I did think about combining the queue ringing hint from review 1619 but it's a different function, and only required by co-workers that may be able to help.

Many other divisions want to be able to drop a call into a queue, with the prior knowledge that it should be answered (NOTINUSE), or will possibly go to voicemail (INUSE).
In use on our headoffice production system.

Below is a hint for our itg_queue

exten => 8501,hint,Queue:itg_queue_avail

Note: '_avail' is added to the queuename

Diff revision 1

This is not the most recent revision of the diff. The latest diff is revision 3. See what's changed.

1 2 3
1 2 3

  1. trunk/apps/app_queue.c: Loading...
trunk/apps/app_queue.c
Revision 373162 New Change
[20] 1657 lines
[+20] [+] static int handle_statechange(void *datap)
1658
	struct statechange *sc = datap;
1658
	struct statechange *sc = datap;
1659
	struct ao2_iterator miter, qiter;
1659
	struct ao2_iterator miter, qiter;
1660
	struct member *m;
1660
	struct member *m;
1661
	struct call_queue *q;
1661
	struct call_queue *q;
1662
	char interface[80], *slash_pos;
1662
	char interface[80], *slash_pos;
1663
	int found = 0;
1663
	int found = 0;			/* Found in any queue */

    
   
1664
	int found_member;		/* Found in this queue */

    
   
1665
	int avail = 0;
1664

    
   
1666

   
1665
	qiter = ao2_iterator_init(queues, 0);
1667
	qiter = ao2_iterator_init(queues, 0);
1666
	while ((q = ao2_t_iterator_next(&qiter, "Iterate over queues"))) {
1668
	while ((q = ao2_t_iterator_next(&qiter, "Iterate over queues"))) {
1667
		ao2_lock(q);
1669
		ao2_lock(q);
1668

    
   
1670

   

    
   
1671
		avail = 0;

    
   
1672
		found_member = 0;
1669
		miter = ao2_iterator_init(q->members, 0);
1673
		miter = ao2_iterator_init(q->members, 0);
1670
		for (; (m = ao2_iterator_next(&miter)); ao2_ref(m, -1)) {
1674
		for (; (m = ao2_iterator_next(&miter)); ao2_ref(m, -1)) {
1671
			ast_copy_string(interface, m->state_interface, sizeof(interface));
1675
			ast_copy_string(interface, m->state_interface, sizeof(interface));
1672

    
   
1676

   
1673
			if ((slash_pos = strchr(interface, '/'))) {
1677
			if ((slash_pos = strchr(interface, '/'))) {
1674
				if (!strncasecmp(interface, "Local/", 6) && (slash_pos = strchr(slash_pos + 1, '/'))) {
1678
				if (!strncasecmp(interface, "Local/", 6) && (slash_pos = strchr(slash_pos + 1, '/'))) {
1675
					*slash_pos = '\0';
1679
					*slash_pos = '\0';
1676
				}
1680
				}
1677
			}
1681
			}
1678

    
   
1682

   
1679
			if (!strcasecmp(interface, sc->dev)) {
1683
			if (!strcasecmp(interface, sc->dev)) {
1680
				found = 1;
1684
				found_member = 1;
1681
				update_status(q, m, sc->state);
1685
				update_status(q, m, sc->state);

    
   
1686
			}

    
   
1687
			if (m->status == AST_DEVICE_NOT_INUSE && (!m->paused)) {

    
   
1688
				avail = 1;

    
   
1689
				if (found_member){
1682
				ao2_ref(m, -1);
1690
					ao2_ref(m, -1);
1683
				break;
1691
					break;
1684
			}
1692
				}
1685
		}
1693
			}

    
   
1694

   

    
   
1695
		}

    
   
1696
		if (found_member) {

    
   
1697
			found = 1;

    
   
1698
			if (avail) {

    
   
1699
				ast_devstate_changed(AST_DEVICE_NOT_INUSE, "Queue:%s_avail", q->name);		

    
   
1700
			} else {

    
   
1701
				ast_devstate_changed(AST_DEVICE_INUSE, "Queue:%s_avail", q->name);		

    
   
1702
			}

    
   
1703
		}

    
   
1704

   
1686
		ao2_iterator_destroy(&miter);
1705
		ao2_iterator_destroy(&miter);
1687

    
   
1706

   
1688
		ao2_unlock(q);
1707
		ao2_unlock(q);
1689
		queue_t_unref(q, "Done with iterator");
1708
		queue_t_unref(q, "Done with iterator");
1690
	}
1709
	}
[+20] [20] 4159 lines
[+20] [+] static int remove_from_queue(const char *queuename, const char *interface)
5850
			ao2_ref(mem, -1);
5869
			ao2_ref(mem, -1);
5851

    
   
5870

   
5852
			if (queue_persistent_members) {
5871
			if (queue_persistent_members) {
5853
				dump_queue_members(q);
5872
				dump_queue_members(q);
5854
			}
5873
			}

    
   
5874

   

    
   
5875
			if (!ao2_container_count(q->members)) {

    
   
5876
				ast_devstate_changed(AST_DEVICE_INUSE, "Queue:%s_avail", q->name);

    
   
5877
			}
5855
			
5878
			
5856
			res = RES_OKAY;
5879
			res = RES_OKAY;
5857
		} else {
5880
		} else {
5858
			res = RES_EXISTS;
5881
			res = RES_EXISTS;
5859
		}
5882
		}
[+20] [20] 71 lines
[+20] [+] static int add_to_queue(const char *queuename, const char *interface, const char *membername, int penalty, int paused, int dump, const char *state_interface)
5931

    
   
5954

   
5932
			if (dump) {
5955
			if (dump) {
5933
				dump_queue_members(q);
5956
				dump_queue_members(q);
5934
			}
5957
			}
5935

    
   
5958

   

    
   
5959
			if (ao2_container_count(q->members) == 1) {

    
   
5960
				ast_devstate_changed(AST_DEVICE_NOT_INUSE, "Queue:%s_avail", q->name);

    
   
5961
			}

    
   
5962

   
5936
			res = RES_OKAY;
5963
			res = RES_OKAY;
5937
		} else {
5964
		} else {
5938
			res = RES_OUTOFMEMORY;
5965
			res = RES_OUTOFMEMORY;
5939
		}
5966
		}
5940
	} else {
5967
	} else {
[+20] [20] 3778 lines
  1. trunk/apps/app_queue.c: Loading...

https://reviewboard.asterisk.org/ runs on a server provided by Digium, Inc. and uses bandwidth donated to the open source Asterisk community by API Digital Communications in Huntsville, AL USA.
Please report problems with this site to asteriskteam@digium.com.