bilal ghayyad
2019-Sep-17 23:15 UTC
[asterisk-users] 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)=01747576) 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20190917/17afc1b0/attachment.html>
Antony Stone
2019-Sep-18 00:55 UTC
[asterisk-users] 10 Caller IDs to be used randomly or progressively
On Wednesday 18 September 2019 at 01:15:57, bilal ghayyad wrote:> 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)=01747576) > > 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? RegardsBilalhttps://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.
Markus
2019-Sep-19 14:58 UTC
[asterisk-users] 10 Caller IDs to be used randomly or progressively
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