Asterisk behind Fritzbox

I’am new to Asterisk and I’ am trying to use it behind my Fritzbox. I found several threads regarding this, but nothing helped so far. I’ve installed AsteriskNow and I’am using FreePBX to configure Asterisk.

At the moment I’am able to receive incoming calls from the Fritzbox, but my goal is to call the numbers on my Fritzbox from Asterisk. So far I’ve configured a trunk using there values:

Outbound CallerID: 620

PEER Details:
type=friend
insecure=very
username=620
fromuser=620
secret=mysecret
host=172.17.1.4
qualify=yes
canreinvite=no

USER Context: 620

USER Details:
username=620
type=user
secret=mysecret
qualify=yes
host=172.17.1.4
fromuser=620
fromdomain=172.17.1.4

Register String: 620:[email protected]/620

this is the output of "sip show registry"
Host dnsmgr Username Refresh State Reg.Time
172.17.1.4:5060 N 620 285 Registered Mon, 14 Mar 2016 23:20:19
1 SIP registrations.

I’ve also configured an outbound route with dial pattern X. and assigned the Fritbox trunk, but still the calls don’t get routed to my Fritzbox. (I e.g. want to call the number **1 of my Fritzbox)

Are there any howto’s on how to configure this using the latest FreePBX?

The only Fritzbox information I can find is about the ADSL Router/Wifi gateway. If that’s what you have, then none of the information in your post makes sense. If that’s not what you have, you will need to give us more information.

One thing that I did see was that you are using X. as an outbound route. Where are you using that? If you are using it in the FreePBX outbound routes, you need to lose it. Without any entries, an outbound route will try to route everything to your trunk.

The more I look at this, it appears that you are using a single extension as your connection to the Fritzbox, but that doesn’t make any sense, since you would then be connecting a PBX to a PBX through an extension (and not a trunk).

How are you trying to send “**1” to the Fritzbox? That sequence is normally captured by Asterisk and processed.

There is so much information here that just doesn’t add up. I recommend you try again, but tell us more about your environment and less about how your trunk is set up. For example, how are your phones connected? Are they connected to Asterisk or (somehow) to the Fritzbox? I just don’t understand what you are trying to do yet.

Thanks for your answer. I will try to explain my situation.

I have an Fritzbox 5490 (Fiber version) with integrated sip server. The Fritzbox has connectors for analog and ISDN phones. I’ve connected one analog phone to the box. (This phone has the internal number **1) On the Fritzbox I’ve also configured my sip provider, so I can make external calls.

The reason why I also want to use Asterisk behind the Fritzbox is to make automated calls. (I have a home automation system which should alert me with a phone call when a smoke alert is triggered) I’ve tried several other solutions (sipcmd etc), but none of them worked without problems, so I’m trying to this this using Asterisk.

So what I’am trying to do is configure Asterisk so it is able to send calls to my analog phone, and also make an external call over the Fritzbox if the analog phone is not picked up. This is why if configured the outbound route to route all calls to the Fritzbox. (I don’t need internal calls in Asterisk)

To test this I’ve setup an internal extension with number 2000 in Asterisk and connected a software sip phone to it. From this software phone I’am now trying to call the analog phone **1 connected to the Fritzbox. The other way (call the software sip phone from the analog phone) is already working.

This is why I’ve setup the connection to the Fritzbox using a trunk.

== >I’ve just found out that outbound calls work if I set the outbound route dial pattern to “+[0-9][0-9][0-9][0-9].”, so I just need to know how I can also route the **1 calls to the Fritzbox. At the moment I get the following log output in Asterisk when trying to call this number:

app_directed_pickup.c:302 pickup_exec: No target channel found for [email protected]
app_directed_pickup.c:302 pickup_exec: No target channel found for [email protected]

How can I route these calls also to the Fritzbox?

Hi @TheNetStriker + @cynjut, have you managed to get Asterisk connected?

I am new to Asterisk and have not yet understood some concepts, e. g. the nature of SIP accounts (well, yes - for authentication) vs. “numbers”.
I use one Fritzbox 7170 successfully for VoIP telephony with sipgate.de and to route house-internal calls beginning with “9” to Asterisk. Asterisk then drives home automation with CURL actions.

That mechanism is set up with one special “number” (“Internettelefonie”) in Fritzbox and Asterisk to contain the respective SIP credentials (say, 9000/9000) and then to use that “number” when setting up a dialling rule (“Wahlregel”) for digit 9. With the appropriate CURL commands in extensions.conf, numbers like (for example) 9601, 9602 then turn lights on and off. That works well, though it did not work for a 2nd such dialling rule.

Now I am still struggling with the reverse way: Dial out from Asterisk to Fritzbox, e. g. using a Dial(SIP/[email protected]) command (issued inside an IVR menu that I dial into) to make a phone in the Fritz-managed telephone network ring. I tried a configuration example for Asterisk with sipgate.de and simply replaced all sipgate.de references with fritz.box or the 192.168.1.1 IP address, pretending that Fritzbox simply acts as a SIP server to Asterisk as would sipgate.de do - but that does not work.

I am monitoring registry + peers + Fritzbox telephony event log output but lack the proper understanding. But I would have assumed that simply routing all calls originating from Asterisk to a Fritzbox should be simple to achieve!?

@TheNetStriker + @cynjut,

I got the issue resolved and have below scribbled a picture of my setup across 3x Fritz!Box and 1x Asterisk.

K-

Thanks @cynjut for pointing this out. I am slowly gaining some understanding and now am also looking for a way to connect Fritzbox (IP 192.168.1.1) and Asterisk (IP 192.168.1.27) trunk-to-trunk rather than by 1 extension only. This would give the ability to dial arbitrary numbers on each side (Dial(SIP/[email protected]/arbitrary) in extensions.conf - as opposed to hardcode device-with-extension entries in sip.conf), and I want to have conference rooms coming in from the Fritzbox with more than 1 participant.

From FritzBox to Asterisk (F2A), I set up one “9000” “Internetrufnummer”.
For the way back (A2F), I set up a friend sin sip.conf with defaultuser=9000,
i. e. sort of mirrored accounts for the same purpose (establishing a trunk - not just a single channel).

However, F2A I best case see yet another caller ID (624) that cross-triggers somehow and not the external caller’s ID, and A2F the call does not seem to be routed at all (I see nothing in the FritzBox telephony logs - not even for specifying wrong login credentials).

My failed approaches - sip.conf, trunk definition, SIP account for FritzBox:

[trunk-fritz0]
type=friend
username=9000
secret=9000
host=192.168.1.1
fromdomain=fritz.box

[9000]
type=friend
defaultuser=9000
secret=9000
host=dynamic