[Problem] Freepbx working trunk settings for 1und1 ?

JohnnyBegood

Neuer User
Mitglied seit
17 Sep 2012
Beiträge
14
Punkte für Reaktionen
0
Punkte
0
Hi all,

Friend lives in Germany with Fritz Box 7390 and I live in USA with Elastix (with embeded FreePBX V2.8.1 & Asterisk v1.8 ). How we can talk for free? I've setup a trunk on my Elastix and it shows registered but when he calls the number it does not show as incloming CLI in Asterisk. Debug shows this error:

Code:
--- (21 headers 10 lines) ---
Sending to 212.227.18.135:5060 (NAT)
Using INVITE request as basis request - 2ebbf099-242c6a8f-7d7740be-3982@1und1-5.sip.mgc.voip.telefonica.de
No matching peer for '+120XXX87950' from '212.227.18.135:5060'



-- (21 headers 10 lines) ---
Sending to 212.227.18.206:5060 (NAT)
Using INVITE request as basis request - 75765656-3cb1e3a8-4a1ece6b-3d15@1und1-5.sip.mgc.voip.telefonica.de
No matching peer for '+120XX87950' from '212.227.18.206:5060'

<--- Reliably Transmitting (NAT) to 212.227.18.206:5060 --->
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 212.227.18.206;branch=z9hG4bKb9be.d76405dd193dbab31638a03002006034.0;received=212.227.18.206;rport=5060
Via: SIP/2.0/UDP 212.227.18.230;branch=z9hG4bKb9be.0f8fde6002b6b97ea30da35f31bacb63.0
Via: SIP/2.0/UDP 212.227.18.198;branch=z9hG4bKb9be.149f17666552288757773fdd712e139f.0
Via: SIP/2.0/UDP 217.188.44.83;branch=z9hG4bKb9be.050ec2e7.0
Via: SIP/2.0/UDP 62.53.191.102:5060;branch=z9hG4bKog1v9o106g9g3a1kp471.1
From: +120XX287950 <sip:[email protected]:5060;user=phone>;tag=1240647468
To: +4920XX65436 <sip:[email protected]:5060;user=phone>;tag=as51ba99a9
Call-ID: 75765656-3cb1e3a8-4a1ece6b-3d15@1und1-5.sip.mgc.voip.telefonica.de
CSeq: 1 INVITE
Server: FPBX-2.8.1(1.8.20.0)
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
WWW-Authenticate: Digest algorithm=MD5, realm="asterisk", nonce="12d722ae"
Content-Length: 0
 
Try the "allow anonymous incoming SIP connections" option set to yes. 1und1 uses several load balancing servers, check out the search for "asterisk 1und1".
 
Try the "allow anonymous incoming SIP connections" option set to yes. 1und1 uses several load balancing servers, check out the search for "asterisk 1und1".
I will try to set it to "yes" and will do a search.
Just wanted to see if I'm on the right track as far as what others are using to achieve free calls using 1und1.
Can someone who has working incoming calls confirm if this is correct trunk setting?

Code:
disallow=all
host=sip.1und1.de
username=4920xxxxxxxx
fromuser=4920xxxxxxxx
secret=password
type=friend
nat=yes
insecure=very
fromdomain=1und1.de
canreinvite=no
allow=alaw&ulaw
context=from-trunk
qualify=yes
 
nat should be force_rport,comedia.
insecure shoud be port,invite in Your case.
canreinvite=no shoud be directmedia=no as canreinvite is not an valid option for 1.8

In Your 1st SIP-package there's another problem:

No matching peer for '+120XXX87950' from '212.227.18.135:5060'

Assuming this is an inbound call from Your friends in Germany You need to make sure, that the destination number is interpreted correctly, it shoud be +4920XXX87950 instead.
Another hint: For Outbound-Calling to Germany You will usually dial 01149... when 1und1 would the destination number expext to be in German national format, in You case this should be 020XXX.
Your trunk for 1und1 should be configured accordingly.

The 2nd Sip-package which seems to represent another - outbound call - shows a similar problem:

From: +120XX287950 <sip:[email protected]:5060;user=phone>;tag=1240647468

