diff --git a/README.md b/README.md index d062091..07f1ab0 100644 --- a/README.md +++ b/README.md @@ -6,9 +6,27 @@ Asterisk in Golang provides a wide range of features, including call routing, re With Asterisk in Golang, developers benefit from the strengths of both the Golang language and the Asterisk ecosystem, resulting in reliable and efficient VOIP solutions that meet the demands of modern communication systems. +### Requirement + +The go version 1.20 + +### Installation + +- Use a specific version (tag) + +```bash +go get github.com/pnguyen215/voipkit@v1.0.0 +``` + +- Latest version + +```bash +go get -u github.com/pnguyen215/voipkit@latest +``` + ### Usage -- [Asterisk Manager Interface (AMI)](https://github.com/pnguyen215/gobase-voip-core/blob/master/docs/ami.md) +- [Asterisk Manager Interface (AMI)](https://github.com/pnguyen215/voipkit/blob/master/docs/ami.md) ### Github Action diff --git a/docs/ami.md b/docs/ami.md index 3ff30d7..92a44f0 100644 --- a/docs/ami.md +++ b/docs/ami.md @@ -1,11 +1,5 @@ # Asterisk Manager Interface (AMI) -## Installation - -```sh -go get -u github.com/pnguyen215/gobase-voip-core@v1.0.13 -``` - ## Usage 1. Open connection to asterisk server @@ -32,7 +26,7 @@ package main import ( "log" - "github.com/pnguyen215/gobase-voip-core/pkg/ami" + "github.com/pnguyen215/voipkit/pkg/ami" ) func NewClient() (*ami.AMI, error) { @@ -41,7 +35,7 @@ func NewClient() (*ami.AMI, error) { } func main() { - + client, err := NewClient() if err != nil { @@ -52,7 +46,7 @@ func main() { ``` 2. Custom listen all events from asterisk -// note: using go func(){...} + // note: using go func(){...} ```Go // AllEvents subscribes to any AMI message received from Asterisk server @@ -75,8 +69,8 @@ import ( "log" "strings" - "github.com/pnguyen215/gobase-voip-core/pkg/ami" - "github.com/pnguyen215/gobase-voip-core/pkg/ami/config" + "github.com/pnguyen215/voipkit/pkg/ami" + "github.com/pnguyen215/voipkit/pkg/ami/config" ) func NewClient() (*ami.AMI, error) { @@ -120,7 +114,7 @@ package main import ( "log" - "github.com/pnguyen215/gobase-voip-core/pkg/ami" + "github.com/pnguyen215/voipkit/pkg/ami" ) func NewClient() (*ami.AMI, error) { @@ -146,6 +140,7 @@ func main() { ``` 4. Listen events and get field from event by adding key-value you want to take value from that field + ##### Example ```Go @@ -154,7 +149,7 @@ package main import ( "log" - "github.com/pnguyen215/gobase-voip-core/pkg/ami" + "github.com/pnguyen215/voipkit/pkg/ami" ) func NewClient() (*ami.AMI, error) { @@ -184,7 +179,8 @@ func main() { ``` 5. Listen events and get field from event by adding key-value you want to take value from that field. -You can customize event by adding new callback function + You can customize event by adding new callback function + ##### Example ```Go @@ -193,7 +189,7 @@ package main import ( "log" - "github.com/pnguyen215/gobase-voip-core/pkg/ami" + "github.com/pnguyen215/voipkit/pkg/ami" ) func NewClient() (*ami.AMI, error) { @@ -224,4 +220,4 @@ func main() { }) }() } -``` \ No newline at end of file +``` diff --git a/go.mod b/go.mod index 92a12e4..ce91326 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/pnguyen215/gobase-voip-core +module github.com/pnguyen215/voipkit go 1.20 diff --git a/pkg/ami/ami.go b/pkg/ami/ami.go index 28e1ea1..e5621c7 100644 --- a/pkg/ami/ami.go +++ b/pkg/ami/ami.go @@ -6,7 +6,7 @@ import ( "strings" "time" - "github.com/pnguyen215/gobase-voip-core/pkg/ami/config" + "github.com/pnguyen215/voipkit/pkg/ami/config" ) // NewAmi connect to Asterisk Server using net connection and try to login diff --git a/pkg/ami/ami_ confbridge.go b/pkg/ami/ami_ confbridge.go index 40f172f..717cb5f 100644 --- a/pkg/ami/ami_ confbridge.go +++ b/pkg/ami/ami_ confbridge.go @@ -3,7 +3,7 @@ package ami import ( "context" - "github.com/pnguyen215/gobase-voip-core/pkg/ami/config" + "github.com/pnguyen215/voipkit/pkg/ami/config" ) // ConfbridgeList lists all users in a particular ConfBridge conference. diff --git a/pkg/ami/ami_ presence.go b/pkg/ami/ami_ presence.go index 8586f6d..2a3b452 100644 --- a/pkg/ami/ami_ presence.go +++ b/pkg/ami/ami_ presence.go @@ -3,7 +3,7 @@ package ami import ( "context" - "github.com/pnguyen215/gobase-voip-core/pkg/ami/config" + "github.com/pnguyen215/voipkit/pkg/ami/config" ) // PresenceState check presence state. diff --git a/pkg/ami/ami_action.go b/pkg/ami/ami_action.go index 3f0ab42..bf3d964 100644 --- a/pkg/ami/ami_action.go +++ b/pkg/ami/ami_action.go @@ -5,7 +5,7 @@ import ( "log" "strings" - "github.com/pnguyen215/gobase-voip-core/pkg/ami/config" + "github.com/pnguyen215/voipkit/pkg/ami/config" ) func NewAction() *AMIAction { diff --git a/pkg/ami/ami_agent.go b/pkg/ami/ami_agent.go index aeff3b7..32bdbed 100644 --- a/pkg/ami/ami_agent.go +++ b/pkg/ami/ami_agent.go @@ -3,7 +3,7 @@ package ami import ( "context" - "github.com/pnguyen215/gobase-voip-core/pkg/ami/config" + "github.com/pnguyen215/voipkit/pkg/ami/config" ) // Agents lists agents and their status. diff --git a/pkg/ami/ami_agi.go b/pkg/ami/ami_agi.go index 502611c..295b3b5 100644 --- a/pkg/ami/ami_agi.go +++ b/pkg/ami/ami_agi.go @@ -3,7 +3,7 @@ package ami import ( "context" - "github.com/pnguyen215/gobase-voip-core/pkg/ami/config" + "github.com/pnguyen215/voipkit/pkg/ami/config" ) // AGI add an AGI command to execute by Async AGI. diff --git a/pkg/ami/ami_atxfer.go b/pkg/ami/ami_atxfer.go index 239102e..a767639 100644 --- a/pkg/ami/ami_atxfer.go +++ b/pkg/ami/ami_atxfer.go @@ -3,7 +3,7 @@ package ami import ( "context" - "github.com/pnguyen215/gobase-voip-core/pkg/ami/config" + "github.com/pnguyen215/voipkit/pkg/ami/config" ) // Atxfer attended transfer. diff --git a/pkg/ami/ami_bridge.go b/pkg/ami/ami_bridge.go index d2f67fa..d365710 100644 --- a/pkg/ami/ami_bridge.go +++ b/pkg/ami/ami_bridge.go @@ -3,7 +3,7 @@ package ami import ( "context" - "github.com/pnguyen215/gobase-voip-core/pkg/ami/config" + "github.com/pnguyen215/voipkit/pkg/ami/config" ) // Bridge bridges two channels already in the PBX. diff --git a/pkg/ami/ami_callback.go b/pkg/ami/ami_callback.go index ba98ffa..9b6586f 100644 --- a/pkg/ami/ami_callback.go +++ b/pkg/ami/ami_callback.go @@ -6,7 +6,7 @@ import ( "strings" "time" - "github.com/pnguyen215/gobase-voip-core/pkg/ami/config" + "github.com/pnguyen215/voipkit/pkg/ami/config" ) type AMICallbackService interface { diff --git a/pkg/ami/ami_cdr.go b/pkg/ami/ami_cdr.go index e898e67..f54ceab 100644 --- a/pkg/ami/ami_cdr.go +++ b/pkg/ami/ami_cdr.go @@ -7,7 +7,7 @@ import ( "strings" "time" - "github.com/pnguyen215/gobase-voip-core/pkg/ami/config" + "github.com/pnguyen215/voipkit/pkg/ami/config" ) func NewAMICdr() *AMICdr { diff --git a/pkg/ami/ami_channel.go b/pkg/ami/ami_channel.go index 1461303..b5a116a 100644 --- a/pkg/ami/ami_channel.go +++ b/pkg/ami/ami_channel.go @@ -8,7 +8,7 @@ import ( "strconv" "strings" - "github.com/pnguyen215/gobase-voip-core/pkg/ami/config" + "github.com/pnguyen215/voipkit/pkg/ami/config" ) func NewChannel() *AMIChannel { diff --git a/pkg/ami/ami_chanspy.go b/pkg/ami/ami_chanspy.go index 0d2b110..b7c4a66 100644 --- a/pkg/ami/ami_chanspy.go +++ b/pkg/ami/ami_chanspy.go @@ -6,7 +6,7 @@ import ( "log" "strings" - "github.com/pnguyen215/gobase-voip-core/pkg/ami/config" + "github.com/pnguyen215/voipkit/pkg/ami/config" ) func NewAMIPayloadChanspy() *AMIPayloadChanspy { diff --git a/pkg/ami/ami_class.go b/pkg/ami/ami_class.go index 959b410..d851a4b 100644 --- a/pkg/ami/ami_class.go +++ b/pkg/ami/ami_class.go @@ -1,7 +1,7 @@ package ami import ( - "github.com/pnguyen215/gobase-voip-core/pkg/ami/config" + "github.com/pnguyen215/voipkit/pkg/ami/config" ) var chargingEvents *map[string]string = &map[string]string{} diff --git a/pkg/ami/ami_command.go b/pkg/ami/ami_command.go index 9b00d16..0591913 100644 --- a/pkg/ami/ami_command.go +++ b/pkg/ami/ami_command.go @@ -8,7 +8,7 @@ import ( "strings" "time" - "github.com/pnguyen215/gobase-voip-core/pkg/ami/config" + "github.com/pnguyen215/voipkit/pkg/ami/config" "golang.org/x/exp/slices" ) diff --git a/pkg/ami/ami_conf.go b/pkg/ami/ami_conf.go index cff7d25..8be16db 100644 --- a/pkg/ami/ami_conf.go +++ b/pkg/ami/ami_conf.go @@ -4,7 +4,7 @@ import ( "strconv" "time" - "github.com/pnguyen215/gobase-voip-core/pkg/ami/config" + "github.com/pnguyen215/voipkit/pkg/ami/config" ) var ( diff --git a/pkg/ami/ami_core.go b/pkg/ami/ami_core.go index d59f043..668f379 100644 --- a/pkg/ami/ami_core.go +++ b/pkg/ami/ami_core.go @@ -5,7 +5,7 @@ import ( "fmt" "log" - "github.com/pnguyen215/gobase-voip-core/pkg/ami/config" + "github.com/pnguyen215/voipkit/pkg/ami/config" ) func NewCore() *AMICore { diff --git a/pkg/ami/ami_dahd.go b/pkg/ami/ami_dahd.go index c925367..1a1c96c 100644 --- a/pkg/ami/ami_dahd.go +++ b/pkg/ami/ami_dahd.go @@ -3,7 +3,7 @@ package ami import ( "context" - "github.com/pnguyen215/gobase-voip-core/pkg/ami/config" + "github.com/pnguyen215/voipkit/pkg/ami/config" ) // DAHDIDialOffhook dials over DAHDI channel while offhook. diff --git a/pkg/ami/ami_db.go b/pkg/ami/ami_db.go index 4a3c4e0..b18647f 100644 --- a/pkg/ami/ami_db.go +++ b/pkg/ami/ami_db.go @@ -3,7 +3,7 @@ package ami import ( "context" - "github.com/pnguyen215/gobase-voip-core/pkg/ami/config" + "github.com/pnguyen215/voipkit/pkg/ami/config" ) func NewAMIPayloadDb() *AMIPayloadDb { diff --git a/pkg/ami/ami_dialplan.go b/pkg/ami/ami_dialplan.go index 26f1641..b313928 100644 --- a/pkg/ami/ami_dialplan.go +++ b/pkg/ami/ami_dialplan.go @@ -3,7 +3,7 @@ package ami import ( "context" - "github.com/pnguyen215/gobase-voip-core/pkg/ami/config" + "github.com/pnguyen215/voipkit/pkg/ami/config" ) func NewAMIPayloadExtension() *AMIPayloadExtension { diff --git a/pkg/ami/ami_dictionary.go b/pkg/ami/ami_dictionary.go index ad909a0..f44f45f 100644 --- a/pkg/ami/ami_dictionary.go +++ b/pkg/ami/ami_dictionary.go @@ -5,7 +5,7 @@ import ( "log" "strings" - "github.com/pnguyen215/gobase-voip-core/pkg/ami/config" + "github.com/pnguyen215/voipkit/pkg/ami/config" ) var overlapDictionaries *[]AMIEventDictionary = &[]AMIEventDictionary{} diff --git a/pkg/ami/ami_event.go b/pkg/ami/ami_event.go index e5b8f03..287b925 100644 --- a/pkg/ami/ami_event.go +++ b/pkg/ami/ami_event.go @@ -4,7 +4,7 @@ import ( "log" "strings" - "github.com/pnguyen215/gobase-voip-core/pkg/ami/config" + "github.com/pnguyen215/voipkit/pkg/ami/config" ) func NewEventListener() *AMIEvent { diff --git a/pkg/ami/ami_extension.go b/pkg/ami/ami_extension.go index 5ea1cfa..2e3db04 100644 --- a/pkg/ami/ami_extension.go +++ b/pkg/ami/ami_extension.go @@ -3,7 +3,7 @@ package ami import ( "context" - "github.com/pnguyen215/gobase-voip-core/pkg/ami/config" + "github.com/pnguyen215/voipkit/pkg/ami/config" ) // ExtensionStateList list the current known extension states. diff --git a/pkg/ami/ami_fax.go b/pkg/ami/ami_fax.go index bb0c046..f9f2045 100644 --- a/pkg/ami/ami_fax.go +++ b/pkg/ami/ami_fax.go @@ -3,7 +3,7 @@ package ami import ( "context" - "github.com/pnguyen215/gobase-voip-core/pkg/ami/config" + "github.com/pnguyen215/voipkit/pkg/ami/config" ) // FAXSession responds with a detailed description of a single FAX session. diff --git a/pkg/ami/ami_helper.go b/pkg/ami/ami_helper.go index 48430a0..9194b35 100644 --- a/pkg/ami/ami_helper.go +++ b/pkg/ami/ami_helper.go @@ -20,7 +20,7 @@ import ( "time" "github.com/nyaruka/phonenumbers" - "github.com/pnguyen215/gobase-voip-core/pkg/ami/config" + "github.com/pnguyen215/voipkit/pkg/ami/config" jsonI "github.com/json-iterator/go" ) diff --git a/pkg/ami/ami_iax.go b/pkg/ami/ami_iax.go index 77adb9b..62c8014 100644 --- a/pkg/ami/ami_iax.go +++ b/pkg/ami/ami_iax.go @@ -3,7 +3,7 @@ package ami import ( "context" - "github.com/pnguyen215/gobase-voip-core/pkg/ami/config" + "github.com/pnguyen215/voipkit/pkg/ami/config" ) // IAXnetstats show IAX channels network statistics. diff --git a/pkg/ami/ami_khomp.go b/pkg/ami/ami_khomp.go index a04116f..412145e 100644 --- a/pkg/ami/ami_khomp.go +++ b/pkg/ami/ami_khomp.go @@ -3,7 +3,7 @@ package ami import ( "context" - "github.com/pnguyen215/gobase-voip-core/pkg/ami/config" + "github.com/pnguyen215/voipkit/pkg/ami/config" ) func NewAMIPayloadKhompSMS() *AMIPayloadKhompSMS { diff --git a/pkg/ami/ami_mailbox.go b/pkg/ami/ami_mailbox.go index efa561d..1aa2d70 100644 --- a/pkg/ami/ami_mailbox.go +++ b/pkg/ami/ami_mailbox.go @@ -3,7 +3,7 @@ package ami import ( "context" - "github.com/pnguyen215/gobase-voip-core/pkg/ami/config" + "github.com/pnguyen215/voipkit/pkg/ami/config" ) // MailboxCount checks Mailbox Message Count. diff --git a/pkg/ami/ami_manager.go b/pkg/ami/ami_manager.go index ca00020..781d634 100644 --- a/pkg/ami/ami_manager.go +++ b/pkg/ami/ami_manager.go @@ -6,7 +6,7 @@ import ( "log" "strings" - "github.com/pnguyen215/gobase-voip-core/pkg/ami/config" + "github.com/pnguyen215/voipkit/pkg/ami/config" ) func NewAuth() *AMIAuth { diff --git a/pkg/ami/ami_map.go b/pkg/ami/ami_map.go index badd334..dcaf130 100644 --- a/pkg/ami/ami_map.go +++ b/pkg/ami/ami_map.go @@ -5,7 +5,7 @@ import ( "strconv" "time" - "github.com/pnguyen215/gobase-voip-core/pkg/ami/config" + "github.com/pnguyen215/voipkit/pkg/ami/config" ) func (c *AMICore) ExtensionStatesMap(ctx context.Context, guard *AMIExtensionGuard) (response []AMIExtensionStatus, err error) { diff --git a/pkg/ami/ami_meet_me.go b/pkg/ami/ami_meet_me.go index 05e2174..055b5d6 100644 --- a/pkg/ami/ami_meet_me.go +++ b/pkg/ami/ami_meet_me.go @@ -3,7 +3,7 @@ package ami import ( "context" - "github.com/pnguyen215/gobase-voip-core/pkg/ami/config" + "github.com/pnguyen215/voipkit/pkg/ami/config" ) // MeetMeList lists all users in a particular MeetMe conference. diff --git a/pkg/ami/ami_message.go b/pkg/ami/ami_message.go index 05654cc..eb79435 100644 --- a/pkg/ami/ami_message.go +++ b/pkg/ami/ami_message.go @@ -12,7 +12,7 @@ import ( "strings" "time" - "github.com/pnguyen215/gobase-voip-core/pkg/ami/config" + "github.com/pnguyen215/voipkit/pkg/ami/config" ) func NewActionWith(name string) *AMIMessage { diff --git a/pkg/ami/ami_monitor.go b/pkg/ami/ami_monitor.go index 3d46758..8c88324 100644 --- a/pkg/ami/ami_monitor.go +++ b/pkg/ami/ami_monitor.go @@ -3,7 +3,7 @@ package ami import ( "context" - "github.com/pnguyen215/gobase-voip-core/pkg/ami/config" + "github.com/pnguyen215/voipkit/pkg/ami/config" ) func NewAMIPayloadMonitor() *AMIPayloadMonitor { diff --git a/pkg/ami/ami_originate.go b/pkg/ami/ami_originate.go index 39bd605..8ff6595 100644 --- a/pkg/ami/ami_originate.go +++ b/pkg/ami/ami_originate.go @@ -6,7 +6,7 @@ import ( "log" "strings" - "github.com/pnguyen215/gobase-voip-core/pkg/ami/config" + "github.com/pnguyen215/voipkit/pkg/ami/config" ) func NewAMIPayloadOriginate() *AMIPayloadOriginate { diff --git a/pkg/ami/ami_pjsip.go b/pkg/ami/ami_pjsip.go index b27d082..c80133c 100644 --- a/pkg/ami/ami_pjsip.go +++ b/pkg/ami/ami_pjsip.go @@ -3,7 +3,7 @@ package ami import ( "context" - "github.com/pnguyen215/gobase-voip-core/pkg/ami/config" + "github.com/pnguyen215/voipkit/pkg/ami/config" ) // PJSIPNotify send NOTIFY to either an endpoint, an arbitrary URI, or inside a SIP dialog. diff --git a/pkg/ami/ami_pri.go b/pkg/ami/ami_pri.go index e7cf72d..709776d 100644 --- a/pkg/ami/ami_pri.go +++ b/pkg/ami/ami_pri.go @@ -3,7 +3,7 @@ package ami import ( "context" - "github.com/pnguyen215/gobase-voip-core/pkg/ami/config" + "github.com/pnguyen215/voipkit/pkg/ami/config" ) // PRIDebugFileSet set the file used for PRI debug message output. diff --git a/pkg/ami/ami_pub_channel.go b/pkg/ami/ami_pub_channel.go index ea14cb9..6f46bfa 100644 --- a/pkg/ami/ami_pub_channel.go +++ b/pkg/ami/ami_pub_channel.go @@ -4,7 +4,7 @@ import ( "log" "strings" - "github.com/pnguyen215/gobase-voip-core/pkg/ami/config" + "github.com/pnguyen215/voipkit/pkg/ami/config" ) func NewPubSubQueue() *AMIPubSubQueue { diff --git a/pkg/ami/ami_queue.go b/pkg/ami/ami_queue.go index 0398c58..e16c0a9 100644 --- a/pkg/ami/ami_queue.go +++ b/pkg/ami/ami_queue.go @@ -3,7 +3,7 @@ package ami import ( "context" - "github.com/pnguyen215/gobase-voip-core/pkg/ami/config" + "github.com/pnguyen215/voipkit/pkg/ami/config" ) // QueueStatuses show status all members in queue. diff --git a/pkg/ami/ami_sip.go b/pkg/ami/ami_sip.go index 89133b7..7c785ea 100644 --- a/pkg/ami/ami_sip.go +++ b/pkg/ami/ami_sip.go @@ -4,7 +4,7 @@ import ( "context" "fmt" - "github.com/pnguyen215/gobase-voip-core/pkg/ami/config" + "github.com/pnguyen215/voipkit/pkg/ami/config" ) // SIPPeers lists SIP peers in text format with details on current status. diff --git a/pkg/ami/ami_skinny.go b/pkg/ami/ami_skinny.go index 2a1604b..c8e013e 100644 --- a/pkg/ami/ami_skinny.go +++ b/pkg/ami/ami_skinny.go @@ -3,7 +3,7 @@ package ami import ( "context" - "github.com/pnguyen215/gobase-voip-core/pkg/ami/config" + "github.com/pnguyen215/voipkit/pkg/ami/config" ) // SKINNYDevices lists SKINNY devices (text format). diff --git a/pkg/ami/ami_socket.go b/pkg/ami/ami_socket.go index 4552294..22fc415 100644 --- a/pkg/ami/ami_socket.go +++ b/pkg/ami/ami_socket.go @@ -10,7 +10,7 @@ import ( "net" "strings" - "github.com/pnguyen215/gobase-voip-core/pkg/ami/config" + "github.com/pnguyen215/voipkit/pkg/ami/config" ) func NewAMISocket() *AMISocket { diff --git a/pkg/ami/ami_voicemail.go b/pkg/ami/ami_voicemail.go index 1f85c90..35d16f2 100644 --- a/pkg/ami/ami_voicemail.go +++ b/pkg/ami/ami_voicemail.go @@ -3,7 +3,7 @@ package ami import ( "context" - "github.com/pnguyen215/gobase-voip-core/pkg/ami/config" + "github.com/pnguyen215/voipkit/pkg/ami/config" ) // VoicemailRefresh tell asterisk to poll mailboxes for a change.