org.opennms.netmgt.asterisk.utils
Class AsteriskOriginator

java.lang.Object
  extended by org.opennms.netmgt.asterisk.utils.AsteriskOriginator

public class AsteriskOriginator
extends Object

Originates a call using the Asterisk Manager API

Version:
$Id: $
Author:
Jeff Gehlbach

Constructor Summary
AsteriskOriginator()
          Default constructor.
AsteriskOriginator(Properties amiProps)
          Constructor for AsteriskOriginator.
 
Method Summary
 org.asteriskjava.manager.action.OriginateAction buildOriginateAction()
          Build a complete OriginateAction ready for dispatching.
 String getAmiHost()
          getAmiHost
 Properties getAmiProps()
          This returns the properties configured in the asterisk-configuration.properties file.
 String getCallerId()
          getCallerId
 String getChannelVariable(String name)
          Retrieves a named channel variable for the originated call
 Map<String,String> getChannelVariables()
          Retrieves a Map of channel variables for the originated call
 String getLegAChannel()
          getLegAChannel
 String getLegAExtension()
          getLegAExtension
 String getMessageText()
          getMessageText
 String getSubject()
          getSubject
 boolean isDebug()
          isDebug
 void originateCall()
          Originates a call based on properties set on this bean.
 void setAmiHost(String amiHost)
          setAmiHost
 void setCallerId(String cid)
          setCallerId
 void setChannelVariable(String name, String value)
          Sets a variable on the channel used for the originated call
 void setDebug(boolean debug)
          setDebug
 void setLegAChannel(String chan)
          setLegAChannel
 void setLegAExtension(String exten)
          setLegAExtension
 void setMessageText(String messageText)
          setMessageText
 void setSubject(String subject)
          setSubject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AsteriskOriginator

public AsteriskOriginator(Properties amiProps)
                   throws AsteriskOriginatorException

Constructor for AsteriskOriginator.

Parameters:
amiProps - a Properties object.
Throws:
AsteriskOriginatorException - if any.

AsteriskOriginator

public AsteriskOriginator()
                   throws AsteriskOriginatorException
Default constructor. Default properties from asterisk-properties are set into session.

Throws:
AsteriskOriginatorException - if any.
Method Detail

originateCall

public void originateCall()
                   throws AsteriskOriginatorException
Originates a call based on properties set on this bean.

Throws:
AsteriskOriginatorException - if any.

buildOriginateAction

public org.asteriskjava.manager.action.OriginateAction buildOriginateAction()
                                                                     throws AsteriskOriginatorException
Build a complete OriginateAction ready for dispatching.

Returns:
completed OriginateAction, ready to be passed to ManagerConnection.sendAction
Throws:
AsteriskOriginatorException - if any of the underlying operations fail

getCallerId

public String getCallerId()

getCallerId

Returns:
Returns the Caller ID

setCallerId

public void setCallerId(String cid)

setCallerId

Parameters:
cid - The from address to set.

getAmiHost

public String getAmiHost()

getAmiHost

Returns:
Returns the AMI host.

setAmiHost

public void setAmiHost(String amiHost)
                throws UnknownHostException

setAmiHost

Parameters:
amiHost - Sets the mail host.
Throws:
UnknownHostException - if any.

getMessageText

public String getMessageText()

getMessageText

Returns:
Returns the message text.

setMessageText

public void setMessageText(String messageText)

setMessageText

Parameters:
messageText - Sets the message text.

getSubject

public String getSubject()

getSubject

Returns:
Returns the message Subject.

setSubject

public void setSubject(String subject)

setSubject

Parameters:
subject - Sets the message Subject.

getLegAExtension

public String getLegAExtension()

getLegAExtension

Returns:
Returns the extension for Leg A

setLegAExtension

public void setLegAExtension(String exten)

setLegAExtension

Parameters:
exten - Sets the extension for Leg A

getLegAChannel

public String getLegAChannel()

getLegAChannel

Returns:
Returns the channel for Leg A

setLegAChannel

public void setLegAChannel(String chan)

setLegAChannel

Parameters:
chan - Sets the channelfor Leg A

isDebug

public boolean isDebug()

isDebug

Returns:
a boolean.

setDebug

public void setDebug(boolean debug)

setDebug

Parameters:
debug - a boolean.

getAmiProps

public Properties getAmiProps()
This returns the properties configured in the asterisk-configuration.properties file.

Returns:
a Properties object.

setChannelVariable

public void setChannelVariable(String name,
                               String value)
Sets a variable on the channel used for the originated call

Parameters:
name - Name of variable to set
value - Value to set for variable

getChannelVariables

public Map<String,String> getChannelVariables()
Retrieves a Map of channel variables for the originated call

Returns:
A Map of channel variable names and values

getChannelVariable

public String getChannelVariable(String name)
Retrieves a named channel variable for the originated call

Parameters:
name - Name of variable to retrieve
Returns:
Value of named variable


Copyright © 2011. All Rights Reserved.