@sirhc77/signalwire-rest-sdk
Version:
An SDK for the SignalWire REST API
2,866 lines • 112 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.convertSWMLAIHintToJSON = convertSWMLAIHintToJSON;
exports.convertJSONToSWMLAIHint = convertJSONToSWMLAIHint;
exports.convertSWMLAILanguageToJSON = convertSWMLAILanguageToJSON;
exports.convertJSONToSWMLAILanguage = convertJSONToSWMLAILanguage;
exports.convertSWMLAIParamsToJSON = convertSWMLAIParamsToJSON;
exports.convertJSONToSWMLAIParams = convertJSONToSWMLAIParams;
exports.convertSWMLAIPromptToJSON = convertSWMLAIPromptToJSON;
exports.convertJSONToSWMLAIPrompt = convertJSONToSWMLAIPrompt;
exports.convertSWMLAIPronounceToJSON = convertSWMLAIPronounceToJSON;
exports.convertJSONToSWMLAIPronounce = convertJSONToSWMLAIPronounce;
exports.convertSWMLSWAIGDefaultsToJSON = convertSWMLSWAIGDefaultsToJSON;
exports.convertJSONToSWMLSWAIGDefaults = convertJSONToSWMLSWAIGDefaults;
exports.convertSWMLSWAIGDataMapOutputSWMLActionToJSON = convertSWMLSWAIGDataMapOutputSWMLActionToJSON;
exports.convertJSONToSWMLSWAIGDataMapOutputSWMLAction = convertJSONToSWMLSWAIGDataMapOutputSWMLAction;
exports.convertSWMLSWAIGDataMapOutputSayActionToJSON = convertSWMLSWAIGDataMapOutputSayActionToJSON;
exports.convertJSONToSWMLSWAIGDataMapOutputSayAction = convertJSONToSWMLSWAIGDataMapOutputSayAction;
exports.convertSWMLSWAIGDataMapOutputStopActionToJSON = convertSWMLSWAIGDataMapOutputStopActionToJSON;
exports.convertJSONToSWMLSWAIGDataMapOutputStopAction = convertJSONToSWMLSWAIGDataMapOutputStopAction;
exports.convertSWMLSWAIGDataMapOutputToggleFunctionToJSON = convertSWMLSWAIGDataMapOutputToggleFunctionToJSON;
exports.convertJSONToSWMLSWAIGDataMapOutputToggleFunction = convertJSONToSWMLSWAIGDataMapOutputToggleFunction;
exports.convertSWMLSWAIGDataMapOutputToggleFunctionsActionToJSON = convertSWMLSWAIGDataMapOutputToggleFunctionsActionToJSON;
exports.convertJSONToSWMLSWAIGDataMapOutputToggleFunctionsAction = convertJSONToSWMLSWAIGDataMapOutputToggleFunctionsAction;
exports.convertSWMLSWAIGDataMapOutputSetGlobalDataActionToJSON = convertSWMLSWAIGDataMapOutputSetGlobalDataActionToJSON;
exports.convertJSONToSWMLSWAIGDataMapOutputSetGlobalDataAction = convertJSONToSWMLSWAIGDataMapOutputSetGlobalDataAction;
exports.convertSWMLSWAIGDataMapOutputSetMetaDataActionToJSON = convertSWMLSWAIGDataMapOutputSetMetaDataActionToJSON;
exports.convertJSONToSWMLSWAIGDataMapOutputSetMetaDataAction = convertJSONToSWMLSWAIGDataMapOutputSetMetaDataAction;
exports.convertSWMLSWAIGDataMapOutputUnsetGlobalDataActionToJSON = convertSWMLSWAIGDataMapOutputUnsetGlobalDataActionToJSON;
exports.convertJSONToSWMLSWAIGDataMapOutputUnsetGlobalDataAction = convertJSONToSWMLSWAIGDataMapOutputUnsetGlobalDataAction;
exports.convertSWMLSWAIGDataMapOutputUnsetMetaDataActionToJSON = convertSWMLSWAIGDataMapOutputUnsetMetaDataActionToJSON;
exports.convertJSONToSWMLSWAIGDataMapOutputUnsetMetaDataAction = convertJSONToSWMLSWAIGDataMapOutputUnsetMetaDataAction;
exports.convertSWMLSWAIGDataMapOutputPlaybackBGActionToJSON = convertSWMLSWAIGDataMapOutputPlaybackBGActionToJSON;
exports.convertJSONToSWMLSWAIGDataMapOutputPlaybackBGAction = convertJSONToSWMLSWAIGDataMapOutputPlaybackBGAction;
exports.convertSWMLSWAIGDataMapOutputStopPlaybackBGActionToJSON = convertSWMLSWAIGDataMapOutputStopPlaybackBGActionToJSON;
exports.convertJSONToSWMLSWAIGDataMapOutputStopPlaybackBGAction = convertJSONToSWMLSWAIGDataMapOutputStopPlaybackBGAction;
exports.convertSWMLSWAIGDataMapOutputUserInputActionToJSON = convertSWMLSWAIGDataMapOutputUserInputActionToJSON;
exports.convertJSONToSWMLSWAIGDataMapOutputUserInputAction = convertJSONToSWMLSWAIGDataMapOutputUserInputAction;
exports.convertSWMLSWAIGDataMapOutputContextSwitchActionToJSON = convertSWMLSWAIGDataMapOutputContextSwitchActionToJSON;
exports.convertJSONToSWMLSWAIGDataMapOutputContextSwitchAction = convertJSONToSWMLSWAIGDataMapOutputContextSwitchAction;
exports.convertSWMLSWAIGDataMapOutputActionToJSON = convertSWMLSWAIGDataMapOutputActionToJSON;
exports.convertJSONToSWMLSWAIGDataMapOutputAction = convertJSONToSWMLSWAIGDataMapOutputAction;
exports.convertSWMLSWAIGDataMapOutputToJSON = convertSWMLSWAIGDataMapOutputToJSON;
exports.convertJSONToSWMLSWAIGDataMapOutput = convertJSONToSWMLSWAIGDataMapOutput;
exports.convertSWMLSWAIGDataMapExpressionToJSON = convertSWMLSWAIGDataMapExpressionToJSON;
exports.convertJSONToSWMLSWAIGDataMapExpression = convertJSONToSWMLSWAIGDataMapExpression;
exports.convertSWMLSWAIGDataMapWebhookForeachToJSON = convertSWMLSWAIGDataMapWebhookForeachToJSON;
exports.convertJSONToSWMLSWAIGDataMapWebhookForeach = convertJSONToSWMLSWAIGDataMapWebhookForeach;
exports.convertSWMLSWAIGDataMapWebhookToJSON = convertSWMLSWAIGDataMapWebhookToJSON;
exports.convertJSONToSWMLSWAIGDataMapWebhook = convertJSONToSWMLSWAIGDataMapWebhook;
exports.convertSWMLSWAIGDataMapToJSON = convertSWMLSWAIGDataMapToJSON;
exports.convertJSONToSWMLSWAIGDataMap = convertJSONToSWMLSWAIGDataMap;
exports.convertSWMLSWAIGFunctionParameterStringPropertyToJSON = convertSWMLSWAIGFunctionParameterStringPropertyToJSON;
exports.convertJSONToSWMLSWAIGFunctionParameterStringProperty = convertJSONToSWMLSWAIGFunctionParameterStringProperty;
exports.convertSWMLSWAIGFunctionParameterIntegerPropertyToJSON = convertSWMLSWAIGFunctionParameterIntegerPropertyToJSON;
exports.convertJSONToSWMLSWAIGFunctionParameterIntegerProperty = convertJSONToSWMLSWAIGFunctionParameterIntegerProperty;
exports.convertSWMLSWAIGFunctionParameterNumberPropertyToJSON = convertSWMLSWAIGFunctionParameterNumberPropertyToJSON;
exports.convertJSONToSWMLSWAIGFunctionParameterNumberProperty = convertJSONToSWMLSWAIGFunctionParameterNumberProperty;
exports.convertSWMLSWAIGFunctionParameterBooleanPropertyToJSON = convertSWMLSWAIGFunctionParameterBooleanPropertyToJSON;
exports.convertJSONToSWMLSWAIGFunctionParameterBooleanProperty = convertJSONToSWMLSWAIGFunctionParameterBooleanProperty;
exports.convertSWMLSWAIGFunctionParameterArrayPropertyToJSON = convertSWMLSWAIGFunctionParameterArrayPropertyToJSON;
exports.convertJSONToSWMLSWAIGFunctionParameterArrayProperty = convertJSONToSWMLSWAIGFunctionParameterArrayProperty;
exports.convertSWMLSWAIGFunctionParameterPropertiesToJSON = convertSWMLSWAIGFunctionParameterPropertiesToJSON;
exports.convertJSONToSWMLSWAIGFunctionParameterProperties = convertJSONToSWMLSWAIGFunctionParameterProperties;
exports.convertSWMLSWAIGFunctionParameterObjectPropertyToJSON = convertSWMLSWAIGFunctionParameterObjectPropertyToJSON;
exports.convertJSONToSWMLSWAIGFunctionParameterObjectProperty = convertJSONToSWMLSWAIGFunctionParameterObjectProperty;
exports.convertSWMLSWAIGFunctionParameterOneOfPropertyToJSON = convertSWMLSWAIGFunctionParameterOneOfPropertyToJSON;
exports.convertJSONToSWMLSWAIGFunctionParameterOneOfProperty = convertJSONToSWMLSWAIGFunctionParameterOneOfProperty;
exports.convertSWMLSWAIGFunctionParameterAllOfPropertyToJSON = convertSWMLSWAIGFunctionParameterAllOfPropertyToJSON;
exports.convertJSONToSWMLSWAIGFunctionParameterAllOfProperty = convertJSONToSWMLSWAIGFunctionParameterAllOfProperty;
exports.convertSWMLSWAIGFunctionParameterAnyOfPropertyToJSON = convertSWMLSWAIGFunctionParameterAnyOfPropertyToJSON;
exports.convertJSONToSWMLSWAIGFunctionParameterAnyOfProperty = convertJSONToSWMLSWAIGFunctionParameterAnyOfProperty;
exports.convertSWMLSWAIGFunctionParameterConstPropertyToJSON = convertSWMLSWAIGFunctionParameterConstPropertyToJSON;
exports.convertJSONToSWMLSWAIGFunctionParameterConstProperty = convertJSONToSWMLSWAIGFunctionParameterConstProperty;
exports.convertSWMLSWAIGFunctionParameterPropertyToJSON = convertSWMLSWAIGFunctionParameterPropertyToJSON;
exports.convertJSONToSWMLSWAIGFunctionParameterProperty = convertJSONToSWMLSWAIGFunctionParameterProperty;
exports.convertSWMLSWAIGFunctionParametersToJSON = convertSWMLSWAIGFunctionParametersToJSON;
exports.convertJSONToSWMLSWAIGFunctionParameters = convertJSONToSWMLSWAIGFunctionParameters;
exports.convertSWMLSWAIGFunctionFillersToJSON = convertSWMLSWAIGFunctionFillersToJSON;
exports.convertJSONToSWMLSWAIGFunctionFillers = convertJSONToSWMLSWAIGFunctionFillers;
exports.convertSWMLSWAIGFunctionToJSON = convertSWMLSWAIGFunctionToJSON;
exports.convertJSONToSWMLSWAIGFunction = convertJSONToSWMLSWAIGFunction;
exports.convertSWMLSWAIGIncludeToJSON = convertSWMLSWAIGIncludeToJSON;
exports.convertJSONToSWMLSWAIGInclude = convertJSONToSWMLSWAIGInclude;
exports.convertSWMLSWAIGVisualInputFillerToJSON = convertSWMLSWAIGVisualInputFillerToJSON;
exports.convertJSONToSWMLSWAIGVisualInputFiller = convertJSONToSWMLSWAIGVisualInputFiller;
exports.convertSWMLSWAIGInternalFillerToJSON = convertSWMLSWAIGInternalFillerToJSON;
exports.convertJSONToSWMLSWAIGInternalFiller = convertJSONToSWMLSWAIGInternalFiller;
exports.convertSWMLSWAIGToJSON = convertSWMLSWAIGToJSON;
exports.convertJSONToSWMLSWAIG = convertJSONToSWMLSWAIG;
exports.convertSWMLAIHintsToJSON = convertSWMLAIHintsToJSON;
exports.convertJSONToSWMLAIHints = convertJSONToSWMLAIHints;
exports.convertSWMLAIParametersToJSON = convertSWMLAIParametersToJSON;
exports.convertJSONToSWMLAIParameters = convertJSONToSWMLAIParameters;
exports.convertSWMLAIMethodToJSON = convertSWMLAIMethodToJSON;
exports.convertJSONToSWMLAIMethod = convertJSONToSWMLAIMethod;
exports.convertSWMLAnswerParametersToJSON = convertSWMLAnswerParametersToJSON;
exports.convertJSONToSWMLAnswerParameters = convertJSONToSWMLAnswerParameters;
exports.convertSWMLAnswerMethodToJSON = convertSWMLAnswerMethodToJSON;
exports.convertJSONToSWMLAnswerMethod = convertJSONToSWMLAnswerMethod;
exports.convertSWMLCondWhenThenParametersToJSON = convertSWMLCondWhenThenParametersToJSON;
exports.convertJSONToSWMLCondWhenThenParameters = convertJSONToSWMLCondWhenThenParameters;
exports.convertSWMLCondElseParametersToJSON = convertSWMLCondElseParametersToJSON;
exports.convertJSONToSWMLCondElseParameters = convertJSONToSWMLCondElseParameters;
exports.convertSWMLCondParametersToJSON = convertSWMLCondParametersToJSON;
exports.convertJSONToSWMLCondParameters = convertJSONToSWMLCondParameters;
exports.convertSWMLCondMethodToJSON = convertSWMLCondMethodToJSON;
exports.convertJSONToSWMLCondMethod = convertJSONToSWMLCondMethod;
exports.convertSWMLConnectHeaderToJSON = convertSWMLConnectHeaderToJSON;
exports.convertJSONToSWMLConnectHeader = convertJSONToSWMLConnectHeader;
exports.convertSWMLConnectToDialingParameterToJSONObject = convertSWMLConnectToDialingParameterToJSONObject;
exports.convertToParameterToSWMLConnectToDialingParameter = convertToParameterToSWMLConnectToDialingParameter;
exports.convertSWMLConnectDestinationToJSON = convertSWMLConnectDestinationToJSON;
exports.convertJSONToSWMLConnectDestination = convertJSONToSWMLConnectDestination;
exports.convertSWMLConnectSerialDialingParameterToJSONObject = convertSWMLConnectSerialDialingParameterToJSONObject;
exports.convertJSONObjectToSWMLConnectSerialDialingParameter = convertJSONObjectToSWMLConnectSerialDialingParameter;
exports.convertSWMLConnectParallelDialingParameterToJSONObject = convertSWMLConnectParallelDialingParameterToJSONObject;
exports.convertJSONObjectToSWMLConnectParallelDialingParameter = convertJSONObjectToSWMLConnectParallelDialingParameter;
exports.convertSWMLConnectSerialParallelDialingParameterToJSONObject = convertSWMLConnectSerialParallelDialingParameterToJSONObject;
exports.convertJSONObjectToSWMLConnectSerialParallelDialingParameter = convertJSONObjectToSWMLConnectSerialParallelDialingParameter;
exports.convertSWMLConnectDialingParameterToJSONObject = convertSWMLConnectDialingParameterToJSONObject;
exports.convertJSONObjectToSWMLConnectDialingParameter = convertJSONObjectToSWMLConnectDialingParameter;
exports.convertSWMLConnectParametersToJSON = convertSWMLConnectParametersToJSON;
exports.convertJSONToSWMLConnectParameters = convertJSONToSWMLConnectParameters;
exports.convertSWMLConnectMethodToJSON = convertSWMLConnectMethodToJSON;
exports.convertJSONToSWMLConnectMethod = convertJSONToSWMLConnectMethod;
exports.convertSWMLDenoiseMethodToJSON = convertSWMLDenoiseMethodToJSON;
exports.convertJSONToSWMLDenoiseMethod = convertJSONToSWMLDenoiseMethod;
exports.convertSWMLDetectMachineParametersToJSON = convertSWMLDetectMachineParametersToJSON;
exports.convertJSONToSWMLDetectMachineParameters = convertJSONToSWMLDetectMachineParameters;
exports.convertSWMLDetectMachineMethodToJSON = convertSWMLDetectMachineMethodToJSON;
exports.convertJSONToSWMLDetectMachineMethod = convertJSONToSWMLDetectMachineMethod;
exports.convertSWMLExecuteParametersToJSON = convertSWMLExecuteParametersToJSON;
exports.convertJSONToSWMLExecuteParameters = convertJSONToSWMLExecuteParameters;
exports.convertSWMLExecuteMethodToJSON = convertSWMLExecuteMethodToJSON;
exports.convertJSONToSWMLExecuteMethod = convertJSONToSWMLExecuteMethod;
exports.convertSWMLGotoParametersToJSON = convertSWMLGotoParametersToJSON;
exports.convertJSONToSWMLGotoParameters = convertJSONToSWMLGotoParameters;
exports.convertSWMLGotoMethodToJSON = convertSWMLGotoMethodToJSON;
exports.convertJSONToSWMLGotoMethod = convertJSONToSWMLGotoMethod;
exports.convertSWMLHangupParametersToJSON = convertSWMLHangupParametersToJSON;
exports.convertJSONToSWMLHangupParameters = convertJSONToSWMLHangupParameters;
exports.convertSWMLHangupMethodToJSON = convertSWMLHangupMethodToJSON;
exports.convertJSONToSWMLHangupMethod = convertJSONToSWMLHangupMethod;
exports.convertSWMLJoinRoomParametersToJSON = convertSWMLJoinRoomParametersToJSON;
exports.convertJSONToSWMLJoinRoomParameters = convertJSONToSWMLJoinRoomParameters;
exports.convertSWMLJoinRoomMethodToJSON = convertSWMLJoinRoomMethodToJSON;
exports.convertJSONToSWMLJoinRoomMethod = convertJSONToSWMLJoinRoomMethod;
exports.convertSWMLLabelMethodToJSON = convertSWMLLabelMethodToJSON;
exports.convertJSONToSWMLLabelMethod = convertJSONToSWMLLabelMethod;
exports.convertSWMLLiveTranscribeStartActionToJSON = convertSWMLLiveTranscribeStartActionToJSON;
exports.convertJSONToSWMLLiveTranscribeStartAction = convertJSONToSWMLLiveTranscribeStartAction;
exports.convertSWMLLiveTranscribeStopActionToJSON = convertSWMLLiveTranscribeStopActionToJSON;
exports.convertJSONToSWMLLiveTranscribeStopAction = convertJSONToSWMLLiveTranscribeStopAction;
exports.convertSWMLLiveTranscribeSummarizeActionToJSON = convertSWMLLiveTranscribeSummarizeActionToJSON;
exports.convertJSONToSWMLLiveTranscribeSummarizeAction = convertJSONToSWMLLiveTranscribeSummarizeAction;
exports.convertSWMLLiveTranscribeActionToJSON = convertSWMLLiveTranscribeActionToJSON;
exports.convertJSONToSWMLLiveTranscribeAction = convertJSONToSWMLLiveTranscribeAction;
exports.convertSWMLLiveTranscribeParametersToJSON = convertSWMLLiveTranscribeParametersToJSON;
exports.convertJSONToSWMLLiveTranscribeParameters = convertJSONToSWMLLiveTranscribeParameters;
exports.convertSWMLLiveTranscribeMethodToJSON = convertSWMLLiveTranscribeMethodToJSON;
exports.convertJSONToSWMLLiveTranscribeMethod = convertJSONToSWMLLiveTranscribeMethod;
exports.convertSWMLLiveTranslateStartActionToJSON = convertSWMLLiveTranslateStartActionToJSON;
exports.convertJSONToSWMLLiveTranslateStartAction = convertJSONToSWMLLiveTranslateStartAction;
exports.convertSWMLLiveTranslateStopActionToJSON = convertSWMLLiveTranslateStopActionToJSON;
exports.convertJSONToSWMLLiveTranslateStopAction = convertJSONToSWMLLiveTranslateStopAction;
exports.convertSWMLLiveTranslateSummarizeActionToJSON = convertSWMLLiveTranslateSummarizeActionToJSON;
exports.convertJSONToSWMLLiveTranslateSummarizeAction = convertJSONToSWMLLiveTranslateSummarizeAction;
exports.convertSWMLLiveTranslateInjectActionToJSON = convertSWMLLiveTranslateInjectActionToJSON;
exports.convertJSONToSWMLLiveTranslateInjectAction = convertJSONToSWMLLiveTranslateInjectAction;
exports.convertSWMLLiveTranslateActionToJSON = convertSWMLLiveTranslateActionToJSON;
exports.convertJSONToSWMLLiveTranslateAction = convertJSONToSWMLLiveTranslateAction;
exports.convertSWMLLiveTranslateParametersToJSON = convertSWMLLiveTranslateParametersToJSON;
exports.convertJSONToSWMLLiveTranslateParameters = convertJSONToSWMLLiveTranslateParameters;
exports.convertSWMLLiveTranslateMethodToJSON = convertSWMLLiveTranslateMethodToJSON;
exports.convertJSONToSWMLLiveTranslateMethod = convertJSONToSWMLLiveTranslateMethod;
exports.convertSWMLPayParameterToJSON = convertSWMLPayParameterToJSON;
exports.convertJSONToSWMLPayParameter = convertJSONToSWMLPayParameter;
exports.convertSWMLPayPromptActionToJSON = convertSWMLPayPromptActionToJSON;
exports.convertJSONToSWMLPayPromptAction = convertJSONToSWMLPayPromptAction;
exports.convertSWMLPayPromptToJSON = convertSWMLPayPromptToJSON;
exports.convertJSONToSWMLPayPrompt = convertJSONToSWMLPayPrompt;
exports.convertSWMLPayParametersToJSON = convertSWMLPayParametersToJSON;
exports.convertJSONToSWMLPayParameters = convertJSONToSWMLPayParameters;
exports.convertSWMLPayMethodToJSON = convertSWMLPayMethodToJSON;
exports.convertJSONToSWMLPayMethod = convertJSONToSWMLPayMethod;
exports.convertSWMLPlayUrlToJSONObject = convertSWMLPlayUrlToJSONObject;
exports.convertJSONObjectToSWMLPlayUrl = convertJSONObjectToSWMLPlayUrl;
exports.convertSWMLPlayUrlsToJSONObject = convertSWMLPlayUrlsToJSONObject;
exports.convertJSONObjectToSWMLPlayUrls = convertJSONObjectToSWMLPlayUrls;
exports.convertSWMLPlayableSoundToJSONObject = convertSWMLPlayableSoundToJSONObject;
exports.convertJSONObjectToSWMLPlayableSound = convertJSONObjectToSWMLPlayableSound;
exports.convertSWMLPlayParametersToJSON = convertSWMLPlayParametersToJSON;
exports.convertJSONToSWMLPlayParameters = convertJSONToSWMLPlayParameters;
exports.convertSWMLPlayMethodToJSON = convertSWMLPlayMethodToJSON;
exports.convertJSONToSWMLPlayMethod = convertJSONToSWMLPlayMethod;
exports.convertSWMLPromptParametersToJSON = convertSWMLPromptParametersToJSON;
exports.convertJSONToSWMLPromptParameters = convertJSONToSWMLPromptParameters;
exports.convertSWMLPromptMethodToJSON = convertSWMLPromptMethodToJSON;
exports.convertJSONToSWMLPromptMethod = convertJSONToSWMLPromptMethod;
exports.convertSWMLReceiveFaxParametersToJSON = convertSWMLReceiveFaxParametersToJSON;
exports.convertJSONToSWMLReceiveFaxParameters = convertJSONToSWMLReceiveFaxParameters;
exports.convertSWMLReceiveFaxMethodToJSON = convertSWMLReceiveFaxMethodToJSON;
exports.convertJSONToSWMLReceiveFaxMethod = convertJSONToSWMLReceiveFaxMethod;
exports.convertSWMLRecordParametersToJSON = convertSWMLRecordParametersToJSON;
exports.convertJSONToSWMLRecordParameters = convertJSONToSWMLRecordParameters;
exports.convertSWMLRecordMethodToJSON = convertSWMLRecordMethodToJSON;
exports.convertJSONToSWMLRecordMethod = convertJSONToSWMLRecordMethod;
exports.convertSWMLRecordCallParametersToJSON = convertSWMLRecordCallParametersToJSON;
exports.convertJSONToSWMLRecordCallParameters = convertJSONToSWMLRecordCallParameters;
exports.convertSWMLRecordCallMethodToJSON = convertSWMLRecordCallMethodToJSON;
exports.convertJSONToSWMLRecordCallMethod = convertJSONToSWMLRecordCallMethod;
exports.convertSWMLRequestParametersToJSON = convertSWMLRequestParametersToJSON;
exports.convertJSONToSWMLRequestParameters = convertJSONToSWMLRequestParameters;
exports.convertSWMLRequestMethodToJSON = convertSWMLRequestMethodToJSON;
exports.convertJSONToSWMLRequestMethod = convertJSONToSWMLRequestMethod;
exports.convertSWMLReturnMethodToJSON = convertSWMLReturnMethodToJSON;
exports.convertJSONToSWMLReturnMethod = convertJSONToSWMLReturnMethod;
exports.convertSWMLSendDigitsParametersToJSON = convertSWMLSendDigitsParametersToJSON;
exports.convertJSONToSWMLSendDigitsParameters = convertJSONToSWMLSendDigitsParameters;
exports.convertSWMLSendDigitsMethodToJSON = convertSWMLSendDigitsMethodToJSON;
exports.convertJSONToSWMLSendDigitsMethod = convertJSONToSWMLSendDigitsMethod;
exports.convertSWMLSendFaxParametersToJSON = convertSWMLSendFaxParametersToJSON;
exports.convertJSONToSWMLSendFaxParameters = convertJSONToSWMLSendFaxParameters;
exports.convertSWMLSendFaxMethodToJSON = convertSWMLSendFaxMethodToJSON;
exports.convertJSONToSWMLSendFaxMethod = convertJSONToSWMLSendFaxMethod;
exports.convertSWMLSendSMSMessageParametersToJSON = convertSWMLSendSMSMessageParametersToJSON;
exports.convertJSONToSWMLSendSMSMessageParameters = convertJSONToSWMLSendSMSMessageParameters;
exports.convertSWMLSendMMSMessageParametersToJSON = convertSWMLSendMMSMessageParametersToJSON;
exports.convertJSONToSWMLSendMMSMessageParameters = convertJSONToSWMLSendMMSMessageParameters;
exports.convertSWMLSendSMSParametersToJSON = convertSWMLSendSMSParametersToJSON;
exports.convertJSONToSWMLSendSMSParameters = convertJSONToSWMLSendSMSParameters;
exports.convertSWMLSendSMSMethodToJSON = convertSWMLSendSMSMethodToJSON;
exports.convertJSONToSWMLSendSMSMethod = convertJSONToSWMLSendSMSMethod;
exports.convertSWMLSetMethodToJSON = convertSWMLSetMethodToJSON;
exports.convertJSONToSWMLSetMethod = convertJSONToSWMLSetMethod;
exports.convertSWMLSIPReferParametersToJSON = convertSWMLSIPReferParametersToJSON;
exports.convertJSONToSWMLSIPReferParameters = convertJSONToSWMLSIPReferParameters;
exports.convertSWMLSIPReferMethodToJSON = convertSWMLSIPReferMethodToJSON;
exports.convertJSONToSWMLSIPReferMethod = convertJSONToSWMLSIPReferMethod;
exports.convertSWMLSleepParametersToJSON = convertSWMLSleepParametersToJSON;
exports.convertJSONToSWMLSleepParameters = convertJSONToSWMLSleepParameters;
exports.convertSWMLSleepMethodToJSON = convertSWMLSleepMethodToJSON;
exports.convertJSONToSWMLSleepMethod = convertJSONToSWMLSleepMethod;
exports.convertSWMLStopDenoiseMethodToJSON = convertSWMLStopDenoiseMethodToJSON;
exports.convertJSONToSWMLStopDenoiseMethod = convertJSONToSWMLStopDenoiseMethod;
exports.convertSWMLStopRecordCallParametersToJSON = convertSWMLStopRecordCallParametersToJSON;
exports.convertJSONToSWMLStopRecordCallParameters = convertJSONToSWMLStopRecordCallParameters;
exports.convertSWMLStopRecordCallMethodToJSON = convertSWMLStopRecordCallMethodToJSON;
exports.convertJSONToSWMLStopRecordCallMethod = convertJSONToSWMLStopRecordCallMethod;
exports.convertSWMLStopTapParametersToJSON = convertSWMLStopTapParametersToJSON;
exports.convertJSONToSWMLStopTapParameters = convertJSONToSWMLStopTapParameters;
exports.convertSWMLStopTapMethodToJSON = convertSWMLStopTapMethodToJSON;
exports.convertJSONToSWMLStopTapMethod = convertJSONToSWMLStopTapMethod;
exports.convertSWMLSwitchCaseParametersToJSON = convertSWMLSwitchCaseParametersToJSON;
exports.convertJSONToSWMLSwitchCaseParameters = convertJSONToSWMLSwitchCaseParameters;
exports.convertSWMLSwitchParametersToJSON = convertSWMLSwitchParametersToJSON;
exports.convertJSONToSWMLSwitchParameters = convertJSONToSWMLSwitchParameters;
exports.convertSWMLSwitchMethodToJSON = convertSWMLSwitchMethodToJSON;
exports.convertJSONToSWMLSwitchMethod = convertJSONToSWMLSwitchMethod;
exports.convertSWMLTapParametersToJSON = convertSWMLTapParametersToJSON;
exports.convertJSONToSWMLTapParameters = convertJSONToSWMLTapParameters;
exports.convertSWMLTapMethodToJSON = convertSWMLTapMethodToJSON;
exports.convertJSONToSWMLTapMethod = convertJSONToSWMLTapMethod;
exports.convertSWMLTransferParametersToJSON = convertSWMLTransferParametersToJSON;
exports.convertJSONToSWMLTransferParameters = convertJSONToSWMLTransferParameters;
exports.convertSWMLTransferMethodToJSON = convertSWMLTransferMethodToJSON;
exports.convertJSONToSWMLTransferMethod = convertJSONToSWMLTransferMethod;
exports.convertSWMLUnsetParametersToJSON = convertSWMLUnsetParametersToJSON;
exports.convertJSONToSWMLUnsetParameters = convertJSONToSWMLUnsetParameters;
exports.convertSWMLUnsetMethodToJSON = convertSWMLUnsetMethodToJSON;
exports.convertJSONToSWMLUnsetMethod = convertJSONToSWMLUnsetMethod;
exports.convertSWMLUserEventParametersToJSON = convertSWMLUserEventParametersToJSON;
exports.convertJSONToSWMLUserEventParameters = convertJSONToSWMLUserEventParameters;
exports.convertSWMLUserEventMethodToJSON = convertSWMLUserEventMethodToJSON;
exports.convertJSONToSWMLUserEventMethod = convertJSONToSWMLUserEventMethod;
exports.convertSWMLMethodToJSON = convertSWMLMethodToJSON;
exports.convertJSONToSWMLMethod = convertJSONToSWMLMethod;
exports.convertSWMLToJSON = convertSWMLToJSON;
exports.convertJSONToSWML = convertJSONToSWML;
function convertSWMLAIHintToJSON(hint) {
return {
hint: hint.hint,
pattern: hint.pattern,
replace: hint.replace,
ignore_case: hint.ignoreCase
};
}
function convertJSONToSWMLAIHint(json) {
return {
hint: json.hint,
pattern: json.pattern,
replace: json.replace,
ignoreCase: json.ignore_case
};
}
function convertSWMLAILanguageToJSON(language) {
return {
name: language.name,
code: language.code,
voice: language.voice,
emotion: language.emotion,
function_fillers: language.functionFillers,
model: language.model,
speech_fillers: language.speechFillers,
speed: language.speed
};
}
function convertJSONToSWMLAILanguage(json) {
return {
name: json.name,
code: json.code,
voice: json.voice,
emotion: json.emotion,
functionFillers: json.function_fillers,
model: json.model,
speechFillers: json.speech_fillers,
speed: json.speed
};
}
function convertSWMLAIParamsToJSON(params) {
var _a;
if (params === undefined) {
return undefined;
}
return {
ai_model: params.aiModel,
conscience: params.conscience,
thinking_model: params.thinkingModel,
vision_model: params.visionModel,
enable_thinking: params.enableThinking,
enable_vision: params.enableVision,
wait_for_user: params.waitForUser,
direction: params.direction,
conversation_id: params.conversationId,
local_tz: params.localTZ,
save_conversation: params.saveConversation,
transfer_summary: params.transferSummary,
languages_enabled: params.languagesEnabled,
conversation_sliding_window: params.conversationSlidingWindow,
summary_mode: params.summaryMode,
asr_diarize: params.asrDiarize,
asr_speaker_affinity: params.asrSpeakerAffinity,
asr_smart_format: params.asrSmartFormat,
openai_asr_engine: params.openAiAsrEngine,
energy_level: params.energyLevel,
llm_diarize_aware: params.llmDiarizeAware,
end_of_speech_timeout: params.endOfSpeechTimeout,
first_word_timeout: params.firstWordTimeout,
ai_volume: params.aiVolume,
tts_number_format: params.ttsNumberFormat,
eleven_labs_similarity: params.elevenLabsSimilarity,
video_talking_file: params.videoTalkingFile,
video_idle_file: params.videoIdleFile,
video_listening_file: params.videoListeningFile,
max_emotion: params.maxEmotion,
speech_gen_quick_stops: params.speechGenQuickStops,
acknowledge_interruptions: params.acknowledgeInterruptions,
enable_barge: params.enableBarge,
transparent_barge: params.transparentBarge,
barge_match_string: params.bargeMatchString,
barge_min_words: params.bargeMinWords,
interrupt_on_noise: params.interruptOnNoise,
interrupt_prompt: params.interruptPrompt,
barge_functions: params.bargeFunctions,
transparent_barge_max_time: params.transparentBargeMaxTime,
attention_timeout: params.attentionTimeout,
attention_timeout_prompt: params.attentionTimeoutPrompt,
inactivity_timeout: params.inactivityTimeout,
outbound_attention_timeout: params.outboundAttentionTimeout,
initial_sleep_ms: params.initialSleepMS,
speech_event_timeout: params.speechEventTimeout,
digit_timeout: params.digitTimeout,
hard_stop_time: params.hardStopTime,
hard_stop_prompt: params.hardStopPrompt,
speech_timeout: params.speechTimeout,
background_file: params.backgroundFile,
background_file_loops: params.backgroundFileLoops,
background_file_volume: params.backgroundFileVolume,
hold_music: params.holdMusic,
hold_on_process: params.holdOnProcess,
static_greeting: params.staticGreeting,
static_greeting_no_barge: params.staticGreetingNoBarge,
swaig_allow_swml: params.swaigAllowSWML,
swaig_allow_settings: params.swaigAllowSettings,
swaig_post_conversation: params.swaigPostConversation,
function_wait_for_talking: params.functionWaitForTalking,
swaig_set_global_data: params.swaigSetGlobalData,
functions_on_no_response: params.functionsOnNoResponse,
digit_terminators: (_a = params.digitTerminators) === null || _a === void 0 ? void 0 : _a.join(''),
input_poll_freq: params.inputPollFreq,
debug_webhook_url: params.debugWebhookUrl,
debug_webhook_level: params.debugWebhookLevel,
audible_debug: params.audibleDebug,
verbose_logs: params.verboseLogs,
cache_mode: params.cacheMode,
enable_accounting: params.enableAccounting,
audible_latency: params.audibleLatency,
};
}
function convertJSONToSWMLAIParams(json) {
var _a;
return {
aiModel: json.ai_model,
conscience: json.conscience,
thinkingModel: json.thinking_model,
visionModel: json.vision_model,
enableThinking: json.enable_thinking,
enableVision: json.enable_vision,
waitForUser: json.wait_for_user,
direction: json.direction,
conversationId: json.conversation_id,
localTZ: json.local_tz,
saveConversation: json.save_conversation,
transferSummary: json.transfer_summary,
languagesEnabled: json.languages_enabled,
conversationSlidingWindow: json.conversation_sliding_window,
summaryMode: json.summary_mode,
asrDiarize: json.asr_diarize,
asrSpeakerAffinity: json.asr_speaker_affinity,
asrSmartFormat: json.asr_smart_format,
openAiAsrEngine: json.openai_asr_engine,
energyLevel: json.energy_level,
llmDiarizeAware: json.llm_diarize_aware,
endOfSpeechTimeout: json.end_of_speech_timeout,
firstWordTimeout: json.first_word_timeout,
aiVolume: json.ai_volume,
ttsNumberFormat: json.tts_number_format,
elevenLabsStability: json.eleven_labs_stability,
elevenLabsSimilarity: json.eleven_labs_similarity,
videoTalkingFile: json.video_talking_file,
videoIdleFile: json.video_idle_file,
videoListeningFile: json.video_listening_file,
maxEmotion: json.max_emotion,
speechGenQuickStops: json.speech_gen_quick_stops,
acknowledgeInterruptions: json.acknowledge_interruptions,
enableBarge: json.enable_barge,
transparentBarge: json.transparent_barge,
bargeMatchString: json.barge_match_string,
bargeMinWords: json.barge_min_words,
interruptOnNoise: json.interrupt_on_noise,
interruptPrompt: json.interrupt_prompt,
bargeFunctions: json.barge_functions,
transparentBargeMaxTime: json.transparent_barge_max_time,
attentionTimeout: json.attention_timeout,
attentionTimeoutPrompt: json.attention_timeout_prompt,
inactivityTimeout: json.inactivity_timeout,
outboundAttentionTimeout: json.outbound_attention_timeout,
initialSleepMS: json.initial_sleep_ms,
speechEventTimeout: json.speech_event_timeout,
digitTimeout: json.digit_timeout,
hardStopTime: json.hard_stop_time,
hardStopPrompt: json.hard_stop_prompt,
speechTimeout: json.speech_timeout,
backgroundFile: json.background_file,
backgroundFileLoops: json.background_file_loops,
backgroundFileVolume: json.background_file_volume,
holdMusic: json.hold_music,
holdOnProcess: json.hold_on_process,
staticGreeting: json.static_greeting,
staticGreetingNoBarge: json.static_greeting_no_barge,
swaigAllowSWML: json.swaig_allow_swml,
swaigAllowSettings: json.swaig_allow_settings,
swaigPostConversation: json.swaig_post_conversation,
functionWaitForTalking: json.function_wait_for_talking,
swaigSetGlobalData: json.swaig_set_global_data,
functionsOnNoResponse: json.functions_on_no_response,
digitTerminators: (_a = json.digit_terminators) === null || _a === void 0 ? void 0 : _a.split(''),
inputPollFreq: json.input_poll_freq,
debugWebhookUrl: json.debug_webhook_url,
debugWebhookLevel: json.debug_webhook_level,
audibleDebug: json.audible_debug,
verboseLogs: json.verbose_logs,
cacheMode: json.cache_mode,
enableAccounting: json.enable_accounting,
audibleLatency: json.audible_latency,
};
}
function convertSWMLAIPromptToJSON(prompt) {
if (prompt === undefined) {
return undefined;
}
return {
text: prompt.text,
temperature: prompt.temperature,
top_p: prompt.topP,
confidence: prompt.confidence,
presence_penalty: prompt.presencePenalty,
frequency_penalty: prompt.frequencyPenalty
};
}
function convertJSONToSWMLAIPrompt(json) {
if (json === undefined) {
return undefined;
}
return {
text: json.text,
temperature: json.temperature,
topP: json.top_p,
confidence: json.confidence,
presencePenalty: json.presence_penalty,
frequencyPenalty: json.frequency_penalty
};
}
function convertSWMLAIPronounceToJSON(pronounce) {
return {
replace: pronounce.replace,
with: pronounce.with,
ignore_case: pronounce.ignoreCase
};
}
function convertJSONToSWMLAIPronounce(json) {
return {
replace: json.replace,
with: json.with,
ignoreCase: json.ignore_case
};
}
function convertSWMLSWAIGDefaultsToJSON(defaults) {
if (defaults === undefined) {
return undefined;
}
return {
webHookUrl: defaults.webHookUrl
};
}
function convertJSONToSWMLSWAIGDefaults(json) {
if (json === undefined) {
return undefined;
}
return {
webHookUrl: json.web_hook_url
};
}
function convertSWMLSWAIGDataMapOutputSWMLActionToJSON(action) {
return {
SWML: convertSWMLToJSON(action.SWML),
};
}
function convertJSONToSWMLSWAIGDataMapOutputSWMLAction(json) {
return {
type: 'swml',
SWML: convertJSONToSWML(json.SWML)
};
}
function convertSWMLSWAIGDataMapOutputSayActionToJSON(action) {
return {
say: action.say,
};
}
function convertJSONToSWMLSWAIGDataMapOutputSayAction(json) {
return {
type: 'say',
say: json.say
};
}
function convertSWMLSWAIGDataMapOutputStopActionToJSON(action) {
return {
stop: action.stop,
};
}
function convertJSONToSWMLSWAIGDataMapOutputStopAction(json) {
return {
type: 'stop',
stop: json.stop
};
}
function convertSWMLSWAIGDataMapOutputToggleFunctionToJSON(toggleFunction) {
return {
active: toggleFunction.active,
function: toggleFunction.function,
};
}
function convertJSONToSWMLSWAIGDataMapOutputToggleFunction(json) {
return {
active: json.active,
function: json.function,
};
}
function convertSWMLSWAIGDataMapOutputToggleFunctionsActionToJSON(toggleFunctionsAction) {
return {
toggle_functions: toggleFunctionsAction.toggleFunctions.map(convertSWMLSWAIGDataMapOutputToggleFunctionToJSON),
};
}
function convertJSONToSWMLSWAIGDataMapOutputToggleFunctionsAction(json) {
return {
type: 'toggleFunctions',
toggleFunctions: json.toggle_functions.map(convertJSONToSWMLSWAIGDataMapOutputToggleFunction)
};
}
function convertSWMLSWAIGDataMapOutputSetGlobalDataActionToJSON(action) {
return {
set_global_data: action.setGlobalData,
};
}
function convertJSONToSWMLSWAIGDataMapOutputSetGlobalDataAction(json) {
return {
type: 'setGlobalData',
setGlobalData: json.set_global_data
};
}
function convertSWMLSWAIGDataMapOutputSetMetaDataActionToJSON(action) {
return {
set_meta_data: action.setMetaData,
};
}
function convertJSONToSWMLSWAIGDataMapOutputSetMetaDataAction(json) {
return {
type: 'setMetaData',
setMetaData: json.set_meta_data
};
}
function convertSWMLSWAIGDataMapOutputUnsetGlobalDataActionToJSON(action) {
return {
unset_global_data: action.unsetGlobalData
};
}
function convertJSONToSWMLSWAIGDataMapOutputUnsetGlobalDataAction(json) {
return {
type: 'unsetGlobalData',
unsetGlobalData: json.unset_global_data
};
}
function convertSWMLSWAIGDataMapOutputUnsetMetaDataActionToJSON(action) {
return {
unset_meta_data: action.unsetMetaData
};
}
function convertJSONToSWMLSWAIGDataMapOutputUnsetMetaDataAction(json) {
return {
type: 'unsetMetaData',
unsetMetaData: json.unset_meta_data
};
}
function convertSWMLSWAIGDataMapOutputPlaybackBGActionToJSON(action) {
return {
playback_bg: {
file: action.playbackBG.file,
wait: action.playbackBG.wait
}
};
}
function convertJSONToSWMLSWAIGDataMapOutputPlaybackBGAction(json) {
return {
type: 'playbackBG',
playbackBG: {
file: json.playback_bg.file,
wait: json.playback_bg.wait
}
};
}
function convertSWMLSWAIGDataMapOutputStopPlaybackBGActionToJSON(action) {
return {
stop_playback_bg: action.stopPlaybackBG
};
}
function convertJSONToSWMLSWAIGDataMapOutputStopPlaybackBGAction(json) {
return {
type: 'stopPlaybackBG',
stopPlaybackBG: json.stop_playback_bg
};
}
function convertSWMLSWAIGDataMapOutputUserInputActionToJSON(action) {
return {
user_input: action.userInput
};
}
function convertJSONToSWMLSWAIGDataMapOutputUserInputAction(json) {
return {
type: 'userInput',
userInput: json.user_input
};
}
function convertSWMLSWAIGDataMapOutputContextSwitchActionToJSON(action) {
return {
context_switch: {
system_prompt: action.contextSwitch.systemPrompt,
consolidate: action.contextSwitch.consolidate,
user_prompt: action.contextSwitch.userPrompt
}
};
}
function convertJSONToSWMLSWAIGDataMapOutputContextSwitchAction(json) {
return {
type: 'contextSwitch',
contextSwitch: {
systemPrompt: json.context_switch.system_prompt,
consolidate: json.context_switch.consolidate,
userPrompt: json.context_switch.user_prompt
}
};
}
function convertSWMLSWAIGDataMapOutputActionToJSON(action) {
switch (action.type) {
case 'swml':
return convertSWMLSWAIGDataMapOutputSWMLActionToJSON(action);
case 'say':
return convertSWMLSWAIGDataMapOutputSayActionToJSON(action);
case 'stop':
return convertSWMLSWAIGDataMapOutputStopActionToJSON(action);
case 'toggleFunctions':
return convertSWMLSWAIGDataMapOutputToggleFunctionsActionToJSON(action);
case 'setGlobalData':
return convertSWMLSWAIGDataMapOutputSetGlobalDataActionToJSON(action);
case 'setMetaData':
return convertSWMLSWAIGDataMapOutputSetMetaDataActionToJSON(action);
case 'unsetGlobalData':
return convertSWMLSWAIGDataMapOutputUnsetGlobalDataActionToJSON(action);
case 'unsetMetaData':
return convertSWMLSWAIGDataMapOutputUnsetMetaDataActionToJSON(action);
case 'playbackBG':
return convertSWMLSWAIGDataMapOutputPlaybackBGActionToJSON(action);
case 'stopPlaybackBG':
return convertSWMLSWAIGDataMapOutputStopPlaybackBGActionToJSON(action);
case 'userInput':
return convertSWMLSWAIGDataMapOutputUserInputActionToJSON(action);
case 'contextSwitch':
return convertSWMLSWAIGDataMapOutputContextSwitchActionToJSON(action);
default:
throw Error("Unknown DataMap Output Action Type");
}
}
function convertJSONToSWMLSWAIGDataMapOutputAction(json) {
const objectKeys = Object.keys(json);
if (objectKeys.includes('SWML')) {
return convertJSONToSWMLSWAIGDataMapOutputSWMLAction(json);
}
else if (objectKeys.includes('say')) {
return convertJSONToSWMLSWAIGDataMapOutputSayAction(json);
}
else if (objectKeys.includes('stop')) {
return convertJSONToSWMLSWAIGDataMapOutputStopAction(json);
}
else if (objectKeys.includes('toggle_functions')) {
return convertJSONToSWMLSWAIGDataMapOutputToggleFunctionsAction(json);
}
else if (objectKeys.includes('set_global_data')) {
return convertJSONToSWMLSWAIGDataMapOutputSetGlobalDataAction(json);
}
else if (objectKeys.includes('set_meta_data')) {
return convertJSONToSWMLSWAIGDataMapOutputSetMetaDataAction(json);
}
else if (objectKeys.includes('unset_global_data')) {
return convertJSONToSWMLSWAIGDataMapOutputUnsetGlobalDataAction(json);
}
else if (objectKeys.includes('unset_meta_data')) {
return convertJSONToSWMLSWAIGDataMapOutputUnsetMetaDataAction(json);
}
else if (objectKeys.includes('playback_bg')) {
return convertJSONToSWMLSWAIGDataMapOutputPlaybackBGAction(json);
}
else if (objectKeys.includes('stop_playback_bg')) {
return convertJSONToSWMLSWAIGDataMapOutputStopPlaybackBGAction(json);
}
else if (objectKeys.includes('user_input')) {
return convertJSONToSWMLSWAIGDataMapOutputUserInputAction(json);
}
else if (objectKeys.includes('context_switch')) {
return convertJSONToSWMLSWAIGDataMapOutputContextSwitchAction(json);
}
else {
throw Error("Unknown DataMap Output Action Type");
}
}
function convertSWMLSWAIGDataMapOutputToJSON(output) {
if (output === undefined) {
return undefined;
}
return {
response: output.response,
action: output.action.map(convertSWMLSWAIGDataMapOutputActionToJSON)
};
}
function convertJSONToSWMLSWAIGDataMapOutput(json) {
return {
response: json.response,
action: json.action.map(convertJSONToSWMLSWAIGDataMapOutputAction)
};
}
function convertSWMLSWAIGDataMapExpressionToJSON(expression) {
return {
string: expression.string,
pattern: expression.pattern,
output: convertSWMLSWAIGDataMapOutputToJSON(expression.output)
};
}
function convertJSONToSWMLSWAIGDataMapExpression(json) {
return {
string: json.string,
pattern: json.pattern,
output: convertJSONToSWMLSWAIGDataMapOutput(json.output)
};
}
function convertSWMLSWAIGDataMapWebhookForeachToJSON(foreach) {
if (foreach === undefined) {
return undefined;
}
return {
append: foreach.append,
input_key: foreach.inputKey,
max: foreach.max,
output_key: foreach.outputKey
};
}
function convertJSONToSWMLSWAIGDataMapWebhookForeach(json) {
if (json === undefined) {
return undefined;
}
return {
append: json.append,
inputKey: json.input_key,
max: json.max,
outputKey: json.output_key
};
}
function convertSWMLSWAIGDataMapWebhookToJSON(webhook) {
var _a;
return {
expressions: (_a = webhook.expressions) === null || _a === void 0 ? void 0 : _a.map(convertSWMLSWAIGDataMapExpressionToJSON),
error_keys: webhook.errorKeys,
url: webhook.url,
foreach: convertSWMLSWAIGDataMapWebhookForeachToJSON(webhook.foreach),
headers: webhook.headers,
method: webhook.method,
input_args_as_params: webhook.inputArgsAsParams,
params: webhook.params,
required_args: webhook.requiredArgs,
output: convertSWMLSWAIGDataMapOutputToJSON(webhook.output)
};
}
function convertJSONToSWMLSWAIGDataMapWebhook(json) {
var _a;
return {
expressions: (_a = json.expressions) === null || _a === void 0 ? void 0 : _a.map(convertJSONToSWMLSWAIGDataMapExpression),
errorKeys: json.error_keys,
url: json.url,
foreach: convertJSONToSWMLSWAIGDataMapWebhookForeach(json.foreach),
headers: json.headers,
method: json.method,
inputArgsAsParams: json.input_args_as_params,
params: json.params,
requiredArgs: json.required_args,
output: convertJSONToSWMLSWAIGDataMapOutput(json.output)
};
}
function convertSWMLSWAIGDataMapToJSON(dataMap) {
if (dataMap === undefined) {
return undefined;
}
return {
expressions: dataMap.expressions.map(convertSWMLSWAIGDataMapExpressionToJSON),
webhooks: dataMap.webhooks.map(convertSWMLSWAIGDataMapWebhookToJSON),
output: convertSWMLSWAIGDataMapOutputToJSON(dataMap.output)
};
}
function convertJSONToSWMLSWAIGDataMap(json) {
if (json === undefined) {
return undefined;
}
return {
expressions: json.expressions.map(convertJSONToSWMLSWAIGDataMapExpression),
webhooks: json.webhooks.map(convertJSONToSWMLSWAIGDataMapWebhook),
output: convertJSONToSWMLSWAIGDataMapOutput(json.output)
};
}
function convertSWMLSWAIGFunctionParameterStringPropertyToJSON(property) {
return {
type: 'string',
description: property.description,
enum: property.enum,
default: property.default,
pattern: property.pattern,
nullable: property.nullable,
};
}
function convertJSONToSWMLSWAIGFunctionParameterStringProperty(json) {
return {
type: 'string',
description: json.description,
enum: json.enum,
default: json.default,
pattern: json.pattern,
nullable: json.nullable,
};
}
function convertSWMLSWAIGFunctionParameterIntegerPropertyToJSON(property) {
return {
type: 'integer',
description: property.description,
enum: property.enum,
default: property.default,
nullable: property.nullable,
};
}
function convertJSONToSWMLSWAIGFunctionParameterIntegerProperty(json) {
return {
type: 'integer',
description: json.description,
enum: json.enum,
default: json.default,
nullable: json.nullable,
};
}
function convertSWMLSWAIGFunctionParameterNumberPropertyToJSON(property) {
return {
type: 'number',
description: property.description,
enum: property.enum,
default: property.default,
nullable: property.nullable,
};
}
function convertJSONToSWMLSWAIGFunctionParameterNumberProperty(json) {
return {
type: 'number',
description: json.description,
enum: json.enum,
default: json.default,
nullable: json.nullable,
};
}
function convertSWMLSWAIGFunctionParameterBooleanPropertyToJSON(property) {
return {
type: 'boolean',
description: property.description,
default: property.default,
nullable: property.nullable,
};
}
function convertJSONToSWMLSWAIGFunctionParameterBooleanProperty(json) {
return {
type: 'boolean',
description: json.description,
default: json.default,
nullable: json.nullable,
};
}
function convertSWMLSWAIGFunctionParameterArrayPropertyToJSON(property) {
return {
type: 'array',
description: property.description,
items: property.items.map(convertSWMLSWAIGFunctionParameterPropertyToJSON),
default: property.default,
nullable: property.nullable,
};
}
function convertJSONToSWMLSWAIGFunctionParameterArrayProperty(json) {
return {
type: 'array',
description: json.description,
items: json.items.map(convertJSONToSWMLSWAIGFunctionParameterProperty),
default: json.default,
nullable: json.nullable,
};
}
function convertSWMLSWAIGFunctionParameterPropertiesToJSON(properties) {
const propertiesEntries = Object.entries(properties).map(([key, value]) => {
const tuple = [key, convertSWMLSWAIGFunctionParameterPropertyToJSON(value)];
return tuple;
});
return Object.fromEntries(propertiesEntries);
}
function convertJSONToSWMLSWAIGFunctionParameterProperties(json) {
const propertiesEntries = Object.entries(json).map(([key, value]) => {
const tuple = [key, convertJSONToSWMLSWAIGFunctionParameterProperty(value)];
return tuple;
});
return Object.fromEntries(propertiesEntries);
}
function convertSWMLSWAIGFunctionParameterObjectPropertyToJSON(property) {
return {
type: 'object',
description: property.description,
properties: convertSWMLSWAIGFunctionParameterPropertiesToJSON(property.properties),
required: property.required,
default: property.default,
nullable: property.nullable,
};
}
function convertJSONToSWMLSWAIGFunctionParameterObjectProperty(json) {
return {
type: 'object',
description: json.description,
properties: convertJSONToSWMLSWAIGFunctionParameterProperties(json.properties),
required: json.required,
default: json.default,
nullable: json.nullable,
};
}
function convertSWMLSWAIGFunctionParameterOneOfPropertyToJSON(property) {
return {
oneOf: property.oneOf.map(convertSWMLSWAIGFunctionParameterPropertyToJSON)
};
}
function convertJSONToSWMLSWAIGFunctionParameterOneOfProperty(json) {
return {
type: 'oneOf',
oneOf: json.oneOf.map(convertJSONToSWMLSWAIGFunctionParameterProperty)
};
}
function convertSWMLSWAIGFunctionParameterAllOfPropertyToJSON(property) {
return {
allOf: property.allOf.map(convertSWMLSWAIGFunctionParameterPropertyToJSON)
};
}
function convertJSONToSWMLSWAIGFunctionParameterAllOfProperty(json) {
return {
type: 'allOf',
allOf: json.allOf.map(convertJSONToSWMLSWAIGFunctionParameterProperty)
};
}
function convertSWMLSWAIGFunctionParameterAnyOfPropertyToJSON(property) {
return {
anyOf: property.anyOf.map(convertSWMLSWAIGFunctionParameterPropertyToJSON)
};
}
function convertJSONToSWMLSWAIGFunctionParameterAnyOfProperty(json) {
return {
type: 'anyOf',
anyOf: json.anyOf.map(convertJSONToSWMLSWAIGFunctionParameterProperty)
};
}
function convertSWMLSWAIGFunctionParameterConstPropertyToJSON(property) {
return {
const: property.const
};
}
function convertJSONToSWMLSWAIGFunctionParameterConstProperty(json) {
return {
type: 'const',
const: json.const
};
}
function convertSWMLSWAIGFunctionParameterPropertyToJSON(property) {
switch (property.type) {
case 'string':
return convertSWMLSWAIGFunctionParameterStringPropertyToJSON(property);
case 'integer':
return convertSWMLSWAIGFunctionParameterIntegerPropertyToJSON(property);
case 'number':
return convertSWMLSWAIGFunctionParameterNumberPropertyToJSON(property);
case 'boolean':
return convertSWMLSWAIGFunctionParameterBooleanPropertyToJSON(property);
case 'array':
return convertSWMLSWAIGFunctionParameterArrayPropertyToJSON(property);
case 'object':
return convertSWMLSWAIGFunctionParameterObjectPropertyToJSON(property);
case 'oneOf':
return convertSWMLSWAIGFunctionParameterOneOfPropertyToJSON(property);
case 'allOf':
return convertSWMLSWAIGFunctionParameterAllOfPropertyToJSON(property);
case 'anyOf':
return convertSWMLSWAIGFunctionParameterAnyOfPropertyToJSON(property);
case 'const':
return convertSWMLSWAIGFunctionParameterConstPropertyToJSON(property);
default:
throw Error("Unknown Function Parameter Type");
}
}
function convertJSONToSWMLSWAIGFunctionParameterProperty(json) {
switch (json.type) {
case 'string':
return convertJSONToSWMLSWAIGFunctionParameterStringProperty(json);
case 'integer':
return convertJSONToSWMLSWAIGFunctionParameterIntegerProperty(json);
case 'number':
return convertJSONToSWMLSWAIGFunctionParameterNumberProperty(json);
case 'boolean':
return convertJSONToSWMLSWAIGFunctionParameterBooleanProperty(json);
case 'array':
return convertJSONToSWMLSWAIGFunctionParameterArrayProperty(json);
case 'object':
return convertJSONToSWMLSWAIGFunctionParameterObjectProperty(json);
default:
const objectKeys = Object.keys(json);
if (objectKeys.includes('oneOf')) {
return convertJSONToSWMLSWAIGFunctionParameterOneOfProperty(json);
}
else if (objectKeys.includes('allOf')) {
return convertJSONToSWMLSWAIGFunctionParameterAllOfProperty(json);
}
else if (objectKeys.includes('anyOf')) {
return convertJSONToSWMLSWAIGFunctionParameterAnyOfProperty(json);
}
else if (objectKeys.includes('const')) {
return convertJSONToSWMLSWAIGFunctionParameterConstProperty(json);
}
else {
throw Error("Unknown Function Parameter Type");
}
}
}
function convertSWMLSWAIGFunctionParametersToJSON(parameters) {
if (parameters === undefined) {
return undefined;
}
return {
type: parameters.type,
properties: convertSWMLSWAIGFunctionParameterPropertiesToJSON(parameters.properties),
required: parameters.required
};
}
function convertJSONToSWMLSWAIGFunctionParameters(json) {
if (json === undefined) {
return undefined;
}
return {
type: json.type,
properties: convertJSONToSWMLSWAIGFunctionParameterProperties(json.properties),
required: json.required
};
}
function convertSWMLSWAIGFunctionFillersToJSON(fillers) {
if (fillers === undefined) {
return undefined;
}
const fillersEntries = Object.entries(fillers).map(([languageCode, value]) => {
const tuple = [languageCode, value];
return tuple;
});
return Object.fromEntries(fillersEntries);
}
function convertJSONToSWMLSWAIGFunctionFillers(json) {
const entries = Object.entries(json).map(([languageCode, value]) => {
const tuple = [languageCode, value];
return tuple;
});
return Object.fromEntries(entries);
}
function convertSWMLSWAIGFunctionToJSON(func) {
return {
description: func.description,
function: func.function,
active: func.active,
data_map: convertSWMLSWAIGDataMapToJSON(func.dataMap),
parameters: convertSWMLSWAIGFunctionParametersToJSON(func.parameters),
fillers: convertSWMLSWAIGFunctionFillersToJSON(func.fillers),
meta_data: func.metaData,
meta_data_token: func.metaDataToken,
wait_file: func.waitFile,
wait_file_loops: func.waitFileLoops,
wait_for_fillers: func.waitForFillers,
web_hook_url: func.webHookUrl,
};
}
function convertJSONToSWMLSWAIGFunction(json) {
return {
description: json.description,
function: json.function,
active: json.active,
dataMap: convertJSONToSWMLSWAIGDataMap(json.data_map),
parameters: convertJSONToSWMLSWAIGFunctionParameters(json.parameters),
fillers: convertJSONToSWMLSWAIGFunctionFillers(json.fillers),
metaData: json.meta_data,
metaDataToken: json.meta_data_token,
waitFile: json.wait_file,
waitFileLoops: json.wait_file_loops,
waitForFillers: json.wait_for_fillers,
webHookUrl: json.web_hook_url,
};
}
function convertSWMLSWAIGIncludeToJSON(include) {
return {
url: include.url,
function: include.function,
meta_data: include.metaData,
};
}
function convertJSONToSWMLSWAIGInclude(json) {
return {
url: json.url,
function: json.function,
metaData: json.meta_data,
};
}
function convertSWMLSWAIGVisualInputFillerToJSON(filler) {
const objectEntries = Object.entries(filler).map(([languageCode, value]) => {
const tuple = [languageCode, value];
return tuple;
});
return Object.fromEntries(objectEntries);
}
function convertJSONToSWMLSWAIGVisualInputFiller(json) {
const entries = Object.entries(json).map(([languageCode, value]) => {
const tuple = [languageCode, value];
return tuple;
});
return Object.fromEntries(entries);
}
function convertSWMLSWAIGInternalFillerToJSON(filler) {
if (filler === undefined) {
return undefined;
}
return {
get_visual_input: convertSWMLSWAIGVisualInputFillerToJSON(filler.getVisualInput)
};
}
function convertJSONToSWMLSWAIGInternalFiller(json) {
if (json === undefined) {
return undefined;
}
return {
getVisualInput: convertJSONToSWMLSWAIGVisualInputFiller(json.get_visual_input)
};
}
function convertSWMLSWAIGToJSON(swaig) {
var _a, _b;
if (swaig === undefined) {
return undefined;
}
return {
defaults: convertSWMLSWAIGDefaultsToJSON(swaig.defaults),
functions: (_a = swaig.functions) === null || _a === void 0 ? void 0 : _a.map(convertSWMLSWAIGFunctionToJSON),
includes: (_b = swaig.includes) === null || _b === void 0 ? void 0 : _b.map(convertSWMLSWAIGIncludeToJSON),
internal_fillers: convertSWMLSWAIGInternalFillerToJSON(swaig.internalFillers),
native_functions: swaig.nativeFunctions,
};
}
function convertJSONToSWMLSWAIG(json) {
var _a, _b;
if (json === undefined) {
return undefined;
}
return {
defaults: convertJSONToSWMLSWAIGDefaults(json.defaults),
functions: (_a = json.functions) === null || _a === void 0 ? void 0 : _a.map(convertJSONToSWMLSWAIGFunction),
includes: (_b = json.includes) === null || _b === void 0 ? void 0 : _b.map(convertJSONToSWMLSWAIGInclude),
internalFillers: convertJSONToSWMLSWAIGInternalFiller(json.internal_fillers),
nativeFunctions: json.native_functions,
};
}
function convertSWMLAIHintsToJSON(hints) {
const isArrayOfStrings = Array.isArray(hints) && hints.every(element => typeof element === 'string');
if (isArrayOfStrings) {
return hints;
}
else {
return hints === null || hints === void 0 ? void 0 : hints.map(convertSWMLAIHintToJSON);
}
}
function convertJSONToSWMLAIHints(json) {
const isArrayOfStrings = Array.isArray(json) && json.every(element => typeof element === 'string');
if (isArrayOfStrings) {
return json;
}
else {
return json === null || json === void 0 ? void 0 : json.map(convertJSONToSWMLAIHint);
}
}
function convertSWMLAIParametersToJSON(parameters) {
var _a, _b;
return {
global_data: parameters.globalData,
hints: convertSWMLAIHintsToJSON(parameters.hints),
languages: (_a = parameters.languages) === null || _a === void 0 ? void 0 : _a.map(convertSWMLAILanguageToJSON),
params: convertSWMLAIParamsToJSON(parameters.params),
post_prompt: convertSWMLAIPromptToJSON(parameters.postPrompt),
post_prompt_url: parameters.postPromptUrl,
pronounce: (_b = parameters.pronounce) === null || _b === void 0 ? void 0 : _b.map(convertSWMLAIPronounceToJSON),
prompt: convertSWMLAIPromptToJSON(parameters.prompt),
SWAIG: convertSWMLSWAIGToJSON(parameters.SWAIG)
};
}
function convertJSONToSWMLAIParameters(json) {
var _a, _b;
return {
globalData: json.global_data,
hints: convertJSONToSWMLAIHints(json.hints),
languages: (_a = json.languages) === null || _a === void 0 ? void 0 : _a.map(convertJSONToSWMLAILanguage),
params: convertJSONToSWMLAIParams(json.params),
postPrompt: convertJSONToSWMLAIPrompt(json.post_prompt),
postPromptUrl: json.post_prompt_url,
pronounce: (_b = json.pronounce) === null || _b === void 0 ? void 0 : _b.map(convertJSONToSWMLAIPronounce),
prompt: convertJSONToSWMLAIPrompt(json.prompt),
SWAIG: convertJSONToSWMLSWAIG(json.SWAIG)
};
}
function convertSWMLAIMethodToJSON(method) {
return {
ai: convertSWMLAIParametersToJSON(method.ai)
};
}
function convertJSONToSWMLAIMethod(json) {
return {
type: 'ai',
ai: convertJSONToSWMLAIParameters(json.ai)
};
}
function convertSWMLAnswerParametersToJSON(parameters) {
return {
max_duration: parameters.maxDuration,
sip_auth_username: parameters.sipAuthUsername,
sip_auth_password: parameters.sipAuthPassword,
};
}
function convertJSONToSWMLAnswerParameters(json) {
return {
maxDuration: json.max_duration,
sipAuthUsername: json.sip_auth_username,
sipAuthPassword: json.sip_auth_password,
};
}
function convertSWMLAnswerMethodToJSON(method) {
return {
answer: convertSWMLAnswerParametersToJSON(method.answer)
};
}
function convertJSONToSWMLAnswerMethod(json) {
return {
type: 'answer',
answer: convertJSONToSWMLAnswerParameters(json.answer)
};
}
function convertSWMLCondWhenThenParametersToJSON(parameters) {
return {
when: parameters.when,
then: parameters.then.map(convertSWMLMethodToJSON),
};
}
function convertJSONToSWMLCondWhenThenParameters(json) {
return {
type: 'whenThen',
when: json.when,
then: json.then.map(convertJSONToSWMLMethod),
};
}
function convertSWMLCondElseParametersToJSON(parameters) {
var _a;
return {
else: (_a = parameters.else) === null || _a === void 0 ? void 0 : _a.map(convertSWMLMethodToJSON)
};
}
function convertJSONToSWMLCondElseParameters(json) {
var _a;
return {
type: 'else',
else: (_a = json.else) === null || _a === void 0 ? void 0 : _a.map(convertJSONToSWMLMethod),
};
}
function convertSWMLCondParametersToJSON(parameters) {
switch (parameters.type) {
case 'whenThen':
return convertSWMLCondWhenThenParametersToJSON(parameters);
case 'else':
return convertSWMLCondElseParametersToJSON(parameters);
default:
throw Error("Unknown Cond Type");
}
}
function convertJSONToSWMLCondParameters(json) {
const objectKeys = Object.keys(json);
if (objectKeys.includes('when')) {
return convertJSONToSWMLCondWhenThenParameters(json);
}
else if (objectKeys.includes('else') || json.else === undefined) {
return convertJSONToSWMLCondElseParameters(json);
}
else {
throw Error("Unknown Cond Type");
}
}
function convertSWMLCondMethodToJSON(method) {
return {
cond: method.cond.map(convertSWMLCondParametersToJSON)
};
}
function convertJSONToSWMLCondMethod(json) {
return {
type: 'cond',
cond: json.cond.map(convertJSONToSWMLCondParameters),
};
}
function convertSWMLConnectHeaderToJSON(header) {
return {
name: header.name,
value: header.value,
};
}
function convertJSONToSWMLConnectHeader(json) {
return {
name: json.name,
value: json.value,
};
}
function convertSWMLConnectToDialingParameterToJSONObject(parameter) {
return {
to: parameter.to
};
}
function convertToParameterToSWMLConnectToDialingParameter(to) {
return {
type: 'to',
to: to
};
}
function convertSWMLConnectDestinationToJSON(destination) {
return {
to: destination.to,
from: destination.from,
timeout: destination.timeout,
call_state_url: destination.callStateUrl,
call_state_events: destination.callStateEvents,
};
}
function convertJSONToSWMLConnectDestination(json) {
return {
to: json.to,
from: json.from,
timeout: json.timeout,
callStateUrl: json.call_state_url,
callStateEvents: json.call_state_events,
};
}
function convertSWMLConnectSerialDialingParameterToJSONObject(parameter) {
return {
serial: parameter.serial.map(convertSWMLConnectDestinationToJSON),
};
}
function convertJSONObjectToSWMLConnectSerialDialingParameter(json) {
return {
type: 'serial',
serial: json.serial.map(convertJSONToSWMLConnectDestination),
};
}
function convertSWMLConnectParallelDialingParameterToJSONObject(parameter) {
return {
parallel: parameter.parallel.map(convertSWMLConnectDestinationToJSON),
};
}
function convertJSONObjectToSWMLConnectParallelDialingParameter(json) {
return {
type: 'parallel',
parallel: json.parallel.map(convertJSONToSWMLConnectDestination),
};
}
function convertSWMLConnectSerialParallelDialingParameterToJSONObject(parameter) {
return {
serial_parallel: parameter.serialParallel.map(parallel => parallel.map(convertSWMLConnectDestinationToJSON)),
};
}
function convertJSONObjectToSWMLConnectSerialParallelDialingParameter(json) {
return {
type: 'serialParallel',
serialParallel: json.serial_parallel.map((parallel) => parallel.map(convertJSONToSWMLConnectDestination)),
};
}
function convertSWMLConnectDialingParameterToJSONObject(parameter) {
switch (parameter.type) {
case 'to':
return convertSWMLConnectToDialingParameterToJSONObject(parameter);
case 'serial':
return convertSWMLConnectSerialDialingParameterToJSONObject(parameter);
case 'parallel':
return convertSWMLConnectParallelDialingParameterToJSONObject(parameter);
case 'serialParallel':
return convertSWMLConnectSerialParallelDialingParameterToJSONObject(parameter);
default:
throw Error("Unknown Dialing Parameter Type");
}
}
function convertJSONObjectToSWMLConnectDialingParameter(json) {
const objectKeys = Object.keys(json);
if (objectKeys.includes('to')) {
return convertToParameterToSWMLConnectToDialingParameter(json.to);
}
else if (objectKeys.includes('serial')) {
return convertJSONObjectToSWMLConnectSerialDialingParameter(json);
}
else if (objectKeys.includes('parallel')) {
return convertJSONObjectToSWMLConnectParallelDialingParameter(json);
}
else if (objectKeys.includes('serial_parallel')) {
return convertJSONObjectToSWMLConnectSerialParallelDialingParameter(json);
}
else {
throw Error("Unknown Dialing Parameter Type");
}
}
function convertSWMLConnectParametersToJSON(parameters) {
var _a;
const dialingParameter = convertSWMLConnectDialingParameterToJSONObject(parameters.dialing);
return Object.assign({ answer_on_bridge: parameters.answerOnBridge, call_state_events: parameters.callStateEvents, codecs: parameters.codecs, confirm: parameters.confirm, confirm_timeout: parameters.confirmTimeout, encryption: parameters.encryption, from: parameters.from, headers: (_a = parameters.headers) === null || _a === void 0 ? void 0 : _a.map(convertSWMLConnectHeaderToJSON), max_duration: parameters.maxDuration, result: parameters.result, ringback: parameters.ringback, session_timeout: parameters.sessionTimeout, status_url: parameters.statusUrl, timeout: parameters.timeout, username: parameters.username, password: parameters.password, webrtc_media: parameters.webRTCMedia }, dialingParameter);
}
function convertJSONToSWMLConnectParameters(json) {
var _a;
const dialingParameter = convertJSONObjectToSWMLConnectDialingParameter(json);
return {
answerOnBridge: json.answer_on_bridge,
callStateEvents: json.call_state_events,
codecs: json.codecs,
confirm: json.confirm,
confirmTimeout: json.confirm_timeout,
encryption: json.encryption,
from: json.from,
headers: (_a = json.headers) === null || _a === void 0 ? void 0 : _a.map(convertJSONToSWMLConnectHeader),
maxDuration: json.max_duration,
result: json.result,
ringback: json.ringback,
sessionTimeout: json.session_timeout,
statusUrl: json.status_url,
timeout: json.timeout,
username: json.username,
password: json.password,
webRTCMedia: json.webrtc_media,
dialing: dialingParameter
};
}
function convertSWMLConnectMethodToJSON(method) {
return {
connect: convertSWMLConnectParametersToJSON(method.connect)
};
}
function convertJSONToSWMLConnectMethod(json) {
return {
type: 'connect',
connect: convertJSONToSWMLConnectParameters(json.connect)
};
}
function convertSWMLDenoiseMethodToJSON(method) {
return {
denoise: method.denoise,
};
}
function convertJSONToSWMLDenoiseMethod(json) {
return {
type: 'denoise',
denoise: json.denoise,
};
}
function convertSWMLDetectMachineParametersToJSON(parameters) {
return {
detect_message_end: parameters.detectMessageEnd,
detectors: parameters.detectors.join(','),
end_silence_timeout: parameters.endSilenceTimeout,
initial_timeout: parameters.initialTimeout,
machine_ready_timeout: parameters.machineReadyTimeout,
machine_voice_threshold: parameters.machineVoiceThreshold,
machine_words_threshold: parameters.machineWordsThreshold,
status_url: parameters.statusUrl,
timeout: parameters.timeout,
tone: parameters.tone,
wait: parameters.wait,
};
}
function convertJSONToSWMLDetectMachineParameters(json) {
return {
detectMessageEnd: json.detect_message_end,
detectors: json.detectors.split(',').map((detector) => detector.trim()),
endSilenceTimeout: json.end_silence_timeout,
initialTimeout: json.initial_timeout,
machineReadyTimeout: json.machine_ready_timeout,
machineVoiceThreshold: json.machine_voice_threshold,
machineWordsThreshold: json.machine_words_threshold,
statusUrl: json.status_url,
timeout: json.timeout,
tone: json.tone,
wait: json.wait,
};
}
function convertSWMLDetectMachineMethodToJSON(method) {
return {
detect_machine: convertSWMLDetectMachineParametersToJSON(method.detectMachine)
};
}
function convertJSONToSWMLDetectMachineMethod(json) {
return {
type: 'detectMachine',
detectMachine: convertJSONToSWMLDetectMachineParameters(json.detect_machine)
};
}
function convertSWMLExecuteParametersToJSON(parameters) {
var _a;
return {
dest: parameters.dest,
params: parameters.params,
on_return: (_a = parameters.onReturn) === null || _a === void 0 ? void 0 : _a.map(convertSWMLMethodToJSON),
result: parameters.result,
};
}
function convertJSONToSWMLExecuteParameters(json) {
var _a;
return {
dest: json.dest,
params: json.params,
onReturn: (_a = json.on_return) === null || _a === void 0 ? void 0 : _a.map(convertJSONToSWMLMethod),
result: json.result,
};
}
function convertSWMLExecuteMethodToJSON(method) {
return {
execute: convertSWMLExecuteParametersToJSON(method.execute)
};
}
function convertJSONToSWMLExecuteMethod(json) {
return {
type: 'execute',
execute: convertJSONToSWMLExecuteParameters(json.execute)
};
}
function convertSWMLGotoParametersToJSON(parameters) {
return {
label: parameters.label,
when: parameters.when,
max: parameters.max
};
}
function convertJSONToSWMLGotoParameters(json) {
return {
label: json.label,
when: json.when,
max: json.max
};
}
function convertSWMLGotoMethodToJSON(method) {
return {
goto: convertSWMLGotoParametersToJSON(method.goto)
};
}
function convertJSONToSWMLGotoMethod(json) {
return {
type: 'goto',
goto: convertJSONToSWMLGotoParameters(json.goto)
};
}
function convertSWMLHangupParametersToJSON(parameters) {
return {
reason: parameters.reason
};
}
function convertJSONToSWMLHangupParameters(json) {
return {
reason: json.reason
};
}
function convertSWMLHangupMethodToJSON(method) {
return {
hangup: convertSWMLHangupParametersToJSON(method.hangup)
};
}
function convertJSONToSWMLHangupMethod(json) {
return {
type: 'hangup',
hangup: convertJSONToSWMLHangupParameters(json.hangup)
};
}
function convertSWMLJoinRoomParametersToJSON(parameters) {
return {
name: parameters.name,
};
}
function convertJSONToSWMLJoinRoomParameters(json) {
return {
name: json.name,
};
}
function convertSWMLJoinRoomMethodToJSON(method) {
return {
join_room: convertSWMLJoinRoomParametersToJSON(method.joinRoom)
};
}
function convertJSONToSWMLJoinRoomMethod(json) {
return {
type: 'joinRoom',
joinRoom: convertJSONToSWMLJoinRoomParameters(json.join_room)
};
}
function convertSWMLLabelMethodToJSON(method) {
return {
label: method.label
};
}
function convertJSONToSWMLLabelMethod(json) {
return {
type: 'label',
label: json.label
};
}
function convertSWMLLiveTranscribeStartActionToJSON(action) {
return {
webhook: action.webhook,
lang: action.lang,
live_events: action.liveEvents,
ai_summary: action.aiSummary,
speech_timeout: action.speechTimeout,
vad_silence_ms: action.vadSilenceMS,
vad_threshold: action.vadThreshold,
debug_level: action.debugLevel,
direction: action.direction,
summary_prompt: action.summaryPrompt,
};
}
function convertJSONToSWMLLiveTranscribeStartAction(json) {
return {
type: 'liveTranscribeStart',
webhook: json.webhook,
lang: json.lang,
liveEvents: json.live_events,
aiSummary: json.ai_summary,
speechTimeout: json.speech_timeout,
vadSilenceMS: json.vad_silence_ms,
vadThreshold: json.vad_threshold,
debugLevel: json.debug_level,
direction: json.direction,
summaryPrompt: json.summary_prompt,
};
}
function convertSWMLLiveTranscribeStopActionToJSON(action) {
if (action.type === 'liveTranscribeStop') {
return "stop";
}
}
function convertJSONToSWMLLiveTranscribeStopAction(json) {
if (json === 'stop') {
return {
type: 'liveTranscribeStop',
};
}
else {
throw Error('Unknown Live Transcribe Action');
}
}
function convertSWMLLiveTranscribeSummarizeActionToJSON(action) {
return {
webhook: action.webhook,
prompt: action.prompt,
};
}
function convertJSONToSWMLLiveTranscribeSummarizeAction(json) {
return {
type: 'liveTranscribeSummarize',
webhook: json.webhook,
prompt: json.prompt,
};
}
function convertSWMLLiveTranscribeActionToJSON(action) {
switch (action.type) {
case 'liveTranscribeStart':
return convertSWMLLiveTranscribeStartActionToJSON(action);
case 'liveTranscribeStop':
return convertSWMLLiveTranscribeStopActionToJSON(action);
case 'liveTranscribeSummarize':
return convertSWMLLiveTranscribeSummarizeActionToJSON(action);
default:
throw Error("Unknown Live Transcribe Action");
}
}
function convertJSONToSWMLLiveTranscribeAction(json) {
const objectKeys = Object.keys(json);
if (objectKeys.includes('lang') && objectKeys.includes('direction')) {
return convertJSONToSWMLLiveTranscribeStartAction(json);
}
else if (json === 'stop') {
return convertJSONToSWMLLiveTranscribeStopAction(json);
}
else if (objectKeys.includes('webhook') || objectKeys.includes('prompt') || objectKeys.length === 0) {
return convertJSONToSWMLLiveTranscribeSummarizeAction(json);
}
else {
throw Error("Unknown Live Transcribe Action");
}
}
function convertSWMLLiveTranscribeParametersToJSON(parameters) {
return {
action: convertSWMLLiveTranscribeActionToJSON(parameters.action)
};
}
function convertJSONToSWMLLiveTranscribeParameters(json) {
return {
action: convertJSONToSWMLLiveTranscribeAction(json.action)
};
}
function convertSWMLLiveTranscribeMethodToJSON(method) {
return {
live_transcribe: convertSWMLLiveTranscribeParametersToJSON(method.liveTranscribe)
};
}
function convertJSONToSWMLLiveTranscribeMethod(json) {
return {
type: 'liveTranscribe',
liveTranscribe: convertJSONToSWMLLiveTranscribeParameters(json.live_transcribe)
};
}
function convertSWMLLiveTranslateStartActionToJSON(action) {
return {
webhook: action.webhook,
from_lang: action.fromLang,
to_lang: action.toLang,
from_voice: action.fromVoice,
to_voice: action.toVoice,
live_events: action.liveEvents,
ai_summary: action.aiSummary,
speech_timeout: action.speechTimeout,
vad_silence_ms: action.vadSilenceMS,
vad_threshold: action.vadThreshold,
debug_level: action.debugLevel,
direction: action.direction,
summary_prompt: action.summaryPrompt,
};
}
function convertJSONToSWMLLiveTranslateStartAction(json) {
return {
type: 'liveTranslateStart',
webhook: json.webhook,
fromLang: json.from_lang,
toLang: json.to_lang,
fromVoice: json.from_voice,
toVoice: json.to_voice,
liveEvents: json.live_events,
aiSummary: json.ai_summary,
speechTimeout: json.speech_timeout,
vadSilenceMS: json.vad_silence_ms,
vadThreshold: json.vad_threshold,
debugLevel: json.debug_level,
direction: json.direction,
summaryPrompt: json.summary_prompt,
};
}
function convertSWMLLiveTranslateStopActionToJSON(action) {
if (action.type === 'liveTranslateStop') {
return "stop";
}
}
function convertJSONToSWMLLiveTranslateStopAction(json) {
if (json === 'stop') {
return {
type: 'liveTranslateStop',
};
}
else {
throw Error('Unknown Live Translate Action');
}
}
function convertSWMLLiveTranslateSummarizeActionToJSON(action) {
return {
webhook: action.webhook,
prompt: action.prompt,
};
}
function convertJSONToSWMLLiveTranslateSummarizeAction(json) {
return {
type: 'liveTranslateSummarize',
webhook: json.webhook,
prompt: json.prompt,
};
}
function convertSWMLLiveTranslateInjectActionToJSON(action) {
return {
message: action.message,
direction: action.direction,
};
}
function convertJSONToSWMLLiveTranslateInjectAction(json) {
return {
type: 'liveTranslateInject',
message: json.message,
direction: json.direction,
};
}
function convertSWMLLiveTranslateActionToJSON(action) {
switch (action.type) {
case 'liveTranslateStart':
return convertSWMLLiveTranslateStartActionToJSON(action);
case 'liveTranslateStop':
return convertSWMLLiveTranslateStopActionToJSON(action);
case 'liveTranslateSummarize':
return convertSWMLLiveTranslateSummarizeActionToJSON(action);
case 'liveTranslateInject':
return convertSWMLLiveTranslateInjectActionToJSON(action);
default:
throw Error("Unknown Live Translate Action");
}
}
function convertJSONToSWMLLiveTranslateAction(json) {
const objectKeys = Object.keys(json);
if (objectKeys.includes('from_lang') && objectKeys.includes('to_lang') && objectKeys.includes('direction')) {
return convertJSONToSWMLLiveTranslateStartAction(json);
}
else if (json === 'stop') {
return convertJSONToSWMLLiveTranslateStopAction(json);
}
else if (objectKeys.includes('webhook') || objectKeys.includes('prompt') || objectKeys.length === 0) {
return convertJSONToSWMLLiveTranslateSummarizeAction(json);
}
else if (objectKeys.includes('message') && objectKeys.includes('direction')) {
return convertJSONToSWMLLiveTranslateInjectAction(json);
}
else {
throw Error("Unknown Live Translate Action");
}
}
function convertSWMLLiveTranslateParametersToJSON(parameters) {
return {
action: convertSWMLLiveTranslateActionToJSON(parameters.action)
};
}
function convertJSONToSWMLLiveTranslateParameters(json) {
return {
action: convertJSONToSWMLLiveTranslateAction(json.action)
};
}
function convertSWMLLiveTranslateMethodToJSON(method) {
return {
live_translate: convertSWMLLiveTranslateParametersToJSON(method.liveTranslate)
};
}
function convertJSONToSWMLLiveTranslateMethod(json) {
return {
type: 'liveTranslate',
liveTranslate: convertJSONToSWMLLiveTranslateParameters(json.live_translate)
};
}
function convertSWMLPayParameterToJSON(parameter) {
return {
name: parameter.name,
value: parameter.value
};
}
function convertJSONToSWMLPayParameter(json) {
return {
name: json.name,
value: json.value
};
}
function convertSWMLPayPromptActionToJSON(action) {
return {
phrase: action.phrase,
type: action.type,
};
}
function convertJSONToSWMLPayPromptAction(json) {
return {
phrase: json.phrase,
type: json.type,
};
}
function convertSWMLPayPromptToJSON(prompt) {
var _a, _b;
return {
actions: prompt.actions.map(convertSWMLPayPromptActionToJSON),
for: prompt.for,
attempts: prompt.attempts,
card_type: (_a = prompt.cardTypes) === null || _a === void 0 ? void 0 : _a.join(' '),
error_type: (_b = prompt.errorTypes) === null || _b === void 0 ? void 0 : _b.join(' ')
};
}
function convertJSONToSWMLPayPrompt(json) {
var _a, _b;
return {
actions: json.actions.map(convertJSONToSWMLPayPromptAction),
for: json.for,
attempts: json.attempts,
cardTypes: (_a = json.card_type) === null || _a === void 0 ? void 0 : _a.split(' ').filter(Boolean),
errorTypes: (_b = json.error_type) === null || _b === void 0 ? void 0 : _b.split(' ').filter(Boolean),
};
}
function convertSWMLPayParametersToJSON(parameters) {
var _a, _b, _c;
return {
payment_connector_url: parameters.paymentConnectorUrl,
charge_amount: parameters.chargeAmount,
currency: parameters.currency,
description: parameters.description,
input: parameters.input,
language: parameters.language,
max_attempts: parameters.maxAttempts,
min_postal_code_length: parameters.minPostalCodeLength,
parameters: (_a = parameters.parameters) === null || _a === void 0 ? void 0 : _a.map(convertSWMLPayParameterToJSON),
postal_code: parameters.postalCode,
prompts: (_b = parameters.prompts) === null || _b === void 0 ? void 0 : _b.map(convertSWMLPayPromptToJSON),
security_code: parameters.securityCode,
status_url: parameters.statusUrl,
timeout: parameters.timeout,
token_type: parameters.tokenType,
valid_card_types: (_c = parameters.validCardTypes) === null || _c === void 0 ? void 0 : _c.join(' '),
voice: parameters.voice,
};
}
function convertJSONToSWMLPayParameters(json) {
var _a, _b, _c;
return {
paymentConnectorUrl: json.payment_connector_url,
chargeAmount: json.charge_amount,
currency: json.currency,
description: json.description,
input: json.input,
language: json.language,
maxAttempts: json.max_attempts,
minPostalCodeLength: json.min_postal_code_length,
parameters: (_a = json.parameters) === null || _a === void 0 ? void 0 : _a.map(convertJSONToSWMLPayParameter),
postalCode: json.postal_code,
prompts: (_b = json.prompts) === null || _b === void 0 ? void 0 : _b.map(convertJSONToSWMLPayPrompt),
securityCode: json.security_code,
statusUrl: json.status_url,
timeout: json.timeout,
tokenType: json.token_type,
validCardTypes: (_c = json.valid_card_types) === null || _c === void 0 ? void 0 : _c.split(' ').filter(Boolean),
voice: json.voice,
};
}
function convertSWMLPayMethodToJSON(method) {
return {
pay: convertSWMLPayParametersToJSON(method.pay)
};
}
function convertJSONToSWMLPayMethod(json) {
return {
type: 'pay',
pay: convertJSONToSWMLPayParameters(json.pay)
};
}
function convertSWMLPlayUrlToJSONObject(playUrl) {
return {
url: playUrl.url
};
}
function convertJSONObjectToSWMLPlayUrl(json) {
return {
type: 'single',
url: json.url
};
}
function convertSWMLPlayUrlsToJSONObject(playUrls) {
return {
urls: playUrls.urls
};
}
function convertJSONObjectToSWMLPlayUrls(json) {
return {
type: 'multiple',
urls: json.urls
};
}
function convertSWMLPlayableSoundToJSONObject(playableSound) {
switch (playableSound.type) {
case 'single':
return convertSWMLPlayUrlToJSONObject(playableSound);
case 'multiple':
return convertSWMLPlayUrlsToJSONObject(playableSound);
default:
throw Error('Unknown Playable Sound Type');
}
}
function convertJSONObjectToSWMLPlayableSound(json) {
const objectKeys = Object.keys(json);
if (objectKeys.includes('url')) {
return convertJSONObjectToSWMLPlayUrl(json);
}
else if (objectKeys.includes('urls')) {
return convertJSONObjectToSWMLPlayUrls(json);
}
else {
throw Error('Unknown Playable Sound Type');
}
}
function convertSWMLPlayParametersToJSON(playParameters) {
const playJSONObject = convertSWMLPlayableSoundToJSONObject(playParameters.playableSound);
return Object.assign(Object.assign({ auto_answer: playParameters.autoAnswer }, playJSONObject), { volume: playParameters.volume, say_voice: playParameters.sayVoice, say_language: playParameters.sayLanguage, say_gender: playParameters.sayGender, status_url: playParameters.statusUrl });
}
function convertJSONToSWMLPlayParameters(json) {
return {
autoAnswer: json.auto_answer,
playableSound: convertJSONObjectToSWMLPlayableSound(json),
volume: json.volume,
sayVoice: json.say_voice,
sayLanguage: json.say_language,
sayGender: json.say_gender,
statusUrl: json.status_url,
};
}
function convertSWMLPlayMethodToJSON(method) {
return {
play: convertSWMLPlayParametersToJSON(method.play)
};
}
function convertJSONToSWMLPlayMethod(json) {
return {
type: 'play',
play: convertJSONToSWMLPlayParameters(json.play)
};
}
function convertSWMLPromptParametersToJSON(parameters) {
var _a;
return {
play: parameters.play,
volume: parameters.volume,
say_voice: parameters.sayVoice,
say_language: parameters.sayLanguage,
say_gender: parameters.sayGender,
max_digits: parameters.maxDigits,
terminators: (_a = parameters.terminators) === null || _a === void 0 ? void 0 : _a.join(''),
digit_timeout: parameters.digitTimeout,
initial_timeout: parameters.initialTimeout,
speech_timeout: parameters.speechTimeout,
speech_end_timeout: parameters.speechEndTimeout,
speech_language: parameters.speechLanguage,
speech_hints: parameters.speechHints,
status_url: parameters.statusUrl,
};
}
function convertJSONToSWMLPromptParameters(json) {
var _a;
return {
play: json.play,
volume: json.volume,
sayVoice: json.say_voice,
sayLanguage: json.say_language,
sayGender: json.say_gender,
maxDigits: json.max_digits,
terminators: (_a = json.terminators) === null || _a === void 0 ? void 0 : _a.split(''),
digitTimeout: json.digit_timeout,
initialTimeout: json.initial_timeout,
speechTimeout: json.speech_timeout,
speechEndTimeout: json.speech_end_timeout,
speechLanguage: json.speech_language,
speechHints: json.speech_hints,
statusUrl: json.status_url,
};
}
function convertSWMLPromptMethodToJSON(method) {
return {
prompt: convertSWMLPromptParametersToJSON(method.prompt)
};
}
function convertJSONToSWMLPromptMethod(json) {
return {
type: 'prompt',
prompt: convertJSONToSWMLPromptParameters(json.prompt)
};
}
function convertSWMLReceiveFaxParametersToJSON(parameters) {
return {
status_url: parameters.statusUrl
};
}
function convertJSONToSWMLReceiveFaxParameters(json) {
return {
statusUrl: json.status_url
};
}
function convertSWMLReceiveFaxMethodToJSON(method) {
return {
receive_fax: convertSWMLReceiveFaxParametersToJSON(method.receiveFax)
};
}
function convertJSONToSWMLReceiveFaxMethod(json) {
return {
type: 'receiveFax',
receiveFax: convertJSONToSWMLReceiveFaxParameters(json.receive_fax)
};
}
function convertSWMLRecordParametersToJSON(parameters) {
var _a;
return {
stereo: parameters.stereo,
format: parameters.format,
direction: parameters.direction,
terminators: (_a = parameters.terminators) === null || _a === void 0 ? void 0 : _a.join(''),
beep: parameters.beep,
input_sensitivity: parameters.inputSensitivity,
initial_timeout: parameters.initialTimeout,
end_silence_timeout: parameters.endSilenceTimeout,
status_url: parameters.statusUrl,
};
}
function convertJSONToSWMLRecordParameters(json) {
var _a;
return {
stereo: json.stereo,
format: json.format,
direction: json.direction,
terminators: (_a = json.terminators) === null || _a === void 0 ? void 0 : _a.split(''),
beep: json.beep,
inputSensitivity: json.input_sensitivity,
initialTimeout: json.initial_timeout,
endSilenceTimeout: json.end_silence_timeout,
statusUrl: json.status_url,
};
}
function convertSWMLRecordMethodToJSON(method) {
return {
record: convertSWMLRecordParametersToJSON(method.record)
};
}
function convertJSONToSWMLRecordMethod(json) {
return {
type: 'record',
record: convertJSONToSWMLRecordParameters(json.record)
};
}
function convertSWMLRecordCallParametersToJSON(parameters) {
var _a;
return {
control_id: parameters.controlId,
stereo: parameters.stereo,
format: parameters.format,
direction: parameters.direction,
terminators: (_a = parameters.terminators) === null || _a === void 0 ? void 0 : _a.join(''),
beep: parameters.beep,
input_sensitivity: parameters.inputSensitivity,
initial_timeout: parameters.initialTimeout,
end_silence_timeout: parameters.endSilenceTimeout,
status_url: parameters.statusUrl,
};
}
function convertJSONToSWMLRecordCallParameters(json) {
var _a;
return {
controlId: json.control_id,
stereo: json.stereo,
format: json.format,
direction: json.direction,
terminators: (_a = json.terminators) === null || _a === void 0 ? void 0 : _a.split(''),
beep: json.beep,
inputSensitivity: json.input_sensitivity,
initialTimeout: json.initial_timeout,
endSilenceTimeout: json.end_silence_timeout,
statusUrl: json.status_url,
};
}
function convertSWMLRecordCallMethodToJSON(method) {
return {
record_call: convertSWMLRecordCallParametersToJSON(method.recordCall)
};
}
function convertJSONToSWMLRecordCallMethod(json) {
return {
type: 'recordCall',
recordCall: convertJSONToSWMLRecordCallParameters(json.record_call)
};
}
function convertSWMLRequestParametersToJSON(parameters) {
return {
url: parameters.url,
method: parameters.method,
headers: parameters.headers,
body: parameters.body,
connect_timeout: parameters.connectTimeout,
timeout: parameters.timeout,
save_variables: parameters.saveVariables,
};
}
function convertJSONToSWMLRequestParameters(json) {
return {
url: json.url,
method: json.method,
headers: json.headers,
body: json.body,
connectTimeout: json.connect_timeout,
timeout: json.timeout,
saveVariables: json.save_variables,
};
}
function convertSWMLRequestMethodToJSON(method) {
return {
request: convertSWMLRequestParametersToJSON(method.request)
};
}
function convertJSONToSWMLRequestMethod(json) {
return {
type: 'request',
request: convertJSONToSWMLRequestParameters(json.request)
};
}
function convertSWMLReturnMethodToJSON(method) {
return {
return: method.return
};
}
function convertJSONToSWMLReturnMethod(json) {
return {
type: 'return',
return: json.return
};
}
function convertSWMLSendDigitsParametersToJSON(parameters) {
return {
digits: parameters.digits
};
}
function convertJSONToSWMLSendDigitsParameters(json) {
return {
digits: json.digits
};
}
function convertSWMLSendDigitsMethodToJSON(method) {
return {
send_digits: convertSWMLSendDigitsParametersToJSON(method.sendDigits)
};
}
function convertJSONToSWMLSendDigitsMethod(json) {
return {
type: 'sendDigits',
sendDigits: convertJSONToSWMLSendDigitsParameters(json.send_digits)
};
}
function convertSWMLSendFaxParametersToJSON(parameters) {
return {
document: parameters.document,
header_info: parameters.headerInfo,
identity: parameters.identity,
status_url: parameters.statusUrl,
};
}
function convertJSONToSWMLSendFaxParameters(json) {
return {
document: json.document,
headerInfo: json.header_info,
identity: json.identity,
statusUrl: json.status_url,
};
}
function convertSWMLSendFaxMethodToJSON(method) {
return {
send_fax: convertSWMLSendFaxParametersToJSON(method.sendFax)
};
}
function convertJSONToSWMLSendFaxMethod(json) {
return {
type: 'sendFax',
sendFax: convertJSONToSWMLSendFaxParameters(json.send_fax)
};
}
function convertSWMLSendSMSMessageParametersToJSON(parameters) {
return {
to_number: parameters.toNumber,
from_number: parameters.fromNumber,
body: parameters.body,
region: parameters.region,
tags: parameters.tags,
};
}
function convertJSONToSWMLSendSMSMessageParameters(json) {
return {
type: 'sms',
toNumber: json.to_number,
fromNumber: json.from_number,
body: json.body,
region: json.region,
tags: json.tags,
};
}
function convertSWMLSendMMSMessageParametersToJSON(parameters) {
return {
to_number: parameters.toNumber,
from_number: parameters.fromNumber,
media: parameters.media,
body: parameters.body,
region: parameters.region,
tags: parameters.tags,
};
}
function convertJSONToSWMLSendMMSMessageParameters(json) {
return {
type: 'mms',
toNumber: json.to_number,
fromNumber: json.from_number,
media: json.media,
body: json.body,
region: json.region,
tags: json.tags,
};
}
function convertSWMLSendSMSParametersToJSON(parameters) {
switch (parameters.type) {
case 'sms':
return convertSWMLSendSMSMessageParametersToJSON(parameters);
case 'mms':
return convertSWMLSendMMSMessageParametersToJSON(parameters);
default:
throw Error('Unknown Send SMS Type');
}
}
function convertJSONToSWMLSendSMSParameters(json) {
const objectKeys = Object.keys(json);
if (objectKeys.includes('to_number') && objectKeys.includes('from_number')) {
if (objectKeys.includes('media')) {
return convertJSONToSWMLSendMMSMessageParameters(json);
}
else if (objectKeys.includes('body')) {
return convertJSONToSWMLSendSMSMessageParameters(json);
}
}
throw Error('Unknown Send SMS Type');
}
function convertSWMLSendSMSMethodToJSON(method) {
return {
send_sms: convertSWMLSendSMSParametersToJSON(method.sendSMS)
};
}
function convertJSONToSWMLSendSMSMethod(json) {
return {
type: 'sendSMS',
sendSMS: convertJSONToSWMLSendSMSParameters(json.send_sms)
};
}
function convertSWMLSetMethodToJSON(method) {
return {
set: method.set
};
}
function convertJSONToSWMLSetMethod(json) {
return {
type: 'set',
set: json.set
};
}
function convertSWMLSIPReferParametersToJSON(parameters) {
return {
to_uri: parameters.toUri,
status_url: parameters.statusUrl,
sip_auth_username: parameters.sipAuthUsername,
sip_auth_password: parameters.sipAuthPassword,
};
}
function convertJSONToSWMLSIPReferParameters(json) {
return {
toUri: json.to_uri,
statusUrl: json.status_url,
sipAuthUsername: json.sip_auth_username,
sipAuthPassword: json.sip_auth_password,
};
}
function convertSWMLSIPReferMethodToJSON(method) {
return {
sip_refer: convertSWMLSIPReferParametersToJSON(method.sipRefer)
};
}
function convertJSONToSWMLSIPReferMethod(json) {
return {
type: 'sipRefer',
sipRefer: convertJSONToSWMLSIPReferParameters(json.sip_refer)
};
}
function convertSWMLSleepParametersToJSON(parameters) {
return {
duration: parameters.duration
};
}
function convertJSONToSWMLSleepParameters(json) {
return {
duration: json.duration
};
}
function convertSWMLSleepMethodToJSON(method) {
return {
sleep: convertSWMLSleepParametersToJSON(method.sleep)
};
}
function convertJSONToSWMLSleepMethod(json) {
return {
type: 'sleep',
sleep: convertJSONToSWMLSleepParameters(json.sleep)
};
}
function convertSWMLStopDenoiseMethodToJSON(method) {
return {
stop_denoise: method.stopDenoise
};
}
function convertJSONToSWMLStopDenoiseMethod(json) {
return {
type: 'stopDenoise',
stopDenoise: json.stop_denoise
};
}
function convertSWMLStopRecordCallParametersToJSON(parameters) {
return {
control_id: parameters.controlId
};
}
function convertJSONToSWMLStopRecordCallParameters(json) {
return {
controlId: json.control_id
};
}
function convertSWMLStopRecordCallMethodToJSON(method) {
return {
stop_record_call: convertSWMLStopRecordCallParametersToJSON(method.stopRecordCall)
};
}
function convertJSONToSWMLStopRecordCallMethod(json) {
return {
type: 'stopRecordCall',
stopRecordCall: convertJSONToSWMLStopRecordCallParameters(json.stop_record_call)
};
}
function convertSWMLStopTapParametersToJSON(parameters) {
return {
control_id: parameters.controlId
};
}
function convertJSONToSWMLStopTapParameters(json) {
return {
controlId: json.control_id
};
}
function convertSWMLStopTapMethodToJSON(method) {
return {
stop_tap: convertSWMLStopTapParametersToJSON(method.stopTap)
};
}
function convertJSONToSWMLStopTapMethod(json) {
return {
type: 'stopTap',
stopTap: convertJSONToSWMLStopTapParameters(json.stop_tap)
};
}
function convertSWMLSwitchCaseParametersToJSON(parameters) {
const objectEntries = Object.entries(parameters).map(([key, methods]) => {
const tuple = [key, methods.map(convertSWMLMethodToJSON)];
return tuple;
});
return Object.fromEntries(objectEntries);
}
function convertJSONToSWMLSwitchCaseParameters(json) {
const objectEntries = Object.entries(json).map(([key, methods]) => {
if (Array.isArray(methods)) {
const tuple = [key, methods.map(convertJSONToSWMLMethod)];
return tuple;
}
else {
throw Error('Unknown Switch Case Type');
}
});
return Object.fromEntries(objectEntries);
}
function convertSWMLSwitchParametersToJSON(parameters) {
var _a;
return {
variable: parameters.variable,
case: convertSWMLSwitchCaseParametersToJSON(parameters.case),
default: (_a = parameters.default) === null || _a === void 0 ? void 0 : _a.map(convertSWMLMethodToJSON),
};
}
function convertJSONToSWMLSwitchParameters(json) {
var _a;
return {
variable: json.variable,
case: convertJSONToSWMLSwitchCaseParameters(json.case),
default: (_a = json.default) === null || _a === void 0 ? void 0 : _a.map(convertJSONToSWMLMethod),
};
}
function convertSWMLSwitchMethodToJSON(method) {
return {
switch: convertSWMLSwitchParametersToJSON(method.switch)
};
}
function convertJSONToSWMLSwitchMethod(json) {
return {
type: 'switch',
switch: convertJSONToSWMLSwitchParameters(json.switch)
};
}
function convertSWMLTapParametersToJSON(parameters) {
return {
uri: parameters.uri,
control_id: parameters.controlId,
direction: parameters.direction,
codec: parameters.codec,
rtp_ptime: parameters.rtpPTime,
status_url: parameters.statusUrl,
};
}
function convertJSONToSWMLTapParameters(json) {
return {
uri: json.uri,
controlId: json.control_id,
direction: json.direction,
codec: json.codec,
rtpPTime: json.rtp_ptime,
statusUrl: json.status_url,
};
}
function convertSWMLTapMethodToJSON(method) {
return {
tap: convertSWMLTapParametersToJSON(method.tap)
};
}
function convertJSONToSWMLTapMethod(json) {
return {
type: 'tap',
tap: convertJSONToSWMLTapParameters(json.tap)
};
}
function convertSWMLTransferParametersToJSON(parameters) {
return {
dest: parameters.dest,
params: parameters.params,
};
}
function convertJSONToSWMLTransferParameters(json) {
return {
dest: json.dest,
params: json.params,
};
}
function convertSWMLTransferMethodToJSON(method) {
return {
transfer: convertSWMLTransferParametersToJSON(method.transfer)
};
}
function convertJSONToSWMLTransferMethod(json) {
return {
type: 'transfer',
transfer: convertJSONToSWMLTransferParameters(json.transfer)
};
}
function convertSWMLUnsetParametersToJSON(parameters) {
return {
vars: parameters.vars,
};
}
function convertJSONToSWMLUnsetParameters(json) {
return {
vars: json.vars,
};
}
function convertSWMLUnsetMethodToJSON(method) {
return {
unset: convertSWMLUnsetParametersToJSON(method.unset)
};
}
function convertJSONToSWMLUnsetMethod(json) {
return {
type: 'unset',
unset: convertJSONToSWMLUnsetParameters(json.unset)
};
}
function convertSWMLUserEventParametersToJSON(parameters) {
return {
event: parameters.event
};
}
function convertJSONToSWMLUserEventParameters(json) {
return {
event: json.event
};
}
function convertSWMLUserEventMethodToJSON(method) {
return {
user_event: convertSWMLUserEventParametersToJSON(method.userEvent)
};
}
function convertJSONToSWMLUserEventMethod(json) {
return {
type: 'userEvent',
userEvent: convertJSONToSWMLUserEventParameters(json.user_event)
};
}
function convertSWMLMethodToJSON(method) {
switch (method.type) {
case 'ai':
return convertSWMLAIMethodToJSON(method);
case 'answer':
return convertSWMLAnswerMethodToJSON(method);
case 'cond':
return convertSWMLCondMethodToJSON(method);
case 'connect':
return convertSWMLConnectMethodToJSON(method);
case 'denoise':
return convertSWMLDenoiseMethodToJSON(method);
case 'detectMachine':
return convertSWMLDetectMachineMethodToJSON(method);
case 'execute':
return convertSWMLExecuteMethodToJSON(method);
case 'goto':
return convertSWMLGotoMethodToJSON(method);
case 'hangup':
return convertSWMLHangupMethodToJSON(method);
case 'joinRoom':
return convertSWMLJoinRoomMethodToJSON(method);
case 'label':
return convertSWMLLabelMethodToJSON(method);
case 'liveTranscribe':
return convertSWMLLiveTranscribeMethodToJSON(method);
case 'liveTranslate':
return convertSWMLLiveTranslateMethodToJSON(method);
case 'pay':
return convertSWMLPayMethodToJSON(method);
case 'play':
return convertSWMLPlayMethodToJSON(method);
case 'prompt':
return convertSWMLPromptMethodToJSON(method);
case 'receiveFax':
return convertSWMLReceiveFaxMethodToJSON(method);
case 'record':
return convertSWMLRecordMethodToJSON(method);
case 'recordCall':
return convertSWMLRecordCallMethodToJSON(method);
case 'request':
return convertSWMLRequestMethodToJSON(method);
case 'return':
return convertSWMLReturnMethodToJSON(method);
case 'sendDigits':
return convertSWMLSendDigitsMethodToJSON(method);
case 'sendFax':
return convertSWMLSendFaxMethodToJSON(method);
case 'sendSMS':
return convertSWMLSendSMSMethodToJSON(method);
case 'set':
return convertSWMLSetMethodToJSON(method);
case 'sipRefer':
return convertSWMLSIPReferMethodToJSON(method);
case 'sleep':
return convertSWMLSleepMethodToJSON(method);
case 'stopDenoise':
return convertSWMLStopDenoiseMethodToJSON(method);
case 'stopRecordCall':
return convertSWMLStopRecordCallMethodToJSON(method);
case 'stopTap':
return convertSWMLStopTapMethodToJSON(method);
case 'switch':
return convertSWMLSwitchMethodToJSON(method);
case 'tap':
return convertSWMLTapMethodToJSON(method);
case 'transfer':
return convertSWMLTransferMethodToJSON(method);
case 'unset':
return convertSWMLUnsetMethodToJSON(method);
case 'userEvent':
return convertSWMLUserEventMethodToJSON(method);
default:
throw Error("Unknown Method Type");
}
}
function convertJSONToSWMLMethod(json) {
const objectKeys = Object.keys(json);
if (objectKeys.includes('ai')) {
return convertJSONToSWMLAIMethod(json);
}
else if (objectKeys.includes('answer')) {
return convertJSONToSWMLAnswerMethod(json);
}
else if (objectKeys.includes('cond')) {
return convertJSONToSWMLCondMethod(json);
}
else if (objectKeys.includes('connect')) {
return convertJSONToSWMLConnectMethod(json);
}
else if (objectKeys.includes('denoise')) {
return convertJSONToSWMLDenoiseMethod(json);
}
else if (objectKeys.includes('detect_machine')) {
return convertJSONToSWMLDetectMachineMethod(json);
}
else if (objectKeys.includes('execute')) {
return convertJSONToSWMLExecuteMethod(json);
}
else if (objectKeys.includes('goto')) {
return convertJSONToSWMLGotoMethod(json);
}
else if (objectKeys.includes('hangup')) {
return convertJSONToSWMLHangupMethod(json);
}
else if (objectKeys.includes('join_room')) {
return convertJSONToSWMLJoinRoomMethod(json);
}
else if (objectKeys.includes('label')) {
return convertJSONToSWMLLabelMethod(json);
}
else if (objectKeys.includes('live_transcribe')) {
return convertJSONToSWMLLiveTranscribeMethod(json);
}
else if (objectKeys.includes('live_translate')) {
return convertJSONToSWMLLiveTranslateMethod(json);
}
else if (objectKeys.includes('pay')) {
return convertJSONToSWMLPayMethod(json);
}
else if (objectKeys.includes('play')) {
return convertJSONToSWMLPlayMethod(json);
}
else if (objectKeys.includes('prompt')) {
return convertJSONToSWMLPromptMethod(json);
}
else if (objectKeys.includes('receive_fax')) {
return convertJSONToSWMLReceiveFaxMethod(json);
}
else if (objectKeys.includes('record')) {
return convertJSONToSWMLRecordMethod(json);
}
else if (objectKeys.includes('record_call')) {
return convertJSONToSWMLRecordCallMethod(json);
}
else if (objectKeys.includes('request')) {
return convertJSONToSWMLRequestMethod(json);
}
else if (objectKeys.includes('return')) {
return convertJSONToSWMLReturnMethod(json);
}
else if (objectKeys.includes('send_digits')) {
return convertJSONToSWMLSendDigitsMethod(json);
}
else if (objectKeys.includes('send_fax')) {
return convertJSONToSWMLSendFaxMethod(json);
}
else if (objectKeys.includes('send_sms')) {
return convertJSONToSWMLSendSMSMethod(json);
}
else if (objectKeys.includes('set')) {
return convertJSONToSWMLSetMethod(json);
}
else if (objectKeys.includes('sip_refer')) {
return convertJSONToSWMLSIPReferMethod(json);
}
else if (objectKeys.includes('sleep')) {
return convertJSONToSWMLSleepMethod(json);
}
else if (objectKeys.includes('stop_denoise')) {
return convertJSONToSWMLStopDenoiseMethod(json);
}
else if (objectKeys.includes('stop_record_call')) {
return convertJSONToSWMLStopRecordCallMethod(json);
}
else if (objectKeys.includes('stop_tap')) {
return convertJSONToSWMLStopTapMethod(json);
}
else if (objectKeys.includes('switch')) {
return convertJSONToSWMLSwitchMethod(json);
}
else if (objectKeys.includes('tap')) {
return convertJSONToSWMLTapMethod(json);
}
else if (objectKeys.includes('transfer')) {
return convertJSONToSWMLTransferMethod(json);
}
else if (objectKeys.includes('unset')) {
return convertJSONToSWMLUnsetMethod(json);
}
else if (objectKeys.includes('user_event')) {
return convertJSONToSWMLUserEventMethod(json);
}
else {
throw Error("Unknown Method Type");
}
}
function convertSWMLToJSON(swml) {
const subroutineEntries = Object.entries(swml.sections).filter(([name, _]) => name !== 'main')
.map(([name, methods]) => {
const tuple = [name, methods.map(convertSWMLMethodToJSON)];
return tuple;
});
return {
version: swml.version,
sections: Object.assign({ main: swml.sections.main.map(convertSWMLMethodToJSON) }, Object.fromEntries(subroutineEntries)),
};
}
function convertJSONToSWML(json) {
const sections = json.sections;
const main = sections.main;
const subroutines = Object.entries(sections).filter(([name, _]) => name !== 'main')
.map(([name, methods]) => {
if (Array.isArray(methods)) {
const tuple = [name, methods.map(convertJSONToSWMLMethod)];
return tuple;
}
else {
throw Error("Unknown Method Type");
}
});
return {
version: json.version,
sections: Object.assign({ main: main.map(convertJSONToSWMLMethod) }, Object.fromEntries(subroutines)),
};
}