Subscribe via RSS

Playing with queues

The company I work for, is changing the proprietary phone system to an open source one: asterisk. That is a big fat yay of course! Since I’m the only one at this company who knows his way around linux, it’s my job to set things up. Since I like goofing around in .conf files, it is no punishment. Not at all! Anyway, the reason we move to asterisk, is that we have our call-center systems working on vicidial, which, you might have guessed, works on asterisk. Besides the call-center applications, we also have “regular” telephone traffic, and that is what I’m setting up now. And the reason I’m posting this here, is that there might be somebody out there who can benefit from this info.

So, what had to be done is the following. We have two divisions at the office here (we have 3 offices in total, but this setup is only for one of them, the main office). We have a service-desk and a administration-desk. We have one main phone number, which refers to both of these divisions. The caller is presented an ivr menu, where they make their choice of needed service. The choices we have here, are only 3 different ones. At choice 1, they get redirected to another office, choice 2 takes them to the service-desk and choice 3 takes them to administration. Since the divisions we have here are not that large, we have to take into account that one of both divisions can be totally understaffed at any given time. To solve this, I have the phone ring on division X for 30 seconds and if there is no pickup, it will ring on both divisions after that. So, how do we get this done in asterisk?

First we need to have a inbound did on the incoming phone number. I use vicidial here, which has a gui to create dids and call-menus, so that works a little different, but the outcome is the same. You need to put something like this in you extensions.conf:

exten => _inboundnumber,1,Answer
exten => _inboundnumber,2,Playback(some_welcome_message)
exten => _inboundnumber,3,GoTo(MenuSecion,s,1)
exten => _inboundnumber,4,Hangup()

This will play a welcome message and then forwards the incoming number to a section in your extensions.conf, called MenuSection (just using clear names here, call it whatever you like). The MenuSection looks something like this:

[MenuSection]
exten => s,1,log_menu_call_with_agi
exten => s,n,Background(Option1)
exten => s,n,Background(Option2)
exten => s,n,Background(Option3)
exten => s,n,WaitExten(10)
exten => s,n,Background(Option1)
exten => s,n,Background(Option2)
exten => s,n,Background(Option3)
exten => s,n,WaitExten(10)

; Option1
exten => 1,1,Goto(from-internal,phone_number_of_other_office,1)
; Option2
exten => 2,1,Goto(default,666705,1)
; Option3
exten => 3,1,Goto(default,666706,1)

; Timeout
exten => t,1,Playback(no_choice_made_sound)
exten => t,n,Hangup
; Invalid
exten => i,1,Playback(invalid_choice_made_sound)
exten => i,2,Goto(MenuSection,s,1)
; hangup
exten => h,1,log_things_with_agi_or_whatever

This is your menu. First a log will be made, because well, I like to log stuff. Then the menu options will be played, after which a caller has 10 seconds to make his/her choice. No choice after 10 seconds, plays the choices again. A timeout (t) will hangup the call and an invalid (i) choice will reroute back to the start of the call-menu. A hangup will log stuff, just because I want to log that, but it is not necessary. Ok, what is the interesting part here, are the options! I’ll explain those here:

- A caller presses 1

This will forward the caller to another office. The reason it is a simple forward here, is that we make use of oldskool copper lines and there is no VoIP implemented (yet).

- A caller presses 2

The call is rerouted to extension 666705 in the default section of extensions.conf

- A caller presses 3

The call is rerouted to extension 666706 in the default section of extensions.conf

The 66670X extensions are just number I made up myself for this purpose. I start all my extensions with 666, don’t ask me why, I just do. But you can use any number you want, that does not matter. So, what happens in 666705?

exten => 666705,1,Answer
exten => 666705,n,Playback(message_hold_on_a_second)
exten => 666705,n,Queue(SD||||30)
exten => 666705,n,GoTo(VM,2,1)
exten => 666705,n,Hangup()

