Recently I’m working on a project to implement automatic call distributor to my new call center. As I needed a good sample program I downloaded one from the site of Ozeki VoIP SIP SDK. With the help of detailed description it was an easy task to create call routing.
So this is my project basically:
Firstly I needed to set up call routing rules (to choose routing technology and to create data structure). I could choose from several routing methods for example:
1. In case of an agent ID routing I could put the agents in a sorted list and the call was transferred to the first available element of the list.
2. In case of a round robin routing I could also use a list and store the ID of the agent to whom the latest call was transferred. When a new call came in, it was transferred to the agent who was the next available in the list after the stored one. If I reached the end of the list, I could start the distribution from the beginning of the list again.
1. SortedDictionary<int, Ozeki.VoIP.SIPAccount> agents = new SortedDictionary<int, Ozeki.VoIP.SIPAccount>();
2. Dictionary<int, SIPAccount> busyAgents = new Dictionary<int, SIPAccount>();
4. IPhoneCall call;
5. int lastKey;
6. int keys;
8. public int getNextAgent(int key)
10. int n = Array.IndexOf(keys, key) + 1;
11. return n >= keys.Count() ? 0 : n;
14. public void routeRoundRobin(IPhoneCall call)
16. int i = lastKey;
17. while (true)
19. if (!busyAgents.ContainsKey(keys[i = getNextAgent(i)]))
23. busyAgents.Add(agents.First().Key, agents.First().Value);
26. public void callEndedByAgent(int agentID, SIPAccount account)
I don’t wish to write here all call routing methods but if you are interested in this topic you can visit the website (google this: ****/p_421-voip-call-routing-voip) and you will find other examples with codes too eg: routing by the most idle agent or routing according to the least occupied agent.