Connecting 2 asterisk servers

Hello,

I have an asterisk server that has a T1 line and 2 DIDs.
I want to add another asterisk server and connect it to the 1st one.
So asterisk2 will use asterisk1 as an outgoing gateway (not sure what the proper term is)
And asterisk1 will forward calls made to one of the DIDs to asterisk2 server.

Is this possible to achieve?

I tried connecting the 2 servers through iax and they both register with each other, but asterisk2 is not able to make outgoing calls and my DID forward isn’t working either.

Any help would be greatly appreciated.

Thank you in advance.

hi:
I think something is wrong with your call routing. two asterisks can be connected well with iax or sip. please show the log.

What do you mean by DID? It is often misused in the Asterisk community to refer to almost any incoming PSTN to SIP route. With a T1 line and no VoIP at all, I would consider a DID block of 100 numbers to be fairly common.

And yes, tandem connecting Asterisk is a normal thing to do.

Hi,

By DID’s i mean my T1 PRI has two phone numbers attached to it and they currently go to the same server with different IVRs. i want to route the calls from the second number to the asterisk2 server.

So James, you are saying that it is possible to have the T1 lines connected to asterisk1 and have asterisk2 connect to asterisk1 to call out. Is it my dial plan that i need to manipulate since my iax registration works?

yes it is possible.

I have my systems working this way. One is the bridge machine and contains the quad pri card, although we are now only using two ports. Another machine is the pbx and handles all of the pbx functions, extensions, ivr, voicemail. There is even a third machine which has hylafax and iaxmodem.

All machines are linked with iax. The calls come into the bridge machine, if they are the dids for the faxes, they are routed to the hylafax machine. Otherwise, they hop over to the pbx.

on your bridge machine just have your context send the call over to second machine…

[from-pstn]
exten => 1111,1,Goto(IVR,s,1)
exten => 2222,1,Dial(IAX2/to-2ndpbx/${EXTEN})

on your second machine handle the call you would any other.

post your some of the relevant dialplan for both boxes and we can comment on where the problem may be…

Are these actual DIDs, or do you mean that you have some channels for one number and some channels for the other. A two number direct in dialing group is very small for a T1!

If you have different channels for each number, but they are not really DID numbers, then you should put the two sets of channels into different group, with different associated contexts, and then have the context for the number to be forwarded be like:

[context1]
IVR logic
[context2]
s,1,Dial(IAX/…)

You will have to make some provision for routing outgoing calls to the correct channel group, so they get the correct CLID (e.g. a contex for the incoming IAX calls that is used to select the group, or caller ID matches in the dialplan patterns).

If they are true DIDs (i.e. both numbers share the same set of channels and some digits are forwarded) you will have to use the technique already given. You will also need to consider outgoing caller-id, but as you, presumably get to specify that, there will be more options.

Hello Again,
Thank you for your help so far.

I got into a road block…

No matter how i try to connect the 2 boxes i keep getting authentication refused on both machines.
Heer are the errors for the same event on both machines

Asterisk1
iax2 error:
[Jul 7 02:25:39] NOTICE[23689]: chan_iax2.c:8941 iax2_poke_peer: Still have a callno…
[Jul 7 02:25:39] NOTICE[312]: chan_iax2.c:8313 socket_process: Registration of ‘Asterisk1’ rejected: 'Re

sip error:
[Jul 7 02:26:52] WARNING[305]: chan_sip.c:12585 handle_response_register: Forbidden - wrong password on authentication for REGISTER for ‘Asterisk1’ to ‘192.168.10.2’

Asterisk2

[Jul 7 02:32:25] ERROR[3583]: chan_sip.c:13555 register_verify: Peer ‘Asterisk1’ is trying to register, but not configured as host=dynamic
[Jul 7 02:32:25] NOTICE[3583]: chan_sip.c:22172 handle_request_register: Registration from ‘sip:ppdialerserver@192.168.10.2’ failed for ‘192.168.10.1’ - Peer is not supposed to register
[Jul 7 02:40:04] NOTICE[3514]: chan_iax2.c:7693 register_verify: Peer ‘Asterisk1’ is not dynamic (from 192.168.10.1)

here is my config

Astersik1 (192.168.10.1)

iax.conf
[general]
register => Asterisk1:passwd1@192.168.10.2

[Asterisk2]
type=friend
auth=plaintext
secret=passwd2
host=dynamic
context=internal
trunk=yes
callerid="OSDial"
qualify=1000
context=internal

[Asterisk2]
type=user
auth=plaintext
secret=passwd2
host=dynamic
context=internal
trunk=yes
callerid="OSDial"
qualify=1000
context=internal

i also configured sip and still not working:

sip.conf
[general]
register => Asterisk1:passwd1@192.168.10.2

[Asterisk2]
secret=passwd2
host=dynamic
type=friend
dtmfmode=auto
qualify=yes
trunk=yes
;disallow=all
;allow=ulaw
allow=all
context=internal