So, this extension gets answered, then playbacks a message stating to hold on a sec please, then goes into a queue for 30 seconds and when it gets out of the queue after 30 seconds, it goes to the VM section, extension 2. What does all this mean? Well, the caller gets thrown into a queue where he/she will hear some sexy music while waiting for an agent to pick up the call. A queue is setup in queues.conf and the queue I use here, looks something like this:

[SD]
musicclass = MOHMAIN
strategy = ringall
servicelevel = 60
timeout = 30
retry = 10
wrapuptime = 30
autofill = yes
autopause = no
maxlen = 0
joinempty = yes
announce-frequency = 0
periodic-announce-frequency = 15
announce-holdtime = no
periodic-announce = message_one_moment_please
reportholdtime = yes
ringinuse = no
memberdelay = 1
member => Sip/201
member => Sip/202
member => Sip/203
member => Sip/204
member => Sip/205

So, what does all that stuff mean? Well, here we go:
musicclass: this is the on hold music class used and contains the settings for the played music. Mine is called MOHMAIN
strategy: this is the ring strategy used. I chose the ringall, but there are more choices you can make here, eg:

  • ringall – ring all available channels unil one answers
  • roundrobin – take turns ringing each available interface
  • leastrecent – ring interface which was least recently called by this queue
  • fewestcalls – ring the one with the fewest calls from this queue
  • random – ring a random interface
  • rrmemory – roundrobin with memory, remember where left off last ring pass

servicelevel: only used for reporting, see how many calls got answered within the service-level
timeout: how long the phone rings before it is a timeout, in other words: the amount of seconds to keep ringing
retry: the amount of seconds before we give it another go
wrapuptime: the amount of seconds the called agent will not get another call to give them time to “wrap up”
autofill: this has to do with old behavior, just set it to yes
autopause: pauses a station if it does not answer
maxlen: maximum callers waiting in the queue, set to 0 for unlimited
joinempty: this has 3 settings, eg:

  • yes: callers can join a queue with no members or only unavailable members
  • no: callers cannot join a queue with no members
  • strict: callers cannot join a queue with no members or only unavailable members

announce-frequency: how often to announce queue position and/or estimated holdtime to caller (0=off)
periodic-announce-frequency: number of seconds when to make a periodic announce
announce-holdtime: yes|no|once to caller
periodic-announce: sound-file to play for periodic announce
reportholdtime: report the hold-time of the caller to the callee. I find this useful. Agents can prepare for customers who have been waiting way to long and probably will be pissed.
ringinuse: send calls to “in-use” stations (only available on SIP channels)
memberdelay: the delay before a caller gets set trough to the callee after pick-up
member: members of this queue, which in this case, are the phones of the service division.

If the call does not get picked up within the 30 seconds, the call is thrown out of the queue and goes to the VM section, since that is the next step in extension 666706. The VM section looks something like this:

[VM]
exten => 1,1,Answer
exten => 1,n,Playback(message_voicemail)
exten => 1,n,Goto(85026666666667250,1)
exten => 1,n,Hangup

exten => _85026666666667.,1,Wait(1)
exten => _85026666666667.,2,Voicemail(${EXTEN:14}|s)
exten => _85026666666667.,3,Playback(message_thankyou)
exten => _85026666666667.,4,Hangup

exten => i,1,Playback(message_invalid)
exten => i,n,Goto(1)
exten => i,n,Hangup()

exten => 2,1,Background(message_you_can_wait_or_do_voicemail)
exten => 2,n,WaitExten(1)

exten => t,1,Answer
exten => t,n,Queue(WITHVM||||3600)
exten => t,n,Hangup()

Ok, so the call goes to extension 2 in the VM section. This plays a message that the caller can wait, or leave a voicemail. A caller has to press 1 to leave a voicemail, which takes him to extension 1. This routes the caller to extension 85026666666667250 where he/she can leave a voicemail. This is just an extension number I use, were 250 is the voice-mailbox number. If the caller does not make his/her choice in 1 seconds, the caller goes to the timeout extension (t), which puts it in the queue WITHVM for an hour. If nobody answered the phone within an hour, there really is something wrong in this organisation, so guess that will work out ok… Ok, queue WITHVM looks something like this:

