| 34 | } |
| 35 | |
| 36 | func (s *Server) channelCreate(ctx context.Context, reply string, req *proxy.Request) { |
| 37 | create := req.ChannelCreate.ChannelCreateRequest |
| 38 | |
| 39 | if create.ChannelID == "" { |
| 40 | create.ChannelID = rid.New(rid.Channel) |
| 41 | } |
| 42 | |
| 43 | // bind dialog |
| 44 | if req.Key.Dialog != "" { |
| 45 | s.Dialog.Bind(req.Key.Dialog, "channel", create.ChannelID) |
| 46 | s.Dialog.Bind(req.Key.Dialog, "channel", create.OtherChannelID) |
| 47 | } |
| 48 | |
| 49 | h, err := s.ari.Channel().Create(req.Key, create) |
| 50 | if err != nil { |
| 51 | s.sendError(reply, err) |
| 52 | return |
| 53 | } |
| 54 | |
| 55 | s.publish(reply, &proxy.Response{ |
| 56 | Key: h.Key(), |
| 57 | }) |
| 58 | } |
| 59 | |
| 60 | func (s *Server) channelData(ctx context.Context, reply string, req *proxy.Request) { |
| 61 | d, err := s.ari.Channel().Data(req.Key) |