Asterisk ari-event: Difference between revisions

From 탱이의 잡동사니
Jump to navigation Jump to search
(3 intermediate revisions by the same user not shown)
Line 276: Line 276:
* application: string: Name of the application receiving the event.
* application: string: Name of the application receiving the event.
* timestamp: Date(optional): Time at which this event was created.
* timestamp: Date(optional): Time at which this event was created.
* cause: int: Integer representation of the cause of the hangup.
* cause: int: Integer representation of the cause of the hangup. [[Asterisk_hangup_code]]
* cause_txt: string: Text representation of the cause of the hangup.
* cause_txt: string: Text representation of the cause of the hangup.
* channel: [[#Channel|Channel]]
* channel: [[#Channel|Channel]]
Line 460: Line 460:
* application: string - Name of the application receiving the event.
* application: string - Name of the application receiving the event.
* timestamp: Date(optional) - Time at which this event was created.
* timestamp: Date(optional) - Time at which this event was created.
* cause: int(optional) - Integer representation of the cause of the hangup.
* cause: int(optional) - Integer representation of the cause of the hangup. [[Asterisk_hangup_code]]
* channel: Channel - The channel on which the hangup was requested.
* channel: Channel - The channel on which the hangup was requested.
* soft: boolean(optional) - Whether the hangup request was a soft hangup request.
* soft: boolean(optional) - Whether the hangup request was a soft hangup request.
Line 758: Line 758:
* caller: Channel(optional): The calling channel
* caller: Channel(optional): The calling channel
* dialstatus: string: Current status of the dialing attempt to the peer.
* dialstatus: string: Current status of the dialing attempt to the peer.
** <empty> : The dialing has begun
* dialstring: string(optional): The dial string for calling the peer channel.
* dialstring: string(optional): The dial string for calling the peer channel.
* forward: string(optional): Forwarding target requested by the original dialed channel.
* forward: string(optional): Forwarding target requested by the original dialed channel.
* forwarded: Channel(optional): Channel that the caller has been forwared to.
* forwarded: Channel(optional): Channel that the caller has been forwared to.
* peer: [[#Channel|Channel]]: The dialed channel.
* peer: [[#Channel|Channel]]: The dialed channel.
The ARI's Dial event has some different scope compare with AMI's event.
<pre>
2016-05-09 15:00 +0000 [205a31f86c]  Mark Michelson <mmichelson@digium.com>
* Expand the scope of Dial Events
  Dial events up to this point have come in two flavors
  * A Dial event with no status to indicate that dialing has begun
  * A Dial event with a status to indicate that dialing has ended
  With this change, Dial events have been expanded to also give
  intermediate events, such as "RINGING", "PROCEEDING", and "PROGRESS".
  This is especially useful for ARI dialing, as it gives the application
  writer the opportunity to place a channel into an early bridge when
  early media is detected.
  AMI handles these in-progress dial events by sending a new event called
  "DialState" that simply indicates that dial state has changed but has
  not ended. ARI never distinguished between DialBegin and DialEnd, so no
  change was made to the event itself.
  Another change here relates to dial forwards. A forward-related event
  was previously only sent when a channel was successfully able to forward
  a call to a new channel. With this set of changes, if forwarding is
  blocked, we send a Dial event with a forwarding destination but no
  forwarding channel, since we were prevented from creating one. This is
  again useful for ARI since application writers can now handle call
  forward attempts from within their own application.
  ASTERISK-25925 #close
  Reported by Mark Michelson
  Change-Id: I42cbec7730d84640a434d143a0d172a740995543
</pre>


=== Example ===
=== Example ===

Revision as of 10:07, 30 April 2019

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

BridgeCreated

Example

{
	"type": "BridgeCreated",
	"timestamp": "2019-03-19T16:48:54.251+0000",
	"bridge": {
		"id": "1b98c21c-98f5-41cc-8fa0-1981bc380501",
		"technology": "simple_bridge",
		"bridge_type": "mixing",
		"bridge_class": "stasis",
		"creator": "Stasis",
		"name": "",
		"channels": [],
		"video_mode": "none"
	},
	"asterisk_id": "42:01:0a:12:32:12",
	"application": "test"
}

BridgeDestroyed

{
	"type": "BridgeDestroyed",
	"timestamp": "2019-03-19T17:00:36.477+0000",
	"bridge": {
		"id": "1209eb30-5823-49b2-b582-a3100e667eb2",
		"technology": "simple_bridge",
		"bridge_type": "mixing",
		"bridge_class": "stasis",
		"creator": "Stasis",
		"name": "",
		"channels": [],
		"video_mode": "talker"
	},
	"asterisk_id": "42:01:0a:84:12:21",
	"application": "test"
}

ChannelCallerId

Base type: Event

Channel changed Caller ID.

{
  "properties": {
    "caller_presentation_txt": {
      "required": true,
      "type": "string",
      "description": "The text representation of the Caller Presentation value."
    },
    "caller_presentation": {
      "required": true,
      "type": "int",
      "description": "The integer representation of the Caller Presentation value."
    },
    "channel": {
      "required": true,
      "type": "Channel",
      "description": "The channel that changed Caller ID."
    }
  },
  "id": "ChannelCallerId",
  "description": "Channel changed Caller ID."
}
  • 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_presentation: int : The integer representation of the Caller Presentation value.
  • caller_presentation_txt: string : The text representation of the Caller Presentation value.
  • channel: Channel : The channel that changed Caller ID.

Example

{
	"type": "ChannelCallerId",
	"timestamp": "2019-03-10T20:44:47.240+0000",
	"caller_presentation": 0,
	"caller_presentation_txt": "Presentation Allowed, Not Screened",
	"channel": {
		"id": "1552250684.286164",
		"name": "PJSIP/pchero-voip-siptrunking-0f922f18",
		"state": "Ring",
		"caller": {
			"name": "",
			"number": "test_caller"
		},
		"connected": {
			"name": "",
			"number": ""
		},
		"accountcode": "",
		"dialplan": {
			"context": "pchero-voip-siptrunking",
			"exten": "test_call",
			"priority": 2
		},
		"creationtime": "2019-03-10T20:44:44.835+0000",
		"language": "en"
	},
	"asterisk_id": "42:01:0a:94:00:11",
	"application": "pchero_voip"
}

ChannelCreated

Base type: Event

Notification that a channel has been created.

{
  "properties": {
    "channel": {
      "required": true,
      "type": "Channel"
    }
  },
  "id": "ChannelCreated",
  "description": "Notification that a channel has been created."
}
  • 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": "ChannelCreated",
	"timestamp": "2019-03-06T23:47:09.077+0100",
	"channel": {
		"id": "test_call",
		"name": "PJSIP/sipp-uac-00000000",
		"state": "Down",
		"caller": {
			"name": "",
			"number": ""
		},
		"connected": {
			"name": "",
			"number": ""
		},
		"accountcode": "",
		"dialplan": {
			"context": "sipp-uac",
			"exten": "s",
			"priority": 1
		},
		"creationtime": "2019-03-06T23:47:09.058+0100",
		"language": "en"
	},
	"asterisk_id": "00:11:22:33:44:55",
	"application": "test"
}

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. Asterisk_hangup_code
  • 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"
}

ChannelEnteredBridge

Example

{
	"type": "ChannelEnteredBridge",
	"timestamp": "2019-03-19T16:48:54.265+0000",
	"bridge": {
		"id": "1b98c21c-98f5-41cc-8fa0-1981bc380501",
		"technology": "simple_bridge",
		"bridge_type": "mixing",
		"bridge_class": "stasis",
		"creator": "Stasis",
		"name": "",
		"channels": ["d3137253-7118-418c-80f3-1595fbcd75b0"],
		"video_mode": "talker"
	},
	"channel": {
		"id": "d3137253-7118-418c-80f3-1595fbcd75b0",
		"name": "PJSIP/pchero-voip-00000010",
		"state": "Up",
		"caller": {
			"name": "",
			"number": "test"
		},
		"connected": {
			"name": "",
			"number": "test"
		},
		"accountcode": "",
		"dialplan": {
			"context": "pchero-voip",
			"exten": "s",
			"priority": 1
		},
		"creationtime": "2019-03-19T16:48:45.352+0000",
		"language": "en"
	},
	"asterisk_id": "42:01:0a:84:12:32",
	"application": "test"
}

ChannelHangupRequest

Base type: Event

A hangup was requested on the channel.

ChannelHangupRequest 에는 몇 가지 의미가 있다.

Soft 가 true 로 설정되었을 때는, Hangup() application 이 실행되었거나, Dialplan 에서의 h extension 이 실행되었을 경우 발생한다. h extension 은 명시적으로 지정될 수 도 있고, 묵시적으로 실행이 될 수 있다. 따라서 한번 Dailplan 으로 인입된 Channel 이 종료될 때는 이 이벤트를 발생시킨다.

Soft 가 false 이거나 설정되어 있지 않는 경우는, Hangup Request 를 명시적으로 받았음을 의미한다. ```channel hangup request``` 명령어나 상대방쪽에서 BYE 메시지를 먼저 보냈을 경우가 이에 해당한다.

하지만 뭔가 규칙이 일정하지 않다. ARI 에서 ChannelHangupRequest 이벤트를 사용하고자 할 때는 주의가 필요하다.

{
  "properties": {
    "soft": {
      "type": "boolean",
      "description": "Whether the hangup request was a soft hangup request."
    },
    "cause": {
      "type": "int",
      "description": "Integer representation of the cause of the hangup."
    },
    "channel": {
      "required": true,
      "type": "Channel",
      "description": "The channel on which the hangup was requested."
    }
  },
  "id": "ChannelHangupRequest",
  "description": "A hangup was requested on the channel."
}
  • 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.
  • cause: int(optional) - Integer representation of the cause of the hangup. Asterisk_hangup_code
  • channel: Channel - The channel on which the hangup was requested.
  • soft: boolean(optional) - Whether the hangup request was a soft hangup request.

Example

{
	"cause": 32,
	"soft": true,
	"type": "ChannelHangupRequest",
	"timestamp": "2018-12-02T22:11:29.118+0100",
	"channel": {
		"id": "1543785048.30",
		"name": "PJSIP/sippuas-0000000f",
		"state": "Up",
		"caller": {
			"name": "",
			"number": ""
		},
		"connected": {
			"name": "",
			"number": ""
		},
		"accountcode": "",
		"dialplan": {
			"context": "sippuas",
			"exten": "s",
			"priority": 1
		},
		"creationtime": "2018-12-02T22:10:48.176+0100",
		"language": "en"
	},
	"asterisk_id": "08:00:27:2f:9e:d4",
	"application": "test"
}

ChannelLeftBridge

Example

{
	"type": "ChannelLeftBridge",
	"timestamp": "2019-03-19T16:49:09.571+0000",
	"bridge": {
		"id": "1b98c21c-98f5-41cc-8fa0-1981bc380501",
		"technology": "simple_bridge",
		"bridge_type": "mixing",
		"bridge_class": "stasis",
		"creator": "Stasis",
		"name": "",
		"channels": [],
		"video_mode": "talker"
	},
	"channel": {
		"id": "d3137253-7118-418c-80f3-1595fbcd75b0",
		"name": "PJSIP/pchero-voip-00000010",
		"state": "Up",
		"caller": {
			"name": "",
			"number": "test"
		},
		"connected": {
			"name": "",
			"number": ""
		},
		"accountcode": "",
		"dialplan": {
			"context": "pchero-voip",
			"exten": "s",
			"priority": 1
		},
		"creationtime": "2019-03-19T16:48:45.352+0000",
		"language": "en"
	},
	"asterisk_id": "42:01:0a:84:23:12",
	"application": "test"
}

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"
}

DeviceStateChanged

Represents the state of a device.

{
  "properties": {
    "state": {
      "allowableValues": {
        "valueType": "LIST",
        "values": [
          "UNKNOWN",
          "NOT_INUSE",
          "INUSE",
          "BUSY",
          "INVALID",
          "UNAVAILABLE",
          "RINGING",
          "RINGINUSE",
          "ONHOLD"
        ]
      },
      "required": true,
      "type": "string",
      "description": "Device's state"
    },
    "name": {
      "required": true,
      "type": "string",
      "description": "Name of the device."
    }
  },
  "id": "DeviceState",
  "description": "Represents the state of a device."
}
  • name: string - Name of the device.
  • state: string - Device's state.

Example

{
	"type": "DeviceStateChanged",
	"application": "test",
	"timestamp": "2018-12-02T22:11:29.121+0100",
	"device_state": {
		"name": "PJSIP/sippuas",
		"state": "NOT_INUSE"
	},
	"asterisk_id": "08:00:27:2f:9e:d4"
}

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.
    • <empty> : The dialing has begun
  • 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.

The ARI's Dial event has some different scope compare with AMI's event.

2016-05-09 15:00 +0000 [205a31f86c]  Mark Michelson <mmichelson@digium.com>

	* Expand the scope of Dial Events

	  Dial events up to this point have come in two flavors
	  * A Dial event with no status to indicate that dialing has begun
	  * A Dial event with a status to indicate that dialing has ended

	  With this change, Dial events have been expanded to also give
	  intermediate events, such as "RINGING", "PROCEEDING", and "PROGRESS".
	  This is especially useful for ARI dialing, as it gives the application
	  writer the opportunity to place a channel into an early bridge when
	  early media is detected.

	  AMI handles these in-progress dial events by sending a new event called
	  "DialState" that simply indicates that dial state has changed but has
	  not ended. ARI never distinguished between DialBegin and DialEnd, so no
	  change was made to the event itself.

	  Another change here relates to dial forwards. A forward-related event
	  was previously only sent when a channel was successfully able to forward
	  a call to a new channel. With this set of changes, if forwarding is
	  blocked, we send a Dial event with a forwarding destination but no
	  forwarding channel, since we were prevented from creating one. This is
	  again useful for ARI since application writers can now handle call
	  forward attempts from within their own application.

	  ASTERISK-25925 #close
	  Reported by Mark Michelson

	  Change-Id: I42cbec7730d84640a434d143a0d172a740995543

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"
}

PlaybackContinuing

Base type: Event

Event showing the continuation of a media playback operation from one media URI to the next in the list.

{
  "properties": {
    "playback": {
      "required": true,
      "type": "Playback",
      "description": "Playback control object"
    }
  },
  "id": "PlaybackContinuing",
  "description": "Event showing the continuation of a media playback operation from one media URI to the next in the list."
}
  • 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": "PlaybackContinuing",
	"playback": {
		"id": "5618648a-985c-4c81-a35e-32f6135b43b9",
		"media_uri": "sound:https://github.com/pchero/asterisk_wavs/raw/master/pcm_samples/example_pcm16_mono_8k_short.wav",
		"next_media_uri": "sound:https://github.com/pchero/asterisk_wavs/raw/master/pcm_samples/example_pcm16_mono_8k_short.wav",
		"target_uri": "channel:test-call",
		"language": "en",
		"state": "continuing"
	},
	"asterisk_id": "42:01:0a:84:00:12",
	"application": "pchero_voip"
}

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",
	"timestamp": "2019-03-07T21:18:53.043+0100",
	"playback": {
		"id": "5b8ea8c2-bf67-4282-9c10-55ebf37a07c1",
		"media_uri": "sound:https://github.com/pchero/asterisk-medias/raw/master/samples_codec/pcm_samples/example-mono_16bit_8khz_pcm.wav",
		"target_uri": "channel:test_call",
		"language": "en",
		"state": "done"
	},
	"asterisk_id": "00:11:22:33:44:55",
	"application": "test"
}

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",
	"timestamp": "2019-03-07T21:17:56.241+0100",
	"playback": {
		"id": "5b8ea8c2-bf67-4282-9c10-55ebf37a07c1",
		"media_uri": "sound:https://github.com/pchero/asterisk-medias/raw/master/samples_codec/pcm_samples/example-mono_16bit_8khz_pcm.wav",
		"target_uri": "channel:test_call",
		"language": "en",
		"state": "playing"
	},
	"asterisk_id": "00:11:22:33:44:55",
	"application": "test"
}

RecordingStarted

Example

{
	"type": "RecordingStarted",
	"recording": {
		"name": "test_call",
		"format": "wav",
		"state": "recording",
		"target_uri": "channel:test_call"
	},
	"asterisk_id": "42:01:0a:84:00:12",
	"application": "pchero"
}

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