[WITHVM]
musicclass = MOHMAIN
strategy = ringall
servicelevel = 60
timeout = 30
retry = 10
wrapuptime = 30
autofill = yes
autopause = no
maxlen = 0
joinempty = yes
announce-frequency = 0
periodic-announce-frequency = 30
announce-holdtime = no
periodic-announce = periodic_announce_message
reportholdtime = yes
ringinuse = no
context = VM
memberdelay = 1
member => Sip/201
member => Sip/202
member => Sip/203
member => Sip/204
member => Sip/205
member => Sip/101
member => Sip/102
member => Sip/103
member => Sip/104
member => Sip/105
member => Sip/106

Now, this looks almost the same as queue SD, with the difference the administration phones are members of this queue as well, so their phones will also ring! A context is also added: VM. This means, that if this queue is left, because somebody pressed a digit, it goes to the VM section, where a extension 1 will take the caller to the voicemail.

This is more or less how I fixed it for this office, The administration works almost the same, except it uses queue ADM, where only the administration stations are linked and goes to the same WITHVM queue after the 30 seconds time-out. So, this is just my way of implementing this. If anybody knows any better/cooler/faster ways of implementing this stuff, please let me know. Always eager to learn!

If you want more info on queues, take a look here, here or here.

Cloud? Yes please!

The cloud, much can be said about it, and much has. Privacy issues, lock in, integrity, whatever. The only thing I know, is that it is freaking awesome! Reason I think so, is something happened today. My pc @ work broke down… Hardware failure, can happen… So, took another pc from the stock, powered it up a bit, you know, extra ram, better video, installed ubuntu, installed dropbox, et voila, back to work!

Ok, not exactly that fast, because I had to install several other programs, fix my ssh keys and setup a static ip, and wait a pretty long time to get all data synced back, but that was about it. Up and running again! I have my mail at google, data at dropbox and notes at evernote. Sadly enough I also have to use m$ stuff to develop on, but ey, got that on a virtual machine running somewhere on the network. And yes, got a dropbox installed there too, so no worries.

So, cloud? Yes please! I know, you gotta take some precautions, because you never know if one of those services will go down or just quits. That is why I like dropbox: I have local copies of all my files! And not just at work, but at all my machines! Mail is backed up trough a machine that does nothing but popping it, so nothing can get lost.

And if you have really, really private files, like some sex tape or whatever, yeah, do NOT put that one in the cloud. But I think that is pretty obvious, right?

New projects, new style

I’m going to start on a new project at work soon: porting the main legacy application to a more modern and flexible piece of equipment. The application is pretty huge and completely clipper based. It will be a pretty daunting task to port it, but ey, challenges are good! So, I already decided to port it to a web based application. Why? Because I find web based applications way easier to maintain then client apps. I mean, I just update once and everybody is updated! Sure, there are ways to achieve that for clients too of course, I just prefer this way.

Another great advantage is, there is no need to install anything on site! And I love that! Also, all users can login from anywhere, so no more excuses when they are on holidays! So, what technique to use? We use loads of asp.net here, loaded up with telerik stuff. Sure, pretty nice stuff, but man, I’ve seen too many times shit just breaks! I mean, visual studio is a pretty sweet tool, but when it breaks, you’re fcuked!

I know, you can write your apps in notepad if really necessary, and compile from the prompt, but sjees, that just does not work very well. Well, not for me at least. So, decided to go for php. I will use codeigniter as a framework, because, well, why built your own? Sure, building your own is cool, but just don’t have the time to do that. Yeah, I work in a business. And well, you know, time == money!

For me, using php has several advantages over using asp.net:

  • no need to compile, so can implement fixes really fast
  • make use of opensource IDE
  • run apache on linux (my favorite choice of OS)
  • no need to buy any licenses (and that makes the bosses happy, right?)
  • dialer software is also php, so one technology for all

So, looking forward to get started here! Gotta do loads of paperwork first though… Digg into the legacy application and analyze it thoroughly before I can write any code at all. Nothing on paper is a guaranteed fail! Not the favorite part, but ey, what’s gotta be done, has gotta be done!