[Asterisk2]
secret=passwd2
host=dynamic
type=user
dtmfmode=auto
qualify=yes
trunk=yes
;disallow=all
;allow=ulaw
allow=all
context=internal

And now Asterisk2
[general]
register => Asterisk2:passwd2@192.168.10.1

[Asterisk1]
secret=passwd2
host=dynamic
type=peer
dtmfmode=auto
qualify=yes
trunk=yes
;disallow=all
;allow=ulaw
allow=all
context=internal
requirecalltoken=no

[Asterisk1]
secret=passwd2
host=dynamic
type=user
dtmfmode=auto
qualify=yes
trunk=yes
;disallow=all
;allow=ulaw
allow=all
context=internal
requirecalltoken=no

Thank you!

Oh a few more things…
Any idea how to fix the following:

Calling from Asterisk2 to Asterisk1:

Asterisk1:
Scheduling destruction of SIP dialog ‘3076db916c22588b360bf2274d974744@192.168.10.2’ in 32000 ms (Method: OPTIONS)
– Executing [1000@internal:1] Dial(“SIP/2250-09d704f8”, “IAX2/ Asterisk1:passwd1@192.168.10.2/000|30|r”) in new stack
– Called ppdialerserver:ppd1al3r53rv3r!@192.168.10.2/000
[Jul 7 02:47:36] WARNING[315]: chan_iax2.c:7823 socket_process: Call rejected by 192.168.10.2: Unable to negotiate codec
– Hungup ‘IAX2/osdialerserver-12610’
== Everyone is busy/congested at this time (1:0/0/1)
– Executing [1000@internal:2] Dial(“SIP/2250-09d704f8”, “SIP/Asterisk1:passwd1@192.168.10.2/000|30|r”) in new stack
[Jul 7 02:47:36] WARNING[23831]: chan_sip.c:2933 create_addr: No such host: 192.168.10.2/000
[Jul 7 02:47:36] WARNING[23831]: app_dial.c:1242 dial_exec_full: Unable to create channel of type ‘SIP’ (cause 20 - Unknown)
== Everyone is busy/congested at this time (1:0/0/1)
– Executing [1000@internal:3] Congestion(“SIP/2250-09d704f8”, “”) in new stack
== Spawn extension (internal, 1000, 3) exited non-zero on ‘SIP/2250-09d704f8’
[Jul 7 02:47:40] NOTICE[316]: chan_iax2.c:8313 socket_process: Registration of ‘Asterisk1’ rejected: ‘Registration Refused’ from: ‘192.168.10.2’

Errors on Asterisk2:

[Jul 7 02:46:39] NOTICE[3583]: chan_sip.c:18779 handle_response_register: Outbound Registration: Expiry for Asterisk1 is 120 sec (Scheduling reregistration in 105 s)
[b][Jul 7 02:46:48] WARNING[3512]: chan_iax2.c:10331 socket_process: Call rejected by 192.168.10.1: No authority found
[Jul 7 02:46:48] – Hungup ‘IAX2/Asterisk1-16853’

And when i go to check peers and registrations both servers seem to have authenticated each other… i am out of ideas at this point.

Delete the bogus /000

Try by changing host=($IPAddress of other server) in iax.conf or sip.conf whatever you are using. For example

on Server1
host=192.168.1.2.

on Server2
host=192.168.1.1

where IP of server1=192.168.1.1 and IP of server2=192.168.1.2

You can change the IPs according to your IP scheme.

Hello Kashifsaleem,

I tried assigning the static IPs to in the host variable but i kept getting the host not dynamic error.

I tried changing the paswords to MD5 and now i get:

Host 192.168.10.1 did not provide proper plaintext password for Astersik1

After a few tweaks (wrong password on Astersik1 declaration) both servers register with each other, but when i try to make a call i get:

on the IAX2 side:
– Executing [1000@internal:1] Dial(“SIP/2250-09ad3928”, “IAX2/Asterisk1:passwd1@192.168.10.2/1000|30|r”) in new stack
– Called Asterisk1:passwd1@192.168.10.2/1000
[Jul 7 15:41:47] WARNING[311]: chan_iax2.c:7823 socket_process: Call rejected by 192.168.10.2: No authority found
– Hungup ‘IAX2/Asterisk2-15766’

on the SIP side:
[Jul 7 15:41:47] WARNING[5068]: chan_sip.c:2933 create_addr: No such host: 192.168.10.2/1000
[Jul 7 15:41:47] WARNING[5068]: app_dial.c:1242 dial_exec_full: Unable to create channel of type ‘SIP’ (cause 20 - Unknown)

Any ideas?

What is type field set to on both servers?
Try by changing them to friend on both sides.

i tried the user/peer setup as well and i get the same results.
they authenticate to each other on both counts SIP and IAX2 but when it comes to calling out i get:

“No authority found” on the call initiating box
"failed to authenticate" on the call receiving box