net.sf.asterisk.fastagi.impl
Class AGIRequestImpl

java.lang.Object
  extended by net.sf.asterisk.fastagi.impl.AGIRequestImpl
All Implemented Interfaces:
java.io.Serializable, AGIRequest

public class AGIRequestImpl
extends java.lang.Object
implements java.io.Serializable, AGIRequest

Default implementation of the AGIRequest interface.

Version:
$Id: AGIRequestImpl.java,v 1.11 2005/11/27 16:08:17 srt Exp $
Author:
srt
See Also:
Serialized Form

Constructor Summary
AGIRequestImpl(java.util.Collection environment)
          Creates a new AGIRequestImpl.
 
Method Summary
 java.lang.String getAccountCode()
          Returns the account code set for the call.
 java.lang.String getCallerId()
          Returns the Caller*ID, for example "1234".
 java.lang.String getCallerIdName()
          Returns the the Caller*ID Name, for example "John Doe".
 java.lang.Integer getCallingAni2()
          Returns the Callerid ANI 2 (Info digits).
Available since Asterisk 1.2.
 java.lang.Integer getCallingPres()
          Returns the Callerid presentation/screening.
Available since Asterisk 1.2.
 java.lang.Integer getCallingTns()
          Returns the Callerid Transit Network Select.
Available since Asterisk 1.2.
 java.lang.Integer getCallingTon()
          Returns the Callerid Type of Number.
Available since Asterisk 1.2.
 java.lang.String getChannel()
          Returns the name of the channel.
 java.lang.String getContext()
          Returns the context in the dial plan from which the AGI script was called.
 java.lang.String getDnid()
          Returns the number, that has been dialed by the user.
 java.lang.Boolean getEnhanced()
          Returns wheather this agi is passed audio (EAGI - Enhanced AGI).
Enhanced AGI is currently not supported on FastAGI.
 java.lang.String getExtension()
          Returns the extension in the dial plan from which the AGI script was called.
 java.lang.String getLanguage()
          Returns the language, for example "en".
 java.net.InetAddress getLocalAddress()
          Returns the local address this channel, that is the IP address of the AGI server.
 int getLocalPort()
          Returns the local port of this channel, that is the port the AGI server is listening on.
 java.lang.String getParameter(java.lang.String name)
          Returns the value of a request parameter as a String, or null if the parameter does not exist.
 java.util.Map getParameterMap()
          Returns a java.util.Map of the parameters of this request.
 java.lang.String[] getParameterValues(java.lang.String name)
          Returns an array of String objects containing all of the values the given request parameter has, or null if the parameter does not exist.
If the parameter has a single value, the array has a length of 1.
 java.lang.Integer getPriority()
          Returns the priority in the dial plan from which the AGI script was called.
 java.lang.String getRdnis()
          If this call has been forwared, the number of the person doing the redirect is returned (Redirected dialed number identification service).
This is usally only only available on PRI.
 java.net.InetAddress getRemoteAddress()
          Returns the remote address of this channel, that is the IP address of the Asterisk server.
 int getRemotePort()
          Returns the remote port of this channel, that is the client port the Asterisk server is using for the AGI connection.
 java.util.Map getRequest()
          Returns a Map containing the raw request name/value pairs.
 java.lang.String getRequestURL()
          Returns the full URL of the request in the form agi://host[:port][/script].
 java.lang.String getScript()
          Returns the name of the script to execute.
 java.lang.String getType()
          Returns the type of the channel, for example "SIP".
 java.lang.String getUniqueId()
          Returns the unqiue id of the channel.
 void setLocalAddress(java.net.InetAddress localAddress)
           
 void setLocalPort(int localPort)
           
 void setRemoteAddress(java.net.InetAddress remoteAddress)
           
 void setRemotePort(int remotePort)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AGIRequestImpl

public AGIRequestImpl(java.util.Collection environment)
Creates a new AGIRequestImpl.

