10 Caller IDs To Be Used Randomly Or Progressively
Hello;
I have 10 Caller IDs and I need each call (each time) to use one of these Caller IDs to be the caller id. I know that I can use this syntax as example:
exten => _90ZXXXXXX,1,Set(CALLERID(num)747576)
But how I can set the callerid each time from be one of the 10 caller ids that are allowed for me?For example: first call to use caller id 01747576 and second call to use caller id 01747577 and third call to use caller id 01747578 and so on, how?
RegardsBilal
2 thoughts on - 10 Caller IDs To Be Used Randomly Or Progressively
https://www.voip-info.org/asterisk-func-rand/
https://www.voip-info.org/asterisk-cmd-execif/
https://www.voip-info.org/asterisk-cmd-gotoif/
should give you some ideas.
Antony.
—
Never automate fully anything that does not have a manual override capability. Never design anything that cannot work under degraded conditions in emergency.
Please reply to the list;
please *don’t* CC me.
—
Am 18.09.2019 um 01:15 schrieb bilal ghayyad:
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
—