Asterisk-Java

org.asteriskjava.manager.event
Class CdrEvent

java.lang.Object
  extended by java.util.EventObject
      extended by org.asteriskjava.manager.event.ManagerEvent
          extended by org.asteriskjava.manager.event.CdrEvent
All Implemented Interfaces:
java.io.Serializable

public class CdrEvent
extends ManagerEvent

A CdrEvent is triggered when a call detail record is generated, usually at the end of a call.

To enable CdrEvents you have to add enabled = yes to the general section in cdr_manager.conf.

This event is implemented in cdr/cdr_manager.c

Version:
$Id: CdrEvent.java 938 2007-12-31 03:23:38Z srt $
Author:
srt
See Also:
Serialized Form

Field Summary
static java.lang.String AMA_FLAG_BILLING
           
static java.lang.String AMA_FLAG_DOCUMENTATION
           
static java.lang.String AMA_FLAG_OMIT
           
static java.lang.String AMA_FLAG_UNKNOWN
           
static java.lang.String DISPOSITION_ANSWERED
           
static java.lang.String DISPOSITION_BUSY
           
static java.lang.String DISPOSITION_FAILED
           
static java.lang.String DISPOSITION_NO_ANSWER
           
static java.lang.String DISPOSITION_UNKNOWN
           
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
CdrEvent(java.lang.Object source)
           
 
Method Summary
 java.lang.String getAccountCode()
          Returns the account number that is usually used to identify the party to bill for the call.
 java.lang.String getAmaFlags()
          Returns the AMA (Automated Message Accounting) flags.
 java.lang.String getAnswerTime()
          Returns when the call was answered.
 java.util.Date getAnswerTimeAsDate()
          Returns the answer time as Date object.
 java.util.Date getAnswerTimeAsDate(java.util.TimeZone tz)
          Returns the answer time as Date object.
 java.lang.Integer getBillableSeconds()
          Returns the total time (in seconds) the call was up from answer to hangup.
 java.lang.String getCallerId()
          Returns the Caller*ID with text.
 java.lang.String getChannel()
          Returns the name of the channel, for example "SIP/1310-asfe".
 java.lang.String getDestination()
          Returns the destination extension.
 java.lang.String getDestinationChannel()
          Returns the name of the destination channel if appropriate.
 java.lang.String getDestinationContext()
          Returns the destination context.
 java.lang.String getDisposition()
          Returns what happened to the call.
 java.lang.Integer getDuration()
          Returns the total time (in seconds) the caller spent in the system from dial to hangup.
 java.lang.String getEndTime()
          Returns when the call has ended.
 java.util.Date getEndTimeAsDate()
          Returns the end time as Date object.
 java.util.Date getEndTimeAsDate(java.util.TimeZone tz)
          Returns the end time as Date object.
 java.lang.String getLastApplication()
          Returns the last application if appropriate, for example "VoiceMail".
 java.lang.String getLastData()
          Returns the last application's data (arguments), for example "s1234".
 java.lang.String getSrc()
          Returns the Caller*ID number.
 java.lang.String getStartTime()
          Returns when the call has started.
 java.util.Date getStartTimeAsDate()
          Returns the start time as Date object.
 java.util.Date getStartTimeAsDate(java.util.TimeZone tz)
          Returns the start time as Date object.
 java.lang.String getUniqueId()
          Returns the unique id of the channel.
 java.lang.String getUserField()
          Returns the user-defined field as set by Set(CDR(userfield)=Value).
 void setAccountCode(java.lang.String accountCode)
          Sets the account number.
 void setAmaFlags(java.lang.String amaFlags)
          Sets the AMA (Automated Message Accounting) flags.
 void setAnswerTime(java.lang.String answerTime)
          Sets the date/time when the call was answered.
 void setBillableSeconds(java.lang.Integer billableSeconds)
          Sets the total time in call.
 void setCallerId(java.lang.String callerId)
          Sets the Caller*ID with text.
 void setChannel(java.lang.String channel)
          Sets the name of the channel.
 void setDestination(java.lang.String destination)
          Sets the destination extension.
 void setDestinationChannel(java.lang.String destinationChannel)
          Sets the name of the destination channel.
 void setDestinationContext(java.lang.String destinationContext)
          Sets the destination context.
 void setDisposition(java.lang.String disposition)
          Sets the disposition.
 void setDuration(java.lang.Integer duration)
          Sets the total time in system.
 void setEndTime(java.lang.String endTime)
          Sets the date/time when the call has ended.
 void setLastApplication(java.lang.String lastApplication)
          Sets the last application.
 void setLastData(java.lang.String lastData)
          Set the last application's data.
 void setSrc(java.lang.String source)
          Sets the Caller*ID number.
 void setStartTime(java.lang.String startTime)
          Sets the date/time when the call has started.
 void setUniqueId(java.lang.String uniqueId)
          Sets the unique id of the channel.
 void setUserField(java.lang.String userField)
          Sets the user-defined field.
 
