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

Author:
Jeff Gehlbach

Constructor Summary
AsteriskOriginator()
          Default constructor.
AsteriskOriginator(Properties amiProps)
           
 
Method Summary
 org.asteriskjava.manager.action.OriginateAction buildOriginateAction()
          Build a complete OriginateAction ready for dispatching.
 String getAmiHost()
           
 Properties getAmiProps()
          This returns the properties configured in the asterisk-configuration.properties file.
 String 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()
           
 String getLegAExtension()
           
 String getMessageText()
           
 String getSubject()
           
 boolean isDebug()
           
 void originateCall()
          Originates a call based on properties set on this bean.
 void setAmiHost(String amiHost)
           
 void setCallerId(String cid)
           
 void setChannelVariable(String name, String value)
          Sets a variable on the channel used for the originated call
 void setDebug(boolean debug)
           
 void setLegAChannel(String chan)
           
 void setLegAExtension(String exten)
           
 void setMessageText(String messageText)
           
 void setSubject(String subject)
           
 
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
Throws:
AsteriskOriginatorException

AsteriskOriginator

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

Throws:
AsteriskOriginatorException
Method Detail

originateCall

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

Throws:
AsteriskOriginatorException

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()
Returns:
Returns the Caller ID

setCallerId

public void setCallerId(String cid)
Parameters:
from - The from address to set.

getAmiHost

public String getAmiHost()
Returns:
Returns the AMI host.

setAmiHost

public void setAmiHost(String amiHost)
                throws UnknownHostException
Parameters:
amiHost - Sets the mail host.
Throws:
UnknownHostException

getMessageText

public String getMessageText()
Returns:
Returns the message text.

setMessageText

public void setMessageText(String messageText)
Parameters:
messageText - Sets the message text.

getSubject

public String getSubject()
Returns:
Returns the message Subject.

setSubject

public void setSubject(String subject)
Parameters:
subject - Sets the message Subject.

getLegAExtension

public String getLegAExtension()
Returns:
Returns the extension for Leg A

setLegAExtension

public void setLegAExtension(String exten)
Parameters:
exten - Sets the extension for Leg A

getLegAChannel

public String getLegAChannel()
Returns:
Returns the channel for Leg A

setLegAChannel

public void setLegAChannel(String chan)
Parameters:
exten - Sets the channelfor Leg A

isDebug

public boolean isDebug()

setDebug

public void setDebug(boolean debug)

getAmiProps

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

Returns:

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 © 2009. All Rights Reserved.