AllStarLink / ASL3

AllStarLink Version 3
https://www.allstarlink.org
GNU Affero General Public License v3.0
18 stars 3 forks source link

Add command to "play" courtesy tones, morse ID, voice ID, etc. #59

Open Allan-N opened 6 months ago

Allan-N commented 6 months ago

The "rpt.conf" file defines a number of courtesy tones (e.g. "ct1", "ct2", ...) but does not offer a way for the node admin to hear what each tone sounds like other than to modify the .conf file, restart Asterisk, and trigger whatever action is needed to play the tone.

I think it would be nice to add a command where one could exec asl-telemetry-play <telemetry> with the argument specifying what should be played. The command should allow one to specify a telemetry key (e.g. "ct1") or a telemetry tone escape sequence (e.g. "(660,880,150,2048)(660,0,150,2048)").

And, while we're here, it would also be nice to hear what a morse ID or voice ID would sound like.

jxmx commented 5 months ago

Is there a way to do this with Asterisk/AMI? I would LOVE to do this and looked at it before but couldn't come up with a way to make asterisk generate the sound.

Allan-N commented 5 months ago

@InterLinked1 : any thoughts?

InterLinked1 commented 5 months ago

I would LOVE to do this and looked at it before but couldn't come up with a way to make asterisk generate the sound.

I'm a bit confused about this, Asterisk generates the tones when telemetry happens, no?

@InterLinked1 : any thoughts?

I haven't thought about the most elegant way, in depth, but it's certainly possible to do something quick and dirty for testing.

For example, if the tone frequencies are known, you can set up a quick dialplan extension to test:

exten => 1234,1,PlayTones(440+480)
  same => n,Wait(10)
  same => n,Hangup

Or even possibly something like this, assuming DAHDI/1 was a phone that could be called:

channel originate DAHDI/1 application PlayTones 440+480

Obviously this isn't using the definitions in rpt.conf. If those definitions were defined in indications.conf as well, then it could work in a simpler way like this.

As far as Morse ID, I feel that the included MorseCode application in Asterisk probably suffices for that, again:

channel originate DAHDI/1 application MorseCode HELLO

Obviously, there is an AMI equivalent to these CLI commands too.

Hope that helps, if not please clarify what I'm missing and I'll revise my suggestion!

Allan-N commented 5 months ago

Hope that helps, if not please clarify what I'm missing and I'll revise my suggestion!

For the moment, let's take the idea of anasl-telemetry-play "command" out the discussion.

If you look at our current "rpt.conf" file you will see a number of courtesy tones (ct1, ct2, ct3, etc).

I would like to "hear" what each tone sounds like without having to modify the configuration, restart asterisk, trigger whatever would play the tone, etc.

What I'm looking for is an Asterisk CLI command that I could enter that would play "any" tone in the configuration (e.g. "rpt localplay 1999 ct1").

Alternatively, a CLI command where I could pass the value associated with an tone (e.g. "rpt localplay 1999 |t(350,0,100,2048)" ).

For "ct1" would this be :

channel originate DAHDI/1 application PlayTones (350,0,100,2048)(500,0,100,2048)(660,0,100,2048)
InterLinked1 commented 5 months ago

Hope that helps, if not please clarify what I'm missing and I'll revise my suggestion!

For the moment, let's take the idea of anasl-telemetry-play "command" out the discussion.

If you look at our current "rpt.conf" file you will see a number of courtesy tones (ct1, ct2, ct3, etc).

I would like to "hear" what each tone sounds like without having to modify the configuration, restart asterisk, trigger whatever would play the tone, etc.

What I'm looking for is an Asterisk CLI command that I could enter that would play "any" tone in the configuration (e.g. "rpt localplay 1999 ct1").

Alternatively, a CLI command where I could pass the value associated with an tone (e.g. "rpt localplay 1999 |t(350,0,100,2048)" ).

For "ct1" would this be :

channel originate DAHDI/1 application PlayTones (350,0,100,2048)(500,0,100,2048)(660,0,100,2048)

I don't think the arguments translate exactly. You'll have to convert the arguments into PlayTones arguments or indications.conf arguments (I recommend looking at indications.conf.sample).

I'm not sure what 350,0,100,2048 is supposed to do, but if you can state what it does in plain English I might be able to translate it.

Unfortunately channel originate application can only execute one application call (so one call to PlayTones). To do multiple, it would have to call an extension, not an application - so three separate channel originate calls, or one using exten instead of app.

Allan-N commented 5 months ago

I'm not sure what 350,0,100,2048 is supposed to do, but if you can state what it does in plain English I might be able to translate it.

The tone groups are documented @ https://wiki.allstarlink.org/wiki/Courtesy_Tones

Allan-N commented 5 months ago

Another question to ask is : If we don't already have an "rpt" commands/functions that would allow us to play the equivalent sounds based on a provided string vs. what's stored in the configuration and triggered by various actions then how much effort would be needed to ADD new localplay-like commands?

InterLinked1 commented 5 months ago

Another question to ask is : If we don't already have an "rpt" commands/functions that would allow us to play the equivalent sounds based on a provided string vs. what's stored in the configuration and triggered by various actions then how much effort would be needed to ADD new localplay-like commands?

It could be done by adding a new CLI command.

But I would caution against feature creep, which app_rpt already has a lot of, by trying to do everything under the sun within the module, rather than relying on the rest of Asterisk. It could definitely be done in the dialplan.

Another option is to use cli_aliases.conf to make rpt "alias" commands for other commands that do what is desired.

tsawyer commented 5 months ago

Function cop,48 will play tone sequences.

https://wiki.allstarlink.org/wiki/Transmitting_Tone_Sequences

Allan-N commented 5 months ago

Is there a Asterisk CLI command to execute an arbitrary (not currently in rpt.conf) cop,48 sequence? ... or any arbitrary cop sequence?

If the answer is yes, GREAT. If not, sad face.

and, please note, the ask is to provide a way for folks to see what's possible, to "hear" what a change might sound like, to allow node operators to decide what configuration options would work/sound best for them.

Allan-N commented 5 months ago

Possibly answering my own questions. The following command appears to work :-)

rpt cmd 491302 cop 48 !1000+1700/500
tsawyer commented 5 months ago

ct1 = |t(350,0,100,2048)(500,0,100,2048)(660,0,100,2048)

CT1 would be rpt cmd 2506 cop 48 !350/100,!500/100,!660/100

jxmx commented 5 months ago

This is awesome. I never knew this existed. What we need is a new command like asl-playtone. You can format it like the telemetry tones format and just ignore the amplitude element.

Allan-N commented 5 months ago

I'm still thinking about asl-telemetry-play (or asl-play-telemetry) that could play tones, morse code IDs, voice IDs, etc.