Code Monkey home page Code Monkey logo

goami's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

goami's Issues

error import lib

I'm trying to use the lib I'm having this error asking to download the library but I've already downloaded it from github.com/heltonmarx/goami

Fax functions are missing

While trying to use goami to collect metrics I noticed that the FAXStats and FAXSession(s) commands are not implemented, so I did that in PR: #19

import golang

Default github.com/heltonmarx/goami/ami use 1.0.0 version. Can you update release? How i can use latest version goami? Context in example not support in 1.0.0

Possible async events not handle.

In this function (

func requestList(client Client, action, id, event, complete string, v ...interface{}) ([]Response, error) {
) you are expecting that the next events after the action sent will we the ones related with that action, which could be not true: "At its heart, AMI is an asynchronous message bus: it spills events that contain information about the Asterisk system over some transport. In response, clients may request that Asterisk takes some action. These two concepts - actions and events - make up the core of what is AMI. As AMI is asynchronous, as events occur in Asterisk they are immediately sent to the clients. This means that actions issued by entities happen without any synchronization with the events being received, even if those events occur in response to an action. It is the responsibility of entities to associate event responses back to actions."

You should add that if the id of the event received is not equals to the one you sent in the action then discard the event as a response to that specific action.

Logoff inconsistant behaviour

I'm trying to connect with Asterisk AMI interface using goAMI. I am sequentially calling, connect, originate and logoff functions. All looks fine but i face strange behavior with logoff function.
If I call the script and call ami.logoff() function for first time it will return the nil value which seems fine. When I call the same script for the second time, this functions return expected.

Code block

res := ami.Logoff(socket, uuid)
if res == nil {
	println("Logoff successful", res)
} else {
	println("Logoff failed", res)
}

Output when calling the same script for two times.

$ go run main.go
Logoff successful (0x0,0x0)
$ go run main.go
Logoff failed (0x114ca00,0xc000012070)

Asterisk version: 11.25.3
OS: CentOS 7.4

Unable to shutdown on Close(): infinite loop

socket.Recv() does not ends after shutdown socket closed leading to infinite loop in read()

patch to solve:

diff -uwrd old/socket.go new/socket.go
--- old/socket.go	2017-10-11 15:06:17.553303464 +0300
+++ new/socket.go	2017-10-11 15:08:10.601014898 +0300
@@ -7,8 +7,11 @@
 	"net"
 	"strings"
 	"sync"
+	"errors"
 )
 
+var ErrClosed = errors.New("socket closed") 
+
 // Socket holds the socket client connection data.
 type Socket struct {
 	conn     net.Conn
@@ -70,7 +73,7 @@
 				return buffer.String(), nil
 			}
 		case <-s.shutdown:
-			return buffer.String(), nil
+			return buffer.String(), ErrClosed
 		}
 	}
 }

custom error examples

i got custom error with repo examples.
go run ....

login.go
2016/12/05 17:25:41 logoff error: (logout failed: Authentication accepted)
sippeers.go

login ok!
2016/12/05 17:39:21 sip peers error: failed on event PeerEntry:Authentication accepted

exit status 1

but events.go work fine

go1.7.3
Asterisk 13.6.0

Connection reset

Hello Helton. Sorry to open an issue, I really know its not a problem in the goami library, but I need your help, if you could, of course.
Im doing this code :

for {
    queuesummary, err := ami.QueueSummary(socket, uuid, "default")
    if err != nil {
        log.Fatal("QueueSummary() ",err)
        return
    }
    log.Println(queuesummary)
}

So In a very short time of this loop, I got my connection reseted by asterisk ami, but I didn't see nothing at asterisk logs.
The "err" is : 2017/04/19 02:35:57 QueueSummary() write tcp 000.000.000.000:48034->111.111.111.111:8426: write: connection reset by peer
exit status 1

Do you know something I could do to otimize my code avoiding this kind of situation?

Thank you.

Socket run get stack on read error

When you receive an EOF in the reader.ReadString('\n') in run go routing in a Socket the s.Close() is executed but after executing close(s.shutdown) the is waiting for itself to end, that is never. This generates the go routing to get stack, generating, between other things, the TCP connection to get stack in CLOSE_WAIT status.
The issue is simple to reproduce when you are allow to connect to the AMI but you have a wrong password for the given user.
I don't know why you add the waiting group here but I made tests without it and everything went alright.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.