Document MissingParams error message for /ari/events

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393749 65c4cc65-6c06-0410-ace0-fbb531ad65f3
changes/78/78/1
David M. Lee 12 years ago
parent d0a55fa52d
commit 01c21c7aea

@ -64,7 +64,7 @@ static void stasis_http_event_websocket_ws_cb(struct ast_websocket *ws_session,
} }
#if defined(AST_DEVMODE) #if defined(AST_DEVMODE)
session = ari_websocket_session_create(ws_session, session = ari_websocket_session_create(ws_session,
ari_validate_event_fn()); ari_validate_message_fn());
#else #else
session = ari_websocket_session_create(ws_session, NULL); session = ari_websocket_session_create(ws_session, NULL);
#endif #endif

File diff suppressed because it is too large Load Diff

@ -655,6 +655,42 @@ int ari_validate_event(struct ast_json *json);
*/ */
ari_validator ari_validate_event_fn(void); ari_validator ari_validate_event_fn(void);
/*!
* \brief Validator for Message.
*
* Base type for errors and events
*
* \param json JSON object to validate.
* \returns True (non-zero) if valid.
* \returns False (zero) if invalid.
*/
int ari_validate_message(struct ast_json *json);
/*!
* \brief Function pointer to ari_validate_message().
*
* See \ref ari_model_validators.h for more details.
*/
ari_validator ari_validate_message_fn(void);
/*!
* \brief Validator for MissingParams.
*
* Error event sent when required params are missing.
*
* \param json JSON object to validate.
* \returns True (non-zero) if valid.
* \returns False (zero) if invalid.
*/
int ari_validate_missing_params(struct ast_json *json);
/*!
* \brief Function pointer to ari_validate_missing_params().
*
* See \ref ari_model_validators.h for more details.
*/
ari_validator ari_validate_missing_params_fn(void);
/*! /*!
* \brief Validator for PlaybackFinished. * \brief Validator for PlaybackFinished.
* *
@ -780,118 +816,123 @@ ari_validator ari_validate_stasis_start_fn(void);
* - state: string (required) * - state: string (required)
* - target_uri: string (required) * - target_uri: string (required)
* ApplicationReplaced * ApplicationReplaced
* - type: string (required)
* - application: string (required) * - application: string (required)
* - timestamp: Date * - timestamp: Date
* - type: string (required)
* BridgeCreated * BridgeCreated
* - type: string (required)
* - application: string (required) * - application: string (required)
* - timestamp: Date * - timestamp: Date
* - type: string (required)
* - bridge: Bridge (required) * - bridge: Bridge (required)
* BridgeDestroyed * BridgeDestroyed
* - type: string (required)
* - application: string (required) * - application: string (required)
* - timestamp: Date * - timestamp: Date
* - type: string (required)
* - bridge: Bridge (required) * - bridge: Bridge (required)
* BridgeMerged * BridgeMerged
* - type: string (required)
* - application: string (required) * - application: string (required)
* - timestamp: Date * - timestamp: Date
* - type: string (required)
* - bridge: Bridge (required) * - bridge: Bridge (required)
* - bridge_from: Bridge (required) * - bridge_from: Bridge (required)
* ChannelCallerId * ChannelCallerId
* - type: string (required)
* - application: string (required) * - application: string (required)
* - timestamp: Date * - timestamp: Date
* - type: string (required)
* - caller_presentation: int (required) * - caller_presentation: int (required)
* - caller_presentation_txt: string (required) * - caller_presentation_txt: string (required)
* - channel: Channel (required) * - channel: Channel (required)
* ChannelCreated * ChannelCreated
* - type: string (required)
* - application: string (required) * - application: string (required)
* - timestamp: Date * - timestamp: Date
* - type: string (required)
* - channel: Channel (required) * - channel: Channel (required)
* ChannelDestroyed * ChannelDestroyed
* - type: string (required)
* - application: string (required) * - application: string (required)
* - timestamp: Date * - timestamp: Date
* - type: string (required)
* - cause: int (required) * - cause: int (required)
* - cause_txt: string (required) * - cause_txt: string (required)
* - channel: Channel (required) * - channel: Channel (required)
* ChannelDialplan * ChannelDialplan
* - type: string (required)
* - application: string (required) * - application: string (required)
* - timestamp: Date * - timestamp: Date
* - type: string (required)
* - channel: Channel (required) * - channel: Channel (required)
* - dialplan_app: string (required) * - dialplan_app: string (required)
* - dialplan_app_data: string (required) * - dialplan_app_data: string (required)
* ChannelDtmfReceived * ChannelDtmfReceived
* - type: string (required)
* - application: string (required) * - application: string (required)
* - timestamp: Date * - timestamp: Date
* - type: string (required)
* - channel: Channel (required) * - channel: Channel (required)
* - digit: string (required) * - digit: string (required)
* - duration_ms: int (required) * - duration_ms: int (required)
* ChannelEnteredBridge * ChannelEnteredBridge
* - type: string (required)
* - application: string (required) * - application: string (required)
* - timestamp: Date * - timestamp: Date
* - type: string (required)
* - bridge: Bridge (required) * - bridge: Bridge (required)
* - channel: Channel * - channel: Channel
* ChannelHangupRequest * ChannelHangupRequest
* - type: string (required)
* - application: string (required) * - application: string (required)
* - timestamp: Date * - timestamp: Date
* - type: string (required)
* - cause: int * - cause: int
* - channel: Channel (required) * - channel: Channel (required)
* - soft: boolean * - soft: boolean
* ChannelLeftBridge * ChannelLeftBridge
* - type: string (required)
* - application: string (required) * - application: string (required)
* - timestamp: Date * - timestamp: Date
* - type: string (required)
* - bridge: Bridge (required) * - bridge: Bridge (required)
* - channel: Channel (required) * - channel: Channel (required)
* ChannelStateChange * ChannelStateChange
* - type: string (required)
* - application: string (required) * - application: string (required)
* - timestamp: Date * - timestamp: Date
* - type: string (required)
* - channel: Channel (required) * - channel: Channel (required)
* ChannelUserevent * ChannelUserevent
* - type: string (required)
* - application: string (required) * - application: string (required)
* - timestamp: Date * - timestamp: Date
* - type: string (required)
* - channel: Channel (required) * - channel: Channel (required)
* - eventname: string (required) * - eventname: string (required)
* ChannelVarset * ChannelVarset
* - type: string (required)
* - application: string (required) * - application: string (required)
* - timestamp: Date * - timestamp: Date
* - type: string (required)
* - channel: Channel * - channel: Channel
* - value: string (required) * - value: string (required)
* - variable: string (required) * - variable: string (required)
* Event * Event
* - type: string (required)
* - application: string (required) * - application: string (required)
* - timestamp: Date * - timestamp: Date
* Message
* - type: string (required)
* MissingParams
* - type: string (required) * - type: string (required)
* - params: List[string] (required)
* PlaybackFinished * PlaybackFinished
* - type: string (required)
* - application: string (required) * - application: string (required)
* - timestamp: Date * - timestamp: Date
* - type: string (required)
* - playback: Playback (required) * - playback: Playback (required)
* PlaybackStarted * PlaybackStarted
* - type: string (required)
* - application: string (required) * - application: string (required)
* - timestamp: Date * - timestamp: Date
* - type: string (required)
* - playback: Playback (required) * - playback: Playback (required)
* StasisEnd * StasisEnd
* - type: string (required)
* - application: string (required) * - application: string (required)
* - timestamp: Date * - timestamp: Date
* - type: string (required)
* - channel: Channel (required) * - channel: Channel (required)
* StasisStart * StasisStart
* - type: string (required)
* - application: string (required) * - application: string (required)
* - timestamp: Date * - timestamp: Date
* - type: string (required)
* - args: List[string] (required) * - args: List[string] (required)
* - channel: Channel (required) * - channel: Channel (required)
*/ */

