diff --git a/twiml/message/message/message-1/message-1.1.x.go b/twiml/message/message/message-1/message-1.1.x.go new file mode 100644 index 0000000000..dd55821725 --- /dev/null +++ b/twiml/message/message/message-1/message-1.1.x.go @@ -0,0 +1,19 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + response := &twiml.MessagingMessage{} + response.Body = "Store Location: 123 Easy St." + + twimlResult, err := twiml.Messages([]twiml.Element{response}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/message/message/message-2/message-2.1.x.go b/twiml/message/message/message-2/message-2.1.x.go new file mode 100644 index 0000000000..085610ecbe --- /dev/null +++ b/twiml/message/message/message-2/message-2.1.x.go @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + response := &twiml.MessagingMessage{} + + responseBody := &twiml.MessagingBody{} + responseBody.Message = "Store Location: 123 Easy St." + + responseMedia := &twiml.MessagingMedia{} + responseMedia.Url = "https://demo.twilio.com/owl.png" + + response.InnerElements = []twiml.Element{responseBody, responseMedia} + + twimlResult, err := twiml.Messages([]twiml.Element{response}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/message/message/message-3/message-3.1.x.go b/twiml/message/message/message-3/message-3.1.x.go new file mode 100644 index 0000000000..ed5b29dad2 --- /dev/null +++ b/twiml/message/message/message-3/message-3.1.x.go @@ -0,0 +1,22 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + response := &twiml.MessagingMessage{} + + response.Body = "Store Location: 123 Easy St." + response.Action = "/SmsHandler.php" + response.Method = "POST" + + twimlResult, err := twiml.Messages([]twiml.Element{response}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/message/message/message-4/message-4.1.x.go b/twiml/message/message/message-4/message-4.1.x.go new file mode 100644 index 0000000000..1694786ef7 --- /dev/null +++ b/twiml/message/message/message-4/message-4.1.x.go @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + response := &twiml.MessagingMessage{} + + responseBody := &twiml.MessagingBody{} + responseBody.Message = "Hello friend" + + responseMedia := &twiml.MessagingMedia{} + responseMedia.Url = "https://demo.twilio.com/owl.png" + + response.InnerElements = []twiml.Element{responseBody, responseMedia} + + twimlResult, err := twiml.Messages([]twiml.Element{response}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/message/redirect/redirect-1/redirect-1.1.x.go b/twiml/message/redirect/redirect-1/redirect-1.1.x.go new file mode 100644 index 0000000000..1e1454bcd6 --- /dev/null +++ b/twiml/message/redirect/redirect-1/redirect-1.1.x.go @@ -0,0 +1,20 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + response := &twiml.MessagingRedirect{} + + response.Url = "http://www.example.com/nextInstructions" + + twimlResult, err := twiml.Messages([]twiml.Element{response}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/message/redirect/redirect-2/redirect-2.1.x.go b/twiml/message/redirect/redirect-2/redirect-2.1.x.go new file mode 100644 index 0000000000..27cee8345b --- /dev/null +++ b/twiml/message/redirect/redirect-2/redirect-2.1.x.go @@ -0,0 +1,20 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + response := &twiml.MessagingRedirect{} + + response.Url = "../nextInstructions" + + twimlResult, err := twiml.Messages([]twiml.Element{response}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/message/your-response/your-response-1/your-response-1.1.x.go b/twiml/message/your-response/your-response-1/your-response-1.1.x.go new file mode 100644 index 0000000000..f49f982581 --- /dev/null +++ b/twiml/message/your-response/your-response-1/your-response-1.1.x.go @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + message := &twiml.MessagingMessage{} + + msgBody := &twiml.MessagingBody{} + msgBody.Message = "Hello World!" + + message.InnerElements = []twiml.Element{msgBody} + + redirect := &twiml.MessagingRedirect{} + redirect.Url = "https://demo.twilio.com/welcome/sms/" + + twimlResult, err := twiml.Messages([]twiml.Element{message, redirect}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/message/your-response/your-response-2/your-response-2.1.x.go b/twiml/message/your-response/your-response-2/your-response-2.1.x.go new file mode 100644 index 0000000000..e83f77f416 --- /dev/null +++ b/twiml/message/your-response/your-response-2/your-response-2.1.x.go @@ -0,0 +1,22 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + message1 := &twiml.MessagingMessage{} + message1.Body = "This is message 1 of 2." + + message2 := &twiml.MessagingMessage{} + message2.Body = "This is message 2 of 2." + + twimlResult, err := twiml.Messages([]twiml.Element{message1, message2}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/message/your-response/your-response-3/your-response-3.1.x.go b/twiml/message/your-response/your-response-3/your-response-3.1.x.go new file mode 100644 index 0000000000..0f733b2f15 --- /dev/null +++ b/twiml/message/your-response/your-response-3/your-response-3.1.x.go @@ -0,0 +1,19 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + msg := &twiml.MessagingMessage{} + msg.Body = "I'm hungry!" + + twimlResult, err := twiml.Messages([]twiml.Element{msg}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/application/dial-application-basic/dial-application-basic.1.x.go b/twiml/voice/application/dial-application-basic/dial-application-basic.1.x.go new file mode 100644 index 0000000000..f0e70be26c --- /dev/null +++ b/twiml/voice/application/dial-application-basic/dial-application-basic.1.x.go @@ -0,0 +1,24 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + dial := &twiml.VoiceDial{} + application := &twiml.VoiceApplication{} + applicationSid := &twiml.VoiceApplicationSid{} + applicationSid.Sid = "AP1234567890abcdef1234567890abcd" + + application.InnerElements = []twiml.Element{applicationSid} + dial.InnerElements = []twiml.Element{application} + + twimlResult, err := twiml.Voice([]twiml.Element{dial}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/application/dial-application-copyparentto/dial-application-copyparentto.1.x.go b/twiml/voice/application/dial-application-copyparentto/dial-application-copyparentto.1.x.go new file mode 100644 index 0000000000..e4434f582e --- /dev/null +++ b/twiml/voice/application/dial-application-copyparentto/dial-application-copyparentto.1.x.go @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + dial := &twiml.VoiceDial{} + application := &twiml.VoiceApplication{} + application.CopyParentTo = "true" + + applicationSid := &twiml.VoiceApplicationSid{} + applicationSid.Sid = "AP1234567890abcdef1234567890abcd" + + application.InnerElements = []twiml.Element{applicationSid} + dial.InnerElements = []twiml.Element{application} + + twimlResult, err := twiml.Voice([]twiml.Element{dial}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/application/dial-application-customerid/dial-application-customerid.1.x.go b/twiml/voice/application/dial-application-customerid/dial-application-customerid.1.x.go new file mode 100644 index 0000000000..ede4591869 --- /dev/null +++ b/twiml/voice/application/dial-application-customerid/dial-application-customerid.1.x.go @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + dial := &twiml.VoiceDial{} + application := &twiml.VoiceApplication{} + application.CustomerId = "CustomerFriendlyName" + + applicationSid := &twiml.VoiceApplicationSid{} + applicationSid.Sid = "AP1234567890abcdef1234567890abcd" + + application.InnerElements = []twiml.Element{applicationSid} + dial.InnerElements = []twiml.Element{application} + + twimlResult, err := twiml.Voice([]twiml.Element{dial}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/application/dial-application-parameter/dial-application-parameter.1.x.go b/twiml/voice/application/dial-application-parameter/dial-application-parameter.1.x.go new file mode 100644 index 0000000000..9a27ac01dd --- /dev/null +++ b/twiml/voice/application/dial-application-parameter/dial-application-parameter.1.x.go @@ -0,0 +1,34 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + dial := &twiml.VoiceDial{} + application := &twiml.VoiceApplication{} + + applicationSid := &twiml.VoiceApplicationSid{} + applicationSid.Sid = "AP1234567890abcdef1234567890abcd" + + parameter1 := &twiml.VoiceParameter{} + parameter1.Name = "AccountNumber" + parameter1.Value = "12345" + + parameter2 := &twiml.VoiceParameter{ + Name: "TicketNumber", + Value: "9876", + } + + application.InnerElements = []twiml.Element{applicationSid, parameter1, parameter2} + dial.InnerElements = []twiml.Element{application} + + twimlResult, err := twiml.Voice([]twiml.Element{dial}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/application/hangup-parameter-scenario/hangup-parameter-scenario.1.x.go b/twiml/voice/application/hangup-parameter-scenario/hangup-parameter-scenario.1.x.go new file mode 100644 index 0000000000..35911c3393 --- /dev/null +++ b/twiml/voice/application/hangup-parameter-scenario/hangup-parameter-scenario.1.x.go @@ -0,0 +1,40 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + say1 := &twiml.VoiceSay{ + Message: "We're sorry. All of our agents are busy right now.", + } + + say2 := &twiml.VoiceSay{ + Message: "We will call you back as soon as possible.", + } + + say3 := &twiml.VoiceSay{ + Message: "Please stay on the line to be redirected to the main menu.", + } + + hangup := &twiml.VoiceHangup{} + parameter := &twiml.VoiceParameter{} + parameter.Name = "payment_collected" + parameter.Value = "false" + + hangup.InnerElements = []twiml.Element{parameter} + + twimlResult, err := twiml.Voice([]twiml.Element{ + say1, + say2, + say3, + hangup, + }) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/application/hangup-parameter/hangup-parameter.1.x.go b/twiml/voice/application/hangup-parameter/hangup-parameter.1.x.go new file mode 100644 index 0000000000..4ead480177 --- /dev/null +++ b/twiml/voice/application/hangup-parameter/hangup-parameter.1.x.go @@ -0,0 +1,24 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + hangup := &twiml.VoiceHangup{} + + parameter := &twiml.VoiceParameter{} + parameter.Name = "hangup_reason" + parameter.Value = "no agents available" + + hangup.InnerElements = []twiml.Element{parameter} + + twimlResult, err := twiml.Voice([]twiml.Element{hangup}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/application/reject-parameter/reject-parameter.1.x.go b/twiml/voice/application/reject-parameter/reject-parameter.1.x.go new file mode 100644 index 0000000000..9f7ba9884b --- /dev/null +++ b/twiml/voice/application/reject-parameter/reject-parameter.1.x.go @@ -0,0 +1,24 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + reject := &twiml.VoiceReject{} + + parameter := &twiml.VoiceParameter{} + parameter.Name = "reject_reason" + parameter.Value = "no agents available" + + reject.InnerElements = []twiml.Element{parameter} + + twimlResult, err := twiml.Voice([]twiml.Element{reject}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/client/client-1/client-1.1.x.go b/twiml/voice/client/client-1/client-1.1.x.go new file mode 100644 index 0000000000..5c3dfd2d90 --- /dev/null +++ b/twiml/voice/client/client-1/client-1.1.x.go @@ -0,0 +1,22 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + dial := &twiml.VoiceDial{} + client := &twiml.VoiceClient{} + client.Identity = "joey" + + dial.InnerElements = []twiml.Element{client} + + twimlResult, err := twiml.Voice([]twiml.Element{dial}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/client/client-2/client-2.1.x.go b/twiml/voice/client/client-2/client-2.1.x.go new file mode 100644 index 0000000000..62244aff3a --- /dev/null +++ b/twiml/voice/client/client-2/client-2.1.x.go @@ -0,0 +1,31 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + dial := &twiml.VoiceDial{} + dial.CallerId = "+1888XXXXXXX" + + number := &twiml.VoiceNumber{ + PhoneNumber: "858-987-6543", + } + + client1 := &twiml.VoiceClient{} + client1.Identity = "joey" + + client2 := &twiml.VoiceClient{} + client2.Identity = "charlie" + + dial.InnerElements = []twiml.Element{number, client1, client2} + + twimlResult, err := twiml.Voice([]twiml.Element{dial}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/client/client-3/client-3.1.x.go b/twiml/voice/client/client-3/client-3.1.x.go new file mode 100644 index 0000000000..f63ad53231 --- /dev/null +++ b/twiml/voice/client/client-3/client-3.1.x.go @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + dial := &twiml.VoiceDial{} + + client := &twiml.VoiceClient{} + client.Identity = "joey" + client.StatusCallbackEvent = "initiated ringing answered completed" + client.StatusCallback = "https://myapp.com/calls/events" + client.StatusCallbackMethod = "POST" + + dial.InnerElements = []twiml.Element{client} + + twimlResult, err := twiml.Voice([]twiml.Element{dial}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/conference/conference-1/conference-1.1.x.go b/twiml/voice/conference/conference-1/conference-1.1.x.go new file mode 100644 index 0000000000..041f19f772 --- /dev/null +++ b/twiml/voice/conference/conference-1/conference-1.1.x.go @@ -0,0 +1,23 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + dial := &twiml.VoiceDial{} + + conference := &twiml.VoiceConference{} + conference.Name = "Room 1234" + + dial.InnerElements = []twiml.Element{conference} + + twimlResult, err := twiml.Voice([]twiml.Element{dial}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/conference/conference-10/conference-10.1.x.go b/twiml/voice/conference/conference-10/conference-10.1.x.go new file mode 100644 index 0000000000..f842c96b97 --- /dev/null +++ b/twiml/voice/conference/conference-10/conference-10.1.x.go @@ -0,0 +1,25 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + dial := &twiml.VoiceDial{} + + conference := &twiml.VoiceConference{} + conference.Name = "LoveTwilio" + conference.Record = "record-from-start" + conference.RecordingStatusCallback = "www.myexample.com" + + dial.InnerElements = []twiml.Element{conference} + + twimlResult, err := twiml.Voice([]twiml.Element{dial}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/conference/conference-2/conference-2.1.x.go b/twiml/voice/conference/conference-2/conference-2.1.x.go new file mode 100644 index 0000000000..624b41d098 --- /dev/null +++ b/twiml/voice/conference/conference-2/conference-2.1.x.go @@ -0,0 +1,24 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + dial := &twiml.VoiceDial{} + + conference := &twiml.VoiceConference{} + conference.StartConferenceOnEnter = "false" + conference.Name = "moderated-conference-room" + + dial.InnerElements = []twiml.Element{conference} + + twimlResult, err := twiml.Voice([]twiml.Element{dial}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/conference/conference-3/conference-3.1.x.go b/twiml/voice/conference/conference-3/conference-3.1.x.go new file mode 100644 index 0000000000..a67073601a --- /dev/null +++ b/twiml/voice/conference/conference-3/conference-3.1.x.go @@ -0,0 +1,25 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + dial := &twiml.VoiceDial{} + + conference := &twiml.VoiceConference{} + conference.Name = "moderated-conference-room" + conference.StartConferenceOnEnter = "true" + conference.EndConferenceOnExit = "true" + + dial.InnerElements = []twiml.Element{conference} + + twimlResult, err := twiml.Voice([]twiml.Element{dial}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/conference/conference-4/conference-4.1.x.go b/twiml/voice/conference/conference-4/conference-4.1.x.go new file mode 100644 index 0000000000..6f0b3b1660 --- /dev/null +++ b/twiml/voice/conference/conference-4/conference-4.1.x.go @@ -0,0 +1,25 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + dial := &twiml.VoiceDial{} + + conference := &twiml.VoiceConference{} + conference.Name = "EventedConf" + conference.StatusCallback = "https://myapp.com/events" + conference.StatusCallbackEvent = "start end join leave mute hold" + + dial.InnerElements = []twiml.Element{conference} + + twimlResult, err := twiml.Voice([]twiml.Element{dial}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/conference/conference-5/conference-5.1.x.go b/twiml/voice/conference/conference-5/conference-5.1.x.go new file mode 100644 index 0000000000..d5d7781aea --- /dev/null +++ b/twiml/voice/conference/conference-5/conference-5.1.x.go @@ -0,0 +1,24 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + dial := &twiml.VoiceDial{} + + conference := &twiml.VoiceConference{} + conference.Name = "SimpleRoom" + conference.Muted = "true" + + dial.InnerElements = []twiml.Element{conference} + + twimlResult, err := twiml.Voice([]twiml.Element{dial}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/conference/conference-6/conference-6.1.x.go b/twiml/voice/conference/conference-6/conference-6.1.x.go new file mode 100644 index 0000000000..d038d03947 --- /dev/null +++ b/twiml/voice/conference/conference-6/conference-6.1.x.go @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + dial := &twiml.VoiceDial{} + + conference := &twiml.VoiceConference{} + conference.Name = "NoMusicNoBeepRoom" + conference.Beep = "false" + conference.WaitUrl = "http://your-webhook-host.com" + conference.StartConferenceOnEnter = "true" + conference.EndConferenceOnExit = "true" + + dial.InnerElements = []twiml.Element{conference} + + twimlResult, err := twiml.Voice([]twiml.Element{dial}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/conference/conference-7/conference-7.1.x.go b/twiml/voice/conference/conference-7/conference-7.1.x.go new file mode 100644 index 0000000000..30b7d47e73 --- /dev/null +++ b/twiml/voice/conference/conference-7/conference-7.1.x.go @@ -0,0 +1,24 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + dial := &twiml.VoiceDial{} + + conference := &twiml.VoiceConference{} + conference.Name = "Customer Waiting Room" + conference.Beep = "false" + + dial.InnerElements = []twiml.Element{conference} + + twimlResult, err := twiml.Voice([]twiml.Element{dial}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/conference/conference-8/conference-8.1.x.go b/twiml/voice/conference/conference-8/conference-8.1.x.go new file mode 100644 index 0000000000..632e13d5ad --- /dev/null +++ b/twiml/voice/conference/conference-8/conference-8.1.x.go @@ -0,0 +1,25 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + dial := &twiml.VoiceDial{} + + conference := &twiml.VoiceConference{} + conference.Name = "Customer Waiting Room" + conference.Beep = "false" + conference.EndConferenceOnExit = "true" + + dial.InnerElements = []twiml.Element{conference} + + twimlResult, err := twiml.Voice([]twiml.Element{dial}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/conference/conference-9/conference-9.1.x.go b/twiml/voice/conference/conference-9/conference-9.1.x.go new file mode 100644 index 0000000000..047d9e82ff --- /dev/null +++ b/twiml/voice/conference/conference-9/conference-9.1.x.go @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + dial := &twiml.VoiceDial{} + dial.Action = "handleLeaveConference.php" + dial.Method = "POST" + dial.HangupOnStar = "true" + dial.TimeLimit = "30" + + conference := &twiml.VoiceConference{} + conference.Name = "LoveTwilio" + + dial.InnerElements = []twiml.Element{conference} + + twimlResult, err := twiml.Voice([]twiml.Element{dial}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/connect/autopilot/connect-1.1.x.go b/twiml/voice/connect/autopilot/connect-1.1.x.go new file mode 100644 index 0000000000..dd4afb30e5 --- /dev/null +++ b/twiml/voice/connect/autopilot/connect-1.1.x.go @@ -0,0 +1,23 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + connect := &twiml.VoiceConnect{} + + autopilot := &twiml.VoiceAutopilot{} + autopilot.Name = "UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" + + connect.InnerElements = []twiml.Element{autopilot} + + twimlResult, err := twiml.Voice([]twiml.Element{connect}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/connect/connect-1/connect-1.1.x.go b/twiml/voice/connect/connect-1/connect-1.1.x.go new file mode 100644 index 0000000000..9b0724371d --- /dev/null +++ b/twiml/voice/connect/connect-1/connect-1.1.x.go @@ -0,0 +1,23 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + connect := &twiml.VoiceConnect{} + + room := &twiml.VoiceRoom{} + room.Name = "DailyStandup" + + connect.InnerElements = []twiml.Element{room} + + twimlResult, err := twiml.Voice([]twiml.Element{connect}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/connect/connect-2/connect-2.1.x.go b/twiml/voice/connect/connect-2/connect-2.1.x.go new file mode 100644 index 0000000000..4f104b5731 --- /dev/null +++ b/twiml/voice/connect/connect-2/connect-2.1.x.go @@ -0,0 +1,24 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + connect := &twiml.VoiceConnect{} + + room := &twiml.VoiceRoom{} + room.Name = "DailyStandup" + room.ParticipantIdentity = "alice" + + connect.InnerElements = []twiml.Element{room} + + twimlResult, err := twiml.Voice([]twiml.Element{connect}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/connect/conversation/conversation-action-method/conversation-action-method.1.x.go b/twiml/voice/connect/conversation/conversation-action-method/conversation-action-method.1.x.go new file mode 100644 index 0000000000..676d9b75ae --- /dev/null +++ b/twiml/voice/connect/conversation/conversation-action-method/conversation-action-method.1.x.go @@ -0,0 +1,25 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + connect := &twiml.VoiceConnect{} + connect.Action = "https://example.com/yourActionUrl" + connect.Method = "GET" + + conversation := &twiml.VoiceConversation{} + conversation.ServiceInstanceSid = "ISxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + + connect.InnerElements = []twiml.Element{conversation} + + twimlResult, err := twiml.Voice([]twiml.Element{connect}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/connect/conversation/conversation-action-method/output/conversation-action-method.twiml b/twiml/voice/connect/conversation/conversation-action-method/output/conversation-action-method.twiml index 7714db2031..f2cce26327 100644 --- a/twiml/voice/connect/conversation/conversation-action-method/output/conversation-action-method.twiml +++ b/twiml/voice/connect/conversation/conversation-action-method/output/conversation-action-method.twiml @@ -1,3 +1,4 @@ + diff --git a/twiml/voice/connect/conversation/conversation-action-statuscallback/conversation-action-statuscallback.1.x.go b/twiml/voice/connect/conversation/conversation-action-statuscallback/conversation-action-statuscallback.1.x.go new file mode 100644 index 0000000000..64b50eed23 --- /dev/null +++ b/twiml/voice/connect/conversation/conversation-action-statuscallback/conversation-action-statuscallback.1.x.go @@ -0,0 +1,25 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + connect := &twiml.VoiceConnect{} + connect.Action = "https://example.com/yourActionUrl" + + conversation := &twiml.VoiceConversation{} + conversation.ServiceInstanceSid = "ISxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + conversation.StatusCallback = "https://example.com/yourStatusCallback" + + connect.InnerElements = []twiml.Element{conversation} + + twimlResult, err := twiml.Voice([]twiml.Element{connect}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/connect/conversation/conversation-action-statuscallback/output/conversation-action-statuscallback.twiml b/twiml/voice/connect/conversation/conversation-action-statuscallback/output/conversation-action-statuscallback.twiml index f8098c8e82..665b40d52c 100644 --- a/twiml/voice/connect/conversation/conversation-action-statuscallback/output/conversation-action-statuscallback.twiml +++ b/twiml/voice/connect/conversation/conversation-action-statuscallback/output/conversation-action-statuscallback.twiml @@ -1,5 +1,6 @@ + - + diff --git a/twiml/voice/connect/conversation/conversation-action/conversation-action.1.x.go b/twiml/voice/connect/conversation/conversation-action/conversation-action.1.x.go new file mode 100644 index 0000000000..bef7802708 --- /dev/null +++ b/twiml/voice/connect/conversation/conversation-action/conversation-action.1.x.go @@ -0,0 +1,24 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + connect := &twiml.VoiceConnect{} + connect.Action = "https://example.com/yourActionUrl" + + conversation := &twiml.VoiceConversation{} + conversation.ServiceInstanceSid = "ISxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + + connect.InnerElements = []twiml.Element{conversation} + + twimlResult, err := twiml.Voice([]twiml.Element{connect}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/connect/conversation/conversation-action/output/conversation-action.twiml b/twiml/voice/connect/conversation/conversation-action/output/conversation-action.twiml index ca8171a412..0221a79a32 100644 --- a/twiml/voice/connect/conversation/conversation-action/output/conversation-action.twiml +++ b/twiml/voice/connect/conversation/conversation-action/output/conversation-action.twiml @@ -1,3 +1,4 @@ + diff --git a/twiml/voice/connect/conversation/conversation-basic/conversation-basic.1.x.go b/twiml/voice/connect/conversation/conversation-basic/conversation-basic.1.x.go new file mode 100644 index 0000000000..62db750eac --- /dev/null +++ b/twiml/voice/connect/conversation/conversation-basic/conversation-basic.1.x.go @@ -0,0 +1,23 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + connect := &twiml.VoiceConnect{} + + conversation := &twiml.VoiceConversation{} + conversation.ServiceInstanceSid = "ISxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + + connect.InnerElements = []twiml.Element{conversation} + + twimlResult, err := twiml.Voice([]twiml.Element{connect}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/connect/conversation/conversation-basic/output/conversation-basic.twiml b/twiml/voice/connect/conversation/conversation-basic/output/conversation-basic.twiml index cbdf88f001..2ca44293be 100644 --- a/twiml/voice/connect/conversation/conversation-basic/output/conversation-basic.twiml +++ b/twiml/voice/connect/conversation/conversation-basic/output/conversation-basic.twiml @@ -1,5 +1,6 @@ + - + diff --git a/twiml/voice/connect/conversation/conversation-inboundautocreation-routingassignmenttimeout/conversation-inboundautocreationtimeout.1.x.go b/twiml/voice/connect/conversation/conversation-inboundautocreation-routingassignmenttimeout/conversation-inboundautocreationtimeout.1.x.go new file mode 100644 index 0000000000..583967fe6c --- /dev/null +++ b/twiml/voice/connect/conversation/conversation-inboundautocreation-routingassignmenttimeout/conversation-inboundautocreationtimeout.1.x.go @@ -0,0 +1,25 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + connect := &twiml.VoiceConnect{} + + conversation := &twiml.VoiceConversation{} + conversation.ServiceInstanceSid = "ISxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + conversation.InboundAutocreation = "true" + conversation.RoutingAssignmentTimeout = "10" + + connect.InnerElements = []twiml.Element{conversation} + + twimlResult, err := twiml.Voice([]twiml.Element{connect}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/connect/conversation/conversation-inboundautocreation-routingassignmenttimeout/output/conversation-inboundautocreation-routingassignmenttimeout.twiml b/twiml/voice/connect/conversation/conversation-inboundautocreation-routingassignmenttimeout/output/conversation-inboundautocreation-routingassignmenttimeout.twiml index 4ad54a5f7c..37b217e774 100644 --- a/twiml/voice/connect/conversation/conversation-inboundautocreation-routingassignmenttimeout/output/conversation-inboundautocreation-routingassignmenttimeout.twiml +++ b/twiml/voice/connect/conversation/conversation-inboundautocreation-routingassignmenttimeout/output/conversation-inboundautocreation-routingassignmenttimeout.twiml @@ -1,3 +1,4 @@ + diff --git a/twiml/voice/connect/conversation/conversation-inboundautocreation/conversation-inboundautocreation.1.x.go b/twiml/voice/connect/conversation/conversation-inboundautocreation/conversation-inboundautocreation.1.x.go new file mode 100644 index 0000000000..ad9fe5f01b --- /dev/null +++ b/twiml/voice/connect/conversation/conversation-inboundautocreation/conversation-inboundautocreation.1.x.go @@ -0,0 +1,24 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + connect := &twiml.VoiceConnect{} + + conversation := &twiml.VoiceConversation{} + conversation.ServiceInstanceSid = "ISxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + conversation.InboundAutocreation = "true" + + connect.InnerElements = []twiml.Element{conversation} + + twimlResult, err := twiml.Voice([]twiml.Element{connect}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/connect/conversation/conversation-inboundautocreation/output/conversation-inboundautocreation.twiml b/twiml/voice/connect/conversation/conversation-inboundautocreation/output/conversation-inboundautocreation.twiml index 0e3b6320ef..1ab8d0b750 100644 --- a/twiml/voice/connect/conversation/conversation-inboundautocreation/output/conversation-inboundautocreation.twiml +++ b/twiml/voice/connect/conversation/conversation-inboundautocreation/output/conversation-inboundautocreation.twiml @@ -1,3 +1,4 @@ + diff --git a/twiml/voice/connect/conversation/conversation-inboundtimeout/conversation-inboundtimeout.1.x.go b/twiml/voice/connect/conversation/conversation-inboundtimeout/conversation-inboundtimeout.1.x.go new file mode 100644 index 0000000000..655a46a4f6 --- /dev/null +++ b/twiml/voice/connect/conversation/conversation-inboundtimeout/conversation-inboundtimeout.1.x.go @@ -0,0 +1,24 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + connect := &twiml.VoiceConnect{} + + conversation := &twiml.VoiceConversation{} + conversation.ServiceInstanceSid = "ISxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + conversation.InboundTimeout = "10" + + connect.InnerElements = []twiml.Element{conversation} + + twimlResult, err := twiml.Voice([]twiml.Element{connect}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/connect/conversation/conversation-inboundtimeout/output/conversation-inboundtimeout.twiml b/twiml/voice/connect/conversation/conversation-inboundtimeout/output/conversation-inboundtimeout.twiml index 9ba1ca2eb9..4dee312a9e 100644 --- a/twiml/voice/connect/conversation/conversation-inboundtimeout/output/conversation-inboundtimeout.twiml +++ b/twiml/voice/connect/conversation/conversation-inboundtimeout/output/conversation-inboundtimeout.twiml @@ -1,3 +1,4 @@ + diff --git a/twiml/voice/connect/conversation/conversation-record-recordingstatuscallback-and-event/conversation-record-recordingstatuscallback-and-event.1.x.go b/twiml/voice/connect/conversation/conversation-record-recordingstatuscallback-and-event/conversation-record-recordingstatuscallback-and-event.1.x.go new file mode 100644 index 0000000000..374da1ace0 --- /dev/null +++ b/twiml/voice/connect/conversation/conversation-record-recordingstatuscallback-and-event/conversation-record-recordingstatuscallback-and-event.1.x.go @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + connect := &twiml.VoiceConnect{} + + conversation := &twiml.VoiceConversation{} + conversation.ServiceInstanceSid = "ISxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + conversation.Record = "record-from-answer" + conversation.RecordingStatusCallback = "https://example.com/yourRecordingStatusCallback" + conversation.RecordingStatusCallbackEvent = "in-progress completed" + + connect.InnerElements = []twiml.Element{conversation} + + twimlResult, err := twiml.Voice([]twiml.Element{connect}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/connect/conversation/conversation-record-recordingstatuscallback-and-event/output/conversation-record-recordingstatuscallbackmethodevent.twiml b/twiml/voice/connect/conversation/conversation-record-recordingstatuscallback-and-event/output/conversation-record-recordingstatuscallbackmethodevent.twiml index 8603e6cb06..b4b6ca7287 100644 --- a/twiml/voice/connect/conversation/conversation-record-recordingstatuscallback-and-event/output/conversation-record-recordingstatuscallbackmethodevent.twiml +++ b/twiml/voice/connect/conversation/conversation-record-recordingstatuscallback-and-event/output/conversation-record-recordingstatuscallbackmethodevent.twiml @@ -1,3 +1,4 @@ + diff --git a/twiml/voice/connect/conversation/conversation-record-recordingstatuscallback-and-method/conversation-record-recordingstatuscallback-and-method.1.x.go b/twiml/voice/connect/conversation/conversation-record-recordingstatuscallback-and-method/conversation-record-recordingstatuscallback-and-method.1.x.go new file mode 100644 index 0000000000..33474b7fe3 --- /dev/null +++ b/twiml/voice/connect/conversation/conversation-record-recordingstatuscallback-and-method/conversation-record-recordingstatuscallback-and-method.1.x.go @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + connect := &twiml.VoiceConnect{} + + conversation := &twiml.VoiceConversation{} + conversation.ServiceInstanceSid = "ISxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + conversation.Record = "record-from-answer" + conversation.RecordingStatusCallback = "https://example.com/yourRecordingStatusCallback" + conversation.RecordingStatusCallbackMethod = "GET" + + connect.InnerElements = []twiml.Element{conversation} + + twimlResult, err := twiml.Voice([]twiml.Element{connect}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/connect/conversation/conversation-record-recordingstatuscallback-and-method/output/conversation-record-recordingstatuscallbackmethod.twiml b/twiml/voice/connect/conversation/conversation-record-recordingstatuscallback-and-method/output/conversation-record-recordingstatuscallbackmethod.twiml index 016df03ebb..987d232e04 100644 --- a/twiml/voice/connect/conversation/conversation-record-recordingstatuscallback-and-method/output/conversation-record-recordingstatuscallbackmethod.twiml +++ b/twiml/voice/connect/conversation/conversation-record-recordingstatuscallback-and-method/output/conversation-record-recordingstatuscallbackmethod.twiml @@ -1,3 +1,4 @@ + diff --git a/twiml/voice/connect/conversation/conversation-record-recordingstatuscallback/conversation-record-recordingstatuscallback.1.x.go b/twiml/voice/connect/conversation/conversation-record-recordingstatuscallback/conversation-record-recordingstatuscallback.1.x.go new file mode 100644 index 0000000000..6e6336a40d --- /dev/null +++ b/twiml/voice/connect/conversation/conversation-record-recordingstatuscallback/conversation-record-recordingstatuscallback.1.x.go @@ -0,0 +1,25 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + connect := &twiml.VoiceConnect{} + + conversation := &twiml.VoiceConversation{} + conversation.ServiceInstanceSid = "ISxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + conversation.Record = "record-from-answer" + conversation.RecordingStatusCallback = "https://example.com/yourRecordingStatusCallback" + + connect.InnerElements = []twiml.Element{conversation} + + twimlResult, err := twiml.Voice([]twiml.Element{connect}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/connect/conversation/conversation-record-recordingstatuscallback/output/conversation-record-recordingstatuscallback.twiml b/twiml/voice/connect/conversation/conversation-record-recordingstatuscallback/output/conversation-record-recordingstatuscallback.twiml index 023218b7e6..d8ca2fa97d 100644 --- a/twiml/voice/connect/conversation/conversation-record-recordingstatuscallback/output/conversation-record-recordingstatuscallback.twiml +++ b/twiml/voice/connect/conversation/conversation-record-recordingstatuscallback/output/conversation-record-recordingstatuscallback.twiml @@ -1,6 +1,6 @@ + - + - - \ No newline at end of file + diff --git a/twiml/voice/connect/conversation/conversation-record-trim/conversation-record-trim.1.x.go b/twiml/voice/connect/conversation/conversation-record-trim/conversation-record-trim.1.x.go new file mode 100644 index 0000000000..412b31360c --- /dev/null +++ b/twiml/voice/connect/conversation/conversation-record-trim/conversation-record-trim.1.x.go @@ -0,0 +1,25 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + connect := &twiml.VoiceConnect{} + + conversation := &twiml.VoiceConversation{} + conversation.ServiceInstanceSid = "ISxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + conversation.Record = "record-from-answer" + conversation.Trim = "trim-silence" + + connect.InnerElements = []twiml.Element{conversation} + + twimlResult, err := twiml.Voice([]twiml.Element{connect}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/connect/conversation/conversation-record-trim/output/conversation-record-trim.twiml b/twiml/voice/connect/conversation/conversation-record-trim/output/conversation-record-trim.twiml index c3d35c85a1..13d934231a 100644 --- a/twiml/voice/connect/conversation/conversation-record-trim/output/conversation-record-trim.twiml +++ b/twiml/voice/connect/conversation/conversation-record-trim/output/conversation-record-trim.twiml @@ -1,3 +1,4 @@ + diff --git a/twiml/voice/connect/conversation/conversation-record/conversation-record.1.x.go b/twiml/voice/connect/conversation/conversation-record/conversation-record.1.x.go new file mode 100644 index 0000000000..259a2f3273 --- /dev/null +++ b/twiml/voice/connect/conversation/conversation-record/conversation-record.1.x.go @@ -0,0 +1,24 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + connect := &twiml.VoiceConnect{} + + conversation := &twiml.VoiceConversation{} + conversation.ServiceInstanceSid = "ISxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + conversation.Record = "record-from-answer" + + connect.InnerElements = []twiml.Element{conversation} + + twimlResult, err := twiml.Voice([]twiml.Element{connect}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/connect/conversation/conversation-record/output/conversation-record.twiml b/twiml/voice/connect/conversation/conversation-record/output/conversation-record.twiml index c03fe2b523..613dcdc381 100644 --- a/twiml/voice/connect/conversation/conversation-record/output/conversation-record.twiml +++ b/twiml/voice/connect/conversation/conversation-record/output/conversation-record.twiml @@ -1,3 +1,4 @@ + diff --git a/twiml/voice/connect/conversation/conversation-statuscallback-statuscallbackevent/conversation-statuscallback-statuscallbackevent.1.x.go b/twiml/voice/connect/conversation/conversation-statuscallback-statuscallbackevent/conversation-statuscallback-statuscallbackevent.1.x.go new file mode 100644 index 0000000000..1c9fa393ce --- /dev/null +++ b/twiml/voice/connect/conversation/conversation-statuscallback-statuscallbackevent/conversation-statuscallback-statuscallbackevent.1.x.go @@ -0,0 +1,25 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + connect := &twiml.VoiceConnect{} + + conversation := &twiml.VoiceConversation{} + conversation.ServiceInstanceSid = "ISxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + conversation.StatusCallback = "https://example.com/yourStatusCallback" + conversation.StatusCallbackEvent = "call-initiated call-ringing call-answered call-completed" + + connect.InnerElements = []twiml.Element{conversation} + + twimlResult, err := twiml.Voice([]twiml.Element{connect}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/connect/conversation/conversation-statuscallback-statuscallbackevent/output/conversation-statuscallback-statuscallbackevent.twiml b/twiml/voice/connect/conversation/conversation-statuscallback-statuscallbackevent/output/conversation-statuscallback-statuscallbackevent.twiml index a242c4fc0e..be926694ea 100644 --- a/twiml/voice/connect/conversation/conversation-statuscallback-statuscallbackevent/output/conversation-statuscallback-statuscallbackevent.twiml +++ b/twiml/voice/connect/conversation/conversation-statuscallback-statuscallbackevent/output/conversation-statuscallback-statuscallbackevent.twiml @@ -1,5 +1,6 @@ + - + diff --git a/twiml/voice/connect/conversation/conversation-statuscallback-statuscallbackmethod/conversation-statuscallback-statuscallbackmethod.1.x.go b/twiml/voice/connect/conversation/conversation-statuscallback-statuscallbackmethod/conversation-statuscallback-statuscallbackmethod.1.x.go new file mode 100644 index 0000000000..769f2f0455 --- /dev/null +++ b/twiml/voice/connect/conversation/conversation-statuscallback-statuscallbackmethod/conversation-statuscallback-statuscallbackmethod.1.x.go @@ -0,0 +1,25 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + connect := &twiml.VoiceConnect{} + + conversation := &twiml.VoiceConversation{} + conversation.ServiceInstanceSid = "ISxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + conversation.StatusCallback = "https://example.com/yourStatusCallback" + conversation.StatusCallbackMethod = "GET" + + connect.InnerElements = []twiml.Element{conversation} + + twimlResult, err := twiml.Voice([]twiml.Element{connect}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/connect/conversation/conversation-statuscallback-statuscallbackmethod/output/conversation-statuscallback-statuscallbackmethod.twiml b/twiml/voice/connect/conversation/conversation-statuscallback-statuscallbackmethod/output/conversation-statuscallback-statuscallbackmethod.twiml index 8b4b9b8302..317176c88f 100644 --- a/twiml/voice/connect/conversation/conversation-statuscallback-statuscallbackmethod/output/conversation-statuscallback-statuscallbackmethod.twiml +++ b/twiml/voice/connect/conversation/conversation-statuscallback-statuscallbackmethod/output/conversation-statuscallback-statuscallbackmethod.twiml @@ -1,5 +1,6 @@ + - + diff --git a/twiml/voice/connect/conversation/conversation-statuscallback/conversation-statuscallback.1.x.go b/twiml/voice/connect/conversation/conversation-statuscallback/conversation-statuscallback.1.x.go new file mode 100644 index 0000000000..30a52bf2d6 --- /dev/null +++ b/twiml/voice/connect/conversation/conversation-statuscallback/conversation-statuscallback.1.x.go @@ -0,0 +1,24 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + connect := &twiml.VoiceConnect{} + + conversation := &twiml.VoiceConversation{} + conversation.ServiceInstanceSid = "ISxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + conversation.StatusCallback = "https://example.com/yourStatusCallback" + + connect.InnerElements = []twiml.Element{conversation} + + twimlResult, err := twiml.Voice([]twiml.Element{connect}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/connect/conversation/conversation-statuscallback/output/conversation-statuscallback.twiml b/twiml/voice/connect/conversation/conversation-statuscallback/output/conversation-statuscallback.twiml index 85809cea0a..bc4f1af6b5 100644 --- a/twiml/voice/connect/conversation/conversation-statuscallback/output/conversation-statuscallback.twiml +++ b/twiml/voice/connect/conversation/conversation-statuscallback/output/conversation-statuscallback.twiml @@ -1,5 +1,6 @@ + - + diff --git a/twiml/voice/connect/stream/connect_stream.1.x.go b/twiml/voice/connect/stream/connect_stream.1.x.go new file mode 100644 index 0000000000..e4b0ef4c68 --- /dev/null +++ b/twiml/voice/connect/stream/connect_stream.1.x.go @@ -0,0 +1,23 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + connect := &twiml.VoiceConnect{} + + stream := &twiml.VoiceStream{} + stream.Url = "wss://mystream.ngrok.io/audiostream" + + connect.InnerElements = []twiml.Element{stream} + + twimlResult, err := twiml.Voice([]twiml.Element{connect}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/connect/virtualagent-1/virtualagent-1.1.x.go b/twiml/voice/connect/virtualagent-1/virtualagent-1.1.x.go new file mode 100644 index 0000000000..fddf34fad1 --- /dev/null +++ b/twiml/voice/connect/virtualagent-1/virtualagent-1.1.x.go @@ -0,0 +1,25 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + connect := &twiml.VoiceConnect{} + connect.Action = "https://myactionurl.com/twiml" + + agent := &twiml.VoiceVirtualAgent{} + agent.ConnectorName = "project" + agent.StatusCallback = "https://mycallbackurl.com" + + connect.InnerElements = []twiml.Element{agent} + + twimlResult, err := twiml.Voice([]twiml.Element{connect}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/connect/virtualagent-2/virtualagent-2.1.x.go b/twiml/voice/connect/virtualagent-2/virtualagent-2.1.x.go new file mode 100644 index 0000000000..cf677149bd --- /dev/null +++ b/twiml/voice/connect/virtualagent-2/virtualagent-2.1.x.go @@ -0,0 +1,28 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + say := &twiml.VoiceSay{} + say.Message = "Hello! You will be now be connected to a virtual agent." + + connect := &twiml.VoiceConnect{} + connect.Action = "https://myactionurl.com/virtualagent_ended" + + agent := &twiml.VoiceVirtualAgent{} + agent.ConnectorName = "project" + agent.StatusCallback = "https://mycallbackurl.com" + + connect.InnerElements = []twiml.Element{agent} + + twimlResult, err := twiml.Voice([]twiml.Element{say, connect}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/connect/virtualagent-3/output/connect_virtualagent_3.twiml b/twiml/voice/connect/virtualagent-3/output/connect_virtualagent_3.twiml index 2eabc5d235..78247057a5 100644 --- a/twiml/voice/connect/virtualagent-3/output/connect_virtualagent_3.twiml +++ b/twiml/voice/connect/virtualagent-3/output/connect_virtualagent_3.twiml @@ -1,3 +1,4 @@ + diff --git a/twiml/voice/connect/virtualagent-3/virtualagent-3.1.x.go b/twiml/voice/connect/virtualagent-3/virtualagent-3.1.x.go new file mode 100644 index 0000000000..bc7b3e0530 --- /dev/null +++ b/twiml/voice/connect/virtualagent-3/virtualagent-3.1.x.go @@ -0,0 +1,24 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + connect := &twiml.VoiceConnect{} + + agent := &twiml.VoiceVirtualAgent{} + agent.ConnectorName = "project" + agent.Language = "fr" + + connect.InnerElements = []twiml.Element{agent} + + twimlResult, err := twiml.Voice([]twiml.Element{connect}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/connect/virtualagent-4/output/connect_virtualagent_4.twiml b/twiml/voice/connect/virtualagent-4/output/connect_virtualagent_4.twiml index db4edd5cf0..20c51329da 100644 --- a/twiml/voice/connect/virtualagent-4/output/connect_virtualagent_4.twiml +++ b/twiml/voice/connect/virtualagent-4/output/connect_virtualagent_4.twiml @@ -1,3 +1,4 @@ + diff --git a/twiml/voice/connect/virtualagent-4/virtualagent-4.1.x.go b/twiml/voice/connect/virtualagent-4/virtualagent-4.1.x.go new file mode 100644 index 0000000000..a0eec28b2d --- /dev/null +++ b/twiml/voice/connect/virtualagent-4/virtualagent-4.1.x.go @@ -0,0 +1,24 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + connect := &twiml.VoiceConnect{} + + agent := &twiml.VoiceVirtualAgent{} + agent.ConnectorName = "project" + agent.SentimentAnalysis = "true" + + connect.InnerElements = []twiml.Element{agent} + + twimlResult, err := twiml.Voice([]twiml.Element{connect}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/connect/virtualagent-5/output/connect_virtualagent_5.twiml b/twiml/voice/connect/virtualagent-5/output/connect_virtualagent_5.twiml index 3ec9fd0be6..6416cd7665 100644 --- a/twiml/voice/connect/virtualagent-5/output/connect_virtualagent_5.twiml +++ b/twiml/voice/connect/virtualagent-5/output/connect_virtualagent_5.twiml @@ -1,3 +1,4 @@ + diff --git a/twiml/voice/connect/virtualagent-5/virtualagent-5.1.x.go b/twiml/voice/connect/virtualagent-5/virtualagent-5.1.x.go new file mode 100644 index 0000000000..17d0e2191b --- /dev/null +++ b/twiml/voice/connect/virtualagent-5/virtualagent-5.1.x.go @@ -0,0 +1,29 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + connect := &twiml.VoiceConnect{} + + agent := &twiml.VoiceVirtualAgent{} + agent.ConnectorName = "uniqueName" + + parameter := &twiml.VoiceParameter{} + parameter.Name = "customer_name" + parameter.Value = "Burton Guster" + + agent.InnerElements = []twiml.Element{parameter} + + connect.InnerElements = []twiml.Element{agent} + + twimlResult, err := twiml.Voice([]twiml.Element{connect}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/connect/virtualagent-6/output/connect_virtualagent_6.twiml b/twiml/voice/connect/virtualagent-6/output/connect_virtualagent_6.twiml index 3a2ac1da60..884de90d89 100644 --- a/twiml/voice/connect/virtualagent-6/output/connect_virtualagent_6.twiml +++ b/twiml/voice/connect/virtualagent-6/output/connect_virtualagent_6.twiml @@ -1,3 +1,4 @@ + diff --git a/twiml/voice/connect/virtualagent-6/virtualagent-6.1.x.go b/twiml/voice/connect/virtualagent-6/virtualagent-6.1.x.go new file mode 100644 index 0000000000..dcbe33a807 --- /dev/null +++ b/twiml/voice/connect/virtualagent-6/virtualagent-6.1.x.go @@ -0,0 +1,33 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + connect := &twiml.VoiceConnect{} + + agent := &twiml.VoiceVirtualAgent{} + agent.ConnectorName = "uniqueName" + + config1 := &twiml.VoiceConfig{} + config1.Name = "language" + config1.Value = "en-us" + + config2 := &twiml.VoiceConfig{} + config2.Name = "voiceName" + config2.Value = "en-US-Wavenet-C" + + agent.InnerElements = []twiml.Element{config1, config2} + + connect.InnerElements = []twiml.Element{agent} + + twimlResult, err := twiml.Voice([]twiml.Element{connect}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/dial/dial-1/dial-1.1.x.go b/twiml/voice/dial/dial-1/dial-1.1.x.go new file mode 100644 index 0000000000..f7e03383bf --- /dev/null +++ b/twiml/voice/dial/dial-1/dial-1.1.x.go @@ -0,0 +1,23 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + dial := &twiml.VoiceDial{} + + number := &twiml.VoiceNumber{} + number.PhoneNumber = "415-123-4567" + + dial.InnerElements = []twiml.Element{number} + + twimlResult, err := twiml.Voice([]twiml.Element{dial}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/dial/dial-2/dial-2.1.x.go b/twiml/voice/dial/dial-2/dial-2.1.x.go new file mode 100644 index 0000000000..2892586d4c --- /dev/null +++ b/twiml/voice/dial/dial-2/dial-2.1.x.go @@ -0,0 +1,22 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + dial := &twiml.VoiceDial{} + dial.Number = "415-123-4567" + + say := &twiml.VoiceSay{} + say.Message = "Goodbye" + + twimlResult, err := twiml.Voice([]twiml.Element{dial, say}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/dial/dial-3/dial-3.1.x.go b/twiml/voice/dial/dial-3/dial-3.1.x.go new file mode 100644 index 0000000000..62ff0071e6 --- /dev/null +++ b/twiml/voice/dial/dial-3/dial-3.1.x.go @@ -0,0 +1,24 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + dial := &twiml.VoiceDial{} + dial.Number = "415-123-4567" + dial.Action = "/handleDialCallStatus" + dial.Method = "GET" + + say := &twiml.VoiceSay{} + say.Message = "I am unreachable" + + twimlResult, err := twiml.Voice([]twiml.Element{dial, say}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/dial/dial-4/dial-4.1.x.go b/twiml/voice/dial/dial-4/dial-4.1.x.go new file mode 100644 index 0000000000..293229cf9b --- /dev/null +++ b/twiml/voice/dial/dial-4/dial-4.1.x.go @@ -0,0 +1,24 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + dial := &twiml.VoiceDial{} + dial.CallerId = "+15551112222" + + number := &twiml.VoiceNumber{} + number.PhoneNumber = "+15558675310" + + dial.InnerElements = []twiml.Element{number} + + twimlResult, err := twiml.Voice([]twiml.Element{dial}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/dial/dial-5/dial-5.1.x.go b/twiml/voice/dial/dial-5/dial-5.1.x.go new file mode 100644 index 0000000000..ebd5728550 --- /dev/null +++ b/twiml/voice/dial/dial-5/dial-5.1.x.go @@ -0,0 +1,25 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + dial := &twiml.VoiceDial{} + dial.Record = "record-from-ringing-dual" + dial.RecordingStatusCallback = "www.myexample.com" + + number := &twiml.VoiceNumber{} + number.PhoneNumber = "+15558675310" + + dial.InnerElements = []twiml.Element{number} + + twimlResult, err := twiml.Voice([]twiml.Element{dial}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/dial/dial-6/dial-6.1.x.go b/twiml/voice/dial/dial-6/dial-6.1.x.go new file mode 100644 index 0000000000..3a4e64b642 --- /dev/null +++ b/twiml/voice/dial/dial-6/dial-6.1.x.go @@ -0,0 +1,25 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + dial := &twiml.VoiceDial{} + dial.Record = "record-from-ringing-dual" + dial.RecordingStatusCallback = "www.myexample.com" + + conference := &twiml.VoiceConference{} + conference.Name = "myteamroom" + + dial.InnerElements = []twiml.Element{conference} + + twimlResult, err := twiml.Voice([]twiml.Element{dial}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/dial/dial-7/dial-7.1.x.go b/twiml/voice/dial/dial-7/dial-7.1.x.go new file mode 100644 index 0000000000..161523714c --- /dev/null +++ b/twiml/voice/dial/dial-7/dial-7.1.x.go @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + dial := &twiml.VoiceDial{} + dial.Record = "record-from-answer" + dial.RecordingTrack = "inbound" + dial.RecordingStatusCallback = "https://www.myexample.com/recording-handler" + + number := &twiml.VoiceNumber{} + number.PhoneNumber = "+15551239876" + + dial.InnerElements = []twiml.Element{number} + + twimlResult, err := twiml.Voice([]twiml.Element{dial}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/dial/dial-7/output/dial-7.twiml b/twiml/voice/dial/dial-7/output/dial-7.twiml index f2214f9bca..adf07de089 100644 --- a/twiml/voice/dial/dial-7/output/dial-7.twiml +++ b/twiml/voice/dial/dial-7/output/dial-7.twiml @@ -1,3 +1,4 @@ + sip:AgentA@xyz.sip.us1.twilio.com?User-to-User=123456789%3Bencoding%3Dhex&X-Name=Agent%2C+A diff --git a/twiml/voice/dial/dial-9/dial-9.1.x.go b/twiml/voice/dial/dial-9/dial-9.1.x.go new file mode 100644 index 0000000000..901b739212 --- /dev/null +++ b/twiml/voice/dial/dial-9/dial-9.1.x.go @@ -0,0 +1,25 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + dial := &twiml.VoiceDial{} + dial.AnswerOnBridge = "true" + dial.ReferUrl = "https://example.com/handler" + + sip := &twiml.VoiceSip{} + sip.SipUrl = "sip:AgentA@xyz.sip.us1.twilio.com?User-to-User=123456789%3Bencoding%3Dhex&X-Name=Agent%2C+A" + + dial.InnerElements = []twiml.Element{sip} + + twimlResult, err := twiml.Voice([]twiml.Element{dial}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/dial/dial-9/output/dial-9.twiml b/twiml/voice/dial/dial-9/output/dial-9.twiml index cffe1fd8d9..fcbfd4c7ab 100644 --- a/twiml/voice/dial/dial-9/output/dial-9.twiml +++ b/twiml/voice/dial/dial-9/output/dial-9.twiml @@ -1,3 +1,4 @@ + sip:AgentA@xyz.sip.us1.twilio.com?User-to-User=123456789%3Bencoding%3Dhex&X-Name=Agent%2C+A diff --git a/twiml/voice/enqueue/enqueue-1/enqueue-1.1.x.go b/twiml/voice/enqueue/enqueue-1/enqueue-1.1.x.go new file mode 100644 index 0000000000..ec9a866098 --- /dev/null +++ b/twiml/voice/enqueue/enqueue-1/enqueue-1.1.x.go @@ -0,0 +1,20 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + enqueue := &twiml.VoiceEnqueue{} + enqueue.Name = "support" + enqueue.WaitUrl = "wait-music.xml" + + twimlResult, err := twiml.Voice([]twiml.Element{enqueue}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/enqueue/enqueue-2/enqueue-2.1.x.go b/twiml/voice/enqueue/enqueue-2/enqueue-2.1.x.go new file mode 100644 index 0000000000..a8fe9de1d0 --- /dev/null +++ b/twiml/voice/enqueue/enqueue-2/enqueue-2.1.x.go @@ -0,0 +1,19 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + play := &twiml.VoicePlay{} + play.Url = "http://com.twilio.sounds.music.s3.amazonaws.com/MARKOVICHAMP-Borghestral.mp3" + + twimlResult, err := twiml.Voice([]twiml.Element{play}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/gather/gather-1/gather-1.1.x.go b/twiml/voice/gather/gather-1/gather-1.1.x.go new file mode 100644 index 0000000000..c7b2683812 --- /dev/null +++ b/twiml/voice/gather/gather-1/gather-1.1.x.go @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + gather := &twiml.VoiceGather{} + gather.Input = "speech dtmf" + gather.Timeout = "3" + gather.NumDigits = "1" + + say := &twiml.VoiceSay{} + say.Message = "Please press 1 or say sales for sales." + + gather.InnerElements = []twiml.Element{say} + + twimlResult, err := twiml.Voice([]twiml.Element{gather}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/gather/gather-2/gather-2.1.x.go b/twiml/voice/gather/gather-2/gather-2.1.x.go new file mode 100644 index 0000000000..34143342a2 --- /dev/null +++ b/twiml/voice/gather/gather-2/gather-2.1.x.go @@ -0,0 +1,18 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + gather := &twiml.VoiceGather{} + + twimlResult, err := twiml.Voice([]twiml.Element{gather}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/gather/gather-3/gather-3.1.x.go b/twiml/voice/gather/gather-3/gather-3.1.x.go new file mode 100644 index 0000000000..5a7beb0a5e --- /dev/null +++ b/twiml/voice/gather/gather-3/gather-3.1.x.go @@ -0,0 +1,28 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + gather := &twiml.VoiceGather{} + gather.Action = "/process_gather.php" + gather.Method = "GET" + + nestedSay := &twiml.VoiceSay{} + nestedSay.Message = "Please enter your account number,\nfollowed by the pound sign" + + gather.InnerElements = []twiml.Element{nestedSay} + + failoverSay := &twiml.VoiceSay{} + failoverSay.Message = "We didn't receive any input. Goodbye!" + + twimlResult, err := twiml.Voice([]twiml.Element{gather, failoverSay}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/gather/gather-4/gather-4.1.x.go b/twiml/voice/gather/gather-4/gather-4.1.x.go new file mode 100644 index 0000000000..79b3513dae --- /dev/null +++ b/twiml/voice/gather/gather-4/gather-4.1.x.go @@ -0,0 +1,25 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + gather := &twiml.VoiceGather{} + gather.Action = "/completed" + gather.Input = "speech" + + say := &twiml.VoiceSay{} + say.Message = "Welcome to Twilio, please tell us why you're calling" + + gather.InnerElements = []twiml.Element{say} + + twimlResult, err := twiml.Voice([]twiml.Element{gather}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/gather/gather-4/output/gather-4.twiml b/twiml/voice/gather/gather-4/output/gather-4.twiml index cb79b174d3..092c127de5 100644 --- a/twiml/voice/gather/gather-4/output/gather-4.twiml +++ b/twiml/voice/gather/gather-4/output/gather-4.twiml @@ -3,5 +3,5 @@ Welcome to Twilio, please tell us why you're calling - + diff --git a/twiml/voice/gather/gather-5/gather-5.1.x.go b/twiml/voice/gather/gather-5/gather-5.1.x.go new file mode 100644 index 0000000000..d6d407f05d --- /dev/null +++ b/twiml/voice/gather/gather-5/gather-5.1.x.go @@ -0,0 +1,29 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + gather := &twiml.VoiceGather{} + gather.Action = "/process_gather.php" + gather.Method = "GET" + + say := &twiml.VoiceSay{} + say.Message = "Enter something, or not" + + gather.InnerElements = []twiml.Element{say} + + redirect := &twiml.VoiceRedirect{} + redirect.Method = "GET" + redirect.Url = "/process_gather.php?Digits=TIMEOUT" + + twimlResult, err := twiml.Voice([]twiml.Element{gather, redirect}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/hangup/hangup-1/hangup-1.1.x.go b/twiml/voice/hangup/hangup-1/hangup-1.1.x.go new file mode 100644 index 0000000000..bdfc5d9665 --- /dev/null +++ b/twiml/voice/hangup/hangup-1/hangup-1.1.x.go @@ -0,0 +1,18 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + hangup := &twiml.VoiceHangup{} + + twimlResult, err := twiml.Voice([]twiml.Element{hangup}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/leave/leave-1/leave-1.1.x.go b/twiml/voice/leave/leave-1/leave-1.1.x.go new file mode 100644 index 0000000000..0b1f159f94 --- /dev/null +++ b/twiml/voice/leave/leave-1/leave-1.1.x.go @@ -0,0 +1,23 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + enqueue := &twiml.VoiceEnqueue{} + enqueue.Name = "support" + enqueue.WaitUrl = "wait.xml" + + say := &twiml.VoiceSay{} + say.Message = "Unfortunately, the support line has closed. Please call again tomorrow." + + twimlResult, err := twiml.Voice([]twiml.Element{enqueue, say}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/leave/leave-2/leave-2.1.x.go b/twiml/voice/leave/leave-2/leave-2.1.x.go new file mode 100644 index 0000000000..a8fe9de1d0 --- /dev/null +++ b/twiml/voice/leave/leave-2/leave-2.1.x.go @@ -0,0 +1,19 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + play := &twiml.VoicePlay{} + play.Url = "http://com.twilio.sounds.music.s3.amazonaws.com/MARKOVICHAMP-Borghestral.mp3" + + twimlResult, err := twiml.Voice([]twiml.Element{play}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/leave/leave-3/leave-3.1.x.go b/twiml/voice/leave/leave-3/leave-3.1.x.go new file mode 100644 index 0000000000..36b09742b6 --- /dev/null +++ b/twiml/voice/leave/leave-3/leave-3.1.x.go @@ -0,0 +1,18 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + leave := &twiml.VoiceLeave{} + + twimlResult, err := twiml.Voice([]twiml.Element{leave}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/number/number-1/number-1.1.x.go b/twiml/voice/number/number-1/number-1.1.x.go new file mode 100644 index 0000000000..1957a480f7 --- /dev/null +++ b/twiml/voice/number/number-1/number-1.1.x.go @@ -0,0 +1,24 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + dial := &twiml.VoiceDial{} + + number := &twiml.VoiceNumber{} + number.PhoneNumber = "415-123-4567" + number.SendDigits = "wwww1928" + + dial.InnerElements = []twiml.Element{number} + + twimlResult, err := twiml.Voice([]twiml.Element{dial}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/number/number-2/number-2.1.x.go b/twiml/voice/number/number-2/number-2.1.x.go new file mode 100644 index 0000000000..7d2d77de1b --- /dev/null +++ b/twiml/voice/number/number-2/number-2.1.x.go @@ -0,0 +1,29 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + dial := &twiml.VoiceDial{} + + number1 := &twiml.VoiceNumber{} + number1.PhoneNumber = "858-987-6543" + + number2 := &twiml.VoiceNumber{} + number2.PhoneNumber = "415-123-4567" + + number3 := &twiml.VoiceNumber{} + number3.PhoneNumber = "619-765-4321" + + dial.InnerElements = []twiml.Element{number1, number2, number3} + + twimlResult, err := twiml.Voice([]twiml.Element{dial}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/number/number-3/number-3.1.x.go b/twiml/voice/number/number-3/number-3.1.x.go new file mode 100644 index 0000000000..39a1a80ae8 --- /dev/null +++ b/twiml/voice/number/number-3/number-3.1.x.go @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + dial := &twiml.VoiceDial{} + + number := &twiml.VoiceNumber{} + number.PhoneNumber = "+12349013030" + number.StatusCallbackEvent = "initiated ringing answered completed" + number.StatusCallback = "https://myapp.com/calls/events" + number.StatusCallbackMethod = "POST" + + dial.InnerElements = []twiml.Element{number} + + twimlResult, err := twiml.Voice([]twiml.Element{dial}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/number/number-4/number-4.1.x.go b/twiml/voice/number/number-4/number-4.1.x.go new file mode 100644 index 0000000000..0f191fb140 --- /dev/null +++ b/twiml/voice/number/number-4/number-4.1.x.go @@ -0,0 +1,32 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + dial := &twiml.VoiceDial{} + + number1 := &twiml.VoiceNumber{} + number1.PhoneNumber = "+14155555555" + number1.StatusCallbackEvent = "initiated ringing answered completed" + number1.StatusCallback = "https://myapp.com/calls/events" + number1.StatusCallbackMethod = "POST" + + number2 := &twiml.VoiceNumber{} + number2.PhoneNumber = "+14153333333" + number2.StatusCallbackEvent = "initiated ringing answered completed" + number2.StatusCallback = "https://example.com/events" + number2.StatusCallbackMethod = "POST" + + dial.InnerElements = []twiml.Element{number1, number2} + + twimlResult, err := twiml.Voice([]twiml.Element{dial}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/number/number-5/number-5.1.x.go b/twiml/voice/number/number-5/number-5.1.x.go new file mode 100644 index 0000000000..93e1a8925e --- /dev/null +++ b/twiml/voice/number/number-5/number-5.1.x.go @@ -0,0 +1,24 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + dial := &twiml.VoiceDial{} + + number := &twiml.VoiceNumber{} + number.PhoneNumber = "415-123-4567" + number.Url = "http://example.com/agent_screen_call" + + dial.InnerElements = []twiml.Element{number} + + twimlResult, err := twiml.Voice([]twiml.Element{dial}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/parameter/parameter-1/parameter-1.1.x.go b/twiml/voice/parameter/parameter-1/parameter-1.1.x.go new file mode 100644 index 0000000000..8e54acc4f6 --- /dev/null +++ b/twiml/voice/parameter/parameter-1/parameter-1.1.x.go @@ -0,0 +1,36 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + dial := &twiml.VoiceDial{} + + client := &twiml.VoiceClient{} + + identity := &twiml.VoiceIdentity{} + identity.ClientIdentity = "user_jane" + + parameter1 := &twiml.VoiceParameter{} + parameter1.Name = "FirstName" + parameter1.Value = "Jane" + + parameter2 := &twiml.VoiceParameter{ + Name: "LastName", + Value: "Doe", + } + + client.InnerElements = []twiml.Element{identity, parameter1, parameter2} + + dial.InnerElements = []twiml.Element{client} + + twimlResult, err := twiml.Voice([]twiml.Element{dial}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/pause/pause-1/pause-1.1.x.go b/twiml/voice/pause/pause-1/pause-1.1.x.go new file mode 100644 index 0000000000..2c005adf44 --- /dev/null +++ b/twiml/voice/pause/pause-1/pause-1.1.x.go @@ -0,0 +1,25 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + say1 := &twiml.VoiceSay{} + say1.Message = "I will pause 10 seconds starting now!" + + pause := &twiml.VoicePause{} + pause.Length = "10" + + say2 := &twiml.VoiceSay{} + say2.Message = "I just paused 10 seconds" + + twimlResult, err := twiml.Voice([]twiml.Element{say1, pause, say2}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/pause/pause-2/pause-2.1.x.go b/twiml/voice/pause/pause-2/pause-2.1.x.go new file mode 100644 index 0000000000..a4a07502cc --- /dev/null +++ b/twiml/voice/pause/pause-2/pause-2.1.x.go @@ -0,0 +1,22 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + pause := &twiml.VoicePause{} + pause.Length = "5" + + say := &twiml.VoiceSay{} + say.Message = "Hi there." + + twimlResult, err := twiml.Voice([]twiml.Element{pause, say}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/pay/pay-1/pay-1.1.x.go b/twiml/voice/pay/pay-1/pay-1.1.x.go new file mode 100644 index 0000000000..f563558fb4 --- /dev/null +++ b/twiml/voice/pay/pay-1/pay-1.1.x.go @@ -0,0 +1,18 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + pay := &twiml.VoicePay{} + + twimlResult, err := twiml.Voice([]twiml.Element{pay}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/pay/pay-2/pay-2.1.x.go b/twiml/voice/pay/pay-2/pay-2.1.x.go new file mode 100644 index 0000000000..5b676908fc --- /dev/null +++ b/twiml/voice/pay/pay-2/pay-2.1.x.go @@ -0,0 +1,22 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + say := &twiml.VoiceSay{} + say.Message = "Calling Twilio Pay" + + pay := &twiml.VoicePay{} + pay.ChargeAmount = "20.45" + + twimlResult, err := twiml.Voice([]twiml.Element{say, pay}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/pay/pay-3/pay-3.1.x.go b/twiml/voice/pay/pay-3/pay-3.1.x.go new file mode 100644 index 0000000000..d917f2e8a9 --- /dev/null +++ b/twiml/voice/pay/pay-3/pay-3.1.x.go @@ -0,0 +1,23 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + say := &twiml.VoiceSay{} + say.Message = "Calling Twilio Pay" + + pay := &twiml.VoicePay{} + pay.ChargeAmount = "20.45" + pay.Action = "https://enter-your-callback-function-url.twil.io/pay" + + twimlResult, err := twiml.Voice([]twiml.Element{say, pay}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/pay/pay-4/pay-4.1.x.go b/twiml/voice/pay/pay-4/pay-4.1.x.go new file mode 100644 index 0000000000..90d10099a8 --- /dev/null +++ b/twiml/voice/pay/pay-4/pay-4.1.x.go @@ -0,0 +1,19 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + pay := &twiml.VoicePay{} + pay.PaymentConnector = "Stripe_Connector_1" + + twimlResult, err := twiml.Voice([]twiml.Element{pay}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/pay/pay-charge-connector/pay-charge-connector.1.x.go b/twiml/voice/pay/pay-charge-connector/pay-charge-connector.1.x.go new file mode 100644 index 0000000000..bd844c219b --- /dev/null +++ b/twiml/voice/pay/pay-charge-connector/pay-charge-connector.1.x.go @@ -0,0 +1,21 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + pay := &twiml.VoicePay{} + pay.ChargeAmount = "10.00" + pay.PaymentConnector = "My_Pay_Connector" + pay.Action = "https://your-callback-function-url.com/pay" + + twimlResult, err := twiml.Voice([]twiml.Element{pay}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/pay/pay-parameter/pay-parameter.1.x.go b/twiml/voice/pay/pay-parameter/pay-parameter.1.x.go new file mode 100644 index 0000000000..807725eb4b --- /dev/null +++ b/twiml/voice/pay/pay-parameter/pay-parameter.1.x.go @@ -0,0 +1,28 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + pay := &twiml.VoicePay{} + pay.ChargeAmount = "10.00" + pay.PaymentConnector = "My_Generic_Pay_Connector" + pay.Action = "https://your-callback-function-url.com/pay" + + parameter := &twiml.VoiceParameter{ + Name: "custom_parameter_1", + Value: "custom_value_1", + } + + pay.InnerElements = []twiml.Element{parameter} + + twimlResult, err := twiml.Voice([]twiml.Element{pay}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/pay/pay-tokenize-connector/pay-tokenize-connecter.1.x.go b/twiml/voice/pay/pay-tokenize-connector/pay-tokenize-connecter.1.x.go new file mode 100644 index 0000000000..9feb16f126 --- /dev/null +++ b/twiml/voice/pay/pay-tokenize-connector/pay-tokenize-connecter.1.x.go @@ -0,0 +1,21 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + pay := &twiml.VoicePay{} + pay.ChargeAmount = "0" + pay.PaymentConnector = "My_Pay_Connector" + pay.Action = "https://your-callback-function-url.com/pay" + + twimlResult, err := twiml.Voice([]twiml.Element{pay}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/pay/pay-tokenize/pay-tokenize.1.x.go b/twiml/voice/pay/pay-tokenize/pay-tokenize.1.x.go new file mode 100644 index 0000000000..d38ddc6a5f --- /dev/null +++ b/twiml/voice/pay/pay-tokenize/pay-tokenize.1.x.go @@ -0,0 +1,20 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + pay := &twiml.VoicePay{} + pay.TokenType = "one-time" + pay.ChargeAmount = "0" + + twimlResult, err := twiml.Voice([]twiml.Element{pay}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/play/play-1/play-1.1.x.go b/twiml/voice/play/play-1/play-1.1.x.go new file mode 100644 index 0000000000..36e3e99f3b --- /dev/null +++ b/twiml/voice/play/play-1/play-1.1.x.go @@ -0,0 +1,20 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + play := &twiml.VoicePlay{} + play.Url = "https://api.twilio.com/cowbell.mp3" + play.Loop = "10" + + twimlResult, err := twiml.Voice([]twiml.Element{play}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/play/play-2/play-2.1.x.go b/twiml/voice/play/play-2/play-2.1.x.go new file mode 100644 index 0000000000..d4342c9638 --- /dev/null +++ b/twiml/voice/play/play-2/play-2.1.x.go @@ -0,0 +1,19 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + play := &twiml.VoicePlay{} + play.Url = "https://api.twilio.com/cowbell.mp3" + + twimlResult, err := twiml.Voice([]twiml.Element{play}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/play/play-3/play-3.1.x.go b/twiml/voice/play/play-3/play-3.1.x.go new file mode 100644 index 0000000000..099c9ab7d1 --- /dev/null +++ b/twiml/voice/play/play-3/play-3.1.x.go @@ -0,0 +1,20 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + play := &twiml.VoicePlay{} + play.Url = "" + play.Digits = "wwww3" + + twimlResult, err := twiml.Voice([]twiml.Element{play}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/queue/queue-1/queue-1.1.x.go b/twiml/voice/queue/queue-1/queue-1.1.x.go new file mode 100644 index 0000000000..71e674331f --- /dev/null +++ b/twiml/voice/queue/queue-1/queue-1.1.x.go @@ -0,0 +1,24 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + dial := &twiml.VoiceDial{} + + queue := &twiml.VoiceQueue{} + queue.Name = "support" + queue.Url = "about_to_connect.xml" + + dial.InnerElements = []twiml.Element{queue} + + twimlResult, err := twiml.Voice([]twiml.Element{dial}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/queue/queue-2/queue-2.1.x.go b/twiml/voice/queue/queue-2/queue-2.1.x.go new file mode 100644 index 0000000000..e75ec08d5b --- /dev/null +++ b/twiml/voice/queue/queue-2/queue-2.1.x.go @@ -0,0 +1,19 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + say := &twiml.VoiceSay{} + say.Message = "You will now be connected to an agent." + + twimlResult, err := twiml.Voice([]twiml.Element{say}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/record/record-1/record-1.1.x.go b/twiml/voice/record/record-1/record-1.1.x.go new file mode 100644 index 0000000000..851bcc65a3 --- /dev/null +++ b/twiml/voice/record/record-1/record-1.1.x.go @@ -0,0 +1,20 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + record := &twiml.VoiceRecord{} + record.Timeout = "10" + record.Transcribe = "true" + + twimlResult, err := twiml.Voice([]twiml.Element{record}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/record/record-2/record-2.1.x.go b/twiml/voice/record/record-2/record-2.1.x.go new file mode 100644 index 0000000000..ed06f88a9b --- /dev/null +++ b/twiml/voice/record/record-2/record-2.1.x.go @@ -0,0 +1,18 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + record := &twiml.VoiceRecord{} + + twimlResult, err := twiml.Voice([]twiml.Element{record}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/record/record-3/record-3.1.x.go b/twiml/voice/record/record-3/record-3.1.x.go new file mode 100644 index 0000000000..6490a22ed5 --- /dev/null +++ b/twiml/voice/record/record-3/record-3.1.x.go @@ -0,0 +1,28 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + say1 := &twiml.VoiceSay{} + say1.Message = "Please leave a message at the beep.\nPress the star key when finished." + + record := &twiml.VoiceRecord{} + record.Action = "http://foo.edu/handleRecording.php" + record.Method = "GET" + record.MaxLength = "20" + record.FinishOnKey = "*" + + say2 := &twiml.VoiceSay{} + say2.Message = "I did not receive a recording" + + twimlResult, err := twiml.Voice([]twiml.Element{say1, record, say2}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/record/record-4/record-4.1.x.go b/twiml/voice/record/record-4/record-4.1.x.go new file mode 100644 index 0000000000..4e120c9c02 --- /dev/null +++ b/twiml/voice/record/record-4/record-4.1.x.go @@ -0,0 +1,20 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + record := &twiml.VoiceRecord{} + record.Transcribe = "true" + record.TranscribeCallback = "/handle_transcribe.php" + + twimlResult, err := twiml.Voice([]twiml.Element{record}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/redirect/redirect-1/redirect-1.1.x.go b/twiml/voice/redirect/redirect-1/redirect-1.1.x.go new file mode 100644 index 0000000000..6a308bdb28 --- /dev/null +++ b/twiml/voice/redirect/redirect-1/redirect-1.1.x.go @@ -0,0 +1,20 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + redirect := &twiml.VoiceRedirect{} + redirect.Url = "http://pigeons.com/twiml.xml" + redirect.Method = "POST" + + twimlResult, err := twiml.Voice([]twiml.Element{redirect}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/redirect/redirect-2/redirect-2.1.x.go b/twiml/voice/redirect/redirect-2/redirect-2.1.x.go new file mode 100644 index 0000000000..bdb2560812 --- /dev/null +++ b/twiml/voice/redirect/redirect-2/redirect-2.1.x.go @@ -0,0 +1,22 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + dial := &twiml.VoiceDial{} + dial.Number = "415-123-4567" + + redirect := &twiml.VoiceRedirect{} + redirect.Url = "http://www.foo.com/nextInstructions" + + twimlResult, err := twiml.Voice([]twiml.Element{dial, redirect}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/redirect/redirect-3/redirect-3.1.x.go b/twiml/voice/redirect/redirect-3/redirect-3.1.x.go new file mode 100644 index 0000000000..2960a8436e --- /dev/null +++ b/twiml/voice/redirect/redirect-3/redirect-3.1.x.go @@ -0,0 +1,19 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + redirect := &twiml.VoiceRedirect{} + redirect.Url = "../nextInstructions" + + twimlResult, err := twiml.Voice([]twiml.Element{redirect}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/refer/refer-1/refer-1.1.x.go b/twiml/voice/refer/refer-1/refer-1.1.x.go new file mode 100644 index 0000000000..e35793210c --- /dev/null +++ b/twiml/voice/refer/refer-1/refer-1.1.x.go @@ -0,0 +1,23 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + refer := &twiml.VoiceRefer{} + + sip := &twiml.VoiceSip{} + sip.SipUrl = "sip:alice@example.com" + + refer.InnerElements = []twiml.Element{sip} + + twimlResult, err := twiml.Voice([]twiml.Element{refer}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/refer/refer-2/output/refer-2.twiml b/twiml/voice/refer/refer-2/output/refer-2.twiml index 8e111d7fe6..778ed00b1d 100644 --- a/twiml/voice/refer/refer-2/output/refer-2.twiml +++ b/twiml/voice/refer/refer-2/output/refer-2.twiml @@ -4,4 +4,3 @@ sip:alice@example.com?X-AcctNumber=123456&X-ReasonForCalling=billing-question - diff --git a/twiml/voice/refer/refer-2/refer-2.1.x.go b/twiml/voice/refer/refer-2/refer-2.1.x.go new file mode 100644 index 0000000000..aee0689fff --- /dev/null +++ b/twiml/voice/refer/refer-2/refer-2.1.x.go @@ -0,0 +1,23 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + refer := &twiml.VoiceRefer{} + + sip := &twiml.VoiceSip{} + sip.SipUrl = "sip:alice@example.com?X-AcctNumber=123456&X-ReasonForCalling=billing-question" + + refer.InnerElements = []twiml.Element{sip} + + twimlResult, err := twiml.Voice([]twiml.Element{refer}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/refer/refer-3/output/refer-3.twiml b/twiml/voice/refer/refer-3/output/refer-3.twiml index 3c0ef804c7..36e704d312 100644 --- a/twiml/voice/refer/refer-3/output/refer-3.twiml +++ b/twiml/voice/refer/refer-3/output/refer-3.twiml @@ -4,4 +4,3 @@ sip:alice@example.com?User-to-User=123456789%3Bencoding%3Dhex - diff --git a/twiml/voice/refer/refer-3/refer-3.1.x.go b/twiml/voice/refer/refer-3/refer-3.1.x.go new file mode 100644 index 0000000000..297e570538 --- /dev/null +++ b/twiml/voice/refer/refer-3/refer-3.1.x.go @@ -0,0 +1,23 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + refer := &twiml.VoiceRefer{} + + sip := &twiml.VoiceSip{} + sip.SipUrl = "sip:alice@example.com?User-to-User=123456789%3Bencoding%3Dhex" + + refer.InnerElements = []twiml.Element{sip} + + twimlResult, err := twiml.Voice([]twiml.Element{refer}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/refer/refer-4/refer-4.1.x.go b/twiml/voice/refer/refer-4/refer-4.1.x.go new file mode 100644 index 0000000000..a066b79dba --- /dev/null +++ b/twiml/voice/refer/refer-4/refer-4.1.x.go @@ -0,0 +1,25 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + refer := &twiml.VoiceRefer{} + refer.Action = "/handleRefer" + refer.Method = "POST" + + sip := &twiml.VoiceSip{} + sip.SipUrl = "sip:alice@example.com" + + refer.InnerElements = []twiml.Element{sip} + + twimlResult, err := twiml.Voice([]twiml.Element{refer}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/reject/reject-1/reject-1.1.x.go b/twiml/voice/reject/reject-1/reject-1.1.x.go new file mode 100644 index 0000000000..51c5ff9930 --- /dev/null +++ b/twiml/voice/reject/reject-1/reject-1.1.x.go @@ -0,0 +1,18 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + reject := &twiml.VoiceReject{} + + twimlResult, err := twiml.Voice([]twiml.Element{reject}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/reject/reject-2/reject-2.1.x.go b/twiml/voice/reject/reject-2/reject-2.1.x.go new file mode 100644 index 0000000000..42641bcc36 --- /dev/null +++ b/twiml/voice/reject/reject-2/reject-2.1.x.go @@ -0,0 +1,19 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + reject := &twiml.VoiceReject{} + reject.Reason = "busy" + + twimlResult, err := twiml.Voice([]twiml.Element{reject}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/say/say-basic-usage/say-basic-usage.1.x.go b/twiml/voice/say/say-basic-usage/say-basic-usage.1.x.go new file mode 100644 index 0000000000..bd7e0ec991 --- /dev/null +++ b/twiml/voice/say/say-basic-usage/say-basic-usage.1.x.go @@ -0,0 +1,19 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + say := &twiml.VoiceSay{} + say.Message = "Hello!" + + twimlResult, err := twiml.Voice([]twiml.Element{say}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/say/say-language/say-language.1.x.go b/twiml/voice/say/say-language/say-language.1.x.go new file mode 100644 index 0000000000..e9efcc5c57 --- /dev/null +++ b/twiml/voice/say/say-language/say-language.1.x.go @@ -0,0 +1,20 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + say := &twiml.VoiceSay{} + say.Message = "Bonjour!" + say.Language = "fr-FR" + + twimlResult, err := twiml.Voice([]twiml.Element{say}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/say/say-loop/say-loop.1.x.go b/twiml/voice/say/say-loop/say-loop.1.x.go new file mode 100644 index 0000000000..df11493108 --- /dev/null +++ b/twiml/voice/say/say-loop/say-loop.1.x.go @@ -0,0 +1,20 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + say := &twiml.VoiceSay{} + say.Message = "Hello!" + say.Loop = "2" + + twimlResult, err := twiml.Voice([]twiml.Element{say}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/say/say-voice/say-voice.1.x.go b/twiml/voice/say/say-voice/say-voice.1.x.go new file mode 100644 index 0000000000..5af57d4e26 --- /dev/null +++ b/twiml/voice/say/say-voice/say-voice.1.x.go @@ -0,0 +1,21 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + say := &twiml.VoiceSay{} + say.Message = "Bonjour! Je m'appelle Mathieu." + say.Language = "fr-FR" + say.Voice = "Polly.Mathieu" + + twimlResult, err := twiml.Voice([]twiml.Element{say}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/sim/sim-1/sim-1.1.x.go b/twiml/voice/sim/sim-1/sim-1.1.x.go new file mode 100644 index 0000000000..977c391755 --- /dev/null +++ b/twiml/voice/sim/sim-1/sim-1.1.x.go @@ -0,0 +1,23 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + dial := &twiml.VoiceDial{} + + sim := &twiml.VoiceSim{} + sim.SimSid = "DE8caa2afb9d5279926619c458dc7098a8" + + dial.InnerElements = []twiml.Element{sim} + + twimlResult, err := twiml.Voice([]twiml.Element{dial}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/sim/sim-2/sim-2.1.x.go b/twiml/voice/sim/sim-2/sim-2.1.x.go new file mode 100644 index 0000000000..b83e1bf5b8 --- /dev/null +++ b/twiml/voice/sim/sim-2/sim-2.1.x.go @@ -0,0 +1,24 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + dial := &twiml.VoiceDial{} + dial.Record = "record-from-ringing" + + sim := &twiml.VoiceSim{} + sim.SimSid = "DE8caa2afb9d5279926619c458dc7098a8" + + dial.InnerElements = []twiml.Element{sim} + + twimlResult, err := twiml.Voice([]twiml.Element{dial}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/sip/sip-1/sip-1.1.x.go b/twiml/voice/sip/sip-1/sip-1.1.x.go new file mode 100644 index 0000000000..386da12ab4 --- /dev/null +++ b/twiml/voice/sip/sip-1/sip-1.1.x.go @@ -0,0 +1,23 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + dial := &twiml.VoiceDial{} + + sip := &twiml.VoiceSip{} + sip.SipUrl = "sip:jack@example.com" + + dial.InnerElements = []twiml.Element{sip} + + twimlResult, err := twiml.Voice([]twiml.Element{dial}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/sip/sip-10/sip-10.1.x.go b/twiml/voice/sip/sip-10/sip-10.1.x.go new file mode 100644 index 0000000000..334e6b5e5a --- /dev/null +++ b/twiml/voice/sip/sip-10/sip-10.1.x.go @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + dial := &twiml.VoiceDial{} + + sip := &twiml.VoiceSip{} + sip.SipUrl = "sip:kate@example.com" + sip.StatusCallbackEvent = "initiated ringing answered completed" + sip.StatusCallback = "https://myapp.com/calls/events" + sip.StatusCallbackMethod = "POST" + + dial.InnerElements = []twiml.Element{sip} + + twimlResult, err := twiml.Voice([]twiml.Element{dial}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/sip/sip-11/sip-11.1.x.go b/twiml/voice/sip/sip-11/sip-11.1.x.go new file mode 100644 index 0000000000..52035dbb7e --- /dev/null +++ b/twiml/voice/sip/sip-11/sip-11.1.x.go @@ -0,0 +1,32 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + dial := &twiml.VoiceDial{} + + number := &twiml.VoiceNumber{} + number.PhoneNumber = "+12143211432" + + sip1 := &twiml.VoiceSip{} + sip1.SipUrl = "sip:alice-soft-phone@example.com" + + sip2 := &twiml.VoiceSip{} + sip2.SipUrl = "sip:alice-desk-phone@example.com" + + sip3 := &twiml.VoiceSip{} + sip3.SipUrl = "sip:alice-mobile-client@example.com" + + dial.InnerElements = []twiml.Element{number, sip1, sip2, sip3} + + twimlResult, err := twiml.Voice([]twiml.Element{dial}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/sip/sip-12/output/sip-12.twiml b/twiml/voice/sip/sip-12/output/sip-12.twiml index dc7038722b..0d2740668b 100644 --- a/twiml/voice/sip/sip-12/output/sip-12.twiml +++ b/twiml/voice/sip/sip-12/output/sip-12.twiml @@ -4,5 +4,5 @@ sip:alice@example.com sip:bob@example.com sip:charlie@example.com - + diff --git a/twiml/voice/sip/sip-12/sip-12.1.x.go b/twiml/voice/sip/sip-12/sip-12.1.x.go new file mode 100644 index 0000000000..116071ad6d --- /dev/null +++ b/twiml/voice/sip/sip-12/sip-12.1.x.go @@ -0,0 +1,30 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + dial := &twiml.VoiceDial{} + dial.Sequential = "true" + + sip1 := &twiml.VoiceSip{} + sip1.SipUrl = "sip:alice@example.com" + + sip2 := &twiml.VoiceSip{} + sip2.SipUrl = "sip:bob@example.com" + + sip3 := &twiml.VoiceSip{} + sip3.SipUrl = "sip:charlie@example.com" + + dial.InnerElements = []twiml.Element{sip1, sip2, sip3} + + twimlResult, err := twiml.Voice([]twiml.Element{dial}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/sip/sip-2/sip-2.1.x.go b/twiml/voice/sip/sip-2/sip-2.1.x.go new file mode 100644 index 0000000000..4cea1092e3 --- /dev/null +++ b/twiml/voice/sip/sip-2/sip-2.1.x.go @@ -0,0 +1,25 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + dial := &twiml.VoiceDial{} + + sip := &twiml.VoiceSip{} + sip.SipUrl = "sip:kate@example.com" + sip.Username = "admin" + sip.Password = "1234" + + dial.InnerElements = []twiml.Element{sip} + + twimlResult, err := twiml.Voice([]twiml.Element{dial}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/sip/sip-3/sip-3.1.x.go b/twiml/voice/sip/sip-3/sip-3.1.x.go new file mode 100644 index 0000000000..82987cb2f8 --- /dev/null +++ b/twiml/voice/sip/sip-3/sip-3.1.x.go @@ -0,0 +1,23 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + dial := &twiml.VoiceDial{} + + sip := &twiml.VoiceSip{} + sip.SipUrl = "sip:jack@example.com?x-mycustomheader=foo&x-myotherheader=bar" + + dial.InnerElements = []twiml.Element{sip} + + twimlResult, err := twiml.Voice([]twiml.Element{dial}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/sip/sip-4/sip-4.1.x.go b/twiml/voice/sip/sip-4/sip-4.1.x.go new file mode 100644 index 0000000000..0ad6ae1c83 --- /dev/null +++ b/twiml/voice/sip/sip-4/sip-4.1.x.go @@ -0,0 +1,23 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + dial := &twiml.VoiceDial{} + + sip := &twiml.VoiceSip{} + sip.SipUrl = "sip:jack@example.com;transport=tcp" + + dial.InnerElements = []twiml.Element{sip} + + twimlResult, err := twiml.Voice([]twiml.Element{dial}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/sip/sip-5/sip-5.1.x.go b/twiml/voice/sip/sip-5/sip-5.1.x.go new file mode 100644 index 0000000000..2f077b7d28 --- /dev/null +++ b/twiml/voice/sip/sip-5/sip-5.1.x.go @@ -0,0 +1,23 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + dial := &twiml.VoiceDial{} + + sip := &twiml.VoiceSip{} + sip.SipUrl = "sip:jack@example.com;transport=tls" + + dial.InnerElements = []twiml.Element{sip} + + twimlResult, err := twiml.Voice([]twiml.Element{dial}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/sip/sip-6/sip-6.1.x.go b/twiml/voice/sip/sip-6/sip-6.1.x.go new file mode 100644 index 0000000000..dd8e53caeb --- /dev/null +++ b/twiml/voice/sip/sip-6/sip-6.1.x.go @@ -0,0 +1,23 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + dial := &twiml.VoiceDial{} + + sip := &twiml.VoiceSip{} + sip.SipUrl = "kate@example.com" + + dial.InnerElements = []twiml.Element{sip} + + twimlResult, err := twiml.Voice([]twiml.Element{dial}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/sip/sip-7/sip-7.1.x.go b/twiml/voice/sip/sip-7/sip-7.1.x.go new file mode 100644 index 0000000000..950345a332 --- /dev/null +++ b/twiml/voice/sip/sip-7/sip-7.1.x.go @@ -0,0 +1,25 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + dial := &twiml.VoiceDial{} + + sip := &twiml.VoiceSip{} + sip.SipUrl = "kate@example.com" + sip.Username = "admin" + sip.Password = "1234" + + dial.InnerElements = []twiml.Element{sip} + + twimlResult, err := twiml.Voice([]twiml.Element{dial}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/sip/sip-8/sip-8.1.x.go b/twiml/voice/sip/sip-8/sip-8.1.x.go new file mode 100644 index 0000000000..4ea3b4055f --- /dev/null +++ b/twiml/voice/sip/sip-8/sip-8.1.x.go @@ -0,0 +1,23 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + dial := &twiml.VoiceDial{} + + sip := &twiml.VoiceSip{} + sip.SipUrl = "sip:kate@example.com?x-mycustomheader=foo&x-myotherheader=bar" + + dial.InnerElements = []twiml.Element{sip} + + twimlResult, err := twiml.Voice([]twiml.Element{dial}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/sip/sip-9/sip-9.1.x.go b/twiml/voice/sip/sip-9/sip-9.1.x.go new file mode 100644 index 0000000000..03053557ac --- /dev/null +++ b/twiml/voice/sip/sip-9/sip-9.1.x.go @@ -0,0 +1,31 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + dial := &twiml.VoiceDial{} + dial.Record = "record-from-answer" + dial.Timeout = "10" + dial.HangupOnStar = "true" + dial.CallerId = "bob" + dial.Method = "POST" + dial.Action = "/handle_post_dial" + + sip := &twiml.VoiceSip{} + sip.SipUrl = "sip:kate@example.com?x-customheader=foo" + sip.Url = "/handle_screening_on_answer" + sip.Method = "POST" + + dial.InnerElements = []twiml.Element{sip} + + twimlResult, err := twiml.Voice([]twiml.Element{dial}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/siprec/siprec-1/siprec-1.1.x.go b/twiml/voice/siprec/siprec-1/siprec-1.1.x.go new file mode 100644 index 0000000000..8606d45c4c --- /dev/null +++ b/twiml/voice/siprec/siprec-1/siprec-1.1.x.go @@ -0,0 +1,24 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + start := &twiml.VoiceStart{} + + siprec := &twiml.VoiceSipRec{} + siprec.Name = "My SIPREC Stream" + siprec.ConnectorName = "Gridspace_1" + + start.InnerElements = []twiml.Element{siprec} + + twimlResult, err := twiml.Voice([]twiml.Element{start}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/sms/sms-1/sms-1.1.x.go b/twiml/voice/sms/sms-1/sms-1.1.x.go new file mode 100644 index 0000000000..2cb4856824 --- /dev/null +++ b/twiml/voice/sms/sms-1/sms-1.1.x.go @@ -0,0 +1,21 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + sms := &twiml.VoiceSms{} + sms.Message = "The king stay the king." + sms.From = "+14105551234" + sms.To = "+14105556789" + + twimlResult, err := twiml.Voice([]twiml.Element{sms}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/sms/sms-2/sms-2.1.x.go b/twiml/voice/sms/sms-2/sms-2.1.x.go new file mode 100644 index 0000000000..ea43cb2786 --- /dev/null +++ b/twiml/voice/sms/sms-2/sms-2.1.x.go @@ -0,0 +1,22 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + say := &twiml.VoiceSay{} + say.Message = "Our store is located at 123 Easy St." + + sms := &twiml.VoiceSms{} + sms.Message = "Store Location: 123 Easy St." + + twimlResult, err := twiml.Voice([]twiml.Element{say, sms}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/sms/sms-3/sms-3.1.x.go b/twiml/voice/sms/sms-3/sms-3.1.x.go new file mode 100644 index 0000000000..31a4304843 --- /dev/null +++ b/twiml/voice/sms/sms-3/sms-3.1.x.go @@ -0,0 +1,24 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + say := &twiml.VoiceSay{} + say.Message = "Our store is located at 123 Easy St." + + sms := &twiml.VoiceSms{} + sms.Message = "Store Location: 123 Easy St." + sms.Action = "/smsHandler.php" + sms.Method = "POST" + + twimlResult, err := twiml.Voice([]twiml.Element{say, sms}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/sms/sms-4/sms-4.1.x.go b/twiml/voice/sms/sms-4/sms-4.1.x.go new file mode 100644 index 0000000000..bb41df051e --- /dev/null +++ b/twiml/voice/sms/sms-4/sms-4.1.x.go @@ -0,0 +1,23 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + say := &twiml.VoiceSay{} + say.Message = "Our store is located at 123 Easy St." + + sms := &twiml.VoiceSms{} + sms.Message = "Store Location: 123 Easy St." + sms.StatusCallback = "/smsHandler.php" + + twimlResult, err := twiml.Voice([]twiml.Element{say, sms}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/stream/stream-1/stream-1.1.x.go b/twiml/voice/stream/stream-1/stream-1.1.x.go new file mode 100644 index 0000000000..76047de902 --- /dev/null +++ b/twiml/voice/stream/stream-1/stream-1.1.x.go @@ -0,0 +1,24 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + start := &twiml.VoiceStart{} + + stream := &twiml.VoiceStream{} + stream.Name = "Example Audio Stream" + stream.Url = "wss://mystream.ngrok.io/audiostream" + + start.InnerElements = []twiml.Element{stream} + + twimlResult, err := twiml.Voice([]twiml.Element{start}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/stream/stream-2/stream-2.1.x.go b/twiml/voice/stream/stream-2/stream-2.1.x.go new file mode 100644 index 0000000000..5067125a1e --- /dev/null +++ b/twiml/voice/stream/stream-2/stream-2.1.x.go @@ -0,0 +1,33 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + start := &twiml.VoiceStart{} + + stream := &twiml.VoiceStream{} + stream.Url = "wss://mystream.ngrok.io/example" + + param1 := &twiml.VoiceParameter{} + param1.Name = "FirstName" + param1.Value = "Jane" + + param2 := &twiml.VoiceParameter{} + param2.Name = "LastName" + param2.Value = "Doe" + + stream.InnerElements = []twiml.Element{param1, param2} + + start.InnerElements = []twiml.Element{stream} + + twimlResult, err := twiml.Voice([]twiml.Element{start}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/your-response/your-response-1/your-response-1.1.x.go b/twiml/voice/your-response/your-response-1/your-response-1.1.x.go new file mode 100644 index 0000000000..e7cf745dad --- /dev/null +++ b/twiml/voice/your-response/your-response-1/your-response-1.1.x.go @@ -0,0 +1,22 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + say := &twiml.VoiceSay{} + say.Message = "Hello World" + + play := &twiml.VoicePlay{} + play.Url = "https://api.twilio.com/Cowbell.mp3" + + twimlResult, err := twiml.Voice([]twiml.Element{say, play}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +} diff --git a/twiml/voice/your-response/your-response-2/your-response-2.1.x.go b/twiml/voice/your-response/your-response-2/your-response-2.1.x.go new file mode 100644 index 0000000000..813a796c71 --- /dev/null +++ b/twiml/voice/your-response/your-response-2/your-response-2.1.x.go @@ -0,0 +1,19 @@ +package main + +import ( + "fmt" + + "github.com/twilio/twilio-go/twiml" +) + +func main() { + say := &twiml.VoiceSay{} + say.Message = "Hello" + + twimlResult, err := twiml.Voice([]twiml.Element{say}) + if err == nil { + fmt.Println(twimlResult) + } else { + fmt.Println(err) + } +}