Page 1 of 1

balance call

PostPosted: Sat Apr 08, 2017 9:13 am
by davide.filippi
Good evening,
i'm try to code a load balance of provider's server

DIGI1=sip/${EXTEN}@_SERVER_ADDRESS_1
DIGI2=sip/${EXTEN}@_SERVER_ADDRESS_2

exten => _X.,1,GotoIf($[${RoundCount}>=2]?skip2)
exten => _X.,n,GotoIf($[${RoundCount}<2]?skip1)
exten => _X.,n,SetGlobalVar(RoundCount=0)
exten => _X.,n,Wait(1)
exten => _X.,n(skip2),SetGlobalVar(RoundCount=0)
exten => _X.,n(skip1),SetGlobalVar(RoundCount=$[{${RoundCount}+1}])
exten => _X.,n,Dial($DIGI${RoundCount},,Tto)
exten => _X.,n,Hangup

How I have to write the Dial command to work right?

Thanks in advance

Re: balance call

PostPosted: Mon Apr 10, 2017 6:47 am
by davide.filippi
Problem solved.
Correct code is:

DIGI1=_SERVER_ADDRESS_1
DIGI2=_SERVER_ADDRESS_2

exten => _X.,1,GotoIf($[${RoundCount}>=2]?skip2)
exten => _X.,n,GotoIf($[${RoundCount}<2]?skip1)
exten => _X.,n,SetGlobalVar(RoundCount=0)
exten => _X.,n,Wait(1)
exten => _X.,n(skip2),SetGlobalVar(RoundCount=0)
exten => _X.,n(skip1),SetGlobalVar(RoundCount=$[{${RoundCount}+1}])
exten => _X.,n,Dial(sip/${EXTEN}@${DIGI${RoundCount}},,Tto)
exten => _X.,n,Hangup