@ -182,8 +182,8 @@ void ari_websocket_event_websocket(struct ari_websocket_session *ws_session,
RAII_VAR(struct ast_json *, msg, NULL, ast_json_unref); RAII_VAR(struct ast_json *, msg, NULL, ast_json_unref);
msg = ast_json_pack("{s: s, s: [s]}", msg = ast_json_pack("{s: s, s: [s]}",
"error", "MissingParams", "type", "MissingParams",
"params", "app"); "params", "app");
if (!msg) { if (!msg) {
msg = ast_json_ref(ari_oom_json()); msg = ast_json_ref(ari_oom_json());
} }

@ -17,7 +17,7 @@
"websocketProtocol": "ari", "websocketProtocol": "ari",
"summary": "WebSocket connection for events.", "summary": "WebSocket connection for events.",
"nickname": "eventWebsocket", "nickname": "eventWebsocket",
"responseClass": "Event", "responseClass": "Message",
"parameters": [ "parameters": [
{ {
"name": "app", "name": "app",
@ -33,16 +33,35 @@
} }
], ],
"models": { "models": {
"Event": { "Message": {
"id": "Event", "id": "Message",
"description": "Base type for asynchronous events from Asterisk.", "description": "Base type for errors and events",
"discriminator": "type", "discriminator": "type",
"properties": { "properties": {
"type": { "type": {
"type": "string", "type": "string",
"required": true, "required": true,
"description": "Indicates the type of this event." "description": "Indicates the type of this message."
}, }
}
},
"MissingParams": {
"id": "MissingParams",
"extends": "Message",
"description": "Error event sent when required params are missing.",
"properties": {
"params": {
"required": true,
"type": "List[string]",
"description": "A list of the missing parameters"
}
}
},
"Event": {
"id": "Event",
"extends": "Message",
"description": "Base type for asynchronous events from Asterisk.",
"properties": {
"application": { "application": {
"type": "string", "type": "string",
"description": "Name of the application receiving the event.", "description": "Name of the application receiving the event.",

Loading…
Cancel
Save