Parameters:
environment - the first lines as received from Asterisk containing the environment.
Method Detail

getRequest

public java.util.Map getRequest()
Description copied from interface: AGIRequest
Returns a Map containing the raw request name/value pairs.

Specified by:
getRequest in interface AGIRequest
Returns:
Map contain raw request name/value pairs.

getScript

public java.lang.String getScript()
Returns the name of the script to execute.

Specified by:
getScript in interface AGIRequest
Returns:
the name of the script to execute.

getRequestURL

public java.lang.String getRequestURL()
Returns the full URL of the request in the form agi://host[:port][/script].

Specified by:
getRequestURL in interface AGIRequest
Returns:
the full URL of the request in the form agi://host[:port][/script].

getChannel

public java.lang.String getChannel()
Returns the name of the channel.

Specified by:
getChannel in interface AGIRequest
Returns:
the name of the channel.

getUniqueId

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

Specified by:
getUniqueId in interface AGIRequest
Returns:
the unqiue id of the channel.

getType

public java.lang.String getType()
Description copied from interface: AGIRequest
Returns the type of the channel, for example "SIP".

Specified by:
getType in interface AGIRequest
Returns:
the type of the channel, for example "SIP".

getLanguage

public java.lang.String getLanguage()
Description copied from interface: AGIRequest
Returns the language, for example "en".

Specified by:
getLanguage in interface AGIRequest
Returns:
the language, for example "en".

getCallerId

public java.lang.String getCallerId()
Description copied from interface: AGIRequest
Returns the Caller*ID, for example "1234".

Specified by:
getCallerId in interface AGIRequest
Returns:
the Caller*ID, for example "1234", if no Caller*ID is set or it is "unknown" null is returned.

getCallerIdName

public java.lang.String getCallerIdName()
Description copied from interface: AGIRequest
Returns the the Caller*ID Name, for example "John Doe".

Specified by:
getCallerIdName in interface AGIRequest
Returns:
the the Caller*ID Name, for example "John Doe", if no Caller*ID Name is set or it is "unknown" null is returned.

getDnid

public java.lang.String getDnid()
Description copied from interface: AGIRequest
Returns the number, that has been dialed by the user.

Specified by:
getDnid in interface AGIRequest
Returns:
the dialed number, if no DNID is available or it is "unknown" null is returned.

getRdnis

public java.lang.String getRdnis()
Description copied from interface: AGIRequest
If this call has been forwared, the number of the person doing the redirect is returned (Redirected dialed number identification service).
This is usally only only available on PRI.

Specified by:
getRdnis in interface AGIRequest
Returns:
the number of the person doing the redirect, , if no RDNIS is available or it is "unknown" null is returned.

getContext

public java.lang.String getContext()
Description copied from interface: AGIRequest
Returns the context in the dial plan from which the AGI script was called.

Specified by:
getContext in interface AGIRequest
Returns:
the context in the dial plan from which the AGI script was called.

getExtension

public java.lang.String getExtension()
Description copied from interface: AGIRequest
Returns the extension in the dial plan from which the AGI script was called.

Specified by:
getExtension in interface AGIRequest
Returns:
the extension in the dial plan from which the AGI script was called.

getPriority

public java.lang.Integer getPriority()
Description copied from interface: AGIRequest
Returns the priority in the dial plan from which the AGI script was called.

Specified by:
getPriority in interface AGIRequest
Returns:
the priority in the dial plan from which the AGI script was called.

getEnhanced

public java.lang.Boolean getEnhanced()
Description copied from interface: AGIRequest
Returns wheather this agi is passed audio (EAGI - Enhanced AGI).
Enhanced AGI is currently not supported on FastAGI.

Specified by:
getEnhanced in interface AGIRequest
Returns:
Boolean.TRUE if this agi is passed audio, Boolean.FALSE otherwise.

getAccountCode

public java.lang.String getAccountCode()
Description copied from interface: AGIRequest
Returns the account code set for the call.

