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

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

Open
Allan-N opened this issue May 24, 2024 · 14 comments
Open

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

Allan-N opened this issue May 24, 2024 · 14 comments
Labels
enhancement New feature or request

Comments

@Allan-N
Copy link
Collaborator

Allan-N commented May 24, 2024

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
Copy link
Member

jxmx commented Jun 27, 2024

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.

@jxmx jxmx added the enhancement New feature or request label Jun 27, 2024
@Allan-N
Copy link
Collaborator Author

Allan-N commented Jun 27, 2024

@InterLinked1 : any thoughts?

@InterLinked1
Copy link
Member

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
Copy link
Collaborator Author

Allan-N commented Jun 27, 2024

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
Copy link
Member

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
Copy link
Collaborator Author

Allan-N commented Jun 27, 2024

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
Copy link
Collaborator Author

Allan-N commented Jun 27, 2024

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
Copy link
Member

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
Copy link
Member

tsawyer commented Jun 28, 2024

Function cop,48 will play tone sequences.

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

@Allan-N
Copy link
Collaborator Author

Allan-N commented Jun 28, 2024

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
Copy link
Collaborator Author

Allan-N commented Jun 28, 2024

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

rpt cmd 491302 cop 48 !1000+1700/500

@tsawyer
Copy link
Member

tsawyer commented Jun 28, 2024

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
Copy link
Member

jxmx commented Jun 28, 2024

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
Copy link
Collaborator Author

Allan-N commented Jun 28, 2024

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

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

No branches or pull requests

4 participants