Re: [App_rpt-users] Access Command Mode With A Macro
The question is, can a macro be created to connect to a node and then put it in the command mode? I've tried creating the usual macro example. [macro] 1=*325555*425555# *51 only calls the 25555 node yet it does not take into account the *425555
yes On 7/31/2013 2:38 PM, Johnny Keeker wrote:
The question is, can a macro be created to connect to a node and then put it in the command mode?I've tried creating the usual macro example. [macro] 1=*325555*425555# *51 only calls the 25555 node yet it does not take into account the *425555
_______________________________________________ App_rpt-users mailing list App_rpt-users@ohnosec.org http://ohnosec.org/cgi-bin/mailman/listinfo/app_rpt-users
Leave the # off and it will stay in command mode. 1=*355555*455555 Also you can do this shortcut. The zero is an app_rpt shortcut meaning the last node used node number. 1=*355555*40 -- Tim :wq On Jul 31, 2013, at 11:43 AM, Jon Rorke <jrorke@cogeco.ca> wrote:
yes On 7/31/2013 2:38 PM, Johnny Keeker wrote:
The question is, can a macro be created to connect to a node and then put it in the command mode? I've tried creating the usual macro example. [macro] 1=*325555*425555# *51 only calls the 25555 node yet it does not take into account the *425555
_______________________________________________ App_rpt-users mailing list App_rpt-users@ohnosec.org http://ohnosec.org/cgi-bin/mailman/listinfo/app_rpt-users
_______________________________________________ App_rpt-users mailing list App_rpt-users@ohnosec.org http://ohnosec.org/cgi-bin/mailman/listinfo/app_rpt-users
Ok my original answer is not correct. it should be like this: 1=*425555*327999# So if you execute macro *51, you node will command node 25555 to connect to 27999. This works as long as your node is already connected to node 25222. Jon RQ On 7/31/2013 2:43 PM, Jon Rorke wrote:
yes On 7/31/2013 2:38 PM, Johnny Keeker wrote:
The question is, can a macro be created to connect to a node and then put it in the command mode?I've tried creating the usual macro example. [macro] 1=*325555*425555# *51 only calls the 25555 node yet it does not take into account the *425555
_______________________________________________ App_rpt-users mailing list App_rpt-users@ohnosec.org http://ohnosec.org/cgi-bin/mailman/listinfo/app_rpt-users
_______________________________________________ App_rpt-users mailing list App_rpt-users@ohnosec.org http://ohnosec.org/cgi-bin/mailman/listinfo/app_rpt-users
On 7/31/13 2:38 PM, Johnny Keeker wrote:
The question is, can a macro be created to connect to a node and then put it in the command mode? I've tried creating the usual macro example. [macro] 1=*325555*425555# *51 only calls the 25555 node yet it does not take into account the *425555
Colin Chapman, founder of Lotus, had a favorite saying: "Simplify and add lightness". When you get into complex command strings and trying to make the machines jump through hoops, brew coffee, and change the baby at the same time, it's easy to forget that there is more than one way to accomplish what you are trying to do or gore an ox or stuff a ballot box (if you're in Chicago). Ever thought of writing an OS shell script? There you now have somewhat more programmatic control over HOW and IN WHAT sequence commands are executed, can pause in between commands to allow them to run to completion, do variable substitution so that the same shell, with different values passed to it, can be used for multiple functions. In short, to me, it makes more sense. Here, is an example of a useful Macro tied to a schedule: [macro27XXX] 09=*81# [schedule27XXX] 09 = 00 * * * * Which plays the time at the top of every hour. Clean. Neat. Simple. Brilliant. No pillocks here.... But, what if you want to unlink two hub nodes, link another node through a secondary hub (because your brother ops object to the other node because it's a 2-meter link radio?) and tell everyone that it's done? Wow. Tell me the command string for that. I do not see that as a macro job. How about a script to do it: Call this script linkconnect.sh. Put it in a scripts directory somewhere, like /etc/asterisk/scripts, strangely enough... Call it from rpt.conf: 9XX=cmd,/etc/asterisk/scripts/linkconnect.sh -- # Call a shell, no error checking, WYSIWYG, down and dirty #!/bin/bash #Send Asterisk a function message to unlink the two hubs /usr/sbin/asterisk -rx "rpt fun 27123 *127234#" #wait for all the gyrations and Allison to shut up sleep 5 #Now, send a message to the second hub in the network to link #to the link radio node 27999 /usr/sbin/asterisk -rx "rpt fun 27123 *428999*327999#" #Wait for it.... sleep 2 #Now, play an announcement that the new configuration is up and going. /etc/asterisk/scripts/w3skconnect -- (obviously not the real node numbers, apologies to the holders of those numbers if they're in live use.) Now, you can define a 'macro' as, say, 10=*9xx# ;call the function numbered 9XX This gives you added flexibility and the ability to either call, using the internal schedule, on a fixed value, the shell you wrote, or using the OS cron facility, from a cronjob, or, even just run from the shell. Don't fixate on one solution as being better...sometimes imagination is the key to creativity and indecision is the key to flexibility. -- Bryan In this world, you must be oh so smart or oh so pleasant. Well, for years I was smart. I recommend pleasant. You may quote me. Sent from my MacBook Pro.
Brilliantly written Bryan! Kudos Mike - KD5DFB On Wed, Jul 31, 2013 at 2:14 PM, Bryan D. Boyle <bdboyle@bdboyle.com> wrote:
On 7/31/13 2:38 PM, Johnny Keeker wrote:
The question is, can a macro be created to connect to a node and then put it in the command mode? I've tried creating the usual macro example. [macro] 1=*325555*425555# *51 only calls the 25555 node yet it does not take into account the *425555
Colin Chapman, founder of Lotus, had a favorite saying: "Simplify and add lightness".
When you get into complex command strings and trying to make the machines jump through hoops, brew coffee, and change the baby at the same time, it's easy to forget that there is more than one way to accomplish what you are trying to do or gore an ox or stuff a ballot box (if you're in Chicago).
Ever thought of writing an OS shell script? There you now have somewhat more programmatic control over HOW and IN WHAT sequence commands are executed, can pause in between commands to allow them to run to completion, do variable substitution so that the same shell, with different values passed to it, can be used for multiple functions.
In short, to me, it makes more sense.
Here, is an example of a useful Macro tied to a schedule:
[macro27XXX] 09=*81#
[schedule27XXX] 09 = 00 * * * *
Which plays the time at the top of every hour. Clean. Neat. Simple. Brilliant. No pillocks here....
But, what if you want to unlink two hub nodes, link another node through a secondary hub (because your brother ops object to the other node because it's a 2-meter link radio?) and tell everyone that it's done? Wow. Tell me the command string for that.
I do not see that as a macro job.
How about a script to do it:
Call this script linkconnect.sh. Put it in a scripts directory somewhere, like /etc/asterisk/scripts, strangely enough...
Call it from rpt.conf: 9XX=cmd,/etc/asterisk/scripts/**linkconnect.sh
-- # Call a shell, no error checking, WYSIWYG, down and dirty #!/bin/bash
#Send Asterisk a function message to unlink the two hubs /usr/sbin/asterisk -rx "rpt fun 27123 *127234#"
#wait for all the gyrations and Allison to shut up sleep 5
#Now, send a message to the second hub in the network to link #to the link radio node 27999 /usr/sbin/asterisk -rx "rpt fun 27123 *428999*327999#"
#Wait for it.... sleep 2
#Now, play an announcement that the new configuration is up and going. /etc/asterisk/scripts/**w3skconnect --
(obviously not the real node numbers, apologies to the holders of those numbers if they're in live use.)
Now, you can define a 'macro' as, say, 10=*9xx# ;call the function numbered 9XX
This gives you added flexibility and the ability to either call, using the internal schedule, on a fixed value, the shell you wrote, or using the OS cron facility, from a cronjob, or, even just run from the shell.
Don't fixate on one solution as being better...sometimes imagination is the key to creativity and indecision is the key to flexibility.
-- Bryan In this world, you must be oh so smart or oh so pleasant. Well, for years I was smart. I recommend pleasant. You may quote me.
Sent from my MacBook Pro. ______________________________**_________________ App_rpt-users mailing list App_rpt-users@ohnosec.org http://ohnosec.org/cgi-bin/**mailman/listinfo/app_rpt-users<http://ohnosec.org/cgi-bin/mailman/listinfo/app_rpt-users>
Very nice - I do something quite similar. I note that you can define a function to tell Allison to "be quiet" for example 9940=cop,34 ; local telemtry off I execute *9940 at the start of my multi step script and it helps keep things a bit more quiet. At the end, I turn it back on with cop,33. Of course, this only does the local node. I suppose you could execute such a function on the remote node to turn off announcements (after the first one). I have a DSTAR machine at the same site and it sends commands to the asterisk machine, in some cases, using OS scripts like this. 73 Ken From: Michael Hebert [mailto:mhebert1975@gmail.com] Sent: Wednesday, July 31, 2013 3:21 PM To: Bryan D. Boyle Cc: app_rpt mailing list Subject: Re: [App_rpt-users] Access Command Mode With A Macro Brilliantly written Bryan! Kudos Mike - KD5DFB On Wed, Jul 31, 2013 at 2:14 PM, Bryan D. Boyle <bdboyle@bdboyle.com> wrote: On 7/31/13 2:38 PM, Johnny Keeker wrote: The question is, can a macro be created to connect to a node and then put it in the command mode? I've tried creating the usual macro example. [macro] 1=*325555*425555# *51 only calls the 25555 node yet it does not take into account the *425555 Colin Chapman, founder of Lotus, had a favorite saying: "Simplify and add lightness". When you get into complex command strings and trying to make the machines jump through hoops, brew coffee, and change the baby at the same time, it's easy to forget that there is more than one way to accomplish what you are trying to do or gore an ox or stuff a ballot box (if you're in Chicago). Ever thought of writing an OS shell script? There you now have somewhat more programmatic control over HOW and IN WHAT sequence commands are executed, can pause in between commands to allow them to run to completion, do variable substitution so that the same shell, with different values passed to it, can be used for multiple functions. In short, to me, it makes more sense. Here, is an example of a useful Macro tied to a schedule: [macro27XXX] 09=*81# [schedule27XXX] 09 = 00 * * * * Which plays the time at the top of every hour. Clean. Neat. Simple. Brilliant. No pillocks here.... But, what if you want to unlink two hub nodes, link another node through a secondary hub (because your brother ops object to the other node because it's a 2-meter link radio?) and tell everyone that it's done? Wow. Tell me the command string for that. I do not see that as a macro job. How about a script to do it: Call this script linkconnect.sh. Put it in a scripts directory somewhere, like /etc/asterisk/scripts, strangely enough... Call it from rpt.conf: 9XX=cmd,/etc/asterisk/scripts/linkconnect.sh -- # Call a shell, no error checking, WYSIWYG, down and dirty #!/bin/bash #Send Asterisk a function message to unlink the two hubs /usr/sbin/asterisk -rx "rpt fun 27123 *127234#" #wait for all the gyrations and Allison to shut up sleep 5 #Now, send a message to the second hub in the network to link #to the link radio node 27999 /usr/sbin/asterisk -rx "rpt fun 27123 *428999*327999#" #Wait for it.... sleep 2 #Now, play an announcement that the new configuration is up and going. /etc/asterisk/scripts/w3skconnect -- (obviously not the real node numbers, apologies to the holders of those numbers if they're in live use.) Now, you can define a 'macro' as, say, 10=*9xx# ;call the function numbered 9XX This gives you added flexibility and the ability to either call, using the internal schedule, on a fixed value, the shell you wrote, or using the OS cron facility, from a cronjob, or, even just run from the shell. Don't fixate on one solution as being better...sometimes imagination is the key to creativity and indecision is the key to flexibility. -- Bryan In this world, you must be oh so smart or oh so pleasant. Well, for years I was smart. I recommend pleasant. You may quote me. Sent from my MacBook Pro. _______________________________________________ App_rpt-users mailing list App_rpt-users@ohnosec.org http://ohnosec.org/cgi-bin/mailman/listinfo/app_rpt-users
Guys, This is an excellent thread with great ideas. By chance does the cmd function pass the entered DTMF sequence to the shell script? Robert N5QM On Wed, Jul 31, 2013 at 6:10 PM, Ken <ke2n@cs.com> wrote:
Very nice – I do something quite similar.
I note that you can define a function to tell Allison to “be quiet” for example
9940=cop,34 ; local telemtry off
I execute *9940 at the start of my multi step script and it helps keep things a bit more quiet.
At the end, I turn it back on with cop,33.
Of course, this only does the local node. I suppose you could execute such a function on the remote node to turn off announcements (after the first one).
I have a DSTAR machine at the same site and it sends commands to the asterisk machine, in some cases, using OS scripts like this.
73
Ken
From: Michael Hebert [mailto:mhebert1975@gmail.com] Sent: Wednesday, July 31, 2013 3:21 PM To: Bryan D. Boyle Cc: app_rpt mailing list Subject: Re: [App_rpt-users] Access Command Mode With A Macro
Brilliantly written Bryan! Kudos
Mike - KD5DFB
On Wed, Jul 31, 2013 at 2:14 PM, Bryan D. Boyle <bdboyle@bdboyle.com> wrote:
On 7/31/13 2:38 PM, Johnny Keeker wrote:
The question is, can a macro be created to connect to a node and then put it in the command mode? I've tried creating the usual macro example. [macro] 1=*325555*425555# *51 only calls the 25555 node yet it does not take into account the *425555
Colin Chapman, founder of Lotus, had a favorite saying: "Simplify and add lightness".
When you get into complex command strings and trying to make the machines jump through hoops, brew coffee, and change the baby at the same time, it's easy to forget that there is more than one way to accomplish what you are trying to do or gore an ox or stuff a ballot box (if you're in Chicago).
Ever thought of writing an OS shell script? There you now have somewhat more programmatic control over HOW and IN WHAT sequence commands are executed, can pause in between commands to allow them to run to completion, do variable substitution so that the same shell, with different values passed to it, can be used for multiple functions.
In short, to me, it makes more sense.
Here, is an example of a useful Macro tied to a schedule:
[macro27XXX] 09=*81#
[schedule27XXX] 09 = 00 * * * *
Which plays the time at the top of every hour. Clean. Neat. Simple. Brilliant. No pillocks here....
But, what if you want to unlink two hub nodes, link another node through a secondary hub (because your brother ops object to the other node because it's a 2-meter link radio?) and tell everyone that it's done? Wow. Tell me the command string for that.
I do not see that as a macro job.
How about a script to do it:
Call this script linkconnect.sh. Put it in a scripts directory somewhere, like /etc/asterisk/scripts, strangely enough...
Call it from rpt.conf: 9XX=cmd,/etc/asterisk/scripts/linkconnect.sh
-- # Call a shell, no error checking, WYSIWYG, down and dirty #!/bin/bash
#Send Asterisk a function message to unlink the two hubs /usr/sbin/asterisk -rx "rpt fun 27123 *127234#"
#wait for all the gyrations and Allison to shut up sleep 5
#Now, send a message to the second hub in the network to link #to the link radio node 27999 /usr/sbin/asterisk -rx "rpt fun 27123 *428999*327999#"
#Wait for it.... sleep 2
#Now, play an announcement that the new configuration is up and going. /etc/asterisk/scripts/w3skconnect --
(obviously not the real node numbers, apologies to the holders of those numbers if they're in live use.)
Now, you can define a 'macro' as, say, 10=*9xx# ;call the function numbered 9XX
This gives you added flexibility and the ability to either call, using the internal schedule, on a fixed value, the shell you wrote, or using the OS cron facility, from a cronjob, or, even just run from the shell.
Don't fixate on one solution as being better...sometimes imagination is the key to creativity and indecision is the key to flexibility.
-- Bryan In this world, you must be oh so smart or oh so pleasant. Well, for years I was smart. I recommend pleasant. You may quote me.
Sent from my MacBook Pro. _______________________________________________ App_rpt-users mailing list App_rpt-users@ohnosec.org http://ohnosec.org/cgi-bin/mailman/listinfo/app_rpt-users
_______________________________________________ App_rpt-users mailing list App_rpt-users@ohnosec.org http://ohnosec.org/cgi-bin/mailman/listinfo/app_rpt-users
simply, no -- Bryan Sent from my iPhone 5...small keyboard, big fingers...please forgive misspellings... On Jul 31, 2013, at 21:37, Robert Garcia <robert@n5qm.com> wrote:
Guys,
This is an excellent thread with great ideas. By chance does the cmd function pass the entered DTMF sequence to the shell script?
Robert N5QM
On Wed, Jul 31, 2013 at 6:10 PM, Ken <ke2n@cs.com> wrote:
Very nice – I do something quite similar.
I note that you can define a function to tell Allison to “be quiet” for example
9940=cop,34 ; local telemtry off
I execute *9940 at the start of my multi step script and it helps keep things a bit more quiet.
At the end, I turn it back on with cop,33.
Of course, this only does the local node. I suppose you could execute such a function on the remote node to turn off announcements (after the first one).
I have a DSTAR machine at the same site and it sends commands to the asterisk machine, in some cases, using OS scripts like this.
73
Ken
From: Michael Hebert [mailto:mhebert1975@gmail.com] Sent: Wednesday, July 31, 2013 3:21 PM To: Bryan D. Boyle Cc: app_rpt mailing list Subject: Re: [App_rpt-users] Access Command Mode With A Macro
Brilliantly written Bryan! Kudos
Mike - KD5DFB
On Wed, Jul 31, 2013 at 2:14 PM, Bryan D. Boyle <bdboyle@bdboyle.com> wrote:
On 7/31/13 2:38 PM, Johnny Keeker wrote:
The question is, can a macro be created to connect to a node and then put it in the command mode? I've tried creating the usual macro example. [macro] 1=*325555*425555# *51 only calls the 25555 node yet it does not take into account the *425555
Colin Chapman, founder of Lotus, had a favorite saying: "Simplify and add lightness".
When you get into complex command strings and trying to make the machines jump through hoops, brew coffee, and change the baby at the same time, it's easy to forget that there is more than one way to accomplish what you are trying to do or gore an ox or stuff a ballot box (if you're in Chicago).
Ever thought of writing an OS shell script? There you now have somewhat more programmatic control over HOW and IN WHAT sequence commands are executed, can pause in between commands to allow them to run to completion, do variable substitution so that the same shell, with different values passed to it, can be used for multiple functions.
In short, to me, it makes more sense.
Here, is an example of a useful Macro tied to a schedule:
[macro27XXX] 09=*81#
[schedule27XXX] 09 = 00 * * * *
Which plays the time at the top of every hour. Clean. Neat. Simple. Brilliant. No pillocks here....
But, what if you want to unlink two hub nodes, link another node through a secondary hub (because your brother ops object to the other node because it's a 2-meter link radio?) and tell everyone that it's done? Wow. Tell me the command string for that.
I do not see that as a macro job.
How about a script to do it:
Call this script linkconnect.sh. Put it in a scripts directory somewhere, like /etc/asterisk/scripts, strangely enough...
Call it from rpt.conf: 9XX=cmd,/etc/asterisk/scripts/linkconnect.sh
-- # Call a shell, no error checking, WYSIWYG, down and dirty #!/bin/bash
#Send Asterisk a function message to unlink the two hubs /usr/sbin/asterisk -rx "rpt fun 27123 *127234#"
#wait for all the gyrations and Allison to shut up sleep 5
#Now, send a message to the second hub in the network to link #to the link radio node 27999 /usr/sbin/asterisk -rx "rpt fun 27123 *428999*327999#"
#Wait for it.... sleep 2
#Now, play an announcement that the new configuration is up and going. /etc/asterisk/scripts/w3skconnect --
(obviously not the real node numbers, apologies to the holders of those numbers if they're in live use.)
Now, you can define a 'macro' as, say, 10=*9xx# ;call the function numbered 9XX
This gives you added flexibility and the ability to either call, using the internal schedule, on a fixed value, the shell you wrote, or using the OS cron facility, from a cronjob, or, even just run from the shell.
Don't fixate on one solution as being better...sometimes imagination is the key to creativity and indecision is the key to flexibility.
-- Bryan In this world, you must be oh so smart or oh so pleasant. Well, for years I was smart. I recommend pleasant. You may quote me.
Sent from my MacBook Pro. _______________________________________________ App_rpt-users mailing list App_rpt-users@ohnosec.org http://ohnosec.org/cgi-bin/mailman/listinfo/app_rpt-users
_______________________________________________ App_rpt-users mailing list App_rpt-users@ohnosec.org http://ohnosec.org/cgi-bin/mailman/listinfo/app_rpt-users
On 7/31/2013 9:41 PM, Bryan D. Boyle wrote:
simply, no
That being said...there's lots of tricks you can do. For instance, if you have a web server open on the same lan segment or subnet accessible from the asterisk box, you can make sure the manager function is open...and, using a script (I have no idea where it came from, so, if anyone claims authorship...that's fine, I got it from Paul KC2VRJ) called newcontrol.php, and a web page that posts values to it, you can pretty much control your repeater from a web page (put some authentication around it, ok?) And, oh, you'll have to pick up the StarAstAPI.php script that's distributed under the GNU Lesser license. Note, this also happens over a clear channel by default, so, you probably don't want to do this across the net...better, perhaps to stand up a simple web server on the asterisk box itself and use the looparound address to talk to it... -- <?php # Title: newcommand.php # Author: Unknown, but provided to me by Paul Nannery KC2VRJ # Full credit acknowledged if original author ID'd # Mods by: Bryan Boyle WB0YLE # Date: 8 December 2012 # # This bit of php script takes two values: # the first being the node to talk to, # and the second, the DTMF command that's being sent # and echoing it out. # if ($_POST) { $node = $_POST['node']; $cmd = $_POST['cmd']; } else { $node = $argv[1]; $cmd = $argv[2]; echo "Command $cmd is being sent to $node\n\n"; } # Include StarAstAPI: require_once './StarAstAPI.php'; # Connect and log in: # $ami = new AstClientConnection(); # # Login is from the /etc/asterisk/manager.conf credentials as # configured in your base directory on your system. # user password ast system port # vv vv vv vv if ($ami->Login( 'admin', 'changeme', 'asteriskboxIPAddress', 5038 )) { $rp = $ami->GetResponse('1'); //echo $rp->ToString(); } else { exit(1); } # Send the following packet: # ACTION: Command # command: rpt fun $node# $command # $data = new AstPacketData; $data->AddKVPair( 'Action' , 'Command' ); $data->AddKVPair( 'command' , "rpt fun $node $cmd" ); $packet = new AstPacket; $packet->SetAstPacketType( 'Action' ); $packet->SetAstPacketData( $data ); $ami->SendPacket( $packet ); # # Log out -- not strictly necessary, but cleaner: # $ami->Logoff(); # # Unfortunately, StarAstAPI isn't totally discreet. # It does this: # echo "Logoff Called from somewhere ..."; # socket_close($this->mSocket); # echo "\n"; ?> -- Sample page that calls this script with pull-down values (not totally HTML compliant, I just did the bare minimum with the header values...): <html> <head> <title>Test Control Form</title> </head> <body> <h3>Node Control</h3> <form target="_self" method="post" action="newcontrol.php"> <table border="0"> <tr> <td>Node Number:</td> <td> <select name="node"> <option value="XXXXX">220 Machine</option> <option value="XXXXX">900 Machine</option> <option value="XXXXX">Bucks Hub</option> <option value="XXXXX">440 Machine</option> <option value="XXXXX">R&D/Development Hub</option> <option value="XXXXX">144 Machine</option> </select> </td> </tr> <tr> <td>Command to run:</td> <td> <select name="cmd"> <option value="*XXXX">Play Weather (220)</option> <option value="*XXXX">Play Forecast (220)</option> <option value="*XXXX">W3SK Connect</option> <option value="*XXXX">W3SK Disconnect</option> </select> </td> </tr> <tr><td></td> <td> <input type="submit" value="Transmit" /> </td> </tr> </table> </form> <div id="response"></div> </body> </html> ---- Note, these are just a proof of concept/hacked together page...the option values for the select name="cmd" in the web page are the DTMF commands that call the function stanza for the node in question. SO, while all my nodes may have a common *1XXXX disconnect sequence (bing connected to the same hub in question, they can either 1) send directly a DTMF sequence to a node, 2) call a cmd,script to run a shell script, or 3) call a cmd,shell/executable program to do something. Improvements are left as an exercise to the reader. Note, these ideas are so primitive, they really need to be tweaked. But some more grist for the mill. BB
For this sort of functionality (and more) check out https://github.com/tsawyer/allmon -- Tim :wq On Jul 31, 2013, at 7:09 PM, Bryan D. Boyle <bdboyle@bdboyle.com> wrote:
On 7/31/2013 9:41 PM, Bryan D. Boyle wrote:
simply, no
That being said...there's lots of tricks you can do. For instance, if you have a web server open on the same lan segment or subnet accessible from the asterisk box, you can make sure the manager function is open...and, using a script (I have no idea where it came from, so, if anyone claims authorship...that's fine, I got it from Paul KC2VRJ) called newcontrol.php, and a web page that posts values to it, you can pretty much control your repeater from a web page (put some authentication around it, ok?)
And, oh, you'll have to pick up the StarAstAPI.php script that's distributed under the GNU Lesser license. Note, this also happens over a clear channel by default, so, you probably don't want to do this across the net...better, perhaps to stand up a simple web server on the asterisk box itself and use the looparound address to talk to it...
-- <?php
# Title: newcommand.php # Author: Unknown, but provided to me by Paul Nannery KC2VRJ # Full credit acknowledged if original author ID'd # Mods by: Bryan Boyle WB0YLE # Date: 8 December 2012 # # This bit of php script takes two values: # the first being the node to talk to, # and the second, the DTMF command that's being sent # and echoing it out. #
if ($_POST) { $node = $_POST['node']; $cmd = $_POST['cmd']; } else { $node = $argv[1]; $cmd = $argv[2]; echo "Command $cmd is being sent to $node\n\n"; } # Include StarAstAPI:
require_once './StarAstAPI.php';
# Connect and log in: #
$ami = new AstClientConnection();
# # Login is from the /etc/asterisk/manager.conf credentials as # configured in your base directory on your system. # user password ast system port # vv vv vv vv
if ($ami->Login( 'admin', 'changeme', 'asteriskboxIPAddress', 5038 )) { $rp = $ami->GetResponse('1'); //echo $rp->ToString(); } else { exit(1); } # Send the following packet: # ACTION: Command # command: rpt fun $node# $command #
$data = new AstPacketData; $data->AddKVPair( 'Action' , 'Command' ); $data->AddKVPair( 'command' , "rpt fun $node $cmd" ); $packet = new AstPacket; $packet->SetAstPacketType( 'Action' ); $packet->SetAstPacketData( $data ); $ami->SendPacket( $packet );
# # Log out -- not strictly necessary, but cleaner: #
$ami->Logoff();
# # Unfortunately, StarAstAPI isn't totally discreet. # It does this: # echo "Logoff Called from somewhere ..."; # socket_close($this->mSocket); #
echo "\n"; ?> --
Sample page that calls this script with pull-down values (not totally HTML compliant, I just did the bare minimum with the header values...):
<html> <head> <title>Test Control Form</title> </head> <body>
<h3>Node Control</h3> <form target="_self" method="post" action="newcontrol.php"> <table border="0"> <tr> <td>Node Number:</td> <td> <select name="node"> <option value="XXXXX">220 Machine</option> <option value="XXXXX">900 Machine</option> <option value="XXXXX">Bucks Hub</option> <option value="XXXXX">440 Machine</option> <option value="XXXXX">R&D/Development Hub</option> <option value="XXXXX">144 Machine</option> </select> </td> </tr> <tr> <td>Command to run:</td> <td> <select name="cmd"> <option value="*XXXX">Play Weather (220)</option> <option value="*XXXX">Play Forecast (220)</option> <option value="*XXXX">W3SK Connect</option> <option value="*XXXX">W3SK Disconnect</option> </select> </td> </tr> <tr><td></td> <td> <input type="submit" value="Transmit" /> </td> </tr> </table> </form> <div id="response"></div> </body> </html>
----
Note, these are just a proof of concept/hacked together page...the option values for the select name="cmd" in the web page are the DTMF commands that call the function stanza for the node in question. SO, while all my nodes may have a common *1XXXX disconnect sequence (bing connected to the same hub in question, they can either 1) send directly a DTMF sequence to a node, 2) call a cmd,script to run a shell script, or 3) call a cmd,shell/executable program to do something.
Improvements are left as an exercise to the reader. Note, these ideas are so primitive, they really need to be tweaked. But some more grist for the mill.
BB
_______________________________________________ App_rpt-users mailing list App_rpt-users@ohnosec.org http://ohnosec.org/cgi-bin/mailman/listinfo/app_rpt-users
No but that is an interesting idea The DTMF decodes are in the log file. If your script is smart it might be able to find and parse them /var/log/asterisk/messages ... Sep 24 12:58:34] NOTICE[2672] chan_usbradio.c: Got DTMF char * duration 210 ms [Sep 24 12:58:35] NOTICE[2672] chan_usbradio.c: Got DTMF char 9 duration 82 ms [Sep 24 12:58:35] NOTICE[2672] chan_usbradio.c: Got DTMF char 9 duration 191 ms [Sep 24 12:58:36] NOTICE[2672] chan_usbradio.c: Got DTMF char 5 duration 150 ms [Sep 24 12:58:37] NOTICE[2672] chan_usbradio.c: Got DTMF char 2 duration 170 ms ... GL Ken
-----Original Message----- From: Robert Garcia [mailto:robert@n5qm.com] Sent: Wednesday, July 31, 2013 9:37 PM To: Ken Cc: app_rpt mailing list Subject: Re: [App_rpt-users] Access Command Mode With A Macro
Guys,
This is an excellent thread with great ideas. By chance does the cmd function pass the entered DTMF sequence to the shell script?
Robert N5QM
On Wed, Jul 31, 2013 at 6:10 PM, Ken <ke2n@cs.com> wrote:
Very nice - I do something quite similar.
I note that you can define a function to tell Allison to "be quiet" for example
9940=cop,34 ; local telemtry off
I execute *9940 at the start of my multi step script and it helps keep things a bit more quiet.
At the end, I turn it back on with cop,33.
Of course, this only does the local node. I suppose you could execute such a function on the remote node to turn off announcements (after the first one).
I have a DSTAR machine at the same site and it sends commands to the asterisk machine, in some cases, using OS scripts like this.
73
Ken
From: Michael Hebert [mailto:mhebert1975@gmail.com] Sent: Wednesday, July 31, 2013 3:21 PM To: Bryan D. Boyle Cc: app_rpt mailing list Subject: Re: [App_rpt-users] Access Command Mode With A Macro
Brilliantly written Bryan! Kudos
Mike - KD5DFB
On Wed, Jul 31, 2013 at 2:14 PM, Bryan D. Boyle <bdboyle@bdboyle.com> wrote:
On 7/31/13 2:38 PM, Johnny Keeker wrote:
The question is, can a macro be created to connect to a node and then put it in the command mode? I've tried creating the usual macro example. [macro] 1=*325555*425555# *51 only calls the 25555 node yet it does not take into account the *425555
Colin Chapman, founder of Lotus, had a favorite saying: "Simplify and add lightness".
When you get into complex command strings and trying to make the machines jump through hoops, brew coffee, and change the baby at the same time, it's easy to forget that there is more than one way to accomplish what you are trying to do or gore an ox or stuff a ballot box (if you're in Chicago).
Ever thought of writing an OS shell script? There you now have somewhat more programmatic control over HOW and IN WHAT sequence commands are executed, can pause in between commands to allow them to run to completion, do variable substitution so that the same shell, with different values passed to it, can be used for multiple functions.
In short, to me, it makes more sense.
Here, is an example of a useful Macro tied to a schedule:
[macro27XXX] 09=*81#
[schedule27XXX] 09 = 00 * * * *
Which plays the time at the top of every hour. Clean. Neat. Simple. Brilliant. No pillocks here....
But, what if you want to unlink two hub nodes, link another node through a secondary hub (because your brother ops object to the other node because it's a 2-meter link radio?) and tell everyone that it's done? Wow. Tell me the command string for that.
I do not see that as a macro job.
How about a script to do it:
Call this script linkconnect.sh. Put it in a scripts directory somewhere, like /etc/asterisk/scripts, strangely enough...
Call it from rpt.conf: 9XX=cmd,/etc/asterisk/scripts/linkconnect.sh
-- # Call a shell, no error checking, WYSIWYG, down and dirty #!/bin/bash
#Send Asterisk a function message to unlink the two hubs /usr/sbin/asterisk -rx "rpt fun 27123 *127234#"
#wait for all the gyrations and Allison to shut up sleep 5
#Now, send a message to the second hub in the network to link #to the link radio node 27999 /usr/sbin/asterisk -rx "rpt fun 27123 *428999*327999#"
#Wait for it.... sleep 2
#Now, play an announcement that the new configuration is up and going. /etc/asterisk/scripts/w3skconnect --
(obviously not the real node numbers, apologies to the holders of those numbers if they're in live use.)
Now, you can define a 'macro' as, say, 10=*9xx# ;call the function numbered 9XX
This gives you added flexibility and the ability to either call, using the internal schedule, on a fixed value, the shell you wrote, or using the OS cron facility, from a cronjob, or, even just run from the shell.
Don't fixate on one solution as being better...sometimes imagination is the key to creativity and indecision is the key to flexibility.
-- Bryan In this world, you must be oh so smart or oh so pleasant. Well, for years I was smart. I recommend pleasant. You may quote me.
Sent from my MacBook Pro. _______________________________________________ App_rpt-users mailing list App_rpt-users@ohnosec.org http://ohnosec.org/cgi-bin/mailman/listinfo/app_rpt-users
_______________________________________________ App_rpt-users mailing list App_rpt-users@ohnosec.org http://ohnosec.org/cgi-bin/mailman/listinfo/app_rpt-users
Ken, Your idea lead me to this.. The shell script could parse that out rather easily and act upon it. asterisk -rx "rpt stats 29820" | grep executed Last DTMF command executed.......................: 329829 Robert N5QM On Thu, Aug 1, 2013 at 4:10 AM, Ken <ke2n@cs.com> wrote:
No but that is an interesting idea
The DTMF decodes are in the log file. If your script is smart it might be able to find and parse them
/var/log/asterisk/messages ... Sep 24 12:58:34] NOTICE[2672] chan_usbradio.c: Got DTMF char * duration 210 ms [Sep 24 12:58:35] NOTICE[2672] chan_usbradio.c: Got DTMF char 9 duration 82 ms [Sep 24 12:58:35] NOTICE[2672] chan_usbradio.c: Got DTMF char 9 duration 191 ms [Sep 24 12:58:36] NOTICE[2672] chan_usbradio.c: Got DTMF char 5 duration 150 ms [Sep 24 12:58:37] NOTICE[2672] chan_usbradio.c: Got DTMF char 2 duration 170 ms ...
GL Ken
-----Original Message----- From: Robert Garcia [mailto:robert@n5qm.com] Sent: Wednesday, July 31, 2013 9:37 PM To: Ken Cc: app_rpt mailing list Subject: Re: [App_rpt-users] Access Command Mode With A Macro
Guys,
This is an excellent thread with great ideas. By chance does the cmd function pass the entered DTMF sequence to the shell script?
Robert N5QM
On Wed, Jul 31, 2013 at 6:10 PM, Ken <ke2n@cs.com> wrote:
Very nice - I do something quite similar.
I note that you can define a function to tell Allison to "be quiet" for example
9940=cop,34 ; local telemtry off
I execute *9940 at the start of my multi step script and it helps keep things a bit more quiet.
At the end, I turn it back on with cop,33.
Of course, this only does the local node. I suppose you could execute such a function on the remote node to turn off announcements (after the first one).
I have a DSTAR machine at the same site and it sends commands to the asterisk machine, in some cases, using OS scripts like this.
73
Ken
From: Michael Hebert [mailto:mhebert1975@gmail.com] Sent: Wednesday, July 31, 2013 3:21 PM To: Bryan D. Boyle Cc: app_rpt mailing list Subject: Re: [App_rpt-users] Access Command Mode With A Macro
Brilliantly written Bryan! Kudos
Mike - KD5DFB
On Wed, Jul 31, 2013 at 2:14 PM, Bryan D. Boyle <bdboyle@bdboyle.com> wrote:
On 7/31/13 2:38 PM, Johnny Keeker wrote:
The question is, can a macro be created to connect to a node and then put it in the command mode? I've tried creating the usual macro example. [macro] 1=*325555*425555# *51 only calls the 25555 node yet it does not take into account the *425555
Colin Chapman, founder of Lotus, had a favorite saying: "Simplify and add lightness".
When you get into complex command strings and trying to make the machines jump through hoops, brew coffee, and change the baby at the same time, it's easy to forget that there is more than one way to accomplish what you are trying to do or gore an ox or stuff a ballot box (if you're in Chicago).
Ever thought of writing an OS shell script? There you now have somewhat more programmatic control over HOW and IN WHAT sequence commands are executed, can pause in between commands to allow them to run to completion, do variable substitution so that the same shell, with different values passed to it, can be used for multiple functions.
In short, to me, it makes more sense.
Here, is an example of a useful Macro tied to a schedule:
[macro27XXX] 09=*81#
[schedule27XXX] 09 = 00 * * * *
Which plays the time at the top of every hour. Clean. Neat. Simple. Brilliant. No pillocks here....
But, what if you want to unlink two hub nodes, link another node through a secondary hub (because your brother ops object to the other node because it's a 2-meter link radio?) and tell everyone that it's done? Wow. Tell me the command string for that.
I do not see that as a macro job.
How about a script to do it:
Call this script linkconnect.sh. Put it in a scripts directory somewhere, like /etc/asterisk/scripts, strangely enough...
Call it from rpt.conf: 9XX=cmd,/etc/asterisk/scripts/linkconnect.sh
-- # Call a shell, no error checking, WYSIWYG, down and dirty #!/bin/bash
#Send Asterisk a function message to unlink the two hubs /usr/sbin/asterisk -rx "rpt fun 27123 *127234#"
#wait for all the gyrations and Allison to shut up sleep 5
#Now, send a message to the second hub in the network to link #to the link radio node 27999 /usr/sbin/asterisk -rx "rpt fun 27123 *428999*327999#"
#Wait for it.... sleep 2
#Now, play an announcement that the new configuration is up and going. /etc/asterisk/scripts/w3skconnect --
(obviously not the real node numbers, apologies to the holders of those numbers if they're in live use.)
Now, you can define a 'macro' as, say, 10=*9xx# ;call the function numbered 9XX
This gives you added flexibility and the ability to either call, using the internal schedule, on a fixed value, the shell you wrote, or using the OS cron facility, from a cronjob, or, even just run from the shell.
Don't fixate on one solution as being better...sometimes imagination is the key to creativity and indecision is the key to flexibility.
-- Bryan In this world, you must be oh so smart or oh so pleasant. Well, for years I was smart. I recommend pleasant. You may quote me.
Sent from my MacBook Pro. _______________________________________________ App_rpt-users mailing list App_rpt-users@ohnosec.org http://ohnosec.org/cgi-bin/mailman/listinfo/app_rpt-users
_______________________________________________ App_rpt-users mailing list App_rpt-users@ohnosec.org http://ohnosec.org/cgi-bin/mailman/listinfo/app_rpt-users
Or even better... asterisk -rx "rpt stats 29820" | grep executed Last DTMF command executed.......................: 329829 asterisk -rx "rpt stats 29820" | grep executed | cut -c52- 329829 Robert N5QM On Thu, Aug 1, 2013 at 8:23 AM, Robert Garcia <robert@n5qm.com> wrote:
Ken,
Your idea lead me to this.. The shell script could parse that out rather easily and act upon it.
asterisk -rx "rpt stats 29820" | grep executed Last DTMF command executed.......................: 329829
Robert N5QM
On Thu, Aug 1, 2013 at 4:10 AM, Ken <ke2n@cs.com> wrote:
No but that is an interesting idea
The DTMF decodes are in the log file. If your script is smart it might be able to find and parse them
/var/log/asterisk/messages ... Sep 24 12:58:34] NOTICE[2672] chan_usbradio.c: Got DTMF char * duration 210 ms [Sep 24 12:58:35] NOTICE[2672] chan_usbradio.c: Got DTMF char 9 duration 82 ms [Sep 24 12:58:35] NOTICE[2672] chan_usbradio.c: Got DTMF char 9 duration 191 ms [Sep 24 12:58:36] NOTICE[2672] chan_usbradio.c: Got DTMF char 5 duration 150 ms [Sep 24 12:58:37] NOTICE[2672] chan_usbradio.c: Got DTMF char 2 duration 170 ms ...
GL Ken
-----Original Message----- From: Robert Garcia [mailto:robert@n5qm.com] Sent: Wednesday, July 31, 2013 9:37 PM To: Ken Cc: app_rpt mailing list Subject: Re: [App_rpt-users] Access Command Mode With A Macro
Guys,
This is an excellent thread with great ideas. By chance does the cmd function pass the entered DTMF sequence to the shell script?
Robert N5QM
On Wed, Jul 31, 2013 at 6:10 PM, Ken <ke2n@cs.com> wrote:
Very nice - I do something quite similar.
I note that you can define a function to tell Allison to "be quiet" for example
9940=cop,34 ; local telemtry off
I execute *9940 at the start of my multi step script and it helps keep things a bit more quiet.
At the end, I turn it back on with cop,33.
Of course, this only does the local node. I suppose you could execute such a function on the remote node to turn off announcements (after the first one).
I have a DSTAR machine at the same site and it sends commands to the asterisk machine, in some cases, using OS scripts like this.
73
Ken
From: Michael Hebert [mailto:mhebert1975@gmail.com] Sent: Wednesday, July 31, 2013 3:21 PM To: Bryan D. Boyle Cc: app_rpt mailing list Subject: Re: [App_rpt-users] Access Command Mode With A Macro
Brilliantly written Bryan! Kudos
Mike - KD5DFB
On Wed, Jul 31, 2013 at 2:14 PM, Bryan D. Boyle <bdboyle@bdboyle.com> wrote:
On 7/31/13 2:38 PM, Johnny Keeker wrote:
The question is, can a macro be created to connect to a node and then put it in the command mode? I've tried creating the usual macro example. [macro] 1=*325555*425555# *51 only calls the 25555 node yet it does not take into account the *425555
Colin Chapman, founder of Lotus, had a favorite saying: "Simplify and add lightness".
When you get into complex command strings and trying to make the machines jump through hoops, brew coffee, and change the baby at the same time, it's easy to forget that there is more than one way to accomplish what you are trying to do or gore an ox or stuff a ballot box (if you're in Chicago).
Ever thought of writing an OS shell script? There you now have somewhat more programmatic control over HOW and IN WHAT sequence commands are executed, can pause in between commands to allow them to run to completion, do variable substitution so that the same shell, with different values passed to it, can be used for multiple functions.
In short, to me, it makes more sense.
Here, is an example of a useful Macro tied to a schedule:
[macro27XXX] 09=*81#
[schedule27XXX] 09 = 00 * * * *
Which plays the time at the top of every hour. Clean. Neat. Simple. Brilliant. No pillocks here....
But, what if you want to unlink two hub nodes, link another node through a secondary hub (because your brother ops object to the other node because it's a 2-meter link radio?) and tell everyone that it's done? Wow. Tell me the command string for that.
I do not see that as a macro job.
How about a script to do it:
Call this script linkconnect.sh. Put it in a scripts directory somewhere, like /etc/asterisk/scripts, strangely enough...
Call it from rpt.conf: 9XX=cmd,/etc/asterisk/scripts/linkconnect.sh
-- # Call a shell, no error checking, WYSIWYG, down and dirty #!/bin/bash
#Send Asterisk a function message to unlink the two hubs /usr/sbin/asterisk -rx "rpt fun 27123 *127234#"
#wait for all the gyrations and Allison to shut up sleep 5
#Now, send a message to the second hub in the network to link #to the link radio node 27999 /usr/sbin/asterisk -rx "rpt fun 27123 *428999*327999#"
#Wait for it.... sleep 2
#Now, play an announcement that the new configuration is up and going. /etc/asterisk/scripts/w3skconnect --
(obviously not the real node numbers, apologies to the holders of those numbers if they're in live use.)
Now, you can define a 'macro' as, say, 10=*9xx# ;call the function numbered 9XX
This gives you added flexibility and the ability to either call, using the internal schedule, on a fixed value, the shell you wrote, or using the OS cron facility, from a cronjob, or, even just run from the shell.
Don't fixate on one solution as being better...sometimes imagination is the key to creativity and indecision is the key to flexibility.
-- Bryan In this world, you must be oh so smart or oh so pleasant. Well, for years I was smart. I recommend pleasant. You may quote me.
Sent from my MacBook Pro. _______________________________________________ App_rpt-users mailing list App_rpt-users@ohnosec.org http://ohnosec.org/cgi-bin/mailman/listinfo/app_rpt-users
_______________________________________________ App_rpt-users mailing list App_rpt-users@ohnosec.org http://ohnosec.org/cgi-bin/mailman/listinfo/app_rpt-users
of course ... that will return the DTMF code that executed the OS script. I think what is wanted are the digits that come afterwards (so that you can punch in any number not just a fixed menu of numbers). Oh well, I am sure a smart person can figure this out ;-P Ken -----Original Message----- From: Robert Garcia <robert@n5qm.com> To: Ken <ke2n@cs.com> Cc: app_rpt mailing list <app_rpt-users@ohnosec.org> Sent: Thu, Aug 1, 2013 9:29 am Subject: Re: [App_rpt-users] Access Command Mode With A Macro Or even better... asterisk -rx "rpt stats 29820" | grep executed ast DTMF command executed.......................: 329829 asterisk -rx "rpt stats 29820" | grep executed | cut -c52- 29829 Robert 5QM On Thu, Aug 1, 2013 at 8:23 AM, Robert Garcia <robert@n5qm.com> wrote: Ken, Your idea lead me to this.. The shell script could parse that out rather easily and act upon it. asterisk -rx "rpt stats 29820" | grep executed Last DTMF command executed.......................: 329829 Robert N5QM On Thu, Aug 1, 2013 at 4:10 AM, Ken <ke2n@cs.com> wrote:
No but that is an interesting idea
The DTMF decodes are in the log file. If your script is smart it might be able to find and parse them
/var/log/asterisk/messages ... Sep 24 12:58:34] NOTICE[2672] chan_usbradio.c: Got DTMF char * duration 210 ms [Sep 24 12:58:35] NOTICE[2672] chan_usbradio.c: Got DTMF char 9 duration 82 ms [Sep 24 12:58:35] NOTICE[2672] chan_usbradio.c: Got DTMF char 9 duration 191 ms [Sep 24 12:58:36] NOTICE[2672] chan_usbradio.c: Got DTMF char 5 duration 150 ms [Sep 24 12:58:37] NOTICE[2672] chan_usbradio.c: Got DTMF char 2 duration 170 ms ...
GL Ken
-----Original Message----- From: Robert Garcia [mailto:robert@n5qm.com] Sent: Wednesday, July 31, 2013 9:37 PM To: Ken Cc: app_rpt mailing list Subject: Re: [App_rpt-users] Access Command Mode With A Macro
Guys,
This is an excellent thread with great ideas. By chance does the cmd function pass the entered DTMF sequence to the shell script?
Robert N5QM
On Wed, Jul 31, 2013 at 6:10 PM, Ken <ke2n@cs.com> wrote:
Very nice - I do something quite similar.
I note that you can define a function to tell Allison to "be quiet" for example
9940=cop,34 ; local telemtry off
I execute *9940 at the start of my multi step script and it helps keep things a bit more quiet.
At the end, I turn it back on with cop,33.
Of course, this only does the local node. I suppose you could execute such a function on the remote node to turn off announcements (after the first one).
I have a DSTAR machine at the same site and it sends commands to the asterisk machine, in some cases, using OS scripts like this.
73
Ken
From: Michael Hebert [mailto:mhebert1975@gmail.com] Sent: Wednesday, July 31, 2013 3:21 PM To: Bryan D. Boyle Cc: app_rpt mailing list Subject: Re: [App_rpt-users] Access Command Mode With A Macro
Brilliantly written Bryan! Kudos
Mike - KD5DFB
On Wed, Jul 31, 2013 at 2:14 PM, Bryan D. Boyle <bdboyle@bdboyle.com> wrote:
On 7/31/13 2:38 PM, Johnny Keeker wrote:
The question is, can a macro be created to connect to a node and then put it in the command mode? I've tried creating the usual macro example. [macro] 1=*325555*425555# *51 only calls the 25555 node yet it does not take into account the *425555
Colin Chapman, founder of Lotus, had a favorite saying: "Simplify and add lightness".
When you get into complex command strings and trying to make the machines jump through hoops, brew coffee, and change the baby at the same time, it's easy to forget that there is more than one way to accomplish what you are trying to do or gore an ox or stuff a ballot box (if you're in Chicago).
Ever thought of writing an OS shell script? There you now have somewhat more programmatic control over HOW and IN WHAT sequence commands are executed, can pause in between commands to allow them to run to completion, do variable substitution so that the same shell, with different values passed to it, can be used for multiple functions.
In short, to me, it makes more sense.
Here, is an example of a useful Macro tied to a schedule:
[macro27XXX] 09=*81#
[schedule27XXX] 09 = 00 * * * *
Which plays the time at the top of every hour. Clean. Neat. Simple. Brilliant. No pillocks here....
But, what if you want to unlink two hub nodes, link another node through a secondary hub (because your brother ops object to the other node because it's a 2-meter link radio?) and tell everyone that it's done? Wow. Tell me the command string for that.
I do not see that as a macro job.
How about a script to do it:
Call this script linkconnect.sh. Put it in a scripts directory somewhere, like /etc/asterisk/scripts, strangely enough...
Call it from rpt.conf: 9XX=cmd,/etc/asterisk/scripts/linkconnect.sh
-- # Call a shell, no error checking, WYSIWYG, down and dirty #!/bin/bash
#Send Asterisk a function message to unlink the two hubs /usr/sbin/asterisk -rx "rpt fun 27123 *127234#"
#wait for all the gyrations and Allison to shut up sleep 5
#Now, send a message to the second hub in the network to link #to the link radio node 27999 /usr/sbin/asterisk -rx "rpt fun 27123 *428999*327999#"
#Wait for it.... sleep 2
#Now, play an announcement that the new configuration is up and going. /etc/asterisk/scripts/w3skconnect --
(obviously not the real node numbers, apologies to the holders of those numbers if they're in live use.)
Now, you can define a 'macro' as, say, 10=*9xx# ;call the function numbered 9XX
This gives you added flexibility and the ability to either call, using the internal schedule, on a fixed value, the shell you wrote, or using the OS cron facility, from a cronjob, or, even just run from the shell.
Don't fixate on one solution as being better...sometimes imagination is the key to creativity and indecision is the key to flexibility.
-- Bryan In this world, you must be oh so smart or oh so pleasant. Well, for years I was smart. I recommend pleasant. You may quote me.
Sent from my MacBook Pro. _______________________________________________ App_rpt-users mailing list App_rpt-users@ohnosec.org http://ohnosec.org/cgi-bin/mailman/listinfo/app_rpt-users
_______________________________________________ App_rpt-users mailing list App_rpt-users@ohnosec.org http://ohnosec.org/cgi-bin/mailman/listinfo/app_rpt-users
Ken, Agreed. Using the commands I posted would only get you the digits that caused the script to run, but nothing after it unfortunately. Robert N5QM On Thu, Aug 1, 2013 at 10:09 AM, Ken <ke2n@cs.com> wrote:
of course ... that will return the DTMF code that executed the OS script. I think what is wanted are the digits that come afterwards (so that you can punch in any number not just a fixed menu of numbers).
Oh well, I am sure a smart person can figure this out ;-P
Ken
-----Original Message----- From: Robert Garcia <robert@n5qm.com> To: Ken <ke2n@cs.com> Cc: app_rpt mailing list <app_rpt-users@ohnosec.org> Sent: Thu, Aug 1, 2013 9:29 am Subject: Re: [App_rpt-users] Access Command Mode With A Macro
Or even better...
asterisk -rx "rpt stats 29820" | grep executed Last DTMF command executed.......................: 329829
asterisk -rx "rpt stats 29820" | grep executed | cut -c52- 329829
Robert N5QM
On Thu, Aug 1, 2013 at 8:23 AM, Robert Garcia <robert@n5qm.com> wrote:
Ken,
Your idea lead me to this.. The shell script could parse that out rather easily and act upon it.
asterisk -rx "rpt stats 29820" | grep executed Last DTMF command executed.......................: 329829
Robert N5QM
On Thu, Aug 1, 2013 at 4:10 AM, Ken <ke2n@cs.com> wrote:
No but that is an interesting idea
The DTMF decodes are in the log file. If your script is smart it might be able to find and parse them
/var/log/asterisk/messages ... Sep 24 12:58:34] NOTICE[2672] chan_usbradio.c: Got DTMF char * duration 210 ms [Sep 24 12:58:35] NOTICE[2672] chan_usbradio.c: Got DTMF char 9 duration 82 ms [Sep 24 12:58:35] NOTICE[2672] chan_usbradio.c: Got DTMF char 9 duration 191 ms [Sep 24 12:58:36] NOTICE[2672] chan_usbradio.c: Got DTMF char 5 duration 150 ms [Sep 24 12:58:37] NOTICE[2672] chan_usbradio.c: Got DTMF char 2 duration 170 ms ...
GL Ken
-----Original Message----- From: Robert Garcia [mailto:robert@n5qm.com] Sent: Wednesday, July 31, 2013 9:37 PM To: Ken Cc: app_rpt mailing list Subject: Re: [App_rpt-users] Access Command Mode With A Macro
Guys,
This is an excellent thread with great ideas. By chance does the cmd function pass the entered DTMF sequence to the shell script?
Robert N5QM
On Wed, Jul 31, 2013 at 6:10 PM, Ken <ke2n@cs.com> wrote:
Very nice - I do something quite similar.
I note that you can define a function to tell Allison to "be quiet" for example
9940=cop,34 ; local telemtry off
I execute *9940 at the start of my multi step script and it helps keep things a bit more quiet.
At the end, I turn it back on with cop,33.
Of course, this only does the local node. I suppose you could execute such a function on the remote node to turn off announcements (after the first one).
I have a DSTAR machine at the same site and it sends commands to the asterisk machine, in some cases, using OS scripts like this.
73
Ken
From: Michael Hebert [mailto:mhebert1975@gmail.com] Sent: Wednesday, July 31, 2013 3:21 PM To: Bryan D. Boyle Cc: app_rpt mailing list Subject: Re: [App_rpt-users] Access Command Mode With A Macro
Brilliantly written Bryan! Kudos
Mike - KD5DFB
On Wed, Jul 31, 2013 at 2:14 PM, Bryan D. Boyle <bdboyle@bdboyle.com> wrote:
On 7/31/13 2:38 PM, Johnny Keeker wrote:
The question is, can a macro be created to connect to a node and then put it in the command mode? I've tried creating the usual macro example. [macro] 1=*325555*425555# *51 only calls the 25555 node yet it does not take into account the *425555
Colin Chapman, founder of Lotus, had a favorite saying: "Simplify and add lightness".
When you get into complex command strings and trying to make the machines jump through hoops, brew coffee, and change the baby at the same time, it's easy to forget that there is more than one way to accomplish what you are trying to do or gore an ox or stuff a ballot box (if you're in Chicago).
Ever thought of writing an OS shell script? There you now have somewhat more programmatic control over HOW and IN WHAT sequence commands are executed, can pause in between commands to allow them to run to completion, do variable substitution so that the same shell, with different values passed to it, can be used for multiple functions.
In short, to me, it makes more sense.
Here, is an example of a useful Macro tied to a schedule:
[macro27XXX] 09=*81#
[schedule27XXX] 09 = 00 * * * *
Which plays the time at the top of every hour. Clean. Neat. Simple. Brilliant. No pillocks here....
But, what if you want to unlink two hub nodes, link another node through a secondary hub (because your brother ops object to the other node because it's a 2-meter link radio?) and tell everyone that it's done? Wow. Tell me the command string for that.
I do not see that as a macro job.
How about a script to do it:
Call this script linkconnect.sh. Put it in a scripts directory somewhere, like /etc/asterisk/scripts, strangely enough...
Call it from rpt.conf: 9XX=cmd,/etc/asterisk/scripts/linkconnect.sh
-- # Call a shell, no error checking, WYSIWYG, down and dirty #!/bin/bash
#Send Asterisk a function message to unlink the two hubs /usr/sbin/asterisk -rx "rpt fun 27123 *127234#"
#wait for all the gyrations and Allison to shut up sleep 5
#Now, send a message to the second hub in the network to link #to the link radio node 27999 /usr/sbin/asterisk -rx "rpt fun 27123 *428999*327999#"
#Wait for it.... sleep 2
#Now, play an announcement that the new configuration is up and going. /etc/asterisk/scripts/w3skconnect --
(obviously not the real node numbers, apologies to the holders of those numbers if they're in live use.)
Now, you can define a 'macro' as, say, 10=*9xx# ;call the function numbered 9XX
This gives you added flexibility and the ability to either call, using the internal schedule, on a fixed value, the shell you wrote, or using the OS cron facility, from a cronjob, or, even just run from the shell.
Don't fixate on one solution as being better...sometimes imagination is the key to creativity and indecision is the key to flexibility.
-- Bryan In this world, you must be oh so smart or oh so pleasant. Well, for years I was smart. I recommend pleasant. You may quote me.
Sent from my MacBook Pro. _______________________________________________ App_rpt-users mailing list App_rpt-users@ohnosec.org http://ohnosec.org/cgi-bin/mailman/listinfo/app_rpt-users
_______________________________________________ App_rpt-users mailing list App_rpt-users@ohnosec.org http://ohnosec.org/cgi-bin/mailman/listinfo/app_rpt-users
participants (7)
-
Bryan D. Boyle -
Johnny Keeker -
Jon Rorke -
Ken -
Michael Hebert -
Robert Garcia -
Tim Sawyer