@@ -9,123 +9,39 @@ GoESL is a small wrapper around [FreeSwitch](https://freeswitch.org/) [EventSock
9
9
10
10
Point of this library is to fully implement Freeswitch ESL and bring outbound server as inbound client to you, fellow go developer :)
11
11
12
- ** This package is in DEVELOPMENT mode. It does not work and I don't know when will I get it to work due to lack of the free time in this moment.**
13
-
14
12
15
13
### Examples
16
14
15
+ There are few different types of examples that can be found at [ GOESL Examples] ( https://github.com/0x19/goesl/tree/master/examples ) .
17
16
18
- #### TTS Server
19
-
20
- ``` go
21
- package main
22
-
23
- import (
24
- . " github.com/0x19/goesl"
25
- " runtime"
26
- " strings"
27
- )
28
-
29
- var (
30
- goeslMessage = " Hello from GoESL. Open source freeswitch event socket wrapper written in Golang!"
31
- )
32
-
33
- func main () {
34
-
35
- defer func () {
36
- if r := recover (); r != nil {
37
- Error (" Recovered in: " , r)
38
- }
39
- }()
40
-
41
- // Boost it as much as it can go ...
42
- runtime.GOMAXPROCS (runtime.NumCPU ())
43
-
44
- if s , err := NewOutboundServer (" :8084" ); err != nil {
45
- Error (" Got error while starting Freeswitch outbound server: %s " , err)
46
- } else {
47
- go handle (s)
48
- s.Start ()
49
- }
50
-
51
- }
52
-
53
- // handle - Running under goroutine here to explain how to run tts outbound server
54
- func handle (s *OutboundServer ) {
55
-
56
- for {
57
-
58
- select {
59
-
60
- case conn := <- s.Conns :
61
- Notice (" New incomming connection: %v " , conn)
62
-
63
- if err := conn.Connect (); err != nil {
64
- Error (" Got error while accepting connection: %s " , err)
65
- break
66
- }
67
-
68
- answer , err := conn.ExecuteAnswer (" " , false )
17
+ Feel free to suggest more examples :)
69
18
70
- if err != nil {
71
- Error (" Got error while executing answer: %s " , err)
72
- break
73
- }
74
19
75
- Debug (" Answer Message: %s " , answer)
76
- Debug (" Caller UUID: %s " , answer.GetHeader (" Caller-Unique-Id" ))
20
+ ### Contributions / Issues?
77
21
78
- cUUID := answer. GetCallUUID ()
22
+ Please reach me over [email protected] or submit new Issue. I'd prefer tho if you would submit issue.
79
23
80
- if te , err := conn.ExecuteSet (" tts_engine" , " flite" , false ); err != nil {
81
- Error (" Got error while attempting to set tts_engine: %s " , err)
82
- } else {
83
- Debug (" TTS Engine Msg: %s " , te)
84
- }
85
24
86
- if tv , err := conn.ExecuteSet (" tts_voice" , " slt" , false ); err != nil {
87
- Error (" Got error while attempting to set tts_voice: %s " , err)
88
- } else {
89
- Debug (" TTS Voice Msg: %s " , tv)
90
- }
25
+ ### License
91
26
92
- if sm , err := conn.Execute (" speak" , goeslMessage, true ); err != nil {
93
- Error (" Got error while executing speak: %s " , err)
94
- break
95
- } else {
96
- Debug (" Speak Message: %s " , sm)
97
- }
27
+ The MIT License (MIT)
98
28
99
- if hm , err := conn.ExecuteHangup (cUUID, " " , false ); err != nil {
100
- Error (" Got error while executing hangup: %s " , err)
101
- break
102
- } else {
103
- Debug (" Hangup Message: %s " , hm)
104
- }
29
+ Copyright (c) 2015 Nevio Vesic
105
30
106
- go func () {
107
- for {
108
- msg , err := conn.ReadMessage ()
31
+ Permission is hereby granted, free of charge, to any person obtaining a copy
32
+ of this software and associated documentation files (the "Software"), to deal
33
+ in the Software without restriction, including without limitation the rights
34
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
35
+ copies of the Software, and to permit persons to whom the Software is
36
+ furnished to do so, subject to the following conditions:
109
37
110
- if err != nil {
38
+ The above copyright notice and this permission notice shall be included in
39
+ all copies or substantial portions of the Software.
111
40
112
- // If it contains EOF, we really dont care...
113
- if !strings.Contains (err.Error (), " EOF" ) {
114
- Error (" Error while reading Freeswitch message: %s " , err)
115
- }
116
- break
117
- }
118
-
119
- Debug (" %s " , msg.Dump ())
120
- }
121
- }()
122
-
123
- default :
124
- // YabbaDabbaDooooo!
125
- // Flintstones. Meet the Flintstones. They're the modern stone age family. From the town of Bedrock,
126
- // They're a page right out of history. La la,lalalalala la :D
127
- }
128
- }
129
-
130
- }
131
- ```
41
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
42
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
43
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
44
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
45
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
46
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
47
+ THE SOFTWARE.
0 commit comments