Alltough this Number may be an original NANPA-Number it would

  • not be delivered as CLIP-number as 1und1 does not support ClipNoScreening
  • Even if it would be transported it will probably consternate Your friends and will usually not be free of charge when they simpy call this number back


and BTW: Why Elastix and not a native (Vanilla) Asterisk? Especially such constellations as with 1und1 or such non-trivial number-conversions incl. numbering plans a.s.o. are easier to administrate in vanilla once You know the basics about configuring trunks and dialplans ...
 
Zuletzt bearbeitet:
Thanks so much for the reply!
Because of time difference I won't be able to try your suggestions before the weekend because last time every time I would try his DECT phones would ring in the middle of night :)

This debug was captured with command " sip set debug on" and when I tried calling his number from here using google voice.
After checking my trunk settings I made a mistake and entered info into "Outgoing Settings" I've changed it now. That probbaly made some odd formats?

MuVqVcu.jpg

I think he said that he has total of 5 phone numbers with 1und1. Are there any other options that can be setup with Fritz Box?
I was thinking when I get the trunk working he can call that # and I would create incoming route and forward it to my main extension here. It would not cost him anything. I would need to setup up my outgoing settings to be able to call him?

As far as asterisk vanilla I never tried to install it. I like how Elastix is setup. I have it on older C2D Acer Revo.
What would you recommend to install it on its not a standalone distro?
 
Zuletzt bearbeitet von einem Moderator:
First of all: The trunk settings look good now (at the moment)

I think he said that he has ...

If Your friend got 5 numbers (and gave You one of them) he only needs to configure 4 numbers within his FRitzBox.
If this is the setting (4 numbers from 1und1 at his side and one at Yours) all calls between these 5 numbers shoudl be free of charge.
For outgoing calls You need to make sure, that the number-format on the outgoing trunk is

0<German NDC><German SN>

which means in fact, that if You're dialing his German number as usual from NANPA as

01149<German NDC><German SN>

You'll need to strip of the leading 01149 and replace it with a 0.

Please keep in mind that You should create a callroute ensuring that his German numbers are dialed through the 1und1-trunk instead of e.g. GoogleVoice.

If You need any further help in testing You may PM me.

What would you recommend to install it on its not a standalone distro?

Sorry, unfortunately I didn't understand this sentence completly :confused:.
However: I don't know how experienced You are with Linux, but: If You've got a more-or-less "standard" environment concerning trunks and extensions/stations, a vanilla Asterisk (of course without any GUI for configuration and any prdefined macros You probably may find hard top debug) isn't that complicated to manage - I installed one for a friend of mine in the States (VA) with a combination of DAHDI (connecting standard analogue phones as well as a LINGO-Line via FXS/ATA from LINGO) some SIP-Providers. So that's no magic. The distro could be any You prefer, usually there will be the decsion between a debian-based flavour like Ubuntu or a rpm-based like CentOS or so. However - Asterisk vanilla is usable on every distro of Your choice.
 
Are there any other options that can be setup with Fritz Box?

You could leave out 1und1 by creating a client in your PBX and setting up this as a SIP provider ("Internetrufnummer") in the FritzBox. The latter would then work like a phone connected to your PBX. You will just dial the internal extension No. to call your friend, he on the other hand could use the prefix *12x# (replace x as shown in the FritzBox UI) followed by your extension No.

I once did similar for a friend of mine living in Dubai to allow her to chat with her family for free.
 
@rentier-s:
In addittion to this suggestion it would be possible to establish a VPN-tunnel between both sides to have encryption of the calls. (Obwohl ich keine Ahnung habe, wie man in Fritten ein VPN vernünftig einrichtet, ich benutze immer andere Routerhardware ...)

@JohnnyBegood:
To realize the suggestion of rentier-s it would be necessary, that Your Linux-box has either a static IP from Your provider or alternativly a dns-resolvable FQDN (some dyndns-Account would do the trick here.) For my "VPN-addition" both sides should either have static IPs, dns-resolvable FQDNs or a combination thereof.
 
