| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 2438b73 commit 26455a0
15 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -6,4 +6,5 @@ target | |||
| 6 | 6 | .project | |
| 7 | 7 | .settings/* | |
| 8 | 8 | .idea | |
| 9 | + .gradle | ||
| 9 | 10 | classes | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -37,6 +37,13 @@ | |||
| 37 | 37 | <organization>Bureau of Economic and Business Research, University of Florida</organization> | |
| 38 | 38 | <timezone>-5</timezone> | |
| 39 | 39 | </developer> | |
| 40 | + <developer> | ||
| 41 | + <name>Octavio Luna</name> | ||
| 42 | + <id>itaqua</id> | ||
| 43 | + <email>octavio.luna at gmail.com</email> | ||
| 44 | + <organization>N4Utilus Take your Business to the Cloud</organization> | ||
| 45 | + <timezone>-6</timezone> | ||
| 46 | + </developer> | ||
| 40 | 47 | </developers> | |
| 41 | 48 | <scm> | |
| 42 | 49 | <connection>scm:git:git://github.com/srt/asterisk-java.git</connection> | |
@@ -130,6 +137,12 @@ org.apache.log4j;resolution:=optional | |||
| 130 | 137 | <version>1.2.16</version> | |
| 131 | 138 | <scope>compile</scope> | |
| 132 | 139 | </dependency> | |
| 140 | + <dependency> | ||
| 141 | + <groupId>org.apache.commons</groupId> | ||
| 142 | + <artifactId>commons-lang3</artifactId> | ||
| 143 | + <version>3.1</version> | ||
| 144 | + <scope>compile</scope> | ||
| 145 | + </dependency> | ||
| 133 | 146 | <dependency> | |
| 134 | 147 | <groupId>org.slf4j</groupId> | |
| 135 | 148 | <artifactId>slf4j-api</artifactId> | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -17,12 +17,14 @@ | |||
| 17 | 17 | package org.asteriskjava.live; | |
| 18 | 18 | ||
| 19 | 19 | import java.util.Collection; | |
| 20 | + import java.util.Date; | ||
| 20 | 21 | import java.util.List; | |
| 21 | 22 | ||
| 22 | 23 | /** | |
| 23 | 24 | * An Asterisk ACD queue. | |
| 24 | 25 | * | |
| 25 | 26 | * @author srt | |
| 27 | + * @author itaqua | ||
| 26 | 28 | * @version $Id$ | |
| 27 | 29 | */ | |
| 28 | 30 | public interface AsteriskQueue | |
@@ -134,4 +136,67 @@ public interface AsteriskQueue | |||
| 134 | 136 | * @since 0.3 | |
| 135 | 137 | */ | |
| 136 | 138 | void removeAsteriskQueueListener(AsteriskQueueListener listener); | |
| 139 | + | ||
| 140 | + /** | ||
| 141 | + * Returns the number of abandoned calls. | ||
| 142 | + * @author itaqua | ||
| 143 | + * @return the number of abandoned calls. | ||
| 144 | + */ | ||
| 145 | + Integer getAbandoned(); | ||
| 146 | + | ||
| 147 | + /** | ||
| 148 | + * Returns the ratio of calls answered within the specified service level per total completed | ||
| 149 | + * calls (in percent). | ||
| 150 | + * @author itaqua | ||
| 151 | + * @return the ratio of calls answered within the specified service level per total completed | ||
| 152 | + * calls (in percent). | ||
| 153 | + */ | ||
| 154 | + public Double getServiceLevelPerf(); | ||
| 155 | + | ||
| 156 | + /** | ||
| 157 | + * Returns the number of completed calls. | ||
| 158 | + * @author itaqua | ||
| 159 | + * @return the number of completed calls. | ||
| 160 | + */ | ||
| 161 | + public Integer getCompleted(); | ||
| 162 | + | ||
| 163 | + /** | ||
| 164 | + * Returns the current average talk time for this queue based on an exponential average. | ||
| 165 | + * | ||
| 166 | + * @return the current average talk time for this queue. | ||
| 167 | + */ | ||
| 168 | + public Integer getTalkTime(); | ||
| 169 | + | ||
| 170 | + /** | ||
| 171 | + * Returns the current average holdtime for this queue (in seconds). | ||
| 172 | + * @author itaqua | ||
| 173 | + * @return the current average holdtime for this queue (in seconds). | ||
| 174 | + */ | ||
| 175 | + public Integer getHoldTime(); | ||
| 176 | + | ||
| 177 | + /** | ||
| 178 | + * Returns the number of calls currently waiting in the queue. | ||
| 179 | + * Is better to use get Waiting() | ||
| 180 | + * @author itaqua | ||
| 181 | + * @see getWaiting() | ||
| 182 | + * @return the number of calls currently waiting in the queue. | ||
| 183 | + */ | ||
| 184 | + public Integer getCalls(); | ||
| 185 | + | ||
| 186 | + /** | ||
| 187 | + * Returns the number of calls currently waiting in the queue. | ||
| 188 | + * More verbose Method than getCalls() | ||
| 189 | + * @author itaqua | ||
| 190 | + * @return the number of calls currently waiting in the queue. | ||
| 191 | + */ | ||
| 192 | + public Integer getWaiting(); | ||
| 193 | + | ||
| 194 | + /** | ||
| 195 | + * timestamp (miliseconds) of last update of this object | ||
| 196 | + * @todo maybe change this to an immutable object | ||
| 197 | + * @author itaqua | ||
| 198 | + * @return | ||
| 199 | + */ | ||
| 200 | + long getLastUpdateMillis(); | ||
| 201 | + | ||
| 137 | 202 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -27,6 +27,7 @@ | |||
| 27 | 27 | * </ul> | |
| 28 | 28 | * | |
| 29 | 29 | * @author <a href="mailto:patrick.breucking{@nospam}gonicus.de">Patrick Breucking</a> | |
| 30 | + * @author itaqua | ||
| 30 | 31 | * @version $Id$ | |
| 31 | 32 | * @since 0.3.1 | |
| 32 | 33 | */ | |
@@ -35,6 +36,8 @@ public interface AsteriskQueueMember extends LiveObject | |||
| 35 | 36 | String PROPERTY_STATE = "state"; | |
| 36 | 37 | String PROPERTY_PENALTY = "penalty"; | |
| 37 | 38 | String PROPERTY_PAUSED = "paused"; | |
| 39 | + String PROPERTY_CALLSTAKEN = "callsTaken"; | ||
| 40 | + String PROPERTY_LASTCALL = "lastCall"; | ||
| 38 | 41 | ||
| 39 | 42 | /** | |
| 40 | 43 | * Returns the location of this member. | |
@@ -143,4 +146,18 @@ public interface AsteriskQueueMember extends LiveObject | |||
| 143 | 146 | * @since 1.0.0 | |
| 144 | 147 | */ | |
| 145 | 148 | void setPenalty(int penalty) throws IllegalArgumentException, ManagerCommunicationException, InvalidPenaltyException; | |
| 149 | + | ||
| 150 | + /** | ||
| 151 | + * get the timestamp when the last call was terminated | ||
| 152 | + * @author itaqua | ||
| 153 | + * @return | ||
| 154 | + */ | ||
| 155 | + public abstract Long getLastCall(); | ||
| 156 | + | ||
| 157 | + /** | ||
| 158 | + * total calls taken | ||
| 159 | + * @author itaqua | ||
| 160 | + * @return | ||
| 161 | + */ | ||
| 162 | + public abstract Integer getCallsTaken(); | ||
| 146 | 163 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -17,6 +17,7 @@ | |||
| 17 | 17 | package org.asteriskjava.live; | |
| 18 | 18 | ||
| 19 | 19 | import java.util.Collection; | |
| 20 | + import java.util.Date; | ||
| 20 | 21 | import java.util.Map; | |
| 21 | 22 | import java.util.List; | |
| 22 | 23 | ||
@@ -488,4 +489,34 @@ void setGlobalVariable(String variable, String value) | |||
| 488 | 489 | * @throws ManagerCommunicationException if login fails | |
| 489 | 490 | */ | |
| 490 | 491 | void initialize() throws ManagerCommunicationException; | |
| 492 | + | ||
| 493 | + /** | ||
| 494 | + * get Asterisk Queue by name | ||
| 495 | + * @author itaqua | ||
| 496 | + * @param queueName Name of the queue to retrieve | ||
| 497 | + * @return | ||
| 498 | + */ | ||
| 499 | + public AsteriskQueue getQueueByName(String queueName); | ||
| 500 | + | ||
| 501 | + /** | ||
| 502 | + * List of Queues Objects updated after certain date | ||
| 503 | + * @author itaqua | ||
| 504 | + * @param date | ||
| 505 | + * @return | ||
| 506 | + */ | ||
| 507 | + public List<AsteriskQueue> getQueuesUpdatedAfter(Date date); | ||
| 508 | + | ||
| 509 | + /** | ||
| 510 | + * every time we get an event of a queue we reload the information about it from | ||
| 511 | + * the Asterisk Server | ||
| 512 | + * @author itaqua | ||
| 513 | + */ | ||
| 514 | + public void forceQueuesMonitor(boolean force); | ||
| 515 | + | ||
| 516 | + /** | ||
| 517 | + * Check if the Queue Information is forced | ||
| 518 | + * @author itaqua | ||
| 519 | + * @return | ||
| 520 | + */ | ||
| 521 | + public boolean isQueuesMonitorForced(); | ||
| 491 | 522 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -17,6 +17,7 @@ | |||
| 17 | 17 | package org.asteriskjava.live; | |
| 18 | 18 | ||
| 19 | 19 | import java.util.Collection; | |
| 20 | + import java.util.Date; | ||
| 20 | 21 | import java.util.Map; | |
| 21 | 22 | import java.util.List; | |
| 22 | 23 | ||
@@ -313,4 +314,23 @@ public Collection<AsteriskAgent> getAgents() throws ManagerCommunicationExceptio | |||
| 313 | 314 | { | |
| 314 | 315 | return impl.getAgents(); | |
| 315 | 316 | } | |
| 317 | + | ||
| 318 | + public AsteriskQueue getQueueByName(String queueName) { | ||
| 319 | + return impl.getQueueByName(queueName); | ||
| 320 | + } | ||
| 321 | + | ||
| 322 | + @Override | ||
| 323 | + public List<AsteriskQueue> getQueuesUpdatedAfter(Date date) { | ||
| 324 | + return impl.getQueuesUpdatedAfter(date); | ||
| 325 | + } | ||
| 326 | + | ||
| 327 | + @Override | ||
| 328 | + public void forceQueuesMonitor(boolean force) { | ||
| 329 | + impl.forceQueuesMonitor(force); | ||
| 330 | + } | ||
| 331 | + | ||
| 332 | + @Override | ||
| 333 | + public boolean isQueuesMonitorForced() { | ||
| 334 | + return impl.isQueuesMonitorForced(); | ||
| 335 | + } | ||
| 316 | 336 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -72,4 +72,10 @@ public interface LiveObject | |||
| 72 | 72 | * @param listener listener to remove | |
| 73 | 73 | */ | |
| 74 | 74 | void removePropertyChangeListener(String propertyName, PropertyChangeListener listener); | |
| 75 | + | ||
| 76 | + /** | ||
| 77 | + * Timestamp of last update of the Object | ||
| 78 | + * @return | ||
| 79 | + */ | ||
| 80 | + long getLastUpdateMillis(); | ||
| 75 | 81 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -19,7 +19,7 @@ | |||
| 19 | 19 | import org.asteriskjava.manager.event.QueueMemberEvent; | |
| 20 | 20 | ||
| 21 | 21 | /** | |
| 22 | - * Represents the status of a Queue memeber. | ||
| 22 | + * Represents the status of a Queue member. | ||
| 23 | 23 | * | |
| 24 | 24 | * <p/> | |
| 25 | 25 | * Valid status codes are: | |
@@ -36,9 +36,16 @@ | |||
| 36 | 36 | * <dd>?</dd> | |
| 37 | 37 | * <dt>AST_DEVICE_UNAVAILABLE (5)</dt> | |
| 38 | 38 | * <dd>?</dd> | |
| 39 | + * <dt>AST_DEVICE_RINGING (6)</dt> | ||
| 40 | + * <dd>?</dd> | ||
| 41 | + * <dt>AST_DEVICE_RINGINUSE (7)</dt> | ||
| 42 | + * <dd>?</dd> | ||
| 43 | + * <dt>AST_DEVICE_ONHOLD (8)</dt> | ||
| 44 | + * <dd>?</dd> | ||
| 39 | 45 | * </dl> | |
| 40 | 46 | * | |
| 41 | 47 | * @author <a href="mailto:patrick.breucking{@nospam}gonicus.de">Patrick Breucking</a> | |
| 48 | + * @author itaqua | ||
| 42 | 49 | * @version $Id$ | |
| 43 | 50 | * @since 0.3.1 | |
| 44 | 51 | * @see org.asteriskjava.manager.event.QueueMemberEvent | |
@@ -62,9 +69,27 @@ public enum QueueMemberState | |||
| 62 | 69 | DEVICE_INVALID(QueueMemberEvent.AST_DEVICE_INVALID), | |
| 63 | 70 | ||
| 64 | 71 | /** | |
| 65 | - * Device is not availible for call, eg. Agent is logged off. | ||
| 72 | + * Device is not available for call, eg. Agent is logged off. | ||
| 73 | + */ | ||
| 74 | + DEVICE_UNAVAILABLE(QueueMemberEvent.AST_DEVICE_UNAVAILABLE), | ||
| 75 | + | ||
| 76 | + /** | ||
| 77 | + * Device is ringing. | ||
| 66 | 78 | */ | |
| 67 | - DEVICE_UNAVAILABLE(QueueMemberEvent.AST_DEVICE_UNAVAILABLE); | ||
| 79 | + DEVICE_RINGING(QueueMemberEvent.AST_DEVICE_RINGING), | ||
| 80 | + | ||
| 81 | + /** | ||
| 82 | + * Device is ringing *and* in use. | ||
| 83 | + */ | ||
| 84 | + DEVICE_RINGINUSE(QueueMemberEvent.AST_DEVICE_RINGINUSE), | ||
| 85 | + | ||
| 86 | + /** | ||
| 87 | + * Device is on hold | ||
| 88 | + */ | ||
| 89 | + DEVICE_ONHOLD(QueueMemberEvent.AST_DEVICE_ONHOLD); | ||
| 90 | + | ||
| 91 | + | ||
| 92 | + | ||
| 68 | 93 | ||
| 69 | 94 | private final int status; | |
| 70 | 95 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -16,14 +16,14 @@ | |||
| 16 | 16 | */ | |
| 17 | 17 | package org.asteriskjava.live.internal; | |
| 18 | 18 | ||
| 19 | - import java.beans.PropertyChangeListener; | ||
| 20 | - import java.beans.PropertyChangeSupport; | ||
| 21 | - | ||
| 22 | 19 | import org.asteriskjava.live.AsteriskServer; | |
| 23 | 20 | import org.asteriskjava.live.LiveObject; | |
| 24 | 21 | import org.asteriskjava.util.Log; | |
| 25 | 22 | import org.asteriskjava.util.LogFactory; | |
| 26 | 23 | ||
| 24 | + import java.beans.PropertyChangeListener; | ||
| 25 | + import java.beans.PropertyChangeSupport; | ||
| 26 | + | ||
| 27 | 27 | /** | |
| 28 | 28 | * Abstract base class for all live objects. | |
| 29 | 29 | * | |
@@ -36,10 +36,14 @@ abstract class AbstractLiveObject implements LiveObject | |||
| 36 | 36 | private final PropertyChangeSupport changes; | |
| 37 | 37 | protected final AsteriskServerImpl server; | |
| 38 | 38 | ||
| 39 | + //last time this object was updated | ||
| 40 | + private long lastUpdate; | ||
| 41 | + | ||
| 39 | 42 | AbstractLiveObject(AsteriskServerImpl server) | |
| 40 | 43 | { | |
| 41 | 44 | this.server = server; | |
| 42 | 45 | this.changes = new PropertyChangeSupport(this); | |
| 46 | + stampLastUpdate(); | ||
| 43 | 47 | } | |
| 44 | 48 | ||
| 45 | 49 | public AsteriskServer getServer() | |
@@ -71,6 +75,7 @@ protected void firePropertyChange(String propertyName, Object oldValue, Object n | |||
| 71 | 75 | { | |
| 72 | 76 | if (oldValue != null || newValue != null) | |
| 73 | 77 | { | |
| 78 | + stampLastUpdate(); | ||
| 74 | 79 | try | |
| 75 | 80 | { | |
| 76 | 81 | changes.firePropertyChange(propertyName, oldValue, newValue); | |
@@ -81,4 +86,13 @@ protected void firePropertyChange(String propertyName, Object oldValue, Object n | |||
| 81 | 86 | } | |
| 82 | 87 | } | |
| 83 | 88 | } | |
| 89 | + | ||
| 90 | + @Override | ||
| 91 | + public long getLastUpdateMillis() { | ||
| 92 | + return lastUpdate; | ||
| 93 | + } | ||
| 94 | + | ||
| 95 | + public void stampLastUpdate(){ | ||
| 96 | + lastUpdate = System.currentTimeMillis(); | ||
| 97 | + } | ||
| 84 | 98 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments