| 190 | } |
| 191 | |
| 192 | func (s *Server) channelPlay(ctx context.Context, reply string, req *proxy.Request) { |
| 193 | data, err := s.ari.Channel().Data(req.Key) |
| 194 | if err != nil || data == nil { |
| 195 | s.sendError(reply, err) |
| 196 | return |
| 197 | } |
| 198 | |
| 199 | if req.ChannelPlay.PlaybackID == "" { |
| 200 | req.ChannelPlay.PlaybackID = rid.New(rid.Playback) |
| 201 | } |
| 202 | |
| 203 | if req.Key.Dialog != "" { |
| 204 | s.Dialog.Bind(req.Key.Dialog, "channel", req.Key.ID) |
| 205 | s.Dialog.Bind(req.Key.Dialog, "playback", req.ChannelPlay.PlaybackID) |
| 206 | } |
| 207 | |
| 208 | ph, err := s.ari.Channel().Play(req.Key, req.ChannelPlay.PlaybackID, req.ChannelPlay.MediaURI) |
| 209 | if err != nil { |
| 210 | s.sendError(reply, err) |
| 211 | return |
| 212 | } |
| 213 | |
| 214 | s.publish(reply, &proxy.Response{ |
| 215 | Key: ph.Key(), |
| 216 | }) |
| 217 | } |
| 218 | |
| 219 | func (s *Server) channelStagePlay(ctx context.Context, reply string, req *proxy.Request) { |
| 220 | data, err := s.ari.Channel().Data(req.Key) |