Methods inherited from class org.asteriskjava.manager.event.ManagerEvent
getDateReceived, getPrivilege, getServer, getTimestamp, setDateReceived, setPrivilege, setServer, setTimestamp, toString
 
Methods inherited from class java.util.EventObject
getSource
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DISPOSITION_NO_ANSWER

public static final java.lang.String DISPOSITION_NO_ANSWER
See Also:
Constant Field Values

DISPOSITION_FAILED

public static final java.lang.String DISPOSITION_FAILED
See Also:
Constant Field Values

DISPOSITION_BUSY

public static final java.lang.String DISPOSITION_BUSY
See Also:
Constant Field Values

DISPOSITION_ANSWERED

public static final java.lang.String DISPOSITION_ANSWERED
See Also:
Constant Field Values

DISPOSITION_UNKNOWN

public static final java.lang.String DISPOSITION_UNKNOWN
See Also:
Constant Field Values

AMA_FLAG_OMIT

public static final java.lang.String AMA_FLAG_OMIT
See Also:
Constant Field Values

AMA_FLAG_BILLING

public static final java.lang.String AMA_FLAG_BILLING
See Also:
Constant Field Values

AMA_FLAG_DOCUMENTATION

public static final java.lang.String AMA_FLAG_DOCUMENTATION
See Also:
Constant Field Values

AMA_FLAG_UNKNOWN

public static final java.lang.String AMA_FLAG_UNKNOWN
See Also:
Constant Field Values
Constructor Detail

CdrEvent

public CdrEvent(java.lang.Object source)
Parameters:
source -
Method Detail

getAccountCode

public java.lang.String getAccountCode()
Returns the account number that is usually used to identify the party to bill for the call.

Corresponds to CDR field accountcode.

Returns:
the account number.

setAccountCode

public void setAccountCode(java.lang.String accountCode)
Sets the account number.

Parameters:
accountCode - the account number.

getSrc

public java.lang.String getSrc()
Returns the Caller*ID number.

Corresponds to CDR field src.

Returns:
the Caller*ID number.

setSrc

public void setSrc(java.lang.String source)
Sets the Caller*ID number.

Parameters:
source - the Caller*ID number.

getDestination

public java.lang.String getDestination()
Returns the destination extension.

Corresponds to CDR field dst.

Returns:
the destination extension.

setDestination

public void setDestination(java.lang.String destination)
Sets the destination extension.

Parameters:
destination - the destination extension.

getDestinationContext

public java.lang.String getDestinationContext()
Returns the destination context.

Corresponds to CDR field dcontext.

Returns:
the destination context.

setDestinationContext

public void setDestinationContext(java.lang.String destinationContext)
Sets the destination context.

Parameters:
destinationContext - the destination context.

getCallerId

public java.lang.String getCallerId()
Returns the Caller*ID with text.

Corresponds to CDR field clid.

Returns:
the Caller*ID with text

setCallerId

public void setCallerId(java.lang.String callerId)
Sets the Caller*ID with text.

Parameters:
callerId - the Caller*ID with text.

getChannel

public java.lang.String getChannel()
Returns the name of the channel, for example "SIP/1310-asfe".

Corresponds to CDR field channel.

Returns:
the name of the channel.

setChannel

public void setChannel(java.lang.String channel)
Sets the name of the channel.

Parameters:
channel - the name of the channel.

getDestinationChannel

public java.lang.String getDestinationChannel()
Returns the name of the destination channel if appropriate.

Corresponds to CDR field dstchannel.

Returns:
the name of the destination channel or null if not available.

setDestinationChannel

public void setDestinationChannel(java.lang.String destinationChannel)
Sets the name of the destination channel.

Parameters:
destinationChannel - the name of the destination channel.

getLastApplication

public java.lang.String getLastApplication()
Returns the last application if appropriate, for example "VoiceMail".

Corresponds to CDR field lastapp.

Returns:
the last application or null if not avaialble.

setLastApplication

public void setLastApplication(java.lang.String lastApplication)
Sets the last application.

Parameters:
lastApplication - the last application.

getLastData

public java.lang.String getLastData()
Returns the last application's data (arguments), for example "s1234".

Corresponds to CDR field lastdata.

Returns:
the last application's data or null if not avaialble.

setLastData

public void setLastData(java.lang.String lastData)
Set the last application's data.

Parameters:
lastData - the last application's data.

getStartTime

public java.lang.String getStartTime()
Returns when the call has started.

This corresponds to CDR field start.

