Asterisk ari-event

From 탱이의 잡동사니
Revision as of 07:19, 24 October 2018 by Pchero (talk | contribs)
Jump to navigation Jump to search

Overview

Asterisk ARI event 내용 정리

Channel

A specific communication connection between Asterisk and an Endpoint.

{
  "properties": {
    "accountcode": {
      "required": true,
      "type": "string"
    },
    "name": {
      "required": true,
      "type": "string",
      "description": "Name of the channel (i.e. SIP/foo-0000a7e3)"
    },
    "language": {
      "required": true,
      "type": "string",
      "description": "The default spoken language"
    },
    "channelvars": {
      "required": false,
      "type": "object",
      "description": "Channel variables"
    },
    "caller": {
      "required": true,
      "type": "CallerID"
    },
    "creationtime": {
      "required": true,
      "type": "Date",
      "description": "Timestamp when channel was created"
    },
    "state": {
      "allowableValues": {
        "valueType": "LIST",
        "values": [
          "Down",
          "Rsrved",
          "OffHook",
          "Dialing",
          "Ring",
          "Ringing",
          "Up",
          "Busy",
          "Dialing Offhook",
          "Pre-ring",
          "Unknown"
        ]
      },
      "required": true,
      "type": "string"
    },
    "connected": {
      "required": true,
      "type": "CallerID"
    },
    "dialplan": {
      "required": true,
      "type": "DialplanCEP",
      "description": "Current location in the dialplan"
    },
    "id": {
      "required": true,
      "type": "string",
      "description": "Unique identifier of the channel.\n\nThis is the same as the Uniqueid field in AMI."
    }
  },
  "id": "Channel",
  "description": "A specific communication connection between Asterisk and an Endpoint."
}
  • accountcode: string
  • caller: CallerID
  • channelvars: object(optional): Channel variables
  • connected: CallerID
  • creationtime: Date: Timestamp when channel was created.
  • dialplan: DialplanCEP: Current location in the dialplan.
  • id: string: Unique identifier of the channel.
This is the same as the Uniqueid filed in AMI

ChannelDestroyed

Base type: Event

Notification that a channel has been destroyed.

{
  "properties": {
    "cause": {
      "required": true,
      "type": "int",
      "description": "Integer representation of the cause of the hangup"
    },
    "cause_txt": {
      "required": true,
      "type": "string",
      "description": "Text representation of the cause of the hangup"
    },
    "channel": {
      "required": true,
      "type": "Channel"
    }
  },
  "id": "ChannelDestroyed",
  "description": "Notification that a channel has been destroyed."
}
  • asetrisk_id: string(optional): The unique ID for the Asterisk instance that raised this event.
  • type: string: Indicates the type of this message.
  • application: string: Name of the application receiving the event.
  • timestamp: Date(optional): Time at which this event was created.
  • cause: int: Integer representation of the cause of the hangup.
  • cause_txt: string: Text representation of the cause of the hangup.
  • channel: Channel

Example

{
	"type": "ChannelDestroyed",
	"timestamp": "2018-10-23T12:36:11.110+0000",
	"cause": 0,
	"cause_txt": "Unknown",
	"channel": {
		"id": "pchero-462475.572686",
		"name": "PJSIP/pchero-voip-00001b1f",
		"state": "Up",
		"caller": {
			"name": "",
			"number": "1337"
		},
		"connected": {
			"name": "",
			"number": "1337"
		},
		"accountcode": "",
		"dialplan": {
			"context": "pchero-voip",
			"exten": "s",
			"priority": 2
		},
		"creationtime": "2018-10-23T12:36:02.671+0000",
		"language": "en"
	},
	"asterisk_id": "210445d7-73bd-456a-aef2-e0ef847bfa0f",
	"application": "pchero_voip"
}

ChannelDialplan

Base type: Event

Channel changed location in the dialplan.

{
  "properties": {
    "dialplan_app_data": {
      "required": true,
      "type": "string",
      "description": "The data to be passed to the application."
    },
    "channel": {
      "required": true,
      "type": "Channel",
      "description": "The channel that changed dialplan location."
    },
    "dialplan_app": {
      "required": true,
      "type": "string",
      "description": "The application about to be executed."
    }
  },
  "id": "ChannelDialplan",
  "description": "Channel changed location in the dialplan."
}
  • asterisk_id: string(optional): The unique ID for the Asterisk instance that raised this event.
  • type: string: Indicates the type of this message.
  • application: string: Name of the application receiving the event.
  • timestamp: Date(optional): Time at which this event was created.
  • channel: Channel: The channel that changed dialplan location.
  • dialplan_app: string: The application about to be executed.
  • dialplan_app_data: string: The data to be passed to the application.

