[arm-allstar] app_rpt pass argument to script file?

Doug Crompton wa3dsp at gmail.com
Tue Feb 7 13:41:24 EST 2017


Duane,

  In the very same way.

770=cmd,/etc/asterisk/scripts/job.sh 0

job.sh

#!/bin/bash
echo $1
# end job.sh

And the output would be '0'

If you did -

770=cmd,/etc/asterisk/scripts/job.sh 0 1 5

and job.sh was

#!/bin/bash
echo "$1 $2 $3"
# end job.sh

The output would be 0 1 5

And of course you would use these arguments as you like.  This is just
showing you how it would work. Actually you would not see the output in
this example. If you wanted a good test program try this -

#!/bin/bash
echo $1 >> /tmp/test.out
# end job.sh

Then look at the output in /tmp/test.out. The last line would be your last
execution of the DTMF pattern.

A maybe better way to do this depending on your needs would be to make the
arguments dynamic using a variation of the autopatch code. See the howto -
"How-to use the Allstar autopatch for DTMF digit passing and extended
functions" on the hamvoip.org web page.

Doing this you could call a single script with changing input and test for
the arguments in the script. If you wanted to send two single digit
parameters to a script you would use something like - *62xx  - you could
send as many digits as you like by setting up the dialplan appropriately.
This is explained in the howto.

This is the way you would send frequency changes or other control
information to hamlib.



*73 Doug*

*WA3DSP*

*http://www.crompton.com/hamradio <http://www.crompton.com/hamradio>*

On Tue, Feb 7, 2017 at 12:10 PM, "DuaneVT . via arm-allstar" <
arm-allstar at hamvoip.org> wrote:

> Can rpt.conf pass an argument to a called .sh script? as in:
>
> 770=cmd,/etc/asterisk/scripts/job.sh 0
> 771=cmd,/etc/asterisk/scripts/job.sh 1
>
> So entering *771 would call script file /etc/asterisk/scripts/job.sh and
> pass the argument "1" to it for control. *770 would call the file and pass
> "0", so a switch ladder could make multiple decisions based on the user
> inputs.
>
> This can be done in Linux scripts, but how/can it work from within app_rpt?
>
> Thanks,
> Duane KA1LM
> _______________________________________________
>
> arm-allstar mailing list
> arm-allstar at hamvoip.org
> http://lists.hamvoip.org/cgi-bin/mailman/listinfo/arm-allstar
>
> Visit the BBB and RPi2/3 web page - http://hamvoip.org
>
>


More information about the arm-allstar mailing list