Specified by:
getAccountCode in interface AGIRequest
Returns:
the account code set for the call.

getCallingAni2

public java.lang.Integer getCallingAni2()
Description copied from interface: AGIRequest
Returns the Callerid ANI 2 (Info digits).
Available since Asterisk 1.2.

Specified by:
getCallingAni2 in interface AGIRequest
Returns:
the Callerid ANI 2 (Info digits).

getCallingPres

public java.lang.Integer getCallingPres()
Description copied from interface: AGIRequest
Returns the Callerid presentation/screening.
Available since Asterisk 1.2.

Specified by:
getCallingPres in interface AGIRequest
Returns:
the Callerid presentation/screening.

getCallingTns

public java.lang.Integer getCallingTns()
Description copied from interface: AGIRequest
Returns the Callerid Transit Network Select.
Available since Asterisk 1.2.

Specified by:
getCallingTns in interface AGIRequest
Returns:
the Callerid Transit Network Select.

getCallingTon

public java.lang.Integer getCallingTon()
Description copied from interface: AGIRequest
Returns the Callerid Type of Number.
Available since Asterisk 1.2.

Specified by:
getCallingTon in interface AGIRequest
Returns:
the Callerid Type of Number.

getParameter

public java.lang.String getParameter(java.lang.String name)
Description copied from interface: AGIRequest
Returns the value of a request parameter as a String, or null if the parameter does not exist. You should only use this method when you are sure the parameter has only one value.
If the parameter might have more than one value, use AGIRequest.getParameterValues(String).
If you use this method with a multivalued parameter, the value returned is equal to the first value in the array returned by getParameterValues.

Specified by:
getParameter in interface AGIRequest
Parameters:
name - a String containing the name of the parameter whose value is requested.
Returns:
a String representing the single value of the parameter.
See Also:
AGIRequest.getParameterValues(String)

getParameterValues

public java.lang.String[] getParameterValues(java.lang.String name)
Description copied from interface: AGIRequest
Returns an array of String objects containing all of the values the given request parameter has, or null if the parameter does not exist.
If the parameter has a single value, the array has a length of 1.

Specified by:
getParameterValues in interface AGIRequest
Parameters:
name - a String containing the name of the parameter whose value is requested.
Returns:
an array of String objects containing the parameter's values.

getParameterMap

public java.util.Map getParameterMap()
Description copied from interface: AGIRequest
Returns a java.util.Map of the parameters of this request.

Specified by:
getParameterMap in interface AGIRequest
Returns:
a java.util.Map containing parameter names as keys and parameter values as map values. The keys in the parameter map are of type String. The values in the parameter map are of type String array.

getLocalAddress

public java.net.InetAddress getLocalAddress()
Description copied from interface: AGIRequest
Returns the local address this channel, that is the IP address of the AGI server.

Specified by:
getLocalAddress in interface AGIRequest
Returns:
the local address this channel.

setLocalAddress

public void setLocalAddress(java.net.InetAddress localAddress)

getLocalPort

public int getLocalPort()
Description copied from interface: AGIRequest
Returns the local port of this channel, that is the port the AGI server is listening on.

Specified by:
getLocalPort in interface AGIRequest
Returns:
the local port of this socket channel.

setLocalPort

public void setLocalPort(int localPort)

getRemoteAddress

public java.net.InetAddress getRemoteAddress()
Description copied from interface: AGIRequest
Returns the remote address of this channel, that is the IP address of the Asterisk server.

Specified by:
getRemoteAddress in interface AGIRequest
Returns:
the remote address of this channel.

setRemoteAddress

public void setRemoteAddress(java.net.InetAddress remoteAddress)

getRemotePort

public int getRemotePort()
Description copied from interface: AGIRequest
Returns the remote port of this channel, that is the client port the Asterisk server is using for the AGI connection.

Specified by:
getRemotePort in interface AGIRequest
Returns:
the remote port of this channel.

setRemotePort

public void setRemotePort(int remotePort)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


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