Am 18.09.2019 um 01:15 schrieb bilal ghayyad:
I have 10 Caller IDs and I need each call (each time) to use one of these Caller IDs to be the caller id.

exten => 1234,1,AGI(/var/lib/asterisk/randomcli.sh)


randomcli.sh:


#!/bin/bash

WORDFILE="/var/lib/asterisk/mobilecliall.txt"

NUMWORDS=1

#Number of lines in $WORDFILE
tL=`awk 'NF!=0 {++c} END {print c}' $WORDFILE`

for i in `seq $NUMWORDS`
do
rnum=$((RANDOM%$tL+1))
CIDNAME=$(sed -n "$rnum p" $WORDFILE)
done

echo $CIDNAME
echo "Setting CallerID to: \"\"<$CIDNAME>" >&2
echo "SET CALLERID \"\"<$CIDNAME>"


Then put your 10 CLIs in mobliecliall.txt.


PS: Shorter version for randomcli.sh, same functionality:

#!/bin/bash

CIDNAME=$(shuf -n 1 mobilecliall.txt)
echo "SET CALLERID \"\"<$CIDNAME>"


:-))

Regards
Markus

--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

Check out the new Asterisk community forum at: https://community.asterisk.org/

New to Asterisk? Start here:
     https://wiki.asterisk.org/wiki/display/AST/Getting+Started

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
  http://lists.digium.com/mailman/listinfo/asterisk-users

Reply via email to