Example

{
	"type": "ChannelDialplan",
	"timestamp": "2018-10-23T12:36:11.109+0000",
	"dialplan_app": "AppDial2",
	"dialplan_app_data": "(Outgoing Line)",
	"channel": {
		"id": "pchero-462475.572686",
		"name": "PJSIP/pchero-voip-00001b1f",
		"state": "Up",
		"caller": {
			"name": "",
			"number": "1337"
		},
		"connected": {
			"name": "",
			"number": "1337"
		},
		"accountcode": "",
		"dialplan": {
			"context": "pchero-voip",
			"exten": "s",
			"priority": 2
		},
		"creationtime": "2018-10-23T12:36:02.671+0000",
		"language": "en"
	},
	"asterisk_id": "210445d7-73bd-456a-aef2-e0ef847bfa0f",
	"application": "pchero_voip"
}

ChannelStateChange

Base type: Event

Notification of a channel's state change

{
  "properties": {
    "channel": {
      "required": true,
      "type": "Channel"
    }
  },
  "id": "ChannelStateChange",
  "description": "Notification of a channel's state change."
}
  • asterisk_id: string(optional): The unique ID for the Asterisk instance that raised this event.
  • type: string: Indicates the type of this message.
  • application: string: Name of the application receiving the event.
  • timestamp: Date(optional): Time at which this event was created.
  • channel: Channel

Example

{
	"type": "ChannelStateChange",
	"timestamp": "2018-10-23T12:36:07.628+0000",
	"channel": {
		"id": "pchero-462475.572686",
		"name": "PJSIP/pchero-voip-00001b1f",
		"state": "Ringing",
		"caller": {
			"name": "",
			"number": "1337"
		},
		"connected": {
			"name": "",
			"number": "1337"
		},
		"accountcode": "",
		"dialplan": {
			"context": "pchero-voip",
			"exten": "s",
			"priority": 1
		},
		"creationtime": "2018-10-23T12:36:02.671+0000",
		"language": "en"
	},
	"asterisk_id": "210445d7-73bd-456a-aef2-e0ef847bfa0f",
	"application": "pchero_voip"
}

ChannelVarset

Base type: Event

Channel variable changed

{
  "properties": {
    "variable": {
      "required": true,
      "type": "string",
      "description": "The variable that changed."
    },
    "channel": {
      "required": false,
      "type": "Channel",
      "description": "The channel on which the variable was set.\n\nIf missing, the variable is a global variable."
    },
    "value": {
      "required": true,
      "type": "string",
      "description": "The new value of the variable."
    }
  },
  "id": "ChannelVarset",
  "description": "Channel variable changed."
}
  • asterisk_id: string(optional): The unique ID for the Asterisk instance that raised this event.
  • type: string: Indicates the type of this message.
  • application: string: Name of the application receiving the event.
  • timestamp: Date(optional): Time at which this event was created.
  • channel: channel(optional): The channel on which the variable was set.
If missing, the variable is a global variable.

Example

{
	"variable": "STASISSTATUS",
	"value": "",
	"type": "ChannelVarset",
	"timestamp": "2018-10-23T12:36:09.602+0000",
	"channel": {
		"id": "pchero-462475.572686",
		"name": "PJSIP/pchero-voip-00001b1f",
		"state": "Up",
		"caller": {
			"name": "",
			"number": "1337"
		},
		"connected": {
			"name": "",
			"number": "1337"
		},
		"accountcode": "",
		"dialplan": {
			"context": "pchero-voip",
			"exten": "s",
			"priority": 1
		},
		"creationtime": "2018-10-23T12:36:02.671+0000",
		"language": "en"
	},
	"asterisk_id": "210445d7-73bd-456a-aef2-e0ef847bfa0f",
	"application": "pchero_voip"
}

Dial

Base type: Event

Dialing state has changed.

