From ab115eb64b8ffaead796b997e10601d4640627ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Se=C3=A1n=20C=20McCord?= Date: Sat, 7 Mar 2020 11:36:49 -0500 Subject: [PATCH] update to ari 5 release --- _examples/bridge/main.go | 11 ++--- _examples/play/main.go | 8 +-- _examples/record/main.go | 8 +-- _examples/stasisStart/main.go | 8 ++- client/application.go | 2 +- client/asterisk.go | 2 +- client/bridge.go | 21 +++++++- client/bus/bus.go | 2 +- client/bus/bus_test.go | 2 +- client/channel.go | 4 +- client/client.go | 5 +- client/clientserver_test.go | 4 +- client/cluster/cluster_test.go | 3 +- client/config.go | 2 +- client/device.go | 2 +- client/endpoint.go | 2 +- client/listen.go | 2 +- client/liveRecording.go | 3 +- client/logging.go | 2 +- client/mailbox.go | 2 +- client/modules.go | 2 +- client/playback.go | 2 +- client/sound.go | 2 +- client/storedRecording.go | 2 +- cmd.go | 6 +-- go.mod | 7 ++- go.sum | 71 +++++++++------------------ internal/integration/application.go | 6 +-- internal/integration/asterisk.go | 9 ++-- internal/integration/bridge.go | 45 +++++++---------- internal/integration/channel.go | 4 +- internal/integration/clientserver.go | 4 +- internal/integration/config.go | 17 ++----- internal/integration/device.go | 4 +- internal/integration/endpoint.go | 8 +-- internal/integration/liverecording.go | 3 +- internal/integration/logging.go | 10 +--- internal/integration/mailbox.go | 18 +++---- internal/integration/mock.go | 4 +- internal/integration/modules.go | 10 +--- internal/integration/playback.go | 8 +-- internal/integration/sound.go | 4 +- proxy/types.go | 9 +++- server/bridge.go | 40 ++++++++++++--- server/channel.go | 4 +- server/clientserver_test.go | 4 +- server/events.go | 2 +- server/server.go | 4 +- session/transport.go | 2 +- 49 files changed, 183 insertions(+), 223 deletions(-) diff --git a/_examples/bridge/main.go b/_examples/bridge/main.go index 03406b2..423f0b7 100644 --- a/_examples/bridge/main.go +++ b/_examples/bridge/main.go @@ -1,16 +1,15 @@ package main import ( + "context" "sync" - "golang.org/x/net/context" - "github.com/inconshreveable/log15" - "github.com/CyCoreSystems/ari" "github.com/CyCoreSystems/ari-proxy/client" - "github.com/CyCoreSystems/ari/ext/play" - "github.com/CyCoreSystems/ari/rid" + rid "github.com/CyCoreSystems/ari-rid" + "github.com/CyCoreSystems/ari/v5" + "github.com/CyCoreSystems/ari/v5/ext/play" "github.com/pkg/errors" ) @@ -51,7 +50,7 @@ func appStart(ctx context.Context, cl ari.Client) func(*ari.ChannelHandle, *ari. if err := h.Answer(); err != nil { log.Error("failed to answer call", "error", err) - //return + // return } if err := ensureBridge(ctx, cl, h.Key()); err != nil { diff --git a/_examples/play/main.go b/_examples/play/main.go index d1e1c07..01b5870 100644 --- a/_examples/play/main.go +++ b/_examples/play/main.go @@ -1,13 +1,13 @@ package main import ( - "golang.org/x/net/context" + "context" "github.com/inconshreveable/log15" - "github.com/CyCoreSystems/ari" "github.com/CyCoreSystems/ari-proxy/client" - "github.com/CyCoreSystems/ari/ext/play" + "github.com/CyCoreSystems/ari/v5" + "github.com/CyCoreSystems/ari/v5/ext/play" ) var ariApp = "test" @@ -47,7 +47,7 @@ func appStart(ctx context.Context) func(*ari.ChannelHandle, *ari.StasisStart) { if err := h.Answer(); err != nil { log.Error("failed to answer call", "error", err) - //return + // return } if err := play.Play(ctx, h, play.URI("sound:tt-monkeys")).Err(); err != nil { diff --git a/_examples/record/main.go b/_examples/record/main.go index c5f05a5..e46f546 100644 --- a/_examples/record/main.go +++ b/_examples/record/main.go @@ -1,13 +1,13 @@ package main import ( - "golang.org/x/net/context" + "context" "github.com/inconshreveable/log15" - "github.com/CyCoreSystems/ari" "github.com/CyCoreSystems/ari-proxy/client" - "github.com/CyCoreSystems/ari/ext/record" + "github.com/CyCoreSystems/ari/v5" + "github.com/CyCoreSystems/ari/v5/ext/record" ) var ariApp = "test" @@ -49,7 +49,7 @@ func appStart(ctx context.Context) func(*ari.ChannelHandle, *ari.StasisStart) { if err := h.Answer(); err != nil { log.Error("failed to answer call", "error", err) - //return + // return } res, err := record.Record(ctx, h, diff --git a/_examples/stasisStart/main.go b/_examples/stasisStart/main.go index 9718943..f7643b1 100644 --- a/_examples/stasisStart/main.go +++ b/_examples/stasisStart/main.go @@ -1,14 +1,13 @@ package main import ( + "context" "net/http" "sync" - "golang.org/x/net/context" - - "github.com/CyCoreSystems/ari" "github.com/CyCoreSystems/ari-proxy/client" - "github.com/CyCoreSystems/ari/client/native" + "github.com/CyCoreSystems/ari/v5" + "github.com/CyCoreSystems/ari/v5/client/native" "github.com/inconshreveable/log15" ) @@ -124,7 +123,6 @@ func channelHandler(h *ari.ChannelHandle, startEvent *ari.StasisStart) { log.Info("New Channel State", "state", v.Channel.State) } } - }() h.Answer() diff --git a/client/application.go b/client/application.go index cec2aff..60a8424 100644 --- a/client/application.go +++ b/client/application.go @@ -1,8 +1,8 @@ package client import ( - "github.com/CyCoreSystems/ari" "github.com/CyCoreSystems/ari-proxy/proxy" + "github.com/CyCoreSystems/ari/v5" ) type application struct { diff --git a/client/asterisk.go b/client/asterisk.go index 1f8d2c0..357adb0 100644 --- a/client/asterisk.go +++ b/client/asterisk.go @@ -1,8 +1,8 @@ package client import ( - "github.com/CyCoreSystems/ari" "github.com/CyCoreSystems/ari-proxy/proxy" + "github.com/CyCoreSystems/ari/v5" ) type asterisk struct { diff --git a/client/bridge.go b/client/bridge.go index 748fb3a..b8f7c80 100644 --- a/client/bridge.go +++ b/client/bridge.go @@ -1,9 +1,9 @@ package client import ( - "github.com/CyCoreSystems/ari" "github.com/CyCoreSystems/ari-proxy/proxy" - "github.com/CyCoreSystems/ari/rid" + rid "github.com/CyCoreSystems/ari-rid" + "github.com/CyCoreSystems/ari/v5" ) type bridge struct { @@ -231,3 +231,20 @@ func (b *bridge) Subscribe(key *ari.Key, n ...string) ari.Subscription { return b.c.Bus().Subscribe(key, n...) } + +func (b *bridge) VideoSource(key *ari.Key, channelID string) error { + return b.c.commandRequest(&proxy.Request{ + Kind: "BridgeVideoSource", + Key: key, + BridgeVideoSource: &proxy.BridgeVideoSource{ + Channel: channelID, + }, + }) +} + +func (b *bridge) VideoSourceDelete(key *ari.Key) error { + return b.c.commandRequest(&proxy.Request{ + Kind: "BridgeVideoSourceDelete", + Key: key, + }) +} diff --git a/client/bus/bus.go b/client/bus/bus.go index 86e92df..677f5be 100644 --- a/client/bus/bus.go +++ b/client/bus/bus.go @@ -4,7 +4,7 @@ import ( "fmt" "sync" - "github.com/CyCoreSystems/ari" + "github.com/CyCoreSystems/ari/v5" "github.com/inconshreveable/log15" "github.com/nats-io/nats.go" diff --git a/client/bus/bus_test.go b/client/bus/bus_test.go index 89201ee..b1e9dcd 100644 --- a/client/bus/bus_test.go +++ b/client/bus/bus_test.go @@ -6,7 +6,7 @@ import ( "github.com/inconshreveable/log15" - "github.com/CyCoreSystems/ari" + "github.com/CyCoreSystems/ari/v5" ) func TestMatchEvent(t *testing.T) { diff --git a/client/channel.go b/client/channel.go index aabed2a..5bb1f7c 100644 --- a/client/channel.go +++ b/client/channel.go @@ -3,9 +3,9 @@ package client import ( "time" - "github.com/CyCoreSystems/ari" "github.com/CyCoreSystems/ari-proxy/proxy" - "github.com/CyCoreSystems/ari/rid" + rid "github.com/CyCoreSystems/ari-rid" + "github.com/CyCoreSystems/ari/v5" ) type channel struct { diff --git a/client/client.go b/client/client.go index 20ef1c0..6a6376b 100644 --- a/client/client.go +++ b/client/client.go @@ -5,11 +5,11 @@ import ( "os" "time" - "github.com/CyCoreSystems/ari" "github.com/CyCoreSystems/ari-proxy/client/bus" "github.com/CyCoreSystems/ari-proxy/client/cluster" "github.com/CyCoreSystems/ari-proxy/proxy" - "github.com/CyCoreSystems/ari/rid" + rid "github.com/CyCoreSystems/ari-rid" + "github.com/CyCoreSystems/ari/v5" "github.com/inconshreveable/log15" "github.com/nats-io/nats.go" @@ -476,7 +476,6 @@ func (c *Client) getRequest(req *proxy.Request) (*ari.Key, error) { func (c *Client) dataRequest(req *proxy.Request) (*proxy.EntityData, error) { resp, err := c.makeRequest("data", req) - if err != nil { return nil, err } diff --git a/client/clientserver_test.go b/client/clientserver_test.go index f31839e..2184a36 100644 --- a/client/clientserver_test.go +++ b/client/clientserver_test.go @@ -6,9 +6,9 @@ import ( "testing" "time" - "github.com/CyCoreSystems/ari" "github.com/CyCoreSystems/ari-proxy/server" - "github.com/CyCoreSystems/ari/rid" + rid "github.com/CyCoreSystems/ari-rid" + "github.com/CyCoreSystems/ari/v5" "github.com/nats-io/nats.go" ) diff --git a/client/cluster/cluster_test.go b/client/cluster/cluster_test.go index 95986ae..4328374 100644 --- a/client/cluster/cluster_test.go +++ b/client/cluster/cluster_test.go @@ -5,7 +5,7 @@ import ( "testing" "time" - "github.com/CyCoreSystems/ari/rid" + rid "github.com/CyCoreSystems/ari-rid" ) func TestHash(t *testing.T) { @@ -106,5 +106,4 @@ func TestPurge(t *testing.T) { if len(list) != 2 { t.Errorf("Incorrect number of cluster members: %d != 2", len(list)) } - } diff --git a/client/config.go b/client/config.go index b3b82cd..15e89e3 100644 --- a/client/config.go +++ b/client/config.go @@ -1,8 +1,8 @@ package client import ( - "github.com/CyCoreSystems/ari" "github.com/CyCoreSystems/ari-proxy/proxy" + "github.com/CyCoreSystems/ari/v5" ) type config struct { diff --git a/client/device.go b/client/device.go index 0eba356..9085a5d 100644 --- a/client/device.go +++ b/client/device.go @@ -1,8 +1,8 @@ package client import ( - "github.com/CyCoreSystems/ari" "github.com/CyCoreSystems/ari-proxy/proxy" + "github.com/CyCoreSystems/ari/v5" ) type deviceState struct { diff --git a/client/endpoint.go b/client/endpoint.go index 3db5600..77126e0 100644 --- a/client/endpoint.go +++ b/client/endpoint.go @@ -1,8 +1,8 @@ package client import ( - "github.com/CyCoreSystems/ari" "github.com/CyCoreSystems/ari-proxy/proxy" + "github.com/CyCoreSystems/ari/v5" ) type endpoint struct { diff --git a/client/listen.go b/client/listen.go index b8fb4f1..5e114ae 100644 --- a/client/listen.go +++ b/client/listen.go @@ -4,7 +4,7 @@ import ( "context" "fmt" - "github.com/CyCoreSystems/ari" + "github.com/CyCoreSystems/ari/v5" "github.com/nats-io/nats.go" "github.com/pkg/errors" ) diff --git a/client/liveRecording.go b/client/liveRecording.go index 6796178..0bff41b 100644 --- a/client/liveRecording.go +++ b/client/liveRecording.go @@ -1,8 +1,8 @@ package client import ( - "github.com/CyCoreSystems/ari" "github.com/CyCoreSystems/ari-proxy/proxy" + "github.com/CyCoreSystems/ari/v5" ) type liveRecording struct { @@ -19,7 +19,6 @@ func (l *liveRecording) Get(key *ari.Key) *ari.LiveRecordingHandle { return ari.NewLiveRecordingHandle(key, l, nil) } return ari.NewLiveRecordingHandle(k, l, nil) - } func (l *liveRecording) Data(key *ari.Key) (*ari.LiveRecordingData, error) { diff --git a/client/logging.go b/client/logging.go index 89ce3e9..efbbaf7 100644 --- a/client/logging.go +++ b/client/logging.go @@ -1,8 +1,8 @@ package client import ( - "github.com/CyCoreSystems/ari" "github.com/CyCoreSystems/ari-proxy/proxy" + "github.com/CyCoreSystems/ari/v5" ) type logging struct { diff --git a/client/mailbox.go b/client/mailbox.go index 07ad2d7..42d5ea7 100644 --- a/client/mailbox.go +++ b/client/mailbox.go @@ -1,8 +1,8 @@ package client import ( - "github.com/CyCoreSystems/ari" "github.com/CyCoreSystems/ari-proxy/proxy" + "github.com/CyCoreSystems/ari/v5" ) type mailbox struct { diff --git a/client/modules.go b/client/modules.go index ced5405..7365b21 100644 --- a/client/modules.go +++ b/client/modules.go @@ -1,8 +1,8 @@ package client import ( - "github.com/CyCoreSystems/ari" "github.com/CyCoreSystems/ari-proxy/proxy" + "github.com/CyCoreSystems/ari/v5" ) type modules struct { diff --git a/client/playback.go b/client/playback.go index f213cad..a3a6258 100644 --- a/client/playback.go +++ b/client/playback.go @@ -1,8 +1,8 @@ package client import ( - "github.com/CyCoreSystems/ari" "github.com/CyCoreSystems/ari-proxy/proxy" + "github.com/CyCoreSystems/ari/v5" ) type playback struct { diff --git a/client/sound.go b/client/sound.go index 26350ea..4f2819f 100644 --- a/client/sound.go +++ b/client/sound.go @@ -1,8 +1,8 @@ package client import ( - "github.com/CyCoreSystems/ari" "github.com/CyCoreSystems/ari-proxy/proxy" + "github.com/CyCoreSystems/ari/v5" ) type sound struct { diff --git a/client/storedRecording.go b/client/storedRecording.go index f9743ce..038b443 100644 --- a/client/storedRecording.go +++ b/client/storedRecording.go @@ -1,8 +1,8 @@ package client import ( - "github.com/CyCoreSystems/ari" "github.com/CyCoreSystems/ari-proxy/proxy" + "github.com/CyCoreSystems/ari/v5" ) type storedRecording struct { diff --git a/cmd.go b/cmd.go index 6ab2733..64341a2 100644 --- a/cmd.go +++ b/cmd.go @@ -7,7 +7,7 @@ import ( "strings" "github.com/CyCoreSystems/ari-proxy/server" - "github.com/CyCoreSystems/ari/client/native" + "github.com/CyCoreSystems/ari/v5/client/native" "github.com/inconshreveable/log15" "github.com/nats-io/nats.go" @@ -33,7 +33,7 @@ var RootCmd = &cobra.Command{ os.Exit(0) } - var handler = log15.StdoutHandler + handler := log15.StdoutHandler if viper.GetBool("verbose") { Log.Info("verbose logging enabled") handler = log15.LvlFilterHandler(log15.LvlDebug, handler) @@ -98,7 +98,6 @@ func readConfig() { } func runServer(ctx context.Context, log log15.Logger) error { - natsURL := viper.GetString("nats.url") if os.Getenv("NATS_SERVICE_HOST") != "" { natsURL = "nats://" + os.Getenv("NATS_SERVICE_HOST") + ":" + os.Getenv("NATS_SERVICE_PORT_CLIENT") @@ -115,5 +114,4 @@ func runServer(ctx context.Context, log log15.Logger) error { URL: viper.GetString("ari.http_url"), WebsocketURL: viper.GetString("ari.websocket_url"), }, natsURL) - } diff --git a/go.mod b/go.mod index 3b70f2e..8eff866 100644 --- a/go.mod +++ b/go.mod @@ -1,15 +1,18 @@ module github.com/CyCoreSystems/ari-proxy -go 1.12 +go 1.13 require ( github.com/BurntSushi/toml v0.3.1 // indirect - github.com/CyCoreSystems/ari v5.0.0-pre7+incompatible + github.com/CyCoreSystems/ari-rid v0.1.0 + github.com/CyCoreSystems/ari/v5 v5.0.1 github.com/fsnotify/fsnotify v0.0.0-20170329110642-4da3e2cfbabc // indirect + github.com/gogo/protobuf v1.3.1 // indirect github.com/hashicorp/hcl v0.0.0-20170509225359-392dba7d905e // indirect github.com/inconshreveable/log15 v0.0.0-20171019012758-0decfc6c20d9 github.com/inconshreveable/mousetrap v1.0.0 // indirect github.com/magiconair/properties v1.7.3 // indirect + github.com/mattn/go-colorable v0.1.6 // indirect github.com/mitchellh/mapstructure v0.0.0-20170523030023-d0303fe80992 // indirect github.com/nats-io/nats-server/v2 v2.0.0 // indirect github.com/nats-io/nats.go v1.8.1 diff --git a/go.sum b/go.sum index f3eb84e..b8c1165 100644 --- a/go.sum +++ b/go.sum @@ -1,22 +1,20 @@ github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/CyCoreSystems/ari v5.0.0-pre5+incompatible h1:41WZopBWACn3uhcGaau3oEFRW2KX+LdOo1CNMJENN2s= -github.com/CyCoreSystems/ari v5.0.0-pre5+incompatible/go.mod h1:EjkV7D03yBCsTWgwDjGlPPktsPdjWIdEZ8RnZJwloXA= -github.com/CyCoreSystems/ari v5.0.0-pre7+incompatible h1:OC3g9wcNeKYv7itwuBwIZvmIeCbf7C08Llwmq+xSxiI= -github.com/CyCoreSystems/ari v5.0.0-pre7+incompatible/go.mod h1:qXO2XTsScgwHY6+LbahBCuh61zdT5vTrCAbGlYz85VU= +github.com/CyCoreSystems/ari-rid v0.1.0 h1:QSn7/1Jc0b3Se/LIaMa9taGxC9n/zyBlCEw9Conrdrk= +github.com/CyCoreSystems/ari-rid v0.1.0/go.mod h1:vFD6moqOBGXaUM28Yck9X16+5cj+NbFmiyCvpUYuKr4= +github.com/CyCoreSystems/ari/v5 v5.0.1 h1:TfJOwETj6MumVBJPnZJoYqLtfUAo7W8FKnnssMlQ8PM= +github.com/CyCoreSystems/ari/v5 v5.0.1/go.mod h1:5fdxhNmHG+sUJkeIgPfMafi7d7Ec1B8QpPSCFvDDVc0= +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/fsnotify/fsnotify v0.0.0-20170329110642-4da3e2cfbabc h1:fqUzyjP8DApxXq0dOZJE/NvqQkyjxiTy9ARNyRwBPEw= github.com/fsnotify/fsnotify v0.0.0-20170329110642-4da3e2cfbabc/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/go-stack/stack v1.7.0 h1:S04+lLfST9FvL8dl4R31wVUC/paZp/WQZbLmUgWboGw= -github.com/go-stack/stack v1.7.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/gogo/protobuf v1.0.0 h1:2jyBKDKU/8v3v2xVR2PtiWQviFUyiaGk2rpfyFT8rTM= -github.com/gogo/protobuf v1.0.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/gogo/protobuf v1.3.0 h1:G8O7TerXerS4F6sx9OV7/nRfJdnXgHZu/S/7F2SN+UE= github.com/gogo/protobuf v1.3.0/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= +github.com/gogo/protobuf v1.3.1 h1:DqDEcV5aeaTmdFBePNpYsp3FlcVH/2ISVVM9Qf8PSls= +github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/golang/protobuf v1.3.1 h1:YF8+flBXS5eO826T4nzqPrxfhQThhXl0YzfuUPu4SBg= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/hashicorp/hcl v0.0.0-20170509225359-392dba7d905e h1:KJWs1uTCkN3E/J5ofCH9Pf8KKsibTFc3fv0CA9+WsVo= @@ -34,15 +32,13 @@ github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/magiconair/properties v1.7.3 h1:6AOjgCKyZFMG/1yfReDPDz3CJZPxnYk7DGmj2HtyF24= github.com/magiconair/properties v1.7.3/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= -github.com/mattn/go-colorable v0.0.9 h1:UVL0vNpWh04HeJXV0KLcaT7r06gOH2l4OW6ddYRUIY4= -github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= -github.com/mattn/go-colorable v0.1.4 h1:snbPLB8fVfU9iwbbo30TPtbLRzwWu6aJS6Xh4eaaviA= github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= -github.com/mattn/go-isatty v0.0.3 h1:ns/ykhmWi7G9O+8a448SecJU3nSMBXJfqQkl0upE1jI= -github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mattn/go-colorable v0.1.6 h1:6Su7aK7lXmJ/U79bYtBjLNaha4Fs1Rg9plHpcH+vvnE= +github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/mattn/go-isatty v0.0.10 h1:qxFzApOv4WsAL965uUPIsXzAKCZxN2p9UqdhFS4ZW10= github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84= +github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY= +github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mitchellh/mapstructure v0.0.0-20170523030023-d0303fe80992 h1:W7VHAEVflA5/eTyRvQ53Lz5j8bhRd1myHZlI/IZFvbU= github.com/mitchellh/mapstructure v0.0.0-20170523030023-d0303fe80992/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/nats-io/jwt v0.2.6 h1:eAyoYvGgGLXR2EpnsBUvi/FcFrBqN6YKFVbOoEfPN4k= @@ -55,14 +51,10 @@ github.com/nats-io/nkeys v0.0.2 h1:+qM7QpgXnvDDixitZtQUBDY9w/s9mu1ghS+JIbsrx6M= github.com/nats-io/nkeys v0.0.2/go.mod h1:dab7URMsZm6Z/jp9Z5UGa87Uutgc2mVpXLC4B7TDb/4= github.com/nats-io/nuid v1.0.1 h1:5iA8DT8V7q8WK2EScv2padNa/rTESc1KdnPw4TC2paw= github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= -github.com/oklog/ulid v0.3.0 h1:yEMMWFnYiPX/ytx1StIE0E1a35sm8MmWD/uSL9ZtKhg= -github.com/oklog/ulid v0.3.0/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/pelletier/go-toml v0.0.0-20170817000623-4692b8f9babf h1:XjB5kVAWxe9qH3eZIUfsW4gLh7prYlRJmZ5zRjyvCeg= github.com/pelletier/go-toml v0.0.0-20170817000623-4692b8f9babf/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= -github.com/pkg/errors v0.8.0 h1:WdK/asTD0HN+q6hsWO3/vpuAkAr+tw6aNJNDFFf0+qw= -github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= @@ -79,55 +71,38 @@ github.com/spf13/pflag v1.0.0 h1:oaPbdDe/x0UncahuwiPxW1GYJyilRAdsPnq3e1yaPcI= github.com/spf13/pflag v1.0.0/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/viper v1.0.2 h1:Ncr3ZIuJn322w2k1qmzXDnkLAdQMlJqBa9kfAH+irso= github.com/spf13/viper v1.0.2/go.mod h1:A8kyI5cUJhb8N+3pkfONlcEcZbueH6nhAm0Fq7SrnBM= +github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.2.0 h1:Hbg2NidpLE8veEBkEZTL3CvlkUIVzuU9jDplZO54c48= github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/vektra/mockery v0.0.0-20181123154057-e78b021dcbb5/go.mod h1:ppEjwdhyy7Y31EnHRDm1JkChoC7LXIJ7Ex0VYLWtZtQ= golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190530122614-20be4c3c3ed5 h1:8dUaAV7K4uHsF56JQWkprecIQKdPHtR9jCHF5nB8uzc= golang.org/x/crypto v0.0.0-20190530122614-20be4c3c3ed5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5 h1:58fnuSXlxZmFdJyvtTFVmVhcMLU6v5fEb/ok4wyqtNU= -golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550 h1:ObdrDkeb4kJdCP557AjRjq69pTHfNouLtWZG7j9rPN8= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3 h1:0GoQqolDA55aaLxZyTzK/Y2ePZzZTUrRacwib7cNsYQ= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190607181551-461777fb6f67 h1:rJJxsykSlULwd2P2+pg/rtnwN2FrWp4IuCxOSyS0V00= -golang.org/x/net v0.0.0-20190607181551-461777fb6f67/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20191027093000-83d349e8ac1a h1:Yu34BogBivvmu7SAzHHaB9nZWH5D1C+z3F1jyIaYZSQ= -golang.org/x/net v0.0.0-20191027093000-83d349e8ac1a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b h1:0mm1VjtFUOIlE1SbDlwjYaDxZVDP2S5ou6y0gSgXHu8= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d h1:+R4KGOnez64A81RvjARKc4UT5/tI9ujCIVX+P5KiHuI= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190608050228-5b15430b70e3 h1:xUZPeCzQtkdgRi9RjXIA+3w3RdyDLPqiaJlza5Fqpog= -golang.org/x/sys v0.0.0-20190608050228-5b15430b70e3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191026070338-33540a1f6037 h1:YyJpGZS1sBuBCzLAR1VEpK193GlqGZbnPFnPV/5Rsb4= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae h1:/WDfKMnPU+m5M4xB+6x4kaepxRw6jWvR5iDRdvjHgy8= +golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20181112210238-4b1f3b6b1646/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20191026034945-b2104f82a97d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7 h1:+t9dhfO+GNOIGJof6kPOAenx7YgrZMTdRPV+EsnPabk= -gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= +gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/internal/integration/application.go b/internal/integration/application.go index 1ccaa60..00b88b3 100644 --- a/internal/integration/application.go +++ b/internal/integration/application.go @@ -3,7 +3,7 @@ package integration import ( "testing" - "github.com/CyCoreSystems/ari" + "github.com/CyCoreSystems/ari/v5" "github.com/pkg/errors" tmock "github.com/stretchr/testify/mock" ) @@ -18,7 +18,6 @@ func TestApplicationList(t *testing.T, s Server) { }) runTest("nonEmptyList", t, s, func(t *testing.T, m *mock, cl ari.Client) { - h1 := ari.NewKey(ari.ApplicationKey, "1") h2 := ari.NewKey(ari.ApplicationKey, "2") m.Application.On("List", (*ari.Key)(nil)).Return([]*ari.Key{h1, h2}, nil) @@ -37,7 +36,6 @@ func TestApplicationList(t *testing.T, s Server) { t.Errorf("Expected item 1 to be '2', got %s", items[1].ID) } } - }) } @@ -77,7 +75,6 @@ func TestApplicationData(t *testing.T, s Server) { m.Shutdown() m.Application.AssertCalled(t, "Data", key) - }) } @@ -156,5 +153,4 @@ func TestApplicationGet(t *testing.T, s Server) { m.Application.AssertCalled(t, "Data", key) }) - } diff --git a/internal/integration/asterisk.go b/internal/integration/asterisk.go index c465f57..07dc0d6 100644 --- a/internal/integration/asterisk.go +++ b/internal/integration/asterisk.go @@ -3,13 +3,12 @@ package integration import ( "testing" - "github.com/CyCoreSystems/ari" - "github.com/CyCoreSystems/ari/client/arimocks" + "github.com/CyCoreSystems/ari/v5" + "github.com/CyCoreSystems/ari/v5/client/arimocks" "github.com/pkg/errors" ) func TestAsteriskInfo(t *testing.T, s Server) { - runTest("noFilter", t, s, func(t *testing.T, m *mock, cl ari.Client) { var ai ari.AsteriskInfo ai.SystemInfo.EntityID = "1" @@ -46,11 +45,9 @@ func TestAsteriskInfo(t *testing.T, s Server) { m.Asterisk.AssertCalled(t, "Info", ari.NodeKey("asdf", "1")) }) - } func TestAsteriskVariablesGet(t *testing.T, s Server) { - key := ari.NewKey(ari.VariableKey, "s") runTest("simple", t, s, func(t *testing.T, m *mock, cl ari.Client) { @@ -76,7 +73,7 @@ func TestAsteriskVariablesGet(t *testing.T, s Server) { }) runTest("error", t, s, func(t *testing.T, m *mock, cl ari.Client) { - var expected = errors.New("unknown error") + expected := errors.New("unknown error") mv := arimocks.AsteriskVariables{} mv.On("Get", key).Return("", expected) diff --git a/internal/integration/bridge.go b/internal/integration/bridge.go index 31325a7..b31f8af 100644 --- a/internal/integration/bridge.go +++ b/internal/integration/bridge.go @@ -3,12 +3,11 @@ package integration import ( "testing" - "github.com/CyCoreSystems/ari" + "github.com/CyCoreSystems/ari/v5" "github.com/pkg/errors" ) func TestBridgeCreate(t *testing.T, s Server) { - key := ari.NewKey(ari.BridgeKey, "bridgeID") runTest("simple", t, s, func(t *testing.T, m *mock, cl ari.Client) { @@ -33,7 +32,7 @@ func TestBridgeCreate(t *testing.T, s Server) { }) runTest("error", t, s, func(t *testing.T, m *mock, cl ari.Client) { - var expected = errors.New("unknown error") + expected := errors.New("unknown error") m.Bridge.On("Create", key, "bridgeType", "bridgeName").Return(nil, expected) @@ -53,10 +52,9 @@ func TestBridgeCreate(t *testing.T, s Server) { func TestBridgeList(t *testing.T, s Server) { runTest("simple", t, s, func(t *testing.T, m *mock, cl ari.Client) { - var handles []*ari.Key - var h1 = ari.NewKey(ari.BridgeKey, "h1") - var h2 = ari.NewKey(ari.BridgeKey, "h2") + h1 := ari.NewKey(ari.BridgeKey, "h1") + h2 := ari.NewKey(ari.BridgeKey, "h2") handles = append(handles, h1) handles = append(handles, h2) @@ -77,7 +75,7 @@ func TestBridgeList(t *testing.T, s Server) { }) runTest("error", t, s, func(t *testing.T, m *mock, cl ari.Client) { - var expected = errors.New("unknown error") + expected := errors.New("unknown error") m.Bridge.On("List", (*ari.Key)(nil)).Return([]*ari.Key{}, expected) @@ -96,7 +94,7 @@ func TestBridgeList(t *testing.T, s Server) { } func TestBridgeData(t *testing.T, s Server) { - var key = ari.NewKey(ari.BridgeKey, "bridge1") + key := ari.NewKey(ari.BridgeKey, "bridge1") runTest("simple", t, s, func(t *testing.T, m *mock, cl ari.Client) { bd := &ari.BridgeData{ @@ -120,7 +118,6 @@ func TestBridgeData(t *testing.T, s Server) { }) runTest("error", t, s, func(t *testing.T, m *mock, cl ari.Client) { - m.Bridge.On("Data", key).Return(nil, errors.New("Error getting data")) ret, err := cl.Bridge().Data(key) @@ -138,7 +135,7 @@ func TestBridgeData(t *testing.T, s Server) { } func TestBridgeAddChannel(t *testing.T, s Server) { - var key = ari.NewKey(ari.BridgeKey, "bridge1") + key := ari.NewKey(ari.BridgeKey, "bridge1") runTest("simple", t, s, func(t *testing.T, m *mock, cl ari.Client) { m.Bridge.On("AddChannel", key, "channel1").Return(nil) @@ -154,7 +151,6 @@ func TestBridgeAddChannel(t *testing.T, s Server) { }) runTest("error", t, s, func(t *testing.T, m *mock, cl ari.Client) { - m.Bridge.On("AddChannel", key, "channel1").Return(errors.New("unknown error")) err := cl.Bridge().AddChannel(key, "channel1") @@ -169,7 +165,7 @@ func TestBridgeAddChannel(t *testing.T, s Server) { } func TestBridgeRemoveChannel(t *testing.T, s Server) { - var key = ari.NewKey(ari.BridgeKey, "bridge1") + key := ari.NewKey(ari.BridgeKey, "bridge1") runTest("simple", t, s, func(t *testing.T, m *mock, cl ari.Client) { m.Bridge.On("RemoveChannel", key, "channel1").Return(nil) @@ -185,7 +181,6 @@ func TestBridgeRemoveChannel(t *testing.T, s Server) { }) runTest("error", t, s, func(t *testing.T, m *mock, cl ari.Client) { - m.Bridge.On("RemoveChannel", key, "channel1").Return(errors.New("unknown error")) err := cl.Bridge().RemoveChannel(key, "channel1") @@ -200,7 +195,7 @@ func TestBridgeRemoveChannel(t *testing.T, s Server) { } func TestBridgeDelete(t *testing.T, s Server) { - var key = ari.NewKey(ari.BridgeKey, "bridge1") + key := ari.NewKey(ari.BridgeKey, "bridge1") runTest("simple", t, s, func(t *testing.T, m *mock, cl ari.Client) { m.Bridge.On("Delete", key).Return(nil) @@ -216,7 +211,6 @@ func TestBridgeDelete(t *testing.T, s Server) { }) runTest("error", t, s, func(t *testing.T, m *mock, cl ari.Client) { - m.Bridge.On("Delete", key).Return(errors.New("unknown error")) err := cl.Bridge().Delete(key) @@ -231,11 +225,10 @@ func TestBridgeDelete(t *testing.T, s Server) { } func TestBridgePlay(t *testing.T, s Server) { - var key = ari.NewKey(ari.BridgeKey, "bridge1") + key := ari.NewKey(ari.BridgeKey, "bridge1") runTest("simple", t, s, func(t *testing.T, m *mock, cl ari.Client) { - - var ph = ari.NewPlaybackHandle(ari.NewKey(ari.PlaybackKey, "playback1"), m.Playback, nil) + ph := ari.NewPlaybackHandle(ari.NewKey(ari.PlaybackKey, "playback1"), m.Playback, nil) m.Bridge.On("Play", key, "playback1", "mediaURI").Return(ph, nil) @@ -253,7 +246,6 @@ func TestBridgePlay(t *testing.T, s Server) { }) runTest("error", t, s, func(t *testing.T, m *mock, cl ari.Client) { - m.Bridge.On("Play", key, "playback1", "mediaURI").Return(nil, errors.New("unknown error")) ret, err := cl.Bridge().Play(key, "playback1", "mediaURI") @@ -271,13 +263,12 @@ func TestBridgePlay(t *testing.T, s Server) { } func TestBridgeRecord(t *testing.T, s Server) { - var key = ari.NewKey(ari.BridgeKey, "bridge1") + key := ari.NewKey(ari.BridgeKey, "bridge1") runTest("customOpts", t, s, func(t *testing.T, m *mock, cl ari.Client) { + opts := &ari.RecordingOptions{Format: "", MaxDuration: 0, MaxSilence: 0, Exists: "", Beep: false, Terminate: "#"} - var opts = &ari.RecordingOptions{Format: "", MaxDuration: 0, MaxSilence: 0, Exists: "", Beep: false, Terminate: "#"} - - var lrh = ari.NewLiveRecordingHandle(ari.NewKey(ari.LiveRecordingKey, "recording1"), m.LiveRecording, nil) + lrh := ari.NewLiveRecordingHandle(ari.NewKey(ari.LiveRecordingKey, "recording1"), m.LiveRecording, nil) bd := &ari.BridgeData{ ID: "bridge1", @@ -301,10 +292,9 @@ func TestBridgeRecord(t *testing.T, s Server) { }) runTest("nilOpts", t, s, func(t *testing.T, m *mock, cl ari.Client) { + opts := &ari.RecordingOptions{} - var opts = &ari.RecordingOptions{} - - var lrh = ari.NewLiveRecordingHandle(ari.NewKey(ari.LiveRecordingKey, "recording1"), m.LiveRecording, nil) + lrh := ari.NewLiveRecordingHandle(ari.NewKey(ari.LiveRecordingKey, "recording1"), m.LiveRecording, nil) bd := &ari.BridgeData{ ID: "bridge1", @@ -328,7 +318,6 @@ func TestBridgeRecord(t *testing.T, s Server) { }) runTest("error", t, s, func(t *testing.T, m *mock, cl ari.Client) { - bd := &ari.BridgeData{ ID: "bridge1", Class: "class1", @@ -336,7 +325,7 @@ func TestBridgeRecord(t *testing.T, s Server) { } m.Bridge.On("Data", key).Return(bd, nil) - var opts = &ari.RecordingOptions{} + opts := &ari.RecordingOptions{} m.Bridge.On("Record", key, "recording1", opts).Return(nil, errors.New("unknown error")) ret, err := cl.Bridge().Record(key, "recording1", opts) diff --git a/internal/integration/channel.go b/internal/integration/channel.go index 5660dbe..9e2d514 100644 --- a/internal/integration/channel.go +++ b/internal/integration/channel.go @@ -5,8 +5,8 @@ import ( "testing" "time" - "github.com/CyCoreSystems/ari" - "github.com/CyCoreSystems/ari/rid" + rid "github.com/CyCoreSystems/ari-rid" + "github.com/CyCoreSystems/ari/v5" tmock "github.com/stretchr/testify/mock" ) diff --git a/internal/integration/clientserver.go b/internal/integration/clientserver.go index 2b6c89c..b50599b 100644 --- a/internal/integration/clientserver.go +++ b/internal/integration/clientserver.go @@ -8,7 +8,7 @@ import ( "sync" - "github.com/CyCoreSystems/ari" + "github.com/CyCoreSystems/ari/v5" "github.com/nats-io/nats.go" "github.com/pkg/errors" ) @@ -44,7 +44,6 @@ func runTest(desc string, t *testing.T, s Server, fn testHandler) { }() t.Run(desc, func(t *testing.T) { - // setup mocking m := standardMock() @@ -89,7 +88,6 @@ func runTest(desc string, t *testing.T, s Server, fn testHandler) { fmt.Fprintf(os.Stderr, "Timeouts: %d\n", timeout) } } - }) } diff --git a/internal/integration/config.go b/internal/integration/config.go index dfbb932..6da1338 100644 --- a/internal/integration/config.go +++ b/internal/integration/config.go @@ -4,18 +4,17 @@ import ( "errors" "testing" - "github.com/CyCoreSystems/ari" - "github.com/CyCoreSystems/ari/client/arimocks" + "github.com/CyCoreSystems/ari/v5" + "github.com/CyCoreSystems/ari/v5/client/arimocks" tmock "github.com/stretchr/testify/mock" ) var _ = tmock.Anything func TestConfigData(t *testing.T, s Server) { - var key = ari.NewKey("config", ari.ConfigID("c1", "o1", "id1")) + key := ari.NewKey("config", ari.ConfigID("c1", "o1", "id1")) runTest("ok", t, s, func(t *testing.T, m *mock, cl ari.Client) { - var expected ari.ConfigData expected.Class = "c1" expected.Key = key @@ -57,7 +56,6 @@ func TestConfigData(t *testing.T, s Server) { }) runTest("err", t, s, func(t *testing.T, m *mock, cl ari.Client) { - cfg := arimocks.Config{} m.Asterisk.On("Config").Return(&cfg) cfg.On("Data", key).Return(nil, errors.New("error")) @@ -76,10 +74,9 @@ func TestConfigData(t *testing.T, s Server) { } func TestConfigDelete(t *testing.T, s Server) { - var key = ari.NewKey("config", ari.ConfigID("c1", "o1", "id1")) + key := ari.NewKey("config", ari.ConfigID("c1", "o1", "id1")) runTest("ok", t, s, func(t *testing.T, m *mock, cl ari.Client) { - cfg := arimocks.Config{} m.Asterisk.On("Config").Return(&cfg) cfg.On("Delete", key).Return(nil) @@ -94,7 +91,6 @@ func TestConfigDelete(t *testing.T, s Server) { }) runTest("err", t, s, func(t *testing.T, m *mock, cl ari.Client) { - cfg := arimocks.Config{} m.Asterisk.On("Config").Return(&cfg) cfg.On("Delete", key).Return(errors.New("error")) @@ -110,8 +106,7 @@ func TestConfigDelete(t *testing.T, s Server) { } func TestConfigUpdate(t *testing.T, s Server) { - - var key = ari.NewKey("config", ari.ConfigID("c1", "o1", "id1")) + key := ari.NewKey("config", ari.ConfigID("c1", "o1", "id1")) tuples := []ari.ConfigTuple{ ari.ConfigTuple{ @@ -125,7 +120,6 @@ func TestConfigUpdate(t *testing.T, s Server) { } runTest("ok", t, s, func(t *testing.T, m *mock, cl ari.Client) { - cfg := arimocks.Config{} m.Asterisk.On("Config").Return(&cfg) cfg.On("Update", key, tuples).Return(nil) @@ -140,7 +134,6 @@ func TestConfigUpdate(t *testing.T, s Server) { }) runTest("err", t, s, func(t *testing.T, m *mock, cl ari.Client) { - cfg := arimocks.Config{} m.Asterisk.On("Config").Return(&cfg) cfg.On("Update", key, tuples).Return(errors.New("error")) diff --git a/internal/integration/device.go b/internal/integration/device.go index e80afad..3d44cbc 100644 --- a/internal/integration/device.go +++ b/internal/integration/device.go @@ -4,7 +4,7 @@ import ( "errors" "testing" - "github.com/CyCoreSystems/ari" + "github.com/CyCoreSystems/ari/v5" ) func TestDeviceData(t *testing.T, s Server) { @@ -96,7 +96,6 @@ func TestDeviceUpdate(t *testing.T, s Server) { func TestDeviceList(t *testing.T, s Server) { runTest("ok", t, s, func(t *testing.T, m *mock, cl ari.Client) { - h1 := ari.NewKey(ari.DeviceStateKey, "h1") h2 := ari.NewKey(ari.DeviceStateKey, "h2") @@ -114,7 +113,6 @@ func TestDeviceList(t *testing.T, s Server) { }) runTest("err", t, s, func(t *testing.T, m *mock, cl ari.Client) { - m.DeviceState.On("List", (*ari.Key)(nil)).Return([]*ari.Key{}, errors.New("error")) list, err := cl.DeviceState().List(nil) diff --git a/internal/integration/endpoint.go b/internal/integration/endpoint.go index c22b34d..99894ea 100644 --- a/internal/integration/endpoint.go +++ b/internal/integration/endpoint.go @@ -4,12 +4,11 @@ import ( "errors" "testing" - "github.com/CyCoreSystems/ari" + "github.com/CyCoreSystems/ari/v5" ) func TestEndpointList(t *testing.T, s Server) { runTest("ok", t, s, func(t *testing.T, m *mock, cl ari.Client) { - h1 := ari.NewEndpointKey("h1", "1") h2 := ari.NewEndpointKey("h1", "2") @@ -27,7 +26,6 @@ func TestEndpointList(t *testing.T, s Server) { }) runTest("err", t, s, func(t *testing.T, m *mock, cl ari.Client) { - m.Endpoint.On("List", (*ari.Key)(nil)).Return([]*ari.Key{}, errors.New("error")) list, err := cl.Endpoint().List(nil) @@ -44,7 +42,6 @@ func TestEndpointList(t *testing.T, s Server) { func TestEndpointListByTech(t *testing.T, s Server) { runTest("ok", t, s, func(t *testing.T, m *mock, cl ari.Client) { - h1 := ari.NewEndpointKey("h1", "1") h2 := ari.NewEndpointKey("h1", "2") @@ -62,7 +59,6 @@ func TestEndpointListByTech(t *testing.T, s Server) { }) runTest("err", t, s, func(t *testing.T, m *mock, cl ari.Client) { - m.Endpoint.On("ListByTech", "tech", &ari.Key{Kind: "", ID: "", Node: "", Dialog: "", App: ""}).Return([]*ari.Key{}, errors.New("error")) list, err := cl.Endpoint().ListByTech("tech", nil) @@ -79,7 +75,6 @@ func TestEndpointListByTech(t *testing.T, s Server) { func TestEndpointData(t *testing.T, s Server) { runTest("ok", t, s, func(t *testing.T, m *mock, cl ari.Client) { - var expected ari.EndpointData expected.State = "st1" expected.Technology = "tech1" @@ -109,7 +104,6 @@ func TestEndpointData(t *testing.T, s Server) { }) runTest("err", t, s, func(t *testing.T, m *mock, cl ari.Client) { - var expected ari.EndpointData expected.State = "st1" expected.Technology = "tech1" diff --git a/internal/integration/liverecording.go b/internal/integration/liverecording.go index 98f99da..030314f 100644 --- a/internal/integration/liverecording.go +++ b/internal/integration/liverecording.go @@ -5,7 +5,7 @@ import ( "testing" "time" - "github.com/CyCoreSystems/ari" + "github.com/CyCoreSystems/ari/v5" ) func TestLiveRecordingData(t *testing.T, s Server) { @@ -49,7 +49,6 @@ func TestLiveRecordingData(t *testing.T, s Server) { m.LiveRecording.AssertCalled(t, "Data", key) }) runTest("err", t, s, func(t *testing.T, m *mock, cl ari.Client) { - key := ari.NewKey(ari.LiveRecordingKey, "lr1") m.LiveRecording.On("Data", key).Return(nil, errors.New("err")) diff --git a/internal/integration/logging.go b/internal/integration/logging.go index 73ccaab..5f64af2 100644 --- a/internal/integration/logging.go +++ b/internal/integration/logging.go @@ -4,12 +4,12 @@ import ( "errors" "testing" - "github.com/CyCoreSystems/ari" + "github.com/CyCoreSystems/ari/v5" ) func TestLoggingList(t *testing.T, s Server) { runTest("ok", t, s, func(t *testing.T, m *mock, cl ari.Client) { - var expected = []*ari.Key{ + expected := []*ari.Key{ ari.NewKey(ari.LoggingKey, "n1"), } @@ -66,7 +66,6 @@ func TestLoggingList(t *testing.T, s Server) { func TestLoggingCreate(t *testing.T, s Server) { key := ari.NewKey(ari.LoggingKey, "n1") runTest("ok", t, s, func(t *testing.T, m *mock, cl ari.Client) { - m.Logging.On("Create", key, "l1").Return(ari.NewLogHandle(key, m.Logging), nil) _, err := cl.Asterisk().Logging().Create(key, "l1") @@ -78,7 +77,6 @@ func TestLoggingCreate(t *testing.T, s Server) { }) runTest("err", t, s, func(t *testing.T, m *mock, cl ari.Client) { - m.Logging.On("Create", key, "l1").Return(nil, errors.New("error")) _, err := cl.Asterisk().Logging().Create(key, "l1") @@ -94,7 +92,6 @@ func TestLoggingDelete(t *testing.T, s Server) { key := ari.NewKey(ari.LoggingKey, "n1") runTest("ok", t, s, func(t *testing.T, m *mock, cl ari.Client) { - m.Logging.On("Delete", key).Return(nil) err := cl.Asterisk().Logging().Delete(key) @@ -106,7 +103,6 @@ func TestLoggingDelete(t *testing.T, s Server) { }) runTest("err", t, s, func(t *testing.T, m *mock, cl ari.Client) { - m.Logging.On("Delete", key).Return(errors.New("error")) err := cl.Asterisk().Logging().Delete(key) @@ -122,7 +118,6 @@ func TestLoggingRotate(t *testing.T, s Server) { key := ari.NewKey(ari.LoggingKey, "n1") runTest("ok", t, s, func(t *testing.T, m *mock, cl ari.Client) { - m.Logging.On("Rotate", key).Return(nil) err := cl.Asterisk().Logging().Rotate(key) @@ -134,7 +129,6 @@ func TestLoggingRotate(t *testing.T, s Server) { }) runTest("err", t, s, func(t *testing.T, m *mock, cl ari.Client) { - m.Logging.On("Rotate", key).Return(errors.New("error")) err := cl.Asterisk().Logging().Rotate(key) diff --git a/internal/integration/mailbox.go b/internal/integration/mailbox.go index 6284cf7..89ce2c2 100644 --- a/internal/integration/mailbox.go +++ b/internal/integration/mailbox.go @@ -4,7 +4,7 @@ import ( "errors" "testing" - "github.com/CyCoreSystems/ari" + "github.com/CyCoreSystems/ari/v5" ) func TestMailboxList(t *testing.T, s Server) { @@ -25,9 +25,8 @@ func TestMailboxList(t *testing.T, s Server) { }) runTest("nonEmpty", t, s, func(t *testing.T, m *mock, cl ari.Client) { - - var h1 = ari.NewKey(ari.MailboxKey, "h1") - var h2 = ari.NewKey(ari.MailboxKey, "h2") + h1 := ari.NewKey(ari.MailboxKey, "h1") + h2 := ari.NewKey(ari.MailboxKey, "h2") m.Mailbox.On("List", (*ari.Key)(nil)).Return([]*ari.Key{h1, h2}, nil) @@ -77,7 +76,7 @@ func testMailboxCommand(t *testing.T, m *mock, name string, id *ari.Key, expecte } func TestMailboxDelete(t *testing.T, s Server) { - var key = ari.NewKey(ari.MailboxKey, "mbox1") + key := ari.NewKey(ari.MailboxKey, "mbox1") runTest("ok", t, s, func(t *testing.T, m *mock, cl ari.Client) { testMailboxCommand(t, m, "Delete", key, nil, cl.Mailbox().Delete) }) @@ -87,7 +86,7 @@ func TestMailboxDelete(t *testing.T, s Server) { } func TestMailboxUpdate(t *testing.T, s Server) { - var key = ari.NewKey(ari.MailboxKey, "mbox1") + key := ari.NewKey(ari.MailboxKey, "mbox1") runTest("ok", t, s, func(t *testing.T, m *mock, cl ari.Client) { var expected error @@ -110,7 +109,7 @@ func TestMailboxUpdate(t *testing.T, s Server) { }) runTest("err", t, s, func(t *testing.T, m *mock, cl ari.Client) { - var expected = errors.New("error") + expected := errors.New("error") m.Mailbox.On("Update", key, 1, 1).Return(expected) @@ -131,10 +130,9 @@ func TestMailboxUpdate(t *testing.T, s Server) { } func TestMailboxData(t *testing.T, s Server) { - var key = ari.NewKey(ari.MailboxKey, "mbox1") + key := ari.NewKey(ari.MailboxKey, "mbox1") runTest("ok", t, s, func(t *testing.T, m *mock, cl ari.Client) { - var expected ari.MailboxData expected.Name = "mbox1" expected.NewMessages = 2 @@ -161,7 +159,7 @@ func TestMailboxData(t *testing.T, s Server) { }) runTest("err", t, s, func(t *testing.T, m *mock, cl ari.Client) { - var expected = errors.New("error") + expected := errors.New("error") m.Mailbox.On("Data", key).Return(nil, expected) diff --git a/internal/integration/mock.go b/internal/integration/mock.go index 0578839..02ca63f 100644 --- a/internal/integration/mock.go +++ b/internal/integration/mock.go @@ -1,8 +1,8 @@ package integration import ( - "github.com/CyCoreSystems/ari" - "github.com/CyCoreSystems/ari/client/arimocks" + "github.com/CyCoreSystems/ari/v5" + "github.com/CyCoreSystems/ari/v5/client/arimocks" tmock "github.com/stretchr/testify/mock" ) diff --git a/internal/integration/modules.go b/internal/integration/modules.go index 0ad0dc5..8bd6d9d 100644 --- a/internal/integration/modules.go +++ b/internal/integration/modules.go @@ -4,13 +4,12 @@ import ( "errors" "testing" - "github.com/CyCoreSystems/ari" + "github.com/CyCoreSystems/ari/v5" ) func TestModulesLoad(t *testing.T, s Server) { key := ari.NewKey(ari.ModuleKey, "m1") runTest("ok", t, s, func(t *testing.T, m *mock, cl ari.Client) { - m.Modules.On("Load", key).Return(nil) if err := cl.Asterisk().Modules().Load(key); err != nil { @@ -23,7 +22,6 @@ func TestModulesLoad(t *testing.T, s Server) { m.Modules.AssertCalled(t, "Load", key) }) runTest("err", t, s, func(t *testing.T, m *mock, cl ari.Client) { - m.Modules.On("Load", key).Return(errors.New("error")) if err := cl.Asterisk().Modules().Load(key); err == nil { @@ -41,7 +39,6 @@ func TestModulesUnload(t *testing.T, s Server) { key := ari.NewKey(ari.ModuleKey, "m1") runTest("ok", t, s, func(t *testing.T, m *mock, cl ari.Client) { - m.Modules.On("Unload", key).Return(nil) if err := cl.Asterisk().Modules().Unload(key); err != nil { @@ -54,7 +51,6 @@ func TestModulesUnload(t *testing.T, s Server) { m.Modules.AssertCalled(t, "Unload", key) }) runTest("err", t, s, func(t *testing.T, m *mock, cl ari.Client) { - m.Modules.On("Unload", key).Return(errors.New("error")) if err := cl.Asterisk().Modules().Unload(key); err == nil { @@ -72,7 +68,6 @@ func TestModulesReload(t *testing.T, s Server) { key := ari.NewKey(ari.ModuleKey, "m1") runTest("ok", t, s, func(t *testing.T, m *mock, cl ari.Client) { - m.Modules.On("Reload", key).Return(nil) if err := cl.Asterisk().Modules().Reload(key); err != nil { @@ -85,7 +80,6 @@ func TestModulesReload(t *testing.T, s Server) { m.Modules.AssertCalled(t, "Reload", key) }) runTest("err", t, s, func(t *testing.T, m *mock, cl ari.Client) { - m.Modules.On("Reload", key).Return(errors.New("error")) if err := cl.Asterisk().Modules().Reload(key); err == nil { @@ -103,7 +97,6 @@ func TestModulesData(t *testing.T, s Server) { key := ari.NewKey(ari.ModuleKey, "m1") runTest("ok", t, s, func(t *testing.T, m *mock, cl ari.Client) { - var d ari.ModuleData d.Description = "Desc" d.Name = "name" @@ -131,7 +124,6 @@ func TestModulesData(t *testing.T, s Server) { m.Modules.AssertCalled(t, "Data", key) }) runTest("err", t, s, func(t *testing.T, m *mock, cl ari.Client) { - m.Modules.On("Data", key).Return(nil, errors.New("error")) _, err := cl.Asterisk().Modules().Data(key) diff --git a/internal/integration/playback.go b/internal/integration/playback.go index 683f2e5..3107e9a 100644 --- a/internal/integration/playback.go +++ b/internal/integration/playback.go @@ -4,13 +4,12 @@ import ( "errors" "testing" - "github.com/CyCoreSystems/ari" + "github.com/CyCoreSystems/ari/v5" ) func TestPlaybackData(t *testing.T, s Server) { key := ari.NewKey(ari.PlaybackKey, "pb1") runTest("ok", t, s, func(t *testing.T, m *mock, cl ari.Client) { - var pb ari.PlaybackData pb.ID = "pb1" pb.State = "st1" @@ -34,7 +33,6 @@ func TestPlaybackData(t *testing.T, s Server) { m.Playback.AssertCalled(t, "Data", key) }) runTest("err", t, s, func(t *testing.T, m *mock, cl ari.Client) { - m.Playback.On("Data", key).Return(nil, errors.New("error")) _, err := cl.Playback().Data(key) @@ -52,7 +50,6 @@ func TestPlaybackControl(t *testing.T, s Server) { key := ari.NewKey(ari.PlaybackKey, "pb1") runTest("ok", t, s, func(t *testing.T, m *mock, cl ari.Client) { - m.Playback.On("Control", key, "op").Return(nil) err := cl.Playback().Control(key, "op") @@ -65,7 +62,6 @@ func TestPlaybackControl(t *testing.T, s Server) { m.Playback.AssertCalled(t, "Control", key, "op") }) runTest("err", t, s, func(t *testing.T, m *mock, cl ari.Client) { - m.Playback.On("Control", key, "op").Return(errors.New("error")) err := cl.Playback().Control(key, "op") @@ -83,7 +79,6 @@ func TestPlaybackStop(t *testing.T, s Server) { key := ari.NewKey(ari.PlaybackKey, "pb1") runTest("ok", t, s, func(t *testing.T, m *mock, cl ari.Client) { - m.Playback.On("Stop", key).Return(nil) err := cl.Playback().Stop(key) @@ -96,7 +91,6 @@ func TestPlaybackStop(t *testing.T, s Server) { m.Playback.AssertCalled(t, "Stop", key) }) runTest("err", t, s, func(t *testing.T, m *mock, cl ari.Client) { - m.Playback.On("Stop", key).Return(errors.New("error")) err := cl.Playback().Stop(key) diff --git a/internal/integration/sound.go b/internal/integration/sound.go index b6a881e..7525251 100644 --- a/internal/integration/sound.go +++ b/internal/integration/sound.go @@ -4,7 +4,7 @@ import ( "errors" "testing" - "github.com/CyCoreSystems/ari" + "github.com/CyCoreSystems/ari/v5" ) func TestSoundData(t *testing.T, s Server) { @@ -33,7 +33,6 @@ func TestSoundData(t *testing.T, s Server) { m.Sound.AssertCalled(t, "Data", key) }) runTest("err", t, s, func(t *testing.T, m *mock, cl ari.Client) { - m.Sound.On("Data", key).Return(nil, errors.New("error")) _, err := cl.Sound().Data(key) @@ -48,7 +47,6 @@ func TestSoundData(t *testing.T, s Server) { } func TestSoundList(t *testing.T, s Server) { - runTest("ok", t, s, func(t *testing.T, m *mock, cl ari.Client) { sh1 := ari.NewKey(ari.SoundKey, "sh1") sh2 := ari.NewKey(ari.SoundKey, "sh2") diff --git a/proxy/types.go b/proxy/types.go index 170b6b6..6ec6c12 100644 --- a/proxy/types.go +++ b/proxy/types.go @@ -5,7 +5,7 @@ import ( "fmt" "time" - "github.com/CyCoreSystems/ari" + "github.com/CyCoreSystems/ari/v5" ) // AnnouncementInterval is the amount of time to wait between periodic service availability announcements @@ -113,6 +113,7 @@ type Request struct { BridgePlay *BridgePlay `json:"bridge_play,omitempty"` BridgeRecord *BridgeRecord `json:"bridge_record,omitempty"` BridgeRemoveChannel *BridgeRemoveChannel `json:"bridge_remove_channel,omitempty"` + BridgeVideoSource *BridgeVideoSource `json:"bridge_video_source,omitempty"` ChannelCreate *ChannelCreate `json:"channel_create,omitempty"` ChannelContinue *ChannelContinue `json:"channel_continue,omitempty"` @@ -213,6 +214,12 @@ type BridgeRemoveChannel struct { Channel string `json:"channel"` } +// BridgeVideoSource describes the details of a request to set the video source of a bridge explicitly +type BridgeVideoSource struct { + // Channel is the name of the channel to use as the explicit video source + Channel string `json:"channel"` +} + // ChannelCreate describes a request to create a new channel type ChannelCreate struct { // ChannelCreateRequest is the request for creating the channel diff --git a/server/bridge.go b/server/bridge.go index f61c9e0..952a882 100644 --- a/server/bridge.go +++ b/server/bridge.go @@ -3,9 +3,9 @@ package server import ( "context" - "github.com/CyCoreSystems/ari" "github.com/CyCoreSystems/ari-proxy/proxy" - "github.com/CyCoreSystems/ari/rid" + rid "github.com/CyCoreSystems/ari-rid" + "github.com/CyCoreSystems/ari/v5" ) func (s *Server) bridgeAddChannel(ctx context.Context, reply string, req *proxy.Request) { @@ -27,7 +27,6 @@ func (s *Server) bridgeAddChannel(ctx context.Context, reply string, req *proxy. } func (s *Server) bridgeCreate(ctx context.Context, reply string, req *proxy.Request) { - // bind dialog if req.Key.Dialog != "" { s.Dialog.Bind(req.Key.Dialog, "bridge", req.Key.ID) @@ -114,7 +113,6 @@ func (s *Server) bridgeList(ctx context.Context, reply string, req *proxy.Reques } func (s *Server) bridgeMOH(ctx context.Context, reply string, req *proxy.Request) { - // bind dialog if req.Key.Dialog != "" { s.Dialog.Bind(req.Key.Dialog, "bridge", req.Key.ID) @@ -127,7 +125,6 @@ func (s *Server) bridgeMOH(ctx context.Context, reply string, req *proxy.Request } func (s *Server) bridgeStopMOH(ctx context.Context, reply string, req *proxy.Request) { - // bind dialog if req.Key.Dialog != "" { s.Dialog.Bind(req.Key.Dialog, "bridge", req.Key.ID) @@ -140,7 +137,6 @@ func (s *Server) bridgeStopMOH(ctx context.Context, reply string, req *proxy.Req } func (s *Server) bridgePlay(ctx context.Context, reply string, req *proxy.Request) { - // bind dialog if req.Key.Dialog != "" { s.Dialog.Bind(req.Key.Dialog, "bridge", req.Key.ID) @@ -246,7 +242,6 @@ func (s *Server) bridgeRemoveChannel(ctx context.Context, reply string, req *pro } func (s *Server) bridgeSubscribe(ctx context.Context, reply string, req *proxy.Request) { - // bind dialog if req.Key.Dialog != "" { s.Dialog.Bind(req.Key.Dialog, "bridge", req.Key.ID) @@ -259,3 +254,34 @@ func (s *Server) bridgeUnsubscribe(ctx context.Context, reply string, req *proxy // no-op for now; may want to eventually optimize away the dialog subscription s.sendError(reply, nil) } + +func (s *Server) bridgeVideoSource(ctx context.Context, reply string, req *proxy.Request) { + // bind dialog + if req.Key.Dialog != "" { + s.Dialog.Bind(req.Key.Dialog, "bridge", req.Key.ID) + s.Dialog.Bind(req.Key.Dialog, "channel", req.VideoSource.Channel) + } + + err := s.ari.Bridge().VideoSource(req.Key, req.VideoSource.Channel) + if err != nil { + s.sendError(reply, err) + return + } + + s.sendError(reply, nil) +} + +func (s *Server) bridgeVideoSourceDelete(ctx context.Context, reply string, req *proxy.Request) { + // bind dialog + if req.Key.Dialog != "" { + s.Dialog.Bind(req.Key.Dialog, "bridge", req.Key.ID) + } + + err := s.ari.Bridge().VideoSourceDelete(req.Key) + if err != nil { + s.sendError(reply, err) + return + } + + s.sendError(reply, nil) +} diff --git a/server/channel.go b/server/channel.go index aa12abb..15c15a1 100644 --- a/server/channel.go +++ b/server/channel.go @@ -4,9 +4,9 @@ import ( "context" "errors" - "github.com/CyCoreSystems/ari" "github.com/CyCoreSystems/ari-proxy/proxy" - "github.com/CyCoreSystems/ari/rid" + rid "github.com/CyCoreSystems/ari-rid" + "github.com/CyCoreSystems/ari/v5" ) func (s *Server) channelAnswer(ctx context.Context, reply string, req *proxy.Request) { diff --git a/server/clientserver_test.go b/server/clientserver_test.go index f8667d7..b5139d8 100644 --- a/server/clientserver_test.go +++ b/server/clientserver_test.go @@ -7,9 +7,9 @@ import ( "time" - "github.com/CyCoreSystems/ari" "github.com/CyCoreSystems/ari-proxy/client" - "github.com/CyCoreSystems/ari/rid" + "github.com/CyCoreSystems/ari/v5" + "github.com/CyCoreSystems/ari/v5/rid" "github.com/nats-io/nats.go" ) diff --git a/server/events.go b/server/events.go index 5104aa3..6ff1a77 100644 --- a/server/events.go +++ b/server/events.go @@ -1,6 +1,6 @@ package server -import "github.com/CyCoreSystems/ari" +import "github.com/CyCoreSystems/ari/v5" func (s *Server) dialogsForEvent(e ari.Event) (ret []string) { for _, k := range e.Keys() { diff --git a/server/server.go b/server/server.go index 72f7cae..78cc513 100644 --- a/server/server.go +++ b/server/server.go @@ -5,10 +5,10 @@ import ( "fmt" "time" - "github.com/CyCoreSystems/ari" "github.com/CyCoreSystems/ari-proxy/proxy" "github.com/CyCoreSystems/ari-proxy/server/dialog" - "github.com/CyCoreSystems/ari/client/native" + "github.com/CyCoreSystems/ari/v5" + "github.com/CyCoreSystems/ari/v5/client/native" "github.com/inconshreveable/log15" "github.com/nats-io/nats.go" diff --git a/session/transport.go b/session/transport.go index 009acdf..0c2ddac 100644 --- a/session/transport.go +++ b/session/transport.go @@ -1,6 +1,6 @@ package session -import "github.com/CyCoreSystems/ari" +import "github.com/CyCoreSystems/ari/v5" // Transport defines how the commands and events are sent. type Transport interface {