Skip to content

Commit

Permalink
accept empty playback IDs
Browse files Browse the repository at this point in the history
  • Loading branch information
Ulexus committed Sep 27, 2019
1 parent 45b9a6d commit d158603
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
7 changes: 6 additions & 1 deletion client/bridge.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ func (b *bridge) AddChannelWithOptions(key *ari.Key, channelID string, options *
Role: options.Role,
},
})

}

func (b *bridge) RemoveChannel(key *ari.Key, channelID string) error {
Expand Down Expand Up @@ -130,6 +129,9 @@ func (b *bridge) StopMOH(key *ari.Key) error {
}

func (b *bridge) Play(key *ari.Key, id string, uri string) (*ari.PlaybackHandle, error) {
if id == "" {
id = rid.New(rid.Playback)
}
k, err := b.c.createRequest(&proxy.Request{
Kind: "BridgePlay",
Key: key,
Expand All @@ -145,6 +147,9 @@ func (b *bridge) Play(key *ari.Key, id string, uri string) (*ari.PlaybackHandle,
}

func (b *bridge) StagePlay(key *ari.Key, id string, uri string) (*ari.PlaybackHandle, error) {
if id == "" {
id = rid.New(rid.Playback)
}
k, err := b.c.getRequest(&proxy.Request{
Kind: "BridgeStagePlay",
Key: key,
Expand Down
5 changes: 4 additions & 1 deletion client/channel.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ func (c *channel) Originate(referenceKey *ari.Key, o ari.OriginateRequest) (*ari
}

func (c *channel) StageOriginate(referenceKey *ari.Key, o ari.OriginateRequest) (*ari.ChannelHandle, error) {

if o.ChannelID == "" {
o.ChannelID = rid.New(rid.Channel)
}
Expand Down Expand Up @@ -273,6 +272,10 @@ func (c *channel) Dial(key *ari.Key, caller string, timeout time.Duration) error
}

func (c *channel) Play(key *ari.Key, playbackID string, mediaURI string) (*ari.PlaybackHandle, error) {
if playbackID == "" {
playbackID = rid.New(rid.Playback)
}

k, err := c.c.createRequest(&proxy.Request{
Kind: "ChannelPlay",
Key: key,
Expand Down

0 comments on commit d158603

Please sign in to comment.