Hi there!
First of all, sorry if I posted this into wrong thread. I know that Audiosocket is community supported. And to be honest, this is a great addition! I spend a lot of time, trying to find solution which would suit my needs. And before I discovered Audiosocket I was looking into External media via ARI, which is much more complicated than using Audiosocket. So having AudioSocket shipped with asterisk just great !
I am sure that issue is not in module itself, but in my code / setup.
When I use audiosocket, I am able to retrieve audio stream, as well as send it back (which would play it without any issue) But then, when audio is played fully, I send termination message, in asterisk logs I have:
[Dec 07 22:12:18.509] ERROR[2468][C-00000059]: app_audiosocket.c:206 audiosocket_run: Failed to receive frame from AudioSocket message forchannel SIP/dev-00000058
Which impacts call flow.
I use this example: github com/CyCoreSystems/audiosocket/blob/master/examples/playfile/main.go
So then, I added a bit of logs to debug this, also trying different things to see if that helps.
In documentation ( AudioSocket - Asterisk Documentation ) it says that simply socket closure should be sufficient.
So I tried just close socket.
For example, when I modify code to something like this:
// Listen listens for and responds to AudioSocket connections
func Listen(ctx context.Context) error {
l, err := net.Listen("tcp", listenAddr)
if err != nil {
return errors.Wrapf(err, "failed to bind listener to socket %s", listenAddr)
}
for {
conn, err := l.Accept()
if err != nil {
log.Println("failed to accept new connection:", err)
continue
}
ctx, cancel := context.WithTimeout(ctx, MaxCallDuration)
go processDataFromAsterisk(ctx, cancel, conn)
if _, err := conn.Write(audiosocket.HangupMessage()); err != nil {
log.Println("failed to send hangup message:", err)
}
conn.Close()
// go Handle(ctx, conn)
}
}
Basically close connection straight after starting it - same result.
I tried to send silence (something available in code, but not documentation), before sending termination message. I also tried to send termination message before sending audio stream - socket closed by asterisk, but still having an issue in the asterisk logs.
I also looked into audiosocket/asterisk/apps/app_audiosocket.c at master · CyCoreSystems/audiosocket · GitHub
But nothing that I could stop which would help me in troubleshooting
PS: I use Asterisk 18.15.1.
PS: Sorry, I can post only two links in a post, so I had to remove valid links…/
I ran out of ideas and not shure where is that issue is coming from
Thanks in advance!