{
  "properties": {
    "forwarded": {
      "required": false,
      "type": "Channel",
      "description": "Channel that the caller has been forwarded to."
    },
    "caller": {
      "required": false,
      "type": "Channel",
      "description": "The calling channel."
    },
    "dialstatus": {
      "required": true,
      "type": "string",
      "description": "Current status of the dialing attempt to the peer."
    },
    "forward": {
      "required": false,
      "type": "string",
      "description": "Forwarding target requested by the original dialed channel."
    },
    "dialstring": {
      "required": false,
      "type": "string",
      "description": "The dial string for calling the peer channel."
    },
    "peer": {
      "required": true,
      "type": "Channel",
      "description": "The dialed channel."
    }
  },
  "id": "Dial",
  "description": "Dialing state has changed."
}
  • asterisk_id: string(optional): The unique ID for the Asterisk instance that raised this event.
  • type: string: Indicates the type of this message.
  • application: string: Name of the application receiving the event.
  • timestamp: Date(optional): Time at which this event was created.
  • caller: Channel(optional): The calling channel
  • dialstatus: string: Current status of the dialing attempt to the peer.
  • dialstring: string(optional): The dial string for calling the peer channel.
  • forward: string(optional): Forwarding target requested by the original dialed channel.
  • forwarded: Channel(optional): Channel that the caller has been forwared to.
  • peer: channel: The dialed channel.

Example

{
	"type": "Dial",
	"timestamp": "2018-10-23T12:36:02.673+0000",
	"dialstatus": "",
	"forward": "",
	"dialstring": "pchero-voip/sip:284712939482@127.0.0.1",
	"peer": {
		"id": "pchero-462475.572686",
		"name": "PJSIP/pchero-voip-00001b1f",
		"state": "Down",
		"caller": {
			"name": "",
			"number": "1337"
		},
		"connected": {
			"name": "",
			"number": "1337"
		},
		"accountcode": "",
		"dialplan": {
			"context": "pchero-voip",
			"exten": "s",
			"priority": 1
		},
		"creationtime": "2018-10-23T12:36:02.671+0000",
		"language": "en"
	},
	"asterisk_id": "210445d7-73bd-456a-aef2-e0ef847bfa0f",
	"application": "pchero_voip"
}

Playback

Object representing the playback of media to a channel.

{
  "properties": {
    "next_media_uri": {
      "required": false,
      "type": "string",
      "description": "If a list of URIs is being played, the next media URI to be played back."
    },
    "target_uri": {
      "required": true,
      "type": "string",
      "description": "URI for the channel or bridge to play the media on"
    },
    "language": {
      "type": "string",
      "description": "For media types that support multiple languages, the language requested for playback."
    },
    "state": {
      "allowableValues": {
        "valueType": "LIST",
        "values": [
          "queued",
          "playing",
          "continuing",
          "done"
        ]
      },
      "required": true,
      "type": "string",
      "description": "Current state of the playback operation."
    },
    "media_uri": {
      "required": true,
      "type": "string",
      "description": "The URI for the media currently being played back."
    },
    "id": {
      "required": true,
      "type": "string",
      "description": "ID for this playback operation"
    }
  },
  "id": "Playback",
  "description": "Object representing the playback of media to a channel"
}
  • id: string: ID for this playback operation.
  • language: string(optional): For media types that support multiple languages, the language requested for playback.
  • media_uri: string: The URI for the media currently being played back.
  • next_media_uri: string(optional): If a list of URIs is being played, the next media URI to be played back.
  • state: string: Current state of the playback operation.
  • target_uri: string: URI for the channel or bridge to play the media on.

Example

 {
	"id": "1b590cfa-5880-493f-8afc-3f9dfed9022a:3f59e78f-acb2-4bd4-bcd0-23da52c1a2c2",
	"media_uri": "sound:https://pchero21.com/var/spool/asterisk/tts/test.wav",
	"target_uri": "channel:pchero-462475.572686",
	"language": "en",
	"state": "playing"
}

PlaybackFinished

Base type: Event Event showing the completion of a media playback operation.

{
  "properties": {
    "playback": {
      "required": true,
      "type": "Playback",
      "description": "Playback control object"
    }
  },
  "id": "PlaybackFinished",
  "description": "Event showing the completion of a media playback operation."
}
  • asterisk_id: string(optional): The unique ID for the Asterisk instance that raised this event.
  • type: string: Indicates the type of this message.
  • application: string: Name of the application receiving the event.
  • timestamp: Date(optional): Time at which this event was created.
  • playback: Playback: Playback control object.

Example

