twilioclient

package
v0.0.0-...-857d226 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 15, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Example
package main

import (
	"fmt"
	"log"
	"time"

	"github.com/saintpete/twilio-go/twilioclient"
)

func main() {
	cap := twilioclient.NewCapability("AC123", "123")
	cap.AllowClientIncoming("client-name")
	tok, err := cap.GenerateToken(time.Hour)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(tok)
}
Output:

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Capability

type Capability struct {
	// contains filtered or unexported fields
}

func NewCapability

func NewCapability(sid, token string) *Capability

func (*Capability) AllowClientIncoming

func (c *Capability) AllowClientIncoming(clientName string)

Registers this client to accept incoming calls by the given `clientName`. If your app TwiML <Dial>s `clientName`, this client will receive the call.

func (*Capability) AllowClientOutgoing

func (c *Capability) AllowClientOutgoing(appSid string, appParams map[string]string)

Allows this client to call your application with id `appSid` (See https://www.twilio.com/user/account/apps). When the call connects, Twilio will call your voiceUrl REST endpoint. The `appParams` argument will get passed through to your voiceUrl REST endpoint as GET or POST parameters.

func (*Capability) AllowEventStream

func (c *Capability) AllowEventStream(filters map[string]string)

func (*Capability) GenerateToken

func (c *Capability) GenerateToken(ttl time.Duration) (string, error)

Generate the twilio capability token. Deliver this token to your JS/iOS/Android Twilio client.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL