[Gambas-user] Gambas AMI For PBX Asterisk
Mayost Sharon
sharon at 455.co.il
Fri Apr 28 12:56:09 CEST 2023
---------- Original Message -----------
From: T Lee Davidson <t.lee.davidson at gmail.com>
To: user at lists.gambas-basic.org
Sent: Thu, 27 Apr 2023 19:25:36 -0400
Subject: Re: [Gambas-user] Gambas AMI For PBX Asterisk
> On 4/26/23 16:19, Mayost Sharon wrote:
> > Hello
> >
> > I tried to build a class for an ASTERISK AMI
> > https://wiki.asterisk.org/wiki/display/AST/The+Asterisk+Manager+TCP+IP+API
> >
> > It works very well
> > I tried it on my switchboard and it does the job well
> >
> > The class can be used freely by anyone who needs it
> >
> > I will gladly accept comments on the code
> >
> > Thank you very much everyone
>
> I don't know anything about ASTERISK AMI, so I cannot comment much on your code.
>
> However, there a couple things I will mention.
>
> When you are sending or receiving from an external source, you might want to
> use TRY so you can recover from any network errors. Line 95 in gbAmi.class is
> one example.
>
> Also, in the Add method of _Action_Keys.class, you are relying on a valid
> gbAmi instance. You may wish to check if that reference is null before you use
> it.
>
> --
> Lee
>
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
------- End of Original Message -------
Thank you
Indeed, I still have a lot of things to sort out there
I haven't gotten to the error reduction part yet
Also, I'm going to change a few more things
Because my son (he writes in C) told me that there could be a problem
Static Public _$h_socket_copy As Socket
On line 10 in gbAmi.class
He thinks if I use Static
So it will be public to all instances
The problem was that I need to use h_socket also in the class of _Action_Keys.class
And also in the gbAmi.class class
That's why it said I need to pass h_socket when I create NEW
That is, like this:
in the gbAmi.class class
Private Function Actions_Read(h_socket As Socket) As _Action_Keys
Return $Actions
End
in the class of _Action_Keys.class
Public Sub _new(h_socket As Socket)
End
This way I can actually use a variable or object in two classes
Many thanks again
More information about the User
mailing list