Just this past weekend I've tried again to get it to work but no luck. When I call from here it rings and after he picks up we can talk but it never reaches my FreePBX. CLI never show any reference to 1und1. I even deleted "number assigned to me" from his Fritz under Eigene Rufnummern and after I call it never goes to my box eventhough it shows as registered trunk on my FreePBX.

So in other words vanilla Asterisk can be installed on any linux OS. I do have some linux knowledge. I've played with Debian and Ubuntu and have my dedicated Ubuntu server.

eigene nummer.JPG

[Beitrag 2:]

You could leave out 1und1 by creating a client in your PBX and setting up this as a SIP provider ("Internetrufnummer") in the FritzBox.

Could you please explain what to enter in all fields? I've created ext. 200 and I can registering using CSipSimple my android phone but when it tries in Fritz it fails.

Die Prüfung der Internettelefonie ist fehlgeschlagen. Die Anmeldung beim Telefonieanbieter ist gescheitert. Prüfen Sie die eingegebenen Zugangsdaten für die Internettelefonie.

register.JPG

[Beitrag 3:]

In addittion to this suggestion it would be possible to establish a VPN-tunnel between both sides

I've tried to setup VPN between Fritz and my computer but when I install Fritz client on my computer its asking me for a config file which I don't know where to get out of Fritz.

I already have my own dynamic hostname on my router.
 
Zuletzt bearbeitet von einem Moderator:
Please observe the rule, several posts within short time and quotation of whole posts are not welcome. Keeps quotes to what's neccessary and use the edit function to add additional stuff.

Do you have a portforwarding for UDP 5060 to your PBX?
 
I have 1und1 up and running with freepbx.
Some stuff I stumbled across:
  • I had to forward both RTP and SIP Port.
  • SIP port of freepbx changed from 5060 to 5061 since my fritzbox would not play nicely with 5060
  • Dynamic host and local network needs to be set correctly
  • Allow SIP Guests and Allow Anonymous Inbound SIP Calls both set to no
  • Create Inbound Route with DID set to same number as "fromuser" in trunk

Trunk Setting
Code:
type=peer
secret=PWD
qualify=yes
nat=force_rport,comedia
language=de
insecure=port,invite
host=sip.1und1.de
fromuser=49.......
fromdomain=1und1.de
dtmfmode=auto
defaultuser=49.....

sip_custom.conf
Code:
[1und1](!)
type=peer
host=sip.1und1.de
fromdomain=1und1.de
insecure=invite,port
nat=force_rport,comedia
directmedia=no
qualify=yes
dtmfmode=auto
language=de
context=from-trunk

[1und1-1-1](1und1)
host=sipbalance1-1.1und1.de 

[1und1-1-2](1und1)
host=sipbalance1-2.1und1.de

[1und1-1-3](1und1)
host=sipbalance1-3.1und1.de

[1und1-1-4](1und1)
host=sipbalance1-4.1und1.de

[1und1-2-1](1und1)
host=sipbalance2-1.1und1.de

[1und1-2-2](1und1)
host=sipbalance2-2.1und1.de

[1und1-2-3](1und1)
host=sipbalance2-3.1und1.de

[1und1-2-4](1und1)
host=sipbalance2-4.1und1.de

[1und1-3-1](1und1)
host=sipbalance3-1.1und1.de

[1und1-3-2](1und1)
host=sipbalance3-2.1und1.de

[1und1-3-3](1und1)
host=sipbalance3-3.1und1.de

[1und1-3-4](1und1)
host=sipbalance3-4.1und1.de

[1und1-4-1](1und1)
host=sipbalance4-1.1und1.de

[1und1-4-2](1und1)
host=sipbalance4-2.1und1.de

[1und1-4-3](1und1)
host=sipbalance4-3.1und1.de

[1und1-4-4](1und1)
host=sipbalance4-4.1und1.de

[1und1-5-1](1und1)
host=sipbalance5-1.1und1.de

[1und1-5-2](1und1)
host=sipbalance5-2.1und1.de

[1und1-5-3](1und1)
host=sipbalance5-3.1und1.de

[1und1-5-4](1und1)
host=sipbalance5-4.1und1.de

