10 Caller IDs To Be Used Randomly Or Progressively

Home » Asterisk Users » 10 Caller IDs To Be Used Randomly Or Progressively
Asterisk Users 2 Comments

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

  • 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