[App_rpt-users] Access Command Mode With A Macro
Bryan D. Boyle
bdboyle at bdboyle.com
Wed Jul 31 19:14:24 UTC 2013
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.
More information about the App_rpt-users
mailing list