Documentation
¶
Overview ¶
go_ph0n3 is a virtual DTMF phone dialing simulator / tones generator it is uses Oto as sound lib and is based on Oto's example wich is licensed under the Apache License Version 2.0. https://github.com/hajimehoshi/oto/blob/master/example/main.go
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultPh0n3Options = &Ph0n3Options{ SpaceDuration: time.Second / 15, DialToneDuration: 2, ToneDuration: time.Second / 4, BuffSizeBytes: 4096, Channel: 1, RingingToneTimes: 2, BusyToneTimes: 4, Vervose: false, }
DefaultPh0n3Options the default values.
var StandarPad = map[string]Ph0n3Key{ "1": Key1, "2": Key2, "A": Key2, "B": Key2, "C": Key2, "3": Key3, "D": Key3, "E": Key3, "F": Key3, "4": Key4, "G": Key4, "H": Key4, "I": Key4, "5": Key5, "J": Key5, "K": Key5, "L": Key5, "6": Key6, "M": Key6, "N": Key6, "O": Key6, "7": Key7, "P": Key7, "R": Key7, "S": Key7, "8": Key8, "T": Key8, "U": Key8, "V": Key8, "9": Key9, "W": Key9, "X": Key9, "Y": Key9, "0": Key0, "*": KeyStar, "#": KeyHash, }
StandarPad is a map of the standard phone keys and its values to the DTMF key that it belongs. This allows you to dial numbers like: 01-800-SOMETHING.
Functions ¶
This section is empty.
Types ¶
type Ph0n3 ¶
type Ph0n3 struct { Close chan bool // contains filtered or unexported fields }
Ph0n3 is a phone toy you can use to dial a number; it also could be used as dialing tone generator.
Example ¶
phone := go_ph0n3.NewPh0n3(nil).Open() _ = phone.DialString("13243546") <-phone.Close
Output:
func NewPh0n3 ¶
func NewPh0n3(opt *Ph0n3Options) *Ph0n3
NewPh0n3 returns a new phone instance ready to use
func (*Ph0n3) DialString ¶
DialString dial keys from the given strings, if a char does not exists it skips and continue with next.
type Ph0n3Key ¶
type Ph0n3Key int
Ph0n3Key are keys of the DMTF System
const ( Key1 Ph0n3Key = iota Key2 Key3 KeyA Key4 Key5 Key6 KeyB Key7 Key8 Key9 KeyC KeyStar Key0 KeyHash KeyD )
This constants will gonna be safe indexes, we are just ensuring that only defined value will be used; tit is based on the standard 16 key names of the DTMF (Dual-Tone Multi-Frequency) System. https://en.wikipedia.org/wiki/Dual-tone_multi-frequency_signaling
type Ph0n3Options ¶
type Ph0n3Options struct { // SpaceDuration Time between tones SpaceDuration time.Duration `json:"space_duration"` // ToneDuration Time a tone sounds ToneDuration time.Duration `json:"tone_duration"` // DialToneDuration Time during the dial tone will sound before dial 0 = disabled. DialToneDuration time.Duration `json:"dial_tone_duration"` // RingingToneTimes Times the ringing tone will sounds after dialing, // 0 for disable. RingingToneTimes int // BusyTonesTimes Times the busy tone will sounds before the call ends, // 0 for disable. BusyToneTimes int // Channel The sound channel number to be used to play the tones. Channel int // BuffSizeBytes is the buffer size in bytes BuffSizeBytes int // Vervose enables debug messages (the number that is been dialed) Vervose bool }
Ph0n3Options Defines the behavior of a Ph0n3 instance.