[asterisk-users] test case with queues and system()

C. Chad Wallace cwallace at lodgingcompany.com
Wed Jan 20 18:28:29 CST 2010


At 3:09 AM on 21 Jan 2010, ______________ ____________ wrote:

> On Wed, Jan 20, 2010 at 10:18 PM, C. Chad Wallace
> <cwallace at lodgingcompany.com> wrote:
> >
> > At 5:59 PM on 19 Jan 2010, ______________ ____________ wrote:
> >
> >> Test case:
> >> We have e1 trunk and multi-channel sip line. Clients waiting in the
> >> queue, which can handle 30 clients. They listen mellody and their
> >> position, while waiting. The system can handle only 5 clients at
> >> the moment. As soon as client is the first he hears a background
> >> and then if he inputs any number, asterisk executes system command
> >> like wget example.org/?p=<input number> and call terminated.
> >>
> >> I'm reading asteriskbook but can't connect all together right now.
> >
> > I think you'll have to use the Local channel as your queue member,
> > like this (in queues.conf):
> >
> > member => Local/s at systemcommand
> >
> > And then in your dialplan (extensions.conf) you'd have something
> > like this:
> >
> > [systemcommand]
> > exten => s,1,Background(press-a-key)
> > exten => s,n,Read(INPUT_NUMBER)||1)
> > exten => s,n,System(wget http://example.org/?p=${INPUT_NUMBER})
> > exten => s,n,Playback(goodbye)
> >
> >
> > Please note, these are only examples to get you started, and they
> > probably won't work without some tuning.
> 
> Thank you, it helped a lot.
> Now i have only one thing - how can i tell asterisk to work with 5
> clients? I have to make 5 members?

Maybe...  But I think the Local channel queue member will accept
multiple callers at the same time, so you could use GROUP_COUNT in your
dialplan to limit it:

[systemcommand]
exten => s,1,GotoIf($[${GROUP_COUNT(systemcommand)} < 5]?continue)
exten => s,n,Busy()
exten => s,n(continue),Set(GROUP()=systemcommand)
exten => s,n,Background(press-a-key)
exten => s,n,Read(INPUT_NUMBER)||1)
exten => s,n,System(wget http://example.org/?p=${INPUT_NUMBER})
exten => s,n,Playback(goodbye)

It returns Busy if there are already 5 calls being serviced.

Also, you could replace the 5 above with a variable, and set that
variable in your globals, so it's easier to maintain later.


-- 

C. Chad Wallace, B.Sc.
The Lodging Company
http://www.lodgingcompany.com/
OpenPGP Public Key ID: 0x262208A0

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
Url : http://lists.digium.com/pipermail/asterisk-users/attachments/20100120/5dbf2fd0/attachment.pgp 


More information about the asterisk-users mailing list