Documentation ¶
Overview ¶
Call representa la conexion a la llamada iniciada o bien el acceso Outbound de Freeswitch, donde se puede controlar o dirigir el IVR.
http://wiki.freeswitch.org/wiki/Event_Socket_Outbound
Application:bridge EventName:CHANNEL_HANGUP EventName:CHANNEL_EXECUTE_COMPLETE Application:bridge Variable_bridge_hangup_cause:NORMAL_CLEARING Variable_dialstatus:DONTCALL Channel-Call-State:HELD Variable_originate_disposition:CALL_REJECTED Hangup-Cause:CALL_REJECTED
Implemanta Respuesta para Freeswitch Outbound e Inbound La idea inicial, es hacer un clon de plivoframework sencillo pero la diferencia es que recibe todo el mensaje o IVR y lo ejecuta
Index ¶
- Constants
- func DispatcherEvents(call *Call)
- func HandleCall(call *Call, buf *bufio.Reader, replyCh chan CommandStatus, ...)
- func Listen(laddr string, logger *log.Logger) (*server, error)
- func ListenAndserve(laddr string, logger *log.Logger, handler HandlerCall, userData interface{}) error
- type Call
- func (call *Call) AddActionHandle(hl HandlerEvent)
- func (call *Call) Answer()
- func (call *Call) Close()
- func (call *Call) DoneActionHandle(idx int)
- func (call *Call) Execute(app string, arg string, lock bool)
- func (call *Call) Hangup()
- func (call *Call) OnceEventHandle(hl func(chan interface{}) HandlerEvent) chan interface{}
- func (call *Call) Playback(url string)
- func (call *Call) RegisterEventHandle(hl HandlerEvent) int64
- func (call *Call) Reply() CommandStatus
- func (call *Call) ReplyChan() chan CommandStatus
- func (call *Call) SetVar(name string, value string)
- func (call *Call) UnregisterEventHandle(idx int64)
- func (call *Call) WaitAnswer() <-chan interface{}
- func (call *Call) WaitEventChan(filter map[string]string) chan interface{}
- func (call *Call) Write(p []byte) (int, error)
- type Channel
- type CollectDTMFEventHandle
- type CommandStatus
- type Event
- type HandlerCall
- type HandlerEvent
- type WaitAnyEventHandle
- type WaitEventHandle
Constants ¶
const CALL_MAX_QUEUE_EVENTS = 77
Cantidad maxima antes de bloquear la gorutina aqui espero que no se retarde tanto para llenar la QUEUE
Variables ¶
This section is empty.
Functions ¶
func DispatcherEvents ¶
func DispatcherEvents(call *Call)
func HandleCall ¶
func HandleCall(call *Call, buf *bufio.Reader, replyCh chan CommandStatus, stopedCall chan bool)
func ListenAndserve ¶
func ListenAndserve(laddr string, logger *log.Logger, handler HandlerCall, userData interface{}) error
Types ¶
type Call ¶
type Call struct { Conn net.Conn //UUID de la llamada UUID string //Header cabezera Header map[string]string //Variable variables en la llamada Variable map[string]string //Caller quien llama Caller *Channel //Closed cuando la llamada a sido finalizada Closed bool // contains filtered or unexported fields }
La llamada que se controla actualmente Para mas procedimientos mirar chan/ y dptools/
func NewCall ¶
func NewCall(conn *net.Conn, header textproto.MIMEHeader, replyChan chan CommandStatus, logger *log.Logger) *Call
NewCall crea nueva llamada en conexion
func (*Call) AddActionHandle ¶
func (call *Call) AddActionHandle(hl HandlerEvent)
func (*Call) Answer ¶
func (call *Call) Answer()
Contesta http://wiki.freeswitch.org/wiki/Misc._Dialplan_Tools_answer
func (*Call) DoneActionHandle ¶
func (*Call) Hangup ¶
func (call *Call) Hangup()
Cuelga la llamada, al recibir evento CHANNEL_EXECUTE_COMPLETE de hangup o bien respuesta del comando http://wiki.freeswitch.org/wiki/Misc._Dialplan_Tools_hangup
func (*Call) OnceEventHandle ¶
func (call *Call) OnceEventHandle(hl func(chan interface{}) HandlerEvent) chan interface{}
Espera un evento y se ejecuta el handler una sola vez
func (*Call) Playback ¶
Reproduce audio http://wiki.freeswitch.org/wiki/Misc._Dialplan_Tools_playback
func (*Call) RegisterEventHandle ¶
func (call *Call) RegisterEventHandle(hl HandlerEvent) int64
Registra observador a un evento
func (*Call) ReplyChan ¶
func (call *Call) ReplyChan() chan CommandStatus
func (*Call) UnregisterEventHandle ¶
func (*Call) WaitAnswer ¶
func (call *Call) WaitAnswer() <-chan interface{}
Bloquea gorutina esperando evento CHANNEL_ANSWER retorna el chan glivo.Event
func (*Call) WaitEventChan ¶
Se espera un evento determinado
type CollectDTMFEventHandle ¶
type CollectDTMFEventHandle struct {
// contains filtered or unexported fields
}
Recolecta marcacion
func NewCollectDTMFEventHandle ¶
func NewCollectDTMFEventHandle(wait chan string, numDigits int, validDigits string, terminator uint8) CollectDTMFEventHandle
func (CollectDTMFEventHandle) Filter ¶
func (cl CollectDTMFEventHandle) Filter(ev Event) bool
func (CollectDTMFEventHandle) Handle ¶
func (cl CollectDTMFEventHandle) Handle(ev Event)
type CommandStatus ¶
type CommandStatus string
type Event ¶
Representa un evento de Freeswitch Las claves estan Camelised
func EventFromMIME ¶
func EventFromMIME(call *Call, mime textproto.MIMEHeader) Event
Crea evento apartir de el MIME leido
type HandlerEvent ¶
type HandlerEvent interface { //Delimita el handler a que eventos trabajar //retornar +true+ si es el evento esperado Filter(Event) bool //Recibe evento y reacciona a este si fue aceptado en el filtro Handle(Event) }
Permite llamar procedimiento cuando se cumpla el filro o bien cuando el evento cumpla las condiciones esperadas.
type WaitAnyEventHandle ¶
type WaitAnyEventHandle struct {
// contains filtered or unexported fields
}
Este permite esperar un evento determinado y bloquear la gorutina atraves del chan *wait* @todo como manejar un timeout por demora??
func NewWaitAnyEventHandle ¶
func NewWaitAnyEventHandle(wait chan interface{}, filter []map[string]string) WaitAnyEventHandle
func (WaitAnyEventHandle) Filter ¶
func (we WaitAnyEventHandle) Filter(ev Event) bool
func (WaitAnyEventHandle) Handle ¶
func (we WaitAnyEventHandle) Handle(ev Event)
type WaitEventHandle ¶
type WaitEventHandle struct {
// contains filtered or unexported fields
}
Este permite esperar un evento determinado y bloquear la gorutina atraves del chan *wait* TODO como manejar un timeout por demora??
func NewWaitEventHandle ¶
func NewWaitEventHandle(wait chan interface{}, filter map[string]string) WaitEventHandle
func (WaitEventHandle) Filter ¶
func (we WaitEventHandle) Filter(ev Event) bool
func (WaitEventHandle) Handle ¶
func (we WaitEventHandle) Handle(ev Event)