0
votes

Asterisk will receive calls (32 concurrent calls) from IAX2 trunk and will send to SIP based GSM gateway for dial out. Here is my current dialplan:

[general]
static=yes
writeprotect=no
clearglobalvars = yes
[block]

[very-3]
exten => _X.,1,RetryDial(,3,2,SIP/${EXTEN:3}@Goip104)
exten => _X.,n,RetryDial(,3,2,SIP/${EXTEN:3}@Goip105)
exten => _X.,n,RetryDial(,3,2,SIP/${EXTEN:3}@Goip106)
exten => _X.,n,Hangup(17)

I googled above syntax

here is my sip.conf:

[Goip104]
canreinvite=no
context=very-3
dtmfmode=rfc2833
host=192.168.101.104
port=5060
call-limit=8
;allow=all
disallow=all
allow=g729,g723
insecure=port,invite
type = friend

[Goip105]
canreinvite=no
context=very-3
dtmfmode=rfc2833
host=192.168.101.105
port=5060
call-limit=8
;allow=all
disallow=all
allow=g729,g723
insecure=port,invite
type = friend

[Goip106]
canreinvite=no
context=very-3
dtmfmode=rfc2833
host=192.168.101.106
port=5060
call-limit=8
;allow=all
disallow=all
allow=g729,g723
insecure=port,invite
type = friend

This works good but requirement is to share gateway priorities. So 1 call goes to GoIP104, second call goes to GoIP105 and so on. With the current configuration, it fills up the GoIP4 first, then it goes to next gateway in priority. I tried setting up the same priority in dialplan but asterisk gives error on that.

Kindly help!

2

2 Answers

0
votes

It can be done by AGI(asterisk Gateway Interface), you can choose one languages from one of these different programming languages. Perl, PHP, C, Pascal, java etc.

you can get more information about AGI here ..

0
votes

You need check gateway availible( GROUP function/DEVICESTATE function) and check DIALSTATUS variable after each attempt.

Also will be nice do random dialling

Note, use AGI will greatly increase load on your system. This task can be done in pure dialplan without any AGI.

Using asterisk-java will increase load even more(unless you use fastagi version).

Consult this pages:

http://www.voip-info.org/wiki/view/Asterisk+functions

http://www.voip-info.org/wiki/view/Asterisk+variable+DIALSTATUS

http://www.voip-info.org/wiki/view/Asterisk+auto-dial+out

PS doiing dialout code for more then 1-2 channels is very tricky thing. If you not expert use already developed third-party code.