I would like to be able to refuse connection a node which is already connected to others nodes

Hello there !
I want to be able to accept connections from external nodes on my Hub, only if they are not already connected to one or more nodes.
If so, I would like to be able to refuse the connection !
Is there a native feature or modification to do this in Allstar?
Thank you for your reply
73’s

It is not a built-in function.

You can do this but you will need to script it yourself.

Likely the most simple method would be using ‘event programming’ right inside the software.
This can take some time to get your head around it.

The issue comes up every once in a while and nobody comes back and posts a successful method example for others to follow.

Here is info in the wiki
https://wiki.allstarlink.org/wiki/Event_Management

While I don’t think there is a method to stop the initial connect,
you have to query the connected node for it’s list of connected nodes and make a judgement in your script to issue disconnect if needed.

You might need a bash script as well to do that lifting but I think it is possible to do it inside asterisk. Bash may make it easier as you can issue asterisk commands to the app_rpt software from there.
And you have a connection script execution available to start the whole thing off.
I doubt these are in the wiki but here they are…
connpgm=full_path_to_script/name_of_script
discpgm=full_path_to_script/name_of_script

So on new connection, you can call a script
Same with disconnect if needed (likely not)

I have used the above for projects in the past and know they work. But don’t forget to check/change ownership/permission of the script files your using.

If anyone has a working method, please post it to benefit others.

The connect script could call the stats API eg. https://stats.allstarlink.org/api/stats/2530 and then parse out the JSON response stats->data->links field to get the count of connected nodes. Here is some php code that can be called to get the stats and parse the response: https://github.com/davidgsd/AllScan/blob/main/stats/stats.php Then if count($links)>1 call asterisk with a command to disconnect that node.

I believe he wants to block a incoming connection based on node# as a target, not based on the number of connections, but I could be wrong if I am not reading it correctly. And that would be a good bit easier. You would not have to query the incoming for those connected to it and could be done mostly from event management…

Hi Mike and 73’s
Excuse me if I am not very precise in my sentences but as you know, the French speak English like Spanish cows LOL

I would like simple operation as the phone:
If A calls B (me) but A has not hung up the call with previous correspondent C, I want to be able to disconnect automaticly A !

For Allstar developers, I think it would be less complicated for everyone if they modified the Allstar code so that by default a node that connects to another automatically disconnects from the previous one.
If multiple interconnection mode is desired this should be an activatable option, but not the default operation.

I’m not a developer so in the meantime, if an OM can post a functional and detailed solution, that would be wonderful.

Hi and 73’s. Thank you for your answer.
May be this could be the start of a solution but for me, who am not a developer, it is impossible to implement.

FB,
While that may sound advantageous to you, it really is not. I will explain in example.

For many nodes have also private local connections that have nothing to do with the network or network activity and count as a connection, public or private in the connection count registrar.
But some are local rf private networks. Even remote base’s.
They may even have a co-connected public node. I often run the 6meter,440 & 220 repeaters together to a HUB node and make external connections from there. This allows me to drop one repeater if it is needed for some other purpose without reconfiging the connection path.

So, in effect, you would block me because I have a private node used as a system recorder connected as a private node. Or perhaps one other that plays alerts from local hardware that was placed as a private node so I could turn it off if needed by disconnecting it. Or a private node as a remote base to allow other local repeater a chance to enjoy the ASL network and participate.

But this can be achieved with event programming and script looking back at number of connections on the inbound fresh connect. And not something I would spend my own time on.

Otherwise, you only have a setting of the maximum connections you will accept on your node, having nothing to do with how many connections a inbound connection might have. So that is no help.