[1und1-6-1](1und1)
host=sipbalance6-1.1und1.de

[1und1-6-2](1und1)
host=sipbalance6-2.1und1.de

[1und1-6-3](1und1)
host=sipbalance6-3.1und1.de

[1und1-6-4](1und1)
host=sipbalance6-4.1und1.de

[1und1-7-1](1und1)
host=sipbalance7-1.1und1.de

[1und1-7-2](1und1)
host=sipbalance7-2.1und1.de

[1und1-7-3](1und1)
host=sipbalance7-3.1und1.de

[1und1-7-4](1und1)
host=sipbalance7-4.1und1.de

[1und1-8-1](1und1)
host=sipbalance8-1.1und1.de

[1und1-8-2](1und1)
host=sipbalance8-2.1und1.de

[1und1-8-3](1und1)
host=sipbalance8-3.1und1.de

[1und1-8-4](1und1)
host=sipbalance8-4.1und1.de

[1und1-9-1](1und1)
host=sipbalance9-1.1und1.de

[1und1-9-2](1und1)
host=sipbalance9-2.1und1.de

[1und1-9-3](1und1)
host=sipbalance9-3.1und1.de

[1und1-9-4](1und1)
host=sipbalance9-4.1und1.de

[1und1-10-1](1und1)
host=sipbalance10-1.1und1.de

[1und1-10-2](1und1)
host=sipbalance10-2.1und1.de

[1und1-10-3](1und1)
host=sipbalance10-3.1und1.de

[1und1-10-4](1und1)
host=sipbalance10-4.1und1.de

[telefonica-1](1und1)
host=1und1-1.sip.mgc.voip.telefonica.de

[telefonica-2](1und1)
host=1und1-2.sip.mgc.voip.telefonica.de

[telefonica-3](1und1)
host=1und1-3.sip.mgc.voip.telefonica.de

[telefonica-5](1und1)
host=1und1-5.sip.mgc.voip.telefonica.de

[telefonica-6](1und1)
host=1und1-6.sip.mgc.voip.telefonica.de

[telefonica-7](1und1)
host=1und1-7.sip.mgc.voip.telefonica.de

[telefonica-8](1und1)
host=1und1-8.sip.mgc.voip.telefonica.de

Hope this helps.
 
@Monk:
After entering trunk info now I get
linux*CLI> sip show registry
Host dnsmgr Username Refresh State Reg.Time

sip.1und1.de:5060 N 4920xxxxxxxx 120 No Authentication

I've changed also sip_custom.conf
 
Are You sure, that the credentials are correct ? "No Authentication"looks like incorrect user and/or password
 
Hmm, some additional thoughts:

When you change your forwarded SIP port in the fritzbox, then you have to change it in the freepbx settings as well. Find it in Settings --> Asterisk Sip Settings --> Bind Port

Contrary to the screenshot you posted above the trunk details go into Outgoing Settings. For incoming, only the Incoming Route with the correct DID is relevant (no other settings needed for the Incoming route)

Do you have set your Register string correct? Mine looks like
Code:
49....:[email protected]/49...
 