Returns:
A string of the format "%Y-%m-%d %T" (strftime(3)) representing the date/time the call has started, for example "2006-05-19 11:54:48".

getStartTimeAsDate

public java.util.Date getStartTimeAsDate()
Returns the start time as Date object.

This method asumes that the Asterisk server's timezone equals the default timezone of your JVM.

Returns:
the start time as Date object.
Since:
0.3

getStartTimeAsDate

public java.util.Date getStartTimeAsDate(java.util.TimeZone tz)
Returns the start time as Date object.

Parameters:
tz - the timezone of the Asterisk server.
Returns:
the start time as Date object.
Since:
0.3

setStartTime

public void setStartTime(java.lang.String startTime)
Sets the date/time when the call has started.

Parameters:
startTime - the date/time when the call has started.

getAnswerTime

public java.lang.String getAnswerTime()
Returns when the call was answered.

This corresponds to CDR field answered.

Returns:
A string of the format "%Y-%m-%d %T" (strftime(3)) representing the date/time the call was answered, for example "2006-05-19 11:55:01"

getAnswerTimeAsDate

public java.util.Date getAnswerTimeAsDate()
Returns the answer time as Date object.

This method asumes that the Asterisk server's timezone equals the default timezone of your JVM.

Returns:
the answer time as Date object.
Since:
0.3

getAnswerTimeAsDate

public java.util.Date getAnswerTimeAsDate(java.util.TimeZone tz)
Returns the answer time as Date object.

Parameters:
tz - the timezone of the Asterisk server.
Returns:
the answer time as Date object.
Since:
0.3

setAnswerTime

public void setAnswerTime(java.lang.String answerTime)
Sets the date/time when the call was answered.

Parameters:
answerTime - the date/time when the call was answered.

getEndTime

public java.lang.String getEndTime()
Returns when the call has ended.

This corresponds to CDR field end.

Returns:
A string of the format "%Y-%m-%d %T" (strftime(3)) representing the date/time the call has ended, for example "2006-05-19 11:58:21"

getEndTimeAsDate

public java.util.Date getEndTimeAsDate()
Returns the end time as Date object.

This method asumes that the Asterisk server's timezone equals the default timezone of your JVM.

Returns:
the end time as Date object.
Since:
0.3

getEndTimeAsDate

public java.util.Date getEndTimeAsDate(java.util.TimeZone tz)
Returns the end time as Date object.

Parameters:
tz - the timezone of the Asterisk server.
Returns:
the end time as Date object.
Since:
0.3

setEndTime

public void setEndTime(java.lang.String endTime)
Sets the date/time when the call has ended.

Parameters:
endTime - the date/time when the call has ended.

getDuration

public java.lang.Integer getDuration()
Returns the total time (in seconds) the caller spent in the system from dial to hangup.

Corresponds to CDR field duration.

Returns:
the total time in system in seconds.

setDuration

public void setDuration(java.lang.Integer duration)
Sets the total time in system.

Parameters:
duration - total time in system in seconds.

getBillableSeconds

public java.lang.Integer getBillableSeconds()
Returns the total time (in seconds) the call was up from answer to hangup.

Corresponds to CDR field billsec.

Returns:
the total time in call in seconds.

setBillableSeconds

public void setBillableSeconds(java.lang.Integer billableSeconds)
Sets the total time in call.

Parameters:
billableSeconds - the total time in call in seconds.

getDisposition

public java.lang.String getDisposition()
Returns what happened to the call.

This is one of

Corresponds to CDR field disposition.

Returns:
the disposition.

setDisposition

public void setDisposition(java.lang.String disposition)
Sets the disposition.

Parameters:
disposition - the disposition.

getAmaFlags

public java.lang.String getAmaFlags()
Returns the AMA (Automated Message Accounting) flags.

This is one of

Corresponds to CDR field amaflags.

Returns:
the AMA flags.

setAmaFlags

public void setAmaFlags(java.lang.String amaFlags)
Sets the AMA (Automated Message Accounting) flags.

Parameters:
amaFlags - the AMA (Automated Message Accounting) flags.

getUniqueId

public java.lang.String getUniqueId()
Returns the unique id of the channel.

Returns:
the unique id of the channel.

setUniqueId

public void setUniqueId(java.lang.String uniqueId)
Sets the unique id of the channel.

Parameters:
uniqueId - the unique id of the channel.

getUserField

public java.lang.String getUserField()
Returns the user-defined field as set by Set(CDR(userfield)=Value).

Corresponds to CDR field userfield.

Returns:
the user-defined field.

setUserField

public void setUserField(java.lang.String userField)
Sets the user-defined field.

Parameters:
userField - the user-defined field

Asterisk-Java

Copyright © 2004-2009 Stefan Reuter. All Rights Reserved.