Skip to content

Commit

Permalink
update to ari 5 release
Browse files Browse the repository at this point in the history
  • Loading branch information
Ulexus committed Mar 7, 2020
1 parent 9ba2278 commit ab115eb
Show file tree
Hide file tree
Showing 49 changed files with 183 additions and 223 deletions.
11 changes: 5 additions & 6 deletions _examples/bridge/main.go
Original file line number Diff line number Diff line change
@@ -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"
)

Expand Down Expand Up @@ -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 {
Expand Down
8 changes: 4 additions & 4 deletions _examples/play/main.go
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -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 {
Expand Down
8 changes: 4 additions & 4 deletions _examples/record/main.go
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -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,
Expand Down
8 changes: 3 additions & 5 deletions _examples/stasisStart/main.go
Original file line number Diff line number Diff line change
@@ -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"
)
Expand Down Expand Up @@ -124,7 +123,6 @@ func channelHandler(h *ari.ChannelHandle, startEvent *ari.StasisStart) {
log.Info("New Channel State", "state", v.Channel.State)
}
}

}()

h.Answer()
Expand Down
2 changes: 1 addition & 1 deletion client/application.go
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion client/asterisk.go
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
21 changes: 19 additions & 2 deletions client/bridge.go
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down Expand Up @@ -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,
})
}
2 changes: 1 addition & 1 deletion client/bus/bus.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion client/bus/bus_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

"github.com/inconshreveable/log15"

"github.com/CyCoreSystems/ari"
"github.com/CyCoreSystems/ari/v5"
)

func TestMatchEvent(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions client/channel.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
5 changes: 2 additions & 3 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
}
Expand Down
4 changes: 2 additions & 2 deletions client/clientserver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down
3 changes: 1 addition & 2 deletions client/cluster/cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"testing"
"time"

"github.com/CyCoreSystems/ari/rid"
rid "github.com/CyCoreSystems/ari-rid"
)

func TestHash(t *testing.T) {
Expand Down Expand Up @@ -106,5 +106,4 @@ func TestPurge(t *testing.T) {
if len(list) != 2 {
t.Errorf("Incorrect number of cluster members: %d != 2", len(list))
}

}
2 changes: 1 addition & 1 deletion client/config.go
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion client/device.go
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion client/endpoint.go
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion client/listen.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down
3 changes: 1 addition & 2 deletions client/liveRecording.go
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion client/logging.go
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion client/mailbox.go
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion client/modules.go
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion client/playback.go
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion client/sound.go
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion client/storedRecording.go
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
6 changes: 2 additions & 4 deletions cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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)
Expand Down Expand Up @@ -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")
Expand All @@ -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)

}
Loading

0 comments on commit ab115eb

Please sign in to comment.