App logo

Think I never posted this, but this is the logo teh users see everyday when they log in. Yes, I’m working on starwars education.

Our new roomnumber

Our new roomnumber

A whole bunch of new hardware!

A big yay for the boxes that arrived today! Three new bad-ass servers, a bunch of memory, several hard disks and two gigabit switches. Pretty sweet stuff to go and play around with, right? Sure, it creates a load of work to get it all up and running, but ey, it is a fun job to do! This hardware was all ordered because of the stuff I learned at the course I attended in Saint Petersburg the other week. It sometimes is hard to convince management to do large investments, but the course armed me with loads of ammo. I mean, it is better to spend a little more to prevent loads of trouble at a later time, then spending less and get in a shitload of trouble. Which will cost you a lot more then when you would have invested just a bit better in a more expensive, but stable solution.

So, what am I going to do with the new stuff? Two of the servers will be used as database servers, running linux and mysql. All scsi based. Yes, those two are beasts! Well, they should be, because they are the base for a real-time system, with quite a lot of queries running. One of the servers will be a slave for reporting. Besides the new servers, some “old” ones I already have here, will be upgraded. Three dialers and two webservers. All tux based of course. The dialers with asterisk and the webservers with apache.

All of them will work together with Vicidial. Yes, it’s a shitload of work to get it all up and running and put them all in the racks, but ey, it’s a fun job! Better go and get started now…

Back from the U.S.

Yes, back in town again baby! Back from a week hanging out in Florida. I went there for a Vicidial course. This course was pretty good and it was awesome to see the actual Vicidial building and employees. Really nice and capable people, who taught me quite a bit about the suite. I already knew quite a bit from working with the suite, but it really helps if somebody gives you a bunch of live info. I mean, just reading documents is ok, but nothing beats human interaction. I’m far from a Vicidial master yet, but going to do some really hard work to get up to pace. I have some nifty ideas for some cool features as well. Now all I need is time… :/ Ah well, it will work out! Anyway, if you use Vicidial, I can recommend taking a course with these guys! Not only are they crazy smart, they also know very good spots to have lunch. I know that has nothing to do with learning stuff, just mentioning it… ;)

So, what else did I do there? I started out with not doing that much, because Saint Petersburg appeared to be a bit of a boring town… Almost nobody in the streets and an empty mini-mall. They had a gamestop though, so got me some new games. The prizes are unreal man! I have no idea why we have to pay so much more for a game in Europe. Anyway, did some walking around the town, blistered my feet because of the flip-flops i was wearing and had some nice views. Because it is beautiful there man! The ocean, nice sunny weather, big ass birds. Pretty sweet! I did get me some new open shoes at the mini-mall as well, because those blisters man… they hurt! I lost some blood trough those. Picked up some Birkenstocks to be able to do some more around town walking. I have to say: it can be quite boring, being alone. There were some cool people who worked at the hotel though, who were nice to have some conversations with. And this girl who worked at the restaurant next door, where I had my breakfast every day, was very cool as well. But besides having some nice chats with those people, you are still alone in a big city.

So, that’s when the power of social media kicked in! I’ve did some work/brainstorming for a project a while back, where I met up with a guy, who happened to live at Saint Petersburg! I happened to remember I knew someone there and checked my Brightkite account if I remembered correctly. I did! I found that Matthew was living there. He actually lives 9 blocks from the hotel I was staying at. So, decided to contact him and guess what: had a great time with Matthew and his girlfriend. We started of with a dinner and ended up spending quite some time together. They are awesome people who took a lot of effort to show me around town and did all kinds of cool stuff with me! We visited cool places, did some bike riding, had lunches and dinners, went shopping. They even took me to the airport on my departure day, but not before making me pancakes! It was really awesome and we had a good click together. The meet-up with those guys made my non-course days a lot cooler then if I would have been there all alone. I would probably have been bored and poor, because it was not very easy to get around town without a car. Those distances man! They gave me the all-American experience, by taking me to places I would never have found on my own and telling me about the local food, which I would probably not have ordered if I would have been eating out on my own. So yeah, Brightkite is a very useful product!

