Update of /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/manager/event
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29379/src/java/net/sf/asterisk/manager/event
Modified Files:
NewCallerIdEvent.java
Log Message:
Added CidCallingPres and CidCallingPresTxt attributes to NewCallerIdEvent
Index: NewCallerIdEvent.java
===================================================================
RCS file: /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/manager/event/NewCallerIdEvent.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -p -r1.4 -r1.5
--- NewCallerIdEvent.java 26 Feb 2005 20:50:31 -0000 1.4
+++ NewCallerIdEvent.java 27 Aug 2005 02:57:54 -0000 1.5
@@ -16,6 +16,7 @@
*/
package net.sf.asterisk.manager.event;
+
/**
* A NewCallerIdEvent is triggered when the caller id of a channel changes.<br>
* It is implemented in <code>channel.c</code>
@@ -51,6 +52,12 @@ public class NewCallerIdEvent extends Ma
private String uniqueId;
/**
+ * Callerid presentation/screening.
+ */
+ private Integer cidCallingPres;
+ private String cidCallingPresTxt;
+
+ /**
* @param source
*/
public NewCallerIdEvent(Object source)
@@ -119,7 +126,8 @@ public class NewCallerIdEvent extends Ma
}
/**
- * Returns the new Caller*ID Name if set or "≶Unknown>" if none has been set.
+ * Returns the new Caller*ID Name if set or "≶Unknown>" if none has
+ * been set.
*
* @return the new Caller*ID Name.
*/
@@ -129,7 +137,8 @@ public class NewCallerIdEvent extends Ma
}
/**
- * Sets the new Caller*ID Name if set or "≶Unknown>" if none has been set.
+ * Sets the new Caller*ID Name if set or "≶Unknown>" if none has been
+ * set.
*
* @param callerIdName the Caller*ID Name to set.
*/
@@ -137,4 +146,61 @@ public class NewCallerIdEvent extends Ma
{
this.callerIdName = callerIdName;
}
+
+ /**
+ * Returns the CallerId presentation/screening.
+ *
+ * @return the CallerId presentation/screening.
+ */
+ public Integer getCidCallingPres()
+ {
+ return cidCallingPres;
+ }
+
+ /**
+ * Returns the textual respresentation of the CallerId
+ * presentation/screening.
+ *
+ * @return the textual respresentation of the CallerId
+ * presentation/screening.
+ */
+ public String getCidCallingPresTxt()
+ {
+ return cidCallingPresTxt;
+ }
+
+ /**
+ * Sets the CallerId presentation/screening in the form "%d (%s)".
+ *
+ * @param s the CallerId presentation/screening in the form "%d (%s)".
+ */
+ public void setCidCallingPres(String s)
+ {
+ int spaceIdx;
+
+ if (s == null)
+ {
+ return;
+ }
+
+ spaceIdx = s.indexOf(' ');
+ if (spaceIdx <= 0)
+ {
+ spaceIdx = s.length();
+ }
+
+ try
+ {
+ this.cidCallingPres = new Integer(s.substring(0, spaceIdx));
+ }
+ catch (NumberFormatException e)
+ {
+ return;
+ }
+
+ if (s.length() > spaceIdx + 3)
+ {
+ this.cidCallingPresTxt = s.substring(spaceIdx + 2, s.length() - 1);
+ }
+ }
}
|