Zuletzt bearbeitet:
@abw1oim: I have not changed the password. I've verified i was using the same one.
I've started looking into more deeper and found that in my sip_nat.conf I had:
localnet=192.168.1.0/255.255.255.0
externhost=myhostname.no-ip.org
externrefresh=10
btw, this hostname is working and had correct ip when pinged from outside my network.
As soon as I changed it to:
localnet=192.168.1.0/255.255.255.0
externip=my.external.ip
and did reload it showed as registered!
While trying to ping myhostname.no-ip.org from inside Asterisk I was getting replies from:
[root@linux ~]# ping -c4 myhostname.no-ip.org
PING localhost (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.044 ms
64 bytes from localhost (127.0.0.1): icmp_seq=2 ttl=64 time=0.033 ms
64 bytes from localhost (127.0.0.1): icmp_seq=3 ttl=64 time=0.038 ms
64 bytes from localhost (127.0.0.1): icmp_seq=4 ttl=64 time=0.038 ms

--- localhost ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3000ms
rtt min/avg/max/mdev = 0.033/0.038/0.044/0.005 ms
[root@linux ~]#
From windows machine I was getting replies from my external ip?
The file /etc/sysconfig/network has the following in it:
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=myhostname.no-ip.org
GATEWAY=192.168.1.1

Edit: Found the problem. Under /etc/hosts I had the following:
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost myhostname.no-ip.org localhost.localdomain
::1 localhost6.localdomain6 localhost6
Removed myhostname.no-ip.org and now when I ping it I get external ip!




@Monk:
I could not find Settings --> Asterisk Sip Settings --> Bind Port in my FreePBX
Closest what I've found was in Tools --> Asterisk Sip Settings
Have you changed anything under https://login.1und1.de ?
Also, please elaborate more on "When you change your forwarded SIP port in the fritzbox".?
If possible please take a screenshot.

Yes, register string is same as yours (see attached).

trunk.JPG

trunk2.JPG

bind.JPG
 
Zuletzt bearbeitet:
Lets assume your freepbx server has the IP 192.168.1.10 (I recommend to assign a static IP for it). Then create a UDP port forwarding in your fritzbox so that incoming connection from port 5060 are directed to 192.168.1.10 on e.g. port 5063. In your freepbx set the bind port (the one in your screenshot is correct) to 5063.
See my screenshot for an example:

Clipboard01.jpg
Of course all ports like RTP etc have to match your settings. The IAX port can be ignored for your standard setup
 
[root@linux ~]# ping -c4 myhostname.no-ip.org
PING localhost (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.044 ms

This looks like Your dyndns-Name "myhostname.no-ip.org" is somewhere configured to point to 127.0.0.1 in Your /etc/hosts-File or anywhere Your nameserver at Your linux-Box gets it's data from.
It's definitely a bad idea to use externip if Your external IP is not assigned static to You.
 
@abw1oim:
Yes, that's what it was. I've removed it and now I'm getting replies from my IP. I've tried to edit my post to include that but forum was down at that time.

My IP is static and it never changes.

@Monk:
I apologize if I wasn't clear but FreePBX is on my end and friend only has Fritz Box.
My linux-box has also static ip set to 192.168.1.104 and I've forwarded below ports:

elastix_udp.JPG
 
Zuletzt bearbeitet:
Well, surely when you forward 5060 then your bind port in asterisk has to be 5060 as well. Given your local network and your remote IP in the asterisk settings are correct, it should work.

Did you set the extension for your friends phone correctly? Is it registered?

Do a
Code:
asterisk -vvvr

then in the console issue following two commands:
Code:
sip show registry
sip show channelstats

Post the result here.
Then with the console still open try to do a call and post the result here too.


On a side note:
I still have not understood your "call the US for free from Germany" scenario. When you register a 1und1 trunk in your asterisk and your friend calls you, the call will be routed over the 1und1 trunk as outgoing and you will receive it via your provider. Thus the call will travel some thousand miles more but still be full charged.

Why not just having your German friend's phone registered in your asterisk and then he can dial any internal extension you have setup. Say your own phone has the extension 101 and your German friend's phone is registered as 102 your friend just has to dial 101 and your phone will ring.

You just have to make sure that your dial patterns and the extension do not interfere with each other. Say you have some dial patterns that would put 101 through to some North Korean red light provider your friend may be happy afterwards but some hundred $$ poorer.

As an alternative you could try this scenario: http://www.freepbx.org/support/docu...-user-dials-one-of-my-dids-how-do-i-keep-the-
Did not test it but may be worth a shot.
 
Holen Sie sich 3CX - völlig kostenlos!
Verbinden Sie Ihr Team und Ihre Kunden Telefonie Livechat Videokonferenzen

Gehostet oder selbst-verwaltet. Für bis zu 10 Nutzer dauerhaft kostenlos. Keine Kreditkartendetails erforderlich. Ohne Risiko testen.

3CX
Für diese E-Mail-Adresse besteht bereits ein 3CX-Konto. Sie werden zum Kundenportal weitergeleitet, wo Sie sich anmelden oder Ihr Passwort zurücksetzen können, falls Sie dieses vergessen haben.