hp.opencall.media.ccapi
Class AsyncMediaGroup

java.lang.Object
  extended byhp.opencall.media.ccapi.AsyncMediaGroup
All Implemented Interfaces:
ASRConstants, CoderConstants, Conference, ConferenceConstants, EchoCancellerConstants, FaxConstants, FaxLoggerIf, Player, PlayerConstants, Recorder, RecorderConstants, Resource, ResourceConstants, RTPRecorderConstants, SignalConstants, SignalDetector, SignalDetectorConstants, SignalGenerator, SignalGeneratorConstants, SMSPlayerConstants, SMSRecorderConstants, SpeechDetectorConstants, TTSConstants

public class AsyncMediaGroup
extends Object
implements Player, Recorder, SignalGenerator, SignalDetector, Conference, FaxLoggerIf

Adapter class which provides the asynchronous media resource interface to the native Call Control API including access to ASR/TTS servers.

Most of its methods are documented in classes and interfaces defined in JTAPI Media (ECTF S.410) or add for additional features :
Player, Recorder, SignalDetector, SignalGenerator, Conference, EchoCanceller, RTPPlayer, RTPRecorder, SilencePlayer, SpeechDetector. The access to these methods depends on the resource given in the ConfigSpec.

Due to the asynchronous nature of the API, the media resources methods (of interfaces Player, Recorder, SignalDetector and SignalGenerator) are non-blocking and the result is passed back to the application as an event through a listener interface (Callback methods). For example, in the play(). method, the result of the play is passed as a PlayerEvent event in a call to onPlayerEvent(). On the contrary, Conference methods (#join/#unjoin) are synchronous and do not return any result with an event.

This class assumes that all methods are called on a User Thread (see Thread Management in CCSession).

Since:
OCMP 2.0

Nested Class Summary
 
Nested classes inherited from class hp.opencall.media.ccapi.FaxLoggerIf
FaxLoggerIf.FaxLoggerIf2
 
Field Summary
 
Fields inherited from interface hp.telephony.media.ResourceConstants
e_Disconnected, e_OK, FOREVER, q_Duration, q_RTC, q_Standard, q_Stop, rtcc_Disconnected, rtcc_TriggerRTC, v_Forever
 
Fields inherited from interface hp.telephony.media.PlayerConstants
a_AutomaticGainControl, a_Coder, a_Jump, a_Pause, a_Speed, a_Volume, ev_Pause, ev_Play, ev_Resume, ev_Speed, ev_Volume, p_CoderTypes, p_DisplayName, p_EnabledEvents, p_FileFormat, p_IfBusy, p_JumpMSCIncrement, p_JumpTime, p_MaxDuration, p_SpeedChange, p_StartPaused, p_VolumeChange, q_Duration, q_EndOfData, rtca_JumpBackward, rtca_JumpBackwardMSCs, rtca_JumpEndMSC, rtca_JumpEndMSCList, rtca_JumpForward, rtca_JumpForwardMSCs, rtca_JumpStartMSC, rtca_JumpStartMSCList, rtca_NormalSpeed, rtca_NormalVolume, rtca_Pause, rtca_Resume, rtca_SpeedDown, rtca_SpeedUp, rtca_Stop, rtca_StopAll, rtca_ToggleSpeed, rtca_ToggleVolume, rtca_VolumeDown, rtca_VolumeUp, rtcc_PlayComplete, rtcc_PlayStarted, v_Fail, v_GSMFormat, v_Queue, v_RawFormat, v_Stop, v_WavFormat
 
Fields inherited from interface hp.telephony.media.CoderConstants
p_AMR_SDPelement, p_channels, p_crc, p_G723_annexa, p_G723_bitrate, p_G729_annexb, p_interleaving, p_maxptime, p_modechangeneighbor, p_modechangeperiod, p_modeset, p_octetalign, p_ptime, p_robustsorting, v_ADPCM_16kG726, v_ADPCM_24k, v_ADPCM_32k, v_ADPCM_32kG726, v_ADPCM_32kOKI, v_ADPCM_44k, v_ALawPCM_48k, v_ALawPCM_64k, v_ALawPCM_88k, v_AMR, v_AMR_WB, v_G723_1b, v_G723_53, v_G723_63, v_G723_no_vad, v_G723_yes, v_G729_no_vad, v_G729_yes, v_G729a, v_GSM, v_Linear16Bit_64k, v_Linear8Bit_48k, v_Linear8Bit_64k, v_Linear8Bit_88k, v_MuLawPCM_48k, v_MuLawPCM_64k, v_MuLawPCM_88k
 
Fields inherited from interface hp.telephony.media.TTSConstants
a_ASSessionAllocation, a_ASSessionCreation, a_AudioService, e_ResourceUnavailable, e_ServerError, e_ServerFailed, ev_Tag, p_AudioData, p_Language, p_ServerURL, p_Speaker, p_SpeakerCategory, p_SpeakerGender, p_SpeakerPitch, p_SpeakerRate, p_SpeakerVolume, p_StartMarkerMS, p_StartMarkerToken, p_StopMarkerMS, p_StopMarkerToken, p_TextType, p_TTSData, q_StartMarkerNotFound, q_StopMarkerReached, rtca_ReleaseCurrentASSession, v_ASStartTime, v_Call, v_FromFirstOperation, v_OnDemand, v_Operation
 
Fields inherited from interface hp.telephony.media.SMSPlayerConstants
e_TL_InternalError, ev_SMS, p_DLL_MessageType, p_DLL_RequiredTestErrorCause, p_DLL_RequiredTestMessageType, p_DLL_T10Timeout, p_DLL_T11Timeout, p_DLL_T12Timeout, p_TL_Data, p_TL_RequiredTestData, v_DLL_DATA_ACK, v_DLL_DATA_NACK, v_DLL_DATA_REQ, v_DLL_EST_IND, v_DLL_EST_REQ, v_DLL_ExtensionMechanismNotSupported, v_DLL_INFO_CFM, v_DLL_INFO_REJ, v_DLL_INFO_REQ, v_DLL_REL_REQ, v_DLL_UnknownMessageType, v_DLL_UnspecifiedCause, v_DLL_WrongChecksum, v_DLL_WrongMessageLength, v_NO_DLL_MANAGER, v_NO_MEMORY, v_TL_NOT_DLL_EST_REQ, v_TL_NOT_DLL_INFO_CFM, v_TL_NOT_DLL_INFO_REQ
 
Fields inherited from interface hp.telephony.media.FaxConstants
ev_Fax, p_AnswerCED, p_BitRate, p_ByteAlignedEol, p_CapabilityToReceive, p_DataCompressionFormat, p_DeTiffPrefix, p_DeTiffSuffix, p_EnablePolling, p_ErrorCorrection, p_FaxTimeOut, p_FileType, p_InternetRoutingSupport, p_InternetSelectivePollingSupport, p_KeepDataOrder, p_LegalSupport, p_LetterSupport, p_MaxLineToReceive, p_MaxPageToReceive, p_MaxSpeed, p_MinSpeed, p_PageLength, p_PageResolution, p_PagesEncoding, p_PagesPaths, p_PageWidth, p_PasswordSupport, p_PixelArrays, p_Role, p_ScanTimePerLine, p_SelectivePollingSupport, p_SelectivePollingWithSubaddressingSupport, p_StorePath, p_SubaddressingSupport, p_Suffix, p_T37Support, p_T38Support, p_TiffPath, p_VerticalResolution, q_Count, q_Document, q_Page, rtca_AssumeCNG, rtca_Cancel, v_12000bps, v_1216pixelsIn151mm, v_14400bps, v_1728pixelsIn215mm, v_2048pixelsIn255mm, v_2400bps, v_2432pixelsIn303mm, v_33600bps, v_4800bps, v_7200bps, v_864pixelsIn107mm, v_9600bps, v_A4_297mm, v_AfterCNG, v_Answerer, v_B4_364mm, v_BandWarrays, v_BMP, v_Caller, v_DisableECM, v_EnableECM_256bytes, v_EnableECM_64bytes, v_Encoding_MS_BMP, v_Error_Conversion_To_G3, v_Error_Decomp_Init, v_Error_Disconnect, v_Error_File_Open, v_Error_Illegal_Width, v_Error_Page_Format, v_FilesList, v_Fine_196lpi, v_GIF, v_JPEG, v_Normal_98lpi, v_NotSet, v_Page_File_Name_Size, v_PageResolution_0100_0100, v_PageResolution_0200_0100, v_PageResolution_0200_0200, v_PageResolution_0200_0400, v_PageResolution_0300_0300, v_PageResolution_0300_0600, v_PageResolution_0400_0400, v_PageResolution_0400_0800, v_PageResolution_0600_0600, v_PageResolution_0600_1200, v_PageResolution_1200_1200, v_PNG, v_Prefix, v_Rcv_Qual_Bad, v_Rcv_Qual_Medium, v_Rcv_Qual_OK, v_RightNow, v_ST0000, v_ST0505, v_ST1005, v_ST1010, v_ST2010, v_ST2020, v_ST4020, v_ST4040, v_T4_1D_ModifiedHuffman, v_T4_2D_ModifiedRead, v_T4_Buff_Size, v_T6_ModifiedModifiedRead, v_TIFF, v_UnlimitedLength, v_UponRTC
 
Fields inherited from interface hp.telephony.media.RecorderConstants
a_Beep, a_CoderTypes, a_FixedBeep, a_Pause, a_SilenceTruncation, ev_Pause, ev_Record, ev_Resume, p_Append, p_BeepFrequency, p_BeepLength, p_Coder, p_CoderTypes, p_EnabledEvents, p_FileFormat, p_FinalTimeoutBehaviour, p_MaxDuration, p_MinDuration, p_SignalTruncationOn, p_SilenceEnergyThreshold, p_SilenceTerminationOn, p_SilenceTerminationThreshold, p_SilenceTruncationOn, p_SilenceTruncationThreshold, p_SpeechDetectionMode, p_StartBeep, p_StartPaused, q_Silence, rtca_Pause, rtca_Resume, rtca_Stop, rtcc_RecordComplete, v_DetectAllOccurences, v_DetectFirstOccurence, v_GSMFormat, v_Inactive, v_RawFormat, v_WavFormat
 
Fields inherited from interface hp.telephony.media.ASRConstants
a_ASSessionAllocation, a_ASSessionCreation, a_AudioService, e_BadGrammar, e_ResourceUnavailable, e_ServerError, e_ServerFailed, ev_DefineGrammar, ev_DefineGrammer, ev_finalRuleResult, ev_FinalRuleResult, ev_FinalWordResult, ev_NonFinalRuleResult, ev_NonFinalWordResult, p_Grammar, p_GrammarId, p_GrammarType, p_GrammarURI, p_Language, p_LoadGrammar, p_NBestListLength, p_NoInputTimeout, p_Optimize, p_PauseOnIntermediateResult, p_RecogTimeout, p_SaveWaveform, p_SensitivityLevel, p_ServerURL, p_SpeakerName, p_SpeechCompleteTimeout, p_SpeechIncompleteTimeout, p_StubResultIsNoMatch, p_StubResultXML, p_StubResultXMLFile, p_TimersStartImmediately, q_VoiceDetected, rtca_ReleaseCurrentASSession, rtcc_VoiceDetected, v_ASStartTime, v_Call, v_FromFirstOperation, v_OnDemand, v_Operation
 
Fields inherited from interface hp.telephony.media.SpeechDetectorConstants
p_BargeIn, p_FinalTimeout, p_InitialTimeout, p_InPromptSensitivityPercent, p_Sensitivity, p_Type, q_EndOfSpeechDetected, q_NoSpeechTimeout, q_SpeechDetected, rtca_PromptDone, rtcc_EndOfSpeechDetected, rtcc_NoSpeechTimeout, rtcc_SpeechDetected, v_HP, v_Nvad, v_SwiEp, v_Telisma
 
Fields inherited from interface hp.telephony.media.EchoCancellerConstants
p_AcousticEcho, p_AlcInEnable, p_AlcInGain, p_AlcOutEnable, p_AlcOutGain, p_Bypass, p_EchoThreshold, p_MaxDelaySearch, p_Mu, p_NlpControl
 
Fields inherited from interface hp.telephony.media.RTPRecorderConstants
p_SendSignalsUsingRFC2833
 
Fields inherited from interface hp.telephony.media.SMSRecorderConstants
e_TL_InternalError, ev_SMS, q_TL_Message, v_TL_DATA_CFM, v_TL_DATA_ERR, v_TL_DATA_IND, v_TL_DATA_REJ, v_TL_EST_CFM, v_TL_EST_REJ, v_TL_INFO_ABRT, v_TL_INFO_CFM, v_TL_INFO_IND, v_TL_INFO_REJ, v_TL_NOT_DLL_EST_IND, v_TL_REL_ABRT, v_TL_REL_CFM, v_TL_REL_IND
 
Fields inherited from interface hp.telephony.media.SignalGeneratorConstants
a_SourceProvided, ev_SendSignals, p_Amplitude, p_DtmfGeneratorMode, p_InterSigGap, p_Length
 
Fields inherited from interface hp.telephony.media.SignalConstants
p_SymbolChar, v_CED, v_CNG, v_DTMF0, v_DTMF1, v_DTMF2, v_DTMF3, v_DTMF4, v_DTMF5, v_DTMF6, v_DTMF7, v_DTMF8, v_DTMF9, v_DTMFA, v_DTMFB, v_DTMFC, v_DTMFD, v_DTMFHash, v_DtmfInBand, v_DtmfInBandOutBand, v_DtmfNone, v_DtmfOutBand, v_DTMFStar
 
Fields inherited from interface hp.telephony.media.SignalDetectorConstants
a_Buffering, a_BufferSize, a_DiscardOldest, a_PatternCount, ev_FlushBuffer, ev_Overflow, ev_Pattern, ev_RetrieveSignals, ev_SignalDetected, p_Buffering, p_BufferSize, p_DiscardOldest, p_DtmfDetectorMode, p_Duration, p_EnabledEvents, p_Filter, p_InitialTimeout, p_InterSigTimeout, p_Mode, p_Pattern, p_PatternCount, q_Duration, q_InitialTimeout, q_InterSigTimeout, q_NumSignals, q_Pattern, rtca_DetectFaxCallingTone, rtca_EvalBuffer, rtca_FlushBuffer, rtca_IgnoreFaxCallingTone, rtca_PassSignalsThru, rtca_Stop, rtca_TruncateSignals, rtcc_FlushBuffer, rtcc_Pattern, rtcc_RetrieveSignals, rtcc_SignalDetected, v_Detecting, v_Idle
 
Fields inherited from interface hp.telephony.media.ConferenceConstants
p_AutoRelease, p_ListenOnly, p_TalkOnly
 
Method Summary
 void addResourceEventListener(ResourceEventListener aListener)
          Adds the specified resource event listener to receive events from the media group.
 void configure(ConfigSpec configSpec)
          Configures the MediaGroup according to the given configSpec.
 void flushBuffer()
          Remove all signals from the signal buffer.
 ConfigSpec getConfiguration()
          Returns a ConfigSpec that describes the current configuration of the MediaGroup.
 com.hp.opencall.media.common.MGLabel getLabel()
           
 Dictionary getParameters(Symbol[] params)
          Gets the value of various parameters from the MediaGroup.
 Dictionary getUserDictionary()
          Deprecated. No longer needed.
 Dictionary getUserValues(Symbol[] keys)
          Deprecated. No longer needed.
 void join(ConferenceIF confIF)
          Join to a given conference in both directions.
 void performFaxLog(String caller, String called, int duration, Date timeStamp)
          Default means to log fax operations.
 void play(String[] streamIDs, int offset, RTC[] rtc, Dictionary optargs)
          Play a sequence of MSCs (Media Stream Containers) identified by the streamIDs.
 void play(String streamID, int offset, RTC[] rtc, Dictionary optargs)
          Play a single MSC (Media Stream Container) named by streamID.
 void record(String streamID, RTC[] rtc, Dictionary optargs)
          Record data from the Terminal into the named Media Stream Container (MSC).
 void retrieveSignals(int numSignals, Symbol[] patterns, RTC[] rtc, Dictionary optargs)
          Retrieve some signals from the signal buffer.
 void sendSignals(String signals, RTC[] rtc, Dictionary optargs)
          Transmit a series of signals out the Terminal to the network.
 void sendSignals(Symbol[] signals, RTC[] rtc, Dictionary optargs)
          signal generator methods
static void setFaxLogger(FaxLoggerIf listener)
          Provides the OC MP platform with a means to log fax operations.
 void setParameters(Dictionary params)
          Set the value of various parameters for the MediaGroup.
 void setUserDictionary(Dictionary newDict)
          Deprecated. No longer needed.
 void setUserValues(Dictionary params)
          Deprecated. No longer needed.
 void stop()
          Stops all operations currently in progress on this media group.
 String toString()
           
 void triggerRTC(Symbol rtca)
          Triggers a RTC action from the application.
 void unjoin(ConferenceIF confIF)
          Unjoin the MG from a conference.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getLabel

public com.hp.opencall.media.common.MGLabel getLabel()

configure

public void configure(ConfigSpec configSpec)
               throws MediaConfigException
Configures the MediaGroup according to the given configSpec.

Throws:
MediaConfigException
Since:
Not supported

getConfiguration

public ConfigSpec getConfiguration()
                            throws AccessControlException
Returns a ConfigSpec that describes the current configuration of the MediaGroup.

Throws:
AccessControlException
Since:
Not supported

stop

public void stop()
Stops all operations currently in progress on this media group.

Those operations that are stopped get a completion event with:
ResourceEvent.getQualifier() == ResourceEvent.q_Stop


triggerRTC

public void triggerRTC(Symbol rtca)
Triggers a RTC action from the application.

This method allows the application to synthesize the triggering of RTC actions. The RTC Condition associated with this action is:
rtcc_TriggerRTC.

Parameters:
rtca - a Symbol for a recognized RTC action: rtca_Action

setUserDictionary

public void setUserDictionary(Dictionary newDict)
Deprecated. No longer needed.

Sets the entire UserDictionary to a new collection of key-value pairs.


setParameters

public void setParameters(Dictionary params)
Set the value of various parameters for the MediaGroup.

For each key in the supplied Dictionary, the corresponding parameter of the MediaGroup is set to the value of that key in the Dictionary. For interoperability with other languages, the keys in the Dictionary are restricted to type Symbol. The result of using keys of other types is undefined.

If a parameter Symbol refers to a resource that is not present, or the MediaGroup or Resource has no meaning associated with a particular Symbol, the setting for that parameter is quietly ignored.

Parameters:
params - a Dictionary in which the keys are Symbols and the values are assigned to the parameter with that Symbol name.

setUserValues

public void setUserValues(Dictionary params)
Deprecated. No longer needed.

Sets the values of several UserDictionary keys.

The values supplied in the given dict are merged with the current UserDictionary.

Parameters:
params - a Dictionary whose contents is merged into the UserDictionary.

getUserValues

public Dictionary getUserValues(Symbol[] keys)
                         throws AccessControlException
Deprecated. No longer needed.

Creates and returns a new Dictionary that contains the UserDictionary values corresponding to a given set of keys.

If the keys argument is null then a snapshot of the entire UserDictionary is returned.

For interoperability with other languages, the keys in the Dictionary are restricted to type Symbol. The result of using keys of other types is undefined.

Parameters:
keys - an array of key Symbols

Returns:
a Dictionary of application-shared information.
Throws:
AccessControlException

getParameters

public Dictionary getParameters(Symbol[] params)
                         throws AccessControlException
Gets the value of various parameters from the MediaGroup.

Each key in the returned Dictionary has the value of the corresponding parameter. If the params is null, then get all parameters. For example:

Dictionary parms; parms = getParameters(null); // on return, parms contains all parameters.

If a key refers to a Resource that is not present, or the resource has no meaning associated with a particular Symbol, the key is ignored, no error is generated, and that key does not appear in the returned Dictionary.

Parameters:
params - - an array of Symbols naming parameters to be retrieved.

Returns:
a Dictionary of parameter Symbols and their values.

Throws:
BadThreadException - if the method is not called on the proper User Thread.
AccessControlException

getUserDictionary

public Dictionary getUserDictionary()
                             throws AccessControlException
Deprecated. No longer needed.

Returns the entire UserDictionary.

Throws:
AccessControlException

play

public void play(String[] streamIDs,
                 int offset,
                 RTC[] rtc,
                 Dictionary optargs)
          throws MediaResourceException,
                 AccessControlException
Description copied from interface: Player
Play a sequence of MSCs (Media Stream Containers) identified by the streamIDs. This sequence of MSCs is called the "MSC list".

This method cannot be used for sending TTS synthesize requests. Sequences of MSCs are not supported for this type of requests.

This method cannot either be used for SMS, nor for fax.

This method returns when the MSC list is started. This method is non-blocking. The result is passed in a PlayerEvent event through the ResourceEventListener Interface. The condition that caused the play to stop is included in the completion event. RTC actions can alter the course of the play without the intervention of the application. Optional arguments can alter the characteristics of the play.

Exceptions are thrown if pre- or post- conditions are not satisfied

Pre-conditions:

  1. a Player resource is configured
  2. all MSCs are playable

Post-conditions:

  1. As indicated by getQualifier():
    • q_EndOfData: All MSCs named in this MSC list have been played.
    • q_Stop: play was stopped by the stop() method or because (p_IfBusy=v_Stop)
    • q_RTC: play was stopped by Player.rtca_Stop

Specified by:
play in interface Player
Parameters:
streamIDs - a String[] naming the MSC list to be played.
offset - number of milliseconds into the MSC list at which play is to start, offset may span several items in streamIDs.
rtc - Array of RTC that effect this play.
optargs - a Dictionary of optional arguments.
Returns:
a PlayerEvent when the operation is complete (or queued).
Throws:
AccessControlException - if access to resource is refused
MediaResourceException - if requested operation fails.
See Also:
ResourceEventListener.onPlayerEvent(PlayerEvent)

play

public void play(String streamID,
                 int offset,
                 RTC[] rtc,
                 Dictionary optargs)
          throws MediaResourceException,
                 AccessControlException
Description copied from interface: Player
Play a single MSC (Media Stream Container) named by streamID. Equivalent to play() with a String[] of length one, containing the given streamID.

This method should be used for sending TTS synthesize, Fax and SMS requests. This method is non-blocking. The result is passed in a PlayerEvent event through the ResourceEventListener Interface

Specified by:
play in interface Player
Parameters:
streamID - a String naming the MSC to be played or the TTS Audio Service URI in form "rtsp://audioservice"
or the SMS mode in form "sms-tl://"
or the Fax ID prefixed by "fax://".
offset - int number milliseconds into the MSC (ignored for TTS synthesize, fax or SMS requests) at which play is to start. Not supported for file with encoding format: v_ADPCM_32k, v_ADPCM_32kOKI, v_ADPCM_16kG726 and v_ADPCM_32kG726.
rtc - Array of RTC that effect this play.
optargs - a Dictionary of optional arguments.
Throws:
AccessControlException - if access to resource is refused
MediaResourceException - if requested operation fails
See Also:
ResourceEventListener.onPlayerEvent(PlayerEvent)

record

public void record(String streamID,
                   RTC[] rtc,
                   Dictionary optargs)
            throws MediaResourceException,
                   AccessControlException
Description copied from interface: Recorder
Record data from the Terminal into the named Media Stream Container (MSC). Encode and store data from the telephony network. record() encodes the media stream from the bound Terminal, and stores the result in the Media Stream Container identified by the given streamID.

This method can also be used for sending ASR recognize requests as well as for SMS and, soon, faxes.

If the MSC does not exist, it is created and associated with the coder type specified by parameter p_CoderTypes. (instead of original API using p_Coder ; value is a one element array, the coder type). If the MSC does exist, the recording is made using the coder type associated with that DSD, in case of a WAV file, otherwise, the coder type specified by p_CoderTypes will be used. If the Recorder does not support the indicated Coder, record() throws a MediaResourceException, indicating Error.e_Coder.

This method is non-blocking. The result is passed in a RecorderEvent event through the ResourceEventListener Interface. The condition that caused recording to stop is available from the completion event using getQualifier.

The optargs argument specifies values for Recorder parameters for the duration of this record operation. For example, p_CoderTypes (instead of p_Coder) or p_BeepStart can be overridden for a single method invocation.

Exceptions are thrown if pre- or post- conditions are not satisfied
Pre-conditions:

  1. The SDR exists or can be created
  2. The SDR is not locked (that is, is not in use)
  3. Recorder is Idle
  4. Recorder has the required/requested coder

Post-conditions: Record completes normally due to one of:
  1. Duration time reached
  2. a silence exceeding p_SilenceTerminationThreshold millis detected
  3. stop() method invoked
  4. RecorderConstants.rtca_Stop triggered

Specified by:
record in interface Recorder
Parameters:
streamID - the String name of the MSC where data is to be stored
or the ASR Audio Service URI in form "rtsp://audioservice"
or the SMS mode in form "sms-tl://"
or the Fax ID prefixed by "fax://".
rtc - an Array of RTC (Run-Time-Control) objects
optargs - a Dictionary of optional arguments among
  1. RecorderConstants.p_FileFormat
  2. RecorderConstants.p_CoderTypes
  3. RecorderConstants.p_Append
  4. RecorderConstants.p_EnabledEvents
  5. RecorderConstants.p_MaxDuration
  6. RecorderConstants.p_MinDuration
  7. RecorderConstants.p_SilenceTerminationOn
  8. RecorderConstants.p_SilenceTerminationThreshold
  9. RecorderConstants.p_SilenceTruncationOn
  10. RecorderConstants.p_SilenceTruncationThreshold
  11. RecorderConstants.p_SignalTruncationOn
  12. RecorderConstants.p_SilenceEnergyThreshold
  13. RecorderConstants.p_StartBeep
  14. RecorderConstants.p_StartPaused
Throws:
MediaResourceException - if requested operation fails.
AccessControlException
See Also:
ResourceEventListener.onRecorderEvent(hp.telephony.media.RecorderEvent)

sendSignals

public void sendSignals(Symbol[] signals,
                        RTC[] rtc,
                        Dictionary optargs)
                 throws MediaResourceException,
                        AccessControlException
signal generator methods

Specified by:
sendSignals in interface SignalGenerator
Parameters:
signals - an array of Symbols that defines a signal.
rtc - an array of RTC objects that controls this transactions.
optargs - a Dictionary of optional arguments
Returns:
a SignalGeneratorEvent
Throws:
MediaResourceException - if this request fails.
AccessControlException
See Also:
ResourceEventListener.onSignalGeneratorEvent(SignalGeneratorEvent)

sendSignals

public void sendSignals(String signals,
                        RTC[] rtc,
                        Dictionary optargs)
                 throws MediaResourceException,
                        AccessControlException
Description copied from interface: SignalGenerator
Transmit a series of signals out the Terminal to the network.

Each signal is defined by a char in the String.

Specified by:
sendSignals in interface SignalGenerator
Parameters:
signals - an array of Symbols that defines a signal.
rtc - an array of RTC objects that controls this transactions.
optargs - a Dictionary of optional arguments
Returns:
a SignalGeneratorEvent.
Throws:
MediaResourceException - if this request fails.
AccessControlException
See Also:
ResourceEventListener.onSignalGeneratorEvent(SignalGeneratorEvent)

retrieveSignals

public void retrieveSignals(int numSignals,
                            Symbol[] patterns,
                            RTC[] rtc,
                            Dictionary optargs)
                     throws MediaResourceException,
                            AccessControlException
Description copied from interface: SignalDetector
Retrieve some signals from the signal buffer. This method returns when numSignals signals are in the signal buffer (and removes them). May return with fewer than numSignals when some other terminating condition occurs (rtca_Stop, a Pattern is detected, or timeout). In that case, the method returns and removes all the signals from the signal buffer. If (numSignals == -1), then this method returns only when some other termination condition occurs.

The terminating conditions are controlled by the arguments patterns and rtc, and various timeout parameters.

patterns is an array of Symbols, with an entry for each Pattern to enable. If the patterns array contains a pattern Symbol then recognition of that pattern is treated as a terminating condition for retrieveSignals(). If patterns is null, then pattern recognition is not considered as a terminating condition.

retrieveSignals also terminates if any of the p_InitialTimeout, p_InterSigTimeout, p_Duration timeouts are exceeded. These times are relative to the start of the retrieveSignals operation. These parameters can be set with setParameters or in the optargs argument.

To get the retrieved signals, invoke getSignalBuffer() on the SignalDetectorEvent returned from retrieveSignals. If retrieveSignals can not return a signal buffer, it throws an exception, so retrieveSignals(...).getSignalBuffer() is safe. The Signals are accessed as elements of the Symbol[] returned by getSignalBuffer or char elements of the String returned by getSignalString.

Example:
String nextDTMF = retrieveSignals(1,null,null,null).getSignalBuffer();

Note: Due to the effects of overflow and typeahead synchronization, the more reliable way to get the signals that matched a pattern is from the ev_PatternMatched event in the onSignalDetectorEvent() method.

Specified by:
retrieveSignals in interface SignalDetector
Parameters:
numSignals - the int number of signals to be retrieved.
patterns - indicates which Patterns should terminate retrieval.
rtc - an Array of RTC (Run Time Control) objects. The RTC actions may be rtca_Stop or rtca_FlushBuffer.
optargs - a Dictionary of optional arguments. p_Pattern[i] may be set as transient parameters.
Returns:
a SignalDetectorEvent, suitable for for getSignalBuffer().
Throws:
MediaResourceException - if this request fails; usually because of a badly formed request, or implementation cannot process the request.
AccessControlException
See Also:
ResourceEventListener.onSignalDetectorEvent(SignalDetectorEvent)

flushBuffer

public void flushBuffer()
                 throws MediaResourceException,
                        AccessControlException
Description copied from interface: SignalDetector
Remove all signals from the signal buffer.

This prevents buffer overflow, and synchronizes the pattern matchers.

The signals flushed may be accessed using SignalDetectorEvent.getSignalBuffer() or SignalDetectorEvent.getSignalString(). If the flushed signals are not available, then these methods return null.

This is conceptually equivalent to: retrieveSignals((p_BufferSize), null, null, {p_Duration=0});

Note: flushBuffer is also available using rtca_FlushBuffer.

Specified by:
flushBuffer in interface SignalDetector
Returns:
a SignalDetectorEvent containing any signals flushed.
Throws:
MediaResourceException - if this request fails.
AccessControlException
See Also:
ResourceEventListener.onSignalDetectorEvent(SignalDetectorEvent)

performFaxLog

public void performFaxLog(String caller,
                          String called,
                          int duration,
                          Date timeStamp)
Default means to log fax operations. see Sending Fax and see Receiving Fax .

Specified by:
performFaxLog in interface FaxLoggerIf

setFaxLogger

public static void setFaxLogger(FaxLoggerIf listener)
Provides the OC MP platform with a means to log fax operations. see Sending Fax and see Receiving Fax .

The OC MP fax log can be set up externally on the command line, or by an Oclet, e.g..

These examples can be found at the end of the "/etc/opt/OC/ocmp/initOCMP.bsh" file (linux FSL) and in the "/opt/OC/tutorials/examples/oclets/hp/opencall/media/exampoclets/play/SimpleSend.java" tutorial.

Command line sample :

 ocmpSh "source(\"/home/faxAppl/setFaxLogger\"); "
 
Bean Shell code sample (so-called setFaxLogger file) :
 defineFaxLogger( _faxlog ) {
     hp.opencall.media.ccapi.AsyncMediaGroup.setFaxLogger( this );
  
     performFaxLog(cp1,cp2,aDuration,aTimeStamp) {
                         String thatLog = aTimeStamp+", "+aDuration+" ms, "+cp1+" =--> "+cp2;
                         try{
                             //System.out.println(thatLog);
                             PrintStream logger = new PrintStream(new FileOutputStream(_faxlog,true));//append
                             //logger.println(thatLog);
                             logger.close();
                         } catch (java.io.FileNotFoundException e) {
                             e.printStackTrace();
                         }
     }
                         String thatLog = _faxlog+" initialized on "+new Date();
                             PrintStream logger = new PrintStream(new FileOutputStream(_faxlog,true));//append
                             //logger.println(thatLog);
                             logger.close();
 }
 
 defineFaxLogger( "/tmp/bFaxLog.txt" );
 
This script sets up the method which will be called back each time a fax operation completes. In this example, the name of the file is passed as a parameter. The method calls that would make an uncontrolled file grow have been commented out.

Oclet Code sample:

           final static String _faxlog = "/tmp/pFaxLog.txt" ;
           FaxLoggerIf aFaxLogger = new FaxLoggerIf.FaxLoggerIf2() {
               public void performFaxLog(String thatLog) {
                   try{
                       PrintStream logger = new PrintStream(new FileOutputStream(_faxlog,true));//append
                       logger.println(thatLog);
                       logger.close();
                   } catch (java.io.FileNotFoundException e) {
                       //e.printStackTrace();
                   }
               }
               public void addFaxLogEntry(String cp1,String cp2,int aDuration,String remoteId,int useCase,int pageNumber,int totalPageCount,int errorCode,Date aTimeStamp,int tac) {
                   String thatLog = aTimeStamp+", "+aDuration+" ms, "+cp1+", "+cp2
                     +", "+useCase+", "+errorCode+", "+tac
                     +", "+remoteId+", "+pageNumber+" / "+totalPageCount;
                   performFaxLog(thatLog);
               }
               public void performFaxLog(String cp1,String cp2,int aDuration,Date aTimeStamp) {
                   String thatLog = aTimeStamp+", "+aDuration+" ms, "+cp1+" =--> "+cp2;
                   //performFaxLog(thatLog);//will not be called because addFaxLogEntry() will be prefered.
               }
           };
           AsyncMediaGroup.setFaxLogger(aFaxLogger);
 
The code above uses an extension of the FaxLoggerIf interface which allows additionnal information to be logged.


join

public void join(ConferenceIF confIF)
          throws AccessControlException
Description copied from interface: Conference
Join to a given conference in both directions.

Pre-conditions:
1. The configSpec used to build this AsyncMediaGroup is a userConferenceConfig ConfigSpec.
2. The CP looped to this MG must have been registered to this conference.

Post-conditions:
1. Media operations play & record are stopped and get a completion event with : ResourceEvent.getQualifier() == ResourceEvent.q_Stop.
2. SignalDetection remains the only media operation possible.
3. To do other media operations (play, record..), a call to method unjoin(..) is necessary.

Specified by:
join in interface Conference
Throws:
AccessControlException

unjoin

public void unjoin(ConferenceIF confIF)
            throws AccessControlException
Description copied from interface: Conference
Unjoin the MG from a conference.

Pre-conditions:
1. The configSpec used to build this AsyncMediaGroup is a userConferenceConfig ConfigSpec.
2. The MG must have been previously joined to this conferenceIF.

Specified by:
unjoin in interface Conference
Throws:
AccessControlException

addResourceEventListener

public void addResourceEventListener(