Asterisk connects with multiple GOIP

The environment of network is:

Two goip is in the LAN of the office, and asterisk is in the public internet.

The IP address of them:

asterisk: v.voptech.com

two goip: 192.168.1.194 and 192.168.1.195

Our purpose is:

For the outbound calls:

1

When the internal users dial 91+any number, the call will go out through sim card 1 of goip(192.168.1.194);

When the internal users dial 92+any number, the call will do out through sim card 2 of goip(192.168.1.194);

When the internal users dial 95+any number, the call will go out through sim card 1 of goip(192.168.1.195);

When the internal users dial 96+any number, the call will go out through sim card 2 of goip(192.168.1.195);

For the incoming calls:

When the users outside call any sim card of both of goip, they will hear an IVR, and they can dial any internal extensions.

Firstly, let us set the asterisk.

 2

 1. Logon on the asterisk, and enter the following information in sip.conf file.

[general]

match_auth_username=yes   ;when several users of asterisk are registered to one same device, the sentence must be entered.

[lesheng801]

type=friend

context=lesheng

host=dynamic

nat=yes

secret=voptech1984

dtmfmode=auto

disallow=all

allow=ulaw

allow=alaw

allow=gsm

qualify=yes

directmedia=no

[lesheng-trunk1]!

context=fxo-trunk

type=friend

host=dynamic

nat=yes

dtmfmode=auto

disallow=all

allow=ulaw

allow=alaw

allow=gsm

qualify=yes

directmedia=no

secret=voptech1984

[lesheng-trunk2](lesheng-trunk1)

Secret=voptech1984

 [lesheng-trunk3](lesheng-trunk1)

Secret=voptech1984

 [lesheng-trunk4](lesheng-trunk1)

Secret=voptech1984

 [lesheng-trunk5](lesheng-trunk1)

Secret=voptech1984

 [lesheng-trunk6](lesheng-trunk1)

Secret=voptech1984

 [lesheng-trunk7](lesheng-trunk1)

Secret=voptech1984

 [lesheng-trunk8](lesheng-trunk1)

Secret=voptech1984

2. Open the file extensions.conf and write the related content in it.

[lesheng]

exten => _91X.,1,Dial(SIP/lesheng-trunk1/${EXTEN})

exten => _92X.,1,Dial(SIP/lesheng-trunk2/${EXTEN})

exten => _93X.,1,Dial(SIP/lesheng-trunk3/${EXTEN})

exten => _94X.,1,Dial(SIP/lesheng-trunk4/${EXTEN})

exten => _95X.,1,Dial(SIP/lesheng-trunk5/${EXTEN})

exten => _96X.,1,Dial(SIP/lesheng-trunk6/${EXTEN})

exten => _97X.,1,Dial(SIP/lesheng-trunk7/${EXTEN})

exten => _98X.,1,Dial(SIP/lesheng-trunk8/${EXTEN})

[fxo-trunk]

;when you dial 200, you will hear an IVR(welcome). If you dial 1 during the IVR or you dial 1 in 5 seconds after IVR is over, the

;extension lesheng801 will ring.

exten => 200,1,Answer()

same => n,Background(welcome)

same => n,WaitExten(5)

exten => 1,1,Dial(SIP/lesheng801,10)

same => n,Playback(unavailable)

same => n,Hangup()

;if you press any other keys besides 1, you will hear a voice(pbx-invalid), and go back to the start.

exten => i,1,Playback(invalid)

same => n,Goto(fxo-trunk,200,1)

;if you donot press any keys, you will hear a voice(goodbye).

exten => t,1,Playback(goodbye)

same => n,Hangup()

3. Please input the command sip reload and dialplan reload to make the configuration take effect.

 

Secondly, let us configure both of the goip.

1. Logon on the first goip(192.168.1.194) device

a. Go to Configurations->Call settings, and enter the related trunk information in it, then click the Save Changes to save it.

(1)     Choose Line 1, and then enter the trunk information (lesheng-trunk1) in it.

(2)     Choose Line 2, and then enter the trunk information (lesheng-trunk2) in it.

(3)     Choose Line 3, and then enter the trunk information (lesheng-trunk3) in it.

(4)     Choose Line 4, and then enter the trunk information (lesheng-trunk4) in it.

3

b. Go to Configurations->Call Divert, and enter the related information in it, then click the Save Changes to save it.

4

(1)     Choose Line 1, and enter 91:-91 into the Dial Plan (VOIP to PSTN). It means any number starting with 91 will be deleted 91 before the number is called out of goip device.

(2)     Choose Line 2, and enter 92:-92 into the Dial Plan (VOIP to PSTN).

(3)     Choose Line 3, and enter 93:-93 into the Dial Plan (VOIP to PSTN).

(4)     Choose Line 4, and enter 94:-94 into the Dial Plan (VOIP to PSTN).

2. Logon on the second goip device(192.168.1.195), and the configuration is very familiar with goip device(192.168.1.194)

In the Call settings configuration:

5

Line 1     v.voptech.com    lesheng-trunk5       95

Line 2     voptech.com     lesheng-trunk6       96

Line 3     v.voptech.com    lesheng-trunk7       97

Line 4     v.voptech.com    lesheng-trunk8       98

In the Call Divert configuration:

6

Line 1    95:-95     200

Line 2    96:-96     200

Line 3    97:-97     200

Line 4    98:-98     200

,

2 Responses to Asterisk connects with multiple GOIP

  1. wajdan July 16, 2013 at 5:52 pm #

    Thanks for this useful post. I am facing a similar situation only difference is following.

    Rather than configuring goip by line, I want to configure it like

    calls with prefix 92 go through any sim card of goip1
    and cals with prefix 91 go through any sim card of goip2

    Can you please point out what/where to change in above configuration you posted

    Thanks in advance

    • grace Liu July 18, 2013 at 2:06 am #

      In asterisk side, you can just create two trunks, and set the dial plan as: when you dial 92+any number, the call will go out throgh trunk 1, when you dial 91+any number, the call will go out through trunk 2.
      In GOIP side, you can choose singel server mode, and respectively register the trunk in each GOIP.
      If you want to know more details, you can refer to the file: http://blog.voptech.com/asterisk-connects-with-goip-by-single-server-mode/

Leave a Reply