{
	"type": "PlaybackFinished",
	"playback": {
		"id": "b28da5fa-c12e-49b8-a520-1339746cd590:834f78fa-cf49-4092-8805-c1cfe5a8c583",
		"media_uri": "sound:https://pocket-staging.messagebird.io/1/tts/f60a542334f68a0f33e2cb979b2990372772c2fc66b51ecb48e6ef33e38af9b4ec674e5d59b610960d92de0d966446cf1017e021edae559caff418af6a52e618.wav",
		"target_uri": "channel:pchero-462475.572686",
		"language": "en",
		"state": "done"
	},
	"asterisk_id": "210445d7-73bd-456a-aef2-e0ef847bfa0f",
	"application": "pchero_voip"
}

PlaybackStarted

Base type: Event

Event showing the start of a media playback operation.

{
  "properties": {
    "playback": {
      "required": true,
      "type": "Playback",
      "description": "Playback control object"
    }
  },
  "id": "PlaybackStarted",
  "description": "Event showing the start of a media playback operation."
}
  • aserisk_id: string(optional): The unique ID for the Asterisk instance that raised this event.
  • type: string: Indicates the type of this message.
  • application: string: Name of the application receiving the event.
  • timestamp: Date(optional): Time at which this event was created.
  • playback: Playback: Playback control object.

Example

{
	"type": "PlaybackStarted",
	"playback": {
		"id": "1b590cfa-5880-493f-8afc-3f9dfed9022a:3f59e78f-acb2-4bd4-bcd0-23da52c1a2c2",
		"media_uri": "sound:https://pchero21.com/var/spool/asterisk/tts/test.wav",
		"target_uri": "channel:pchero-462475.572686",
		"language": "en",
		"state": "playing"
	},
	"asterisk_id": "210445d7-73bd-456a-aef2-e0ef847bfa0f",
	"application": "pchero_voip"
}

StasisEnd

Bast type: Event

Notification that a channel has left a Stasis application.

{
  "properties": {
    "channel": {
      "required": true,
      "type": "Channel"
    }
  },
  "id": "StasisEnd",
  "description": "Notification that a channel has left a Stasis application."
}
  • asterisk_id: string(optional): The unique ID for the Asterisk instance that raised this event.
  • type: string: Indicates the type of this message.
  • application: string: Name of the application receiving the event.
  • timestamp: Date(Optional): Time at which this event was created.
  • channel: channel

Example

{
	"type": "StasisEnd",
	"timestamp": "2018-10-23T12:36:11.105+0000",
	"channel": {
		"id": "pchero-462475.572686",
		"name": "PJSIP/pchero-voip-00001b1f",
		"state": "Up",
		"caller": {
			"name": "",
			"number": "1337"
		},
		"connected": {
			"name": "",
			"number": "1337"
		},
		"accountcode": "",
		"dialplan": {
			"context": "pchero-voip",
			"exten": "s",
			"priority": 2
		},
		"creationtime": "2018-10-23T12:36:02.671+0000",
		"language": "en"
	},
	"asterisk_id": "210445d7-73bd-456a-aef2-e0ef847bfa0f",
	"application": "pchero_voip"
}

StasisStart

Base type: Event

Notification that a channel has entered a Stasis application.

{
  "properties": {
    "args": {
      "required": true,
      "type": "List[string]",
      "description": "Arguments to the application"
    },
    "replace_channel": {
      "required": false,
      "type": "Channel"
    },
    "channel": {
      "required": true,
      "type": "Channel"
    }
  },
  "id": "StasisStart",
  "description": "Notification that a channel has entered a Stasis application."
}
  • asterisk_id: string(optional): The unique ID for the Asterisk instance that raised this event.
  • type: string: Indicates the type of this message.
  • application: string: Name of the application receiving the event.
  • timestamp: Date(optional): Time at which this event was created.
  • args: List[string]: Arguments to the application.
  • channel: channel
  • replace_channel: channel(optional)

Example

{
	"type": "StasisStart",
	"timestamp": "2018-10-23T12:36:09.603+0000",
	"args": ["PCHERO_DIALED=1"],
	"channel": {
		"id": "pchero-462475.572686",
		"name": "PJSIP/pchero-voip-00001b1f",
		"state": "Up",
		"caller": {
			"name": "",
			"number": "1337"
		},
		"connected": {
			"name": "",
			"number": "1337"
		},
		"accountcode": "",
		"dialplan": {
			"context": "pchero-voip",
			"exten": "s",
			"priority": 1
		},
		"creationtime": "2018-10-23T12:36:02.671+0000",
		"language": "en"
	},
	"asterisk_id": "210445d7-73bd-456a-aef2-e0ef847bfa0f",
	"application": "pchero_voip"
}

See also