| 177 | } |
| 178 | |
| 179 | func (s *Server) bridgeRecord(ctx context.Context, reply string, req *proxy.Request) { |
| 180 | data, err := s.ari.Bridge().Data(req.Key) |
| 181 | if err != nil || data == nil { |
| 182 | s.sendError(reply, err) |
| 183 | return |
| 184 | } |
| 185 | |
| 186 | if req.BridgeRecord.Name == "" { |
| 187 | req.BridgeRecord.Name = rid.New(rid.Recording) |
| 188 | } |
| 189 | |
| 190 | // bind dialog |
| 191 | if req.Key.Dialog != "" { |
| 192 | s.Dialog.Bind(req.Key.Dialog, "bridge", req.Key.ID) |
| 193 | s.Dialog.Bind(req.Key.Dialog, "recording", req.BridgeRecord.Name) |
| 194 | } |
| 195 | |
| 196 | h, err := s.ari.Bridge().Record(req.Key, req.BridgeRecord.Name, req.BridgeRecord.Options) |
| 197 | if err != nil { |
| 198 | s.sendError(reply, err) |
| 199 | return |
| 200 | } |
| 201 | |
| 202 | s.publish(reply, &proxy.Response{ |
| 203 | Key: h.Key(), |
| 204 | }) |
| 205 | } |
| 206 | |
| 207 | func (s *Server) bridgeStageRecord(ctx context.Context, reply string, req *proxy.Request) { |
| 208 | data, err := s.ari.Bridge().Data(req.Key) |