Package metrics4Asterisk.metrics

Examples of metrics4Asterisk.metrics.CallMetric


    public void makeSummary(final Map<String, CallMetric> map) {
        Set<String> keys = map.keySet();
        Iterator<String> iter = keys.iterator();
        while (iter.hasNext()) {
            String key = iter.next();
            CallMetric callMetric = map.get(key);
            if (getQueueNames().contains(callMetric.getQueueName())) {
                //only add calls in the date range
                long logDateLong = callMetric.getEnterQueueTime();
                if (logDateLong < this.toTimeLong) {
                    if (callMetric.getTalkTime() > 0l) {
                        addAnsToTimeMetric(logDateLong);
                        logger.debug("adding answred call");
                    } else {
                        addUnAnsToTimeMetric(logDateLong);
                        logger.debug("adding unanswered call");
                    }
                }
            } else {
                logger.warn("missing queue " + callMetric.getQueueName());
            }
        }
    }
View Full Code Here


        //maybe put in something like average agents metircs
        Set<String> keys = callMap.keySet();
        Iterator<String> iter = keys.iterator();
        while(iter.hasNext()) {
            String key = iter.next();
            CallMetric callMetric = (CallMetric) callMap.get(key);
            AgentMetric agentMetric = (AgentMetric) getLoginMap().get(callMetric.getExtension());
            if (agentMetric != null) {           
                agentMetric.addToCallCount();
                agentMetric.addToWaitTime(callMetric.getWaitTime());
                agentMetric.addToTalkTime(callMetric.getTalkTime());               
            }
        }
    }
View Full Code Here

    public void makeSummary(final Set<String> queueNames, final Map<String, CallMetric> map) {
        Set<String> keys = map.keySet();
        Iterator<String> iter = keys.iterator();
        while(iter.hasNext()) {
            String key = iter.next();
            CallMetric callMetric = map.get(key);
            if (queueNames.contains(callMetric.getQueueName())) {
                //logger.debug("getConnectAgentTime " + callMetric.getConnectAgentTime());
                if (callMetric.getTalkTime() > 0) {
                    logger.debug("add answered");
                    answeredCalls.addCall();
                    answeredCalls.addToDistribution(callMetric.getWaitTime());
                    answeredCalls.addWaitTime(callMetric.getWaitTime());
                    answeredCalls.addTalkTime(callMetric.getTalkTime());
                } else {
                    logger.debug("add unanswered");
                    unansweredCalls.addCall();
                    unansweredCalls.addToDistribution(callMetric.getWaitTime());
                    unansweredCalls.addWaitTime(callMetric.getWaitTime());
                }
            }
        }
    }
View Full Code Here

            //total number of calls to test
            LogMapper<CallMetric> mapper = queueLogParser.getLogMapper();
            assertEquals(4, mapper.getMap().size());

            //test the individual calls
            CallMetric call1 = mapper.getMap().get("1213780184.0");
            //test wait time before pickup
            assertEquals(call1.getWaitTime(), 6);
            //test total call time
            assertEquals(call1.getTalkTime(), 4873);
            //test the correct queuename is used
            assertEquals(call1.getQueueName(), "superqueue");
            //test that the correct extension is recorded
            assertEquals(call1.getExtension(), "Local/6005@internal/n");
           
        } catch (Exception e) {
            fail("no exceptions expected");
        }
    }
View Full Code Here

            //total number of calls to test
            LogMapper<CallMetric> mapper = queueLogParser.getLogMapper();
            assertEquals(3, mapper.getMap().size());

            //test the call that entered teh queue before the date range
            CallMetric call1 = mapper.getMap().get("1213780184.0");
            assertNull(call1);

        } catch (Exception e) {
            fail("no exceptions expected");
        }
View Full Code Here

            //total number of calls to test
            LogMapper<CallMetric> mapper = queueLogParser.getLogMapper();
            assertEquals(4, mapper.getMap().size());

            //test the call that left the queue after the date range
            CallMetric call1 = mapper.getMap().get("1213785844.23");
            assertNotNull(call1);
            //this should register 0 for talk and wait time
            //test wait time before pickup
            assertEquals(call1.getWaitTime(), 0);
            //test total call time
            assertEquals(call1.getTalkTime(), 0);
            //test the correct queuename is used
            assertEquals(call1.getQueueName(), "superqueue");
            //test that the correct extension is recorded
            assertEquals(call1.getExtension(), "Local/6005@internal/n");

        } catch (Exception e) {
            fail("no exceptions expected");
        }
    }
View Full Code Here

                String event = rowValues[4];
               
                if (!map.containsKey(callId)) {
                    if (event.equals("ENTERQUEUE")) {
                        CallMetric callMetric = new CallMetric();
                        callMetric.setEnterQueueTime(logRecordTime);
                        String queueName = rowValues[2];
                        callMetric.setQueueName(queueName);
                        callMetric.setCallId(callId);
                        logger.debug("added metric " + callMetric);
                        map.put(callId, callMetric);
                    } else {
                        logger.warn(callId + "|" + event + ": not in call map but something other than enter queue called");
                    }
                } else {
                    if (event.equals("ENTERQUEUE")) {
                        logger.warn(callId + ": ENTERQUEUE event with a key already in map");
                        return;
                    }

                    CallMetric callMetric = map.get(callId);
                    if (callMetric == null) {
                        logger.error(callId + ": not in map but should be.");
                        return;
                    }

                    logger.debug(event);
                    if (event.equals("ABANDON")) {
                        String waitTime = rowValues[7];
                        callMetric.setWaitTime(Integer.parseInt(waitTime));

                    } else if (event.equals("COMPLETECALLER") || event.equals("COMPLETEAGENT")) {
                        String talkTime = rowValues[6];
                        callMetric.setTalkTime(Integer.parseInt(talkTime));
                        String waitTime = rowValues[5];
                        callMetric.setExitQueueTime(logRecordTime);
                        callMetric.setWaitTime(Integer.parseInt(waitTime));
                    } else if (event.equals("CONNECT")) {
                        String extension = rowValues[3];
                        callMetric.setExtension(extension);
                        String connectTime = rowValues[0];
                        //make the unix timestamp into miliseconds
                        long longconnectTime = Long.parseLong(connectTime) * 1000l;
                        callMetric.setEnterQueueTime(longconnectTime);
                    }
                    logger.debug("metric is " + callMetric);
                }

            } catch (Exception e) {
View Full Code Here

TOP

Related Classes of metrics4Asterisk.metrics.CallMetric

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.