So, all and all had a great time at Saint Pete’s. Made some really cool new friends and learned a lot about Vicidial. What more can you wish for, right? And yes, I took pictures, but haven’t had the time nor the energy to put those up yet. After a 16-17 hour journey including transfer time and a jet-lag I have not done anything with them. Yet! Will put them up as soon as I feel like it though. This week will be a bit of a tough one for me, with the jet-lag and all. Hope it will not take more then a day or 3 to get over it. Ah hell, jet-lags are worth it man, just had an awesome time!

Going Mono

I code C# for a living, but Linux is my desktop of choice. I know, those things don’t mix very well. At the moment I’ve got a tux desktop (debian) at work and do my coding in a virtual machine, setup with visual studio 08 and all other necessary win only tools I need to code my projects. Sure, it works, but this virtual machine consumes such a load of memory, it is not exactly very fast… And if there is something I hate, then it’s slow performance. We make extensive use of Telerik controls here. Very nice controls, but only supported at windows. But, the Telerik boys announced this. And that means possibilities and fun!

This does not mean that we will just go and convert all of our projects to mono over night, but we will go and do some testing with it. I don’t find it useful for just our web-based applications, but also for our form based apps. Wouldn’t it be nice, to build some app and be able to run it on windows, linux and apple boxes? I think it is! It would be convenient just in our little development team, because we have one linux luvr (that would be me), an apple fanboi and a windows sucker. With projects build in mono, we can all keep our favo desktop and run the same tools. Nice!

So, I have started a little project, because I need some practice with gtk+ development. I know I’m not overwhelmed with spare time to code this project, but I’m gonna try to release some code soon. What is it? Well, since I have to query loads of data on different platforms, I thought it would be nice to have some query tool, which is able to connect to different platforms (mySQL, m$SQL, XML). One tool, query loads. And run it native in linux. I guess this makes a nice practice project, which might grow into something really useful over time. I’ve started a project here. I know, dingadong is a strange name, but ey, it does sound nice! I’ll post updates at this blog about the progress of this “practice project” and keep you posted about our mono progress. Let’s go mono!

Some light at the horizon…

Well, I’ve been to the UWV this morning. This is a government institute, who is going to pay the salary my employer owes me. This is quite a sum of money actually. Two months plus holiday money, including holidays not spend. This is well over three months worth of salary, so really hope it will work out well and I do not have to wait for this forever. Yes, I consider myself being lucky that I pay so much taxes now. Sure, I hate taxes, but ey, if it was not for the taxes, I would not receive jack now… So, just for this once: hooray for tax!

So, what is that light about? Well, several people here are working very, very hard to start up a new company. Well, actually it’s the old company, but with a new name. Or however they make it happen. And me is one of the people being asked to join them. Yay! So, why is it “some” light? For the very simple reason that the company does not yet actually exists… I hope to hear about this really soon and be able to sign a contract!

So, just working on in the meantime, waiting for some certaintees…

Bankrupt… Now what?

Yes, I’m very moody since yesterday. Why? Because my company is bankrupt… I got the news yesterday, and it feels shitty! I mean, check out this post. I really luv my job here. It’s a great company with great colleagues. And awesome work. But now it feels like it’s all over… I feel really depressed and I will enter a period of great uncertainties. I mean, what is going to happen now? Will I receive my wages? How long can I stay? Can the company go on in a slimmer form? And will there be a place for me in it? This raises many questions. I guess I’m a bit too emotional at the moment to see thing in the right perspective. Man, this SUCKS!

I wanted to make a bid on a house this week. Finally my girl and me found a house we both really liked, but now I’m about to lose my job, we cannot afford it… Sorry about these emotional ramblings, but I just don’t know what to do! Sure, everything will work out eventually, but now I feel beaten down. It is such a waste of so many cool people and a great awesome team of 300+ pleeps… Well, we’ll see what happens. Nothing more I can do then wait I guess…