Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter received events based on AMIServerID #26

Open
dppancake opened this issue Sep 10, 2021 · 6 comments
Open

Filter received events based on AMIServerID #26

dppancake opened this issue Sep 10, 2021 · 6 comments

Comments

@dppancake
Copy link

dppancake commented Sep 10, 2021

Hi,

Would it be possible to filter events based on the AMIServerID when opening a WebSocket? I want to use this as a proxy for multiple systems and I don't want every connected system to receive events from all connected PBX's / AMI Hosts.

Maybe by providing a header with the AMIServerID when opening the WebSocket or sending an action after the connection has been opened?

For example in Python:
ws.connect(ws_end_point, header={'AMIServerID': 1}

@staskobzar
Copy link
Owner

Hi,
I think, the only way for now would be to filter on client (javascript) side. Just ignore message for 'AMIServerID': 1 in javascript websocket connection.

@dppancake
Copy link
Author

dppancake commented Sep 10, 2021

Hi,

Thanks for the fast reaction.

I already did this, but if possible, I want to prevent to implement this in every system that uses this proxy. Would it be something you could and would implement in amiws?

@staskobzar
Copy link
Owner

I am sorry, but I am not sure I will have a time to work on amiws in near future due to my work load.
But I am not sure I do understand how you see that. Filter on IP base? Like when the websocket connection is from IP AAA then filter AMIServerID in 1, 2, or 3 ?

@dppancake
Copy link
Author

dppancake commented Sep 10, 2021

Ah, I understand. Work goes first :)

Well, I don't know the language C, but maybe you could create a unique ID for every connection, so you can seperate them. Create a object with the Unique ID, connection and headers (AMIServerID) / List. Send the message only to object connections which have the Server ID in the object header "AMIServerID" or don't have the "AMIServerID" header defined (receive everything).

The thing is that I could create multiple websockets from the same IP. So only seperating them by IP, wouldn't be that efficient.

Maybe this can help?

This is just a guess, I could be totally wrong ofcourse. Just trying to throw some ideas.

@staskobzar
Copy link
Owner

what you describe is more like rabbitmq queue messages system with topic or direct exchange. Maybe you need better tool for your task, with more powerful features. Not trying to tell you what to do, just an idea ))
I have golang library for AMI https://github.com/staskobzar/goami2
For more sophisticated message exchanges I use it with rabbitmq and webstomp or websocket

@dppancake
Copy link
Author

I will take a look at it. For now I use amiws and filter them client side with the server_id. Thanks for the help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants