Sip Trunk Deutsche Telekom


(Sofyane Bousalhih) #1

Hello,
i have a sip Trunk with Deutsche Telekom .i have 30 numbers from 0421XXXX01 To 0421XXXX30 .

i am able to register and call in and out but the problem when i receive the calls i receivee only on the registered number filled in the registry string

tcp://+49421XXXX01@sip-trunk.telekom.de:password:username@reg.sip-trunk.telekom.de:5060/+49421XXXX01~480 .

if i call any number the calls are forwarded to my inbound route +49421XXXX01 , it s the same thing if i change my DID to +49421XXXX02 , all the calls are forwarded to +49421XXXX02 .
can you please help me.

Best regards.


(Xeoniz) #2

Remove the “/+49421XXXX01~480” part in the registry string and make sure to set inbound context to “from-pstn-toheader”.

Regards,
Xeoniz


(Sofyane Bousalhih) #3

Perfect that works . thank you very much .


(Judokan9) #4

Hello sofyane,

im happy, that this resolves your Problem for you.
I have some Problems to configure my FreePBX to that same SIP-Trunk.
Can you provide screenshots or something about your SIP-Trunk settings in FreePBX?
That would be great!!!

Best regards Marek


(Sofyane Bousalhih) #5

Hello,
below my actual config

Sip settings
–>outgoing : trunk name TRUNK OUT

videosupport=no
usereqphone=yes
type=peer
transport=tcp
srvlookup=yes
session-timers=refuse
secret=YYYYYYYYY
qualify=yes
insecure=invite
host=reg.sip-trunk.telekom.de
fromdomain=sip-trunk.telekom.de
dtmfmode=rfc2833
disallow=all
directmedia=no
defaultuser=55XXXXXXXX
allow=g722,alaw

—> Incoming : trunk name : IN

videosupport=no
usereqphone=yes
type=peer
transport=tcp
srvlookup=yes
session-timers=refuse
secret=YYYYYYYYY
qualify=yes
insecure=invite
host=reg.sip-trunk.telekom.de
fromdomain=sip-trunk.telekom.de
dtmfmode=rfc2833
disallow=all
directmedia=no
defaultuser=55XXXXXXX
allow=g722,alaw
context=from-pstn-toheader

Register String : tcp://+494zzzzzzz@sip-trunk.telekom.de:YYYYYYYYY:55XXXXXXXX@reg.sip-trunk.telekom.de:5060

you have to enable also in SIP Settings --> Chan SIP Settings

Enable SRV Lookup Yes
Enable TCP Yes


(Judokan9) #6

Thank you very very much, this was soooo helpful.


(Michael Fuchs) #7

Hi uall,
I followed the instructions mentioned here, and I succeeded in being able to dial internal phones and reach them from the outside, but when I try to dial out, that is when the problems start…
My first guess is, that it is a registration problem. When I do a “sip show peers” I get
idefix*CLI> sip show peers
Name/username Host Dyn Forcerport Comedia ACL Port Status Description
13/13 192.168.12.79 D No No A 5060 OK (23 ms)
14 (Unspecified) D No No A 0 UNKNOWN
15/15 192.168.12.56 D No No A 5060 OK (27 ms)
16 (Unspecified) D No No A 0 UNKNOWN
21 (Unspecified) D No No A 0 UNKNOWN
551133016564/551133016564 217.0.15.67 Yes Yes 5060 OK (19 ms)
TelekomSIPTrunk4Testing/5 (Unspecified) Yes Yes 0 UNKNOWN
7 sip peers [Monitored: 3 online, 4 offline Unmonitored: 0 online, 0 offline]

I do not understand, why it shows 2 peers for the telekom, the one that did not register is “TelekomSIPTrunk4Testing”, which is the trunk name in my outgoing chan_sip config.

Here is my chan_sip config:

Trunk Name TelekomSIPTrunk4Testing

PEER Details
videosupport=no
usereqphone=yes
type=peer
transport=tcp
srvlookup=yes
session-timers=refuse
secret=XXXXXX
qualify=yes
insecure=invite
host=reg.sip-trunk.telekom.d(e)
fromdomain=sip-trunk.telekom.d(e)
dtmfmode=rfc2833
disallow=all
directmedia=no
defaultuser=55YYYYYYYYY
allow=g722,alaw

User Context 55YYYYYYYY
User Details secret=XXXXXXXX
type=peer
transport=tcp
srvlookup=yes
insecure=invite
host=reg.sip-trunk.telekom.d(e)
fromdomain=sip-trunk.telekom.d(e)
defaultuser=55YYYYYYYYY
disallow=all
allow=g722,alaw
qualify=yes
context=from-pstn-toheader

tcp://"+49ZZZZZZZZZZ"@“sip-trunk.telekom.d(e)”:“XXXXXXX”:“55YYYYYYYYYY”@reg.sip-trunk.telekom.de:5060

On the cli it says:

[2019-03-17 17:44:13] ERROR[1528]: netsock2.c:305 ast_sockaddr_resolve: getaddrinfo(“reg.sip-trunk.telekom.d(e)”, “(null)”, …): Name or service not known
[2019-03-17 17:44:13] WARNING[1528]: acl.c:835 resolve_first: Unable to lookup ‘reg.sip-trunk.telekom.d(e)’

And when I to dial out:

-- Executing [s@macro-dialout-trunk:24] Dial("SIP/15-00000035", "SIP/TelekomSIPTrunk4Testing/064130020551,300,T") in new stack

[2019-03-17 17:46:25] WARNING[8245][C-0000002f]: app_dial.c:2527 dial_exec_full: Unable to create channel of type ‘SIP’ (cause 20 - Subscriber absent)
== Everyone is busy/congested at this time (1:0/0/1)
– Executing [s@macro-dialout-trunk:25] NoOp(“SIP/15-00000035”, “Dial failed for some reason with DIALSTATUS = CHANUNAVAIL and HANGUPCAUSE = 20”) in new stack

BTW, it is an asterisk 13 with a FreePBX 13…
…and the parentheses around the de-endings are intentional (because I can not post links?) and should be read as d(e) = de

Cheers Michael


(Erik Mevis) #8

Hello

Did you get this resolved? I am in the current state and cannot resolve the SRV record as well.

EM


(Michael Fuchs) #9

Hi EM,
yes, I did solve it. The SRV part was quite easy, you have to enable in the chan_sip settings,
its in the settings quite at the bottom.
But I didn’t succeed in making outgoing calls, so I switched to the chan_pjsip, where it can not not be selected (it is probably on by default?), and now I can call my asterisk from the outside and call out as well.
Cheers Michael

P.S Here is the setting from another user (Trunk) that worked for me:

General

Username: xxxxxxxxxxxx
Kennwort: yyyyyyyy
Authentication: Outbound
Registration: Send
Language Code: German
SIP Server: reg. sip-trunk. telekom. de
SIP Server Port: 5060
Context: from-pstn-toheader
Transport: 0.0.0.0-tcp

Advanced

DTMF Mode: RFC 4733
Permanent Auth Rejection: Yes
Forbidden Retry Interval: 30 (Seconds)
Fatal Retry Interval: 0 (Seconds)
General Retry Interval: 60 (Seconds)
Expiration: 300 (Seconds)
Max Retries: 10
Qualify Frequency: 60 (Seconds)
Outbound Proxy: sip:reg. sip-trunk. telekom. de
Contact user: +49zzzzzzzz
From Domain: sip-trunk. telekom. de
From User: (empty)
Client-URI: sip:+49zzzzzzzz @ sip-trunk. telekom. de:5060
Server URI: sip:xxxxxxxxxxxx @ reg.sip-trunk. telekom. de:5060
Media Address: (empty)
AOR: (empty)
AOR Contact: (empty)
Match (Permit): 217.0.0.0/13
Support Path: No
Support T.38 UDPTL: No
T.38 UDPTL Error Correction: None
T.38 UDPTL NAT: No
T.38 UDPTL MAXDATAGRAM: (empty)
Fax Detect: No
Trust RPID/PAI: Yes
Send RPID/PAI: Send P-Asserted-Identity header
Match Inbound Authentication: Standard
Inband Progress: No
Direct Media: No
Rewrite contact: Yes
RTP Symmetric: Yes
Media Encryption: Kein*e
Message Context: (empty)

Codecs

G722
G726
alaw
ulaw
gsm

The phone number +49zzzzzzzz is ONLY the part of your number which is identical for all extensions. No extension number.

You have to delete the spaces in the links. These were necessary because I’m not allowed to post links.


(Sofyane Bousalhih) #10

Hi ,
You have to enable SRV Lookup in advanced general seetings.


Bets regards.


(Tom Ray) #11

And disable SIP Guests because that just leaves your box open to accept requests from any source.


(Lorne Gaetz) #12

For any provider that relies on SRV and/or NAPTR, you want to be using PJSIP trunks with Asterisk 15+.

edit - As Asterisk 15 is nearing EOL, you now want to be using 16+.


(Erik Mevis) #13

Mr. Fuchs,

Thank You so much! Lorne w/ Sangoma helped out quite a bit as well. We did learn that having 300 indbound routes passing as +49… was working, however Deutsch land lines came in with 0 215 X XXXX (X-XXX). We had to modify our sip conf file to strip +49, 0, and just identify via 215 X XXXX (X-XXX).


#14

Many thanks for all the info here. I’m trying to switch our chan_sip trunk to pjsip to circumvent some sporadic Rejection and Forbidden problems, when the Telekom SIP-server’s IP address changes.

Anyway, after setting up the pjsip trunk and disabling the chan_sip trunk I still get the following:

[2019-11-11 13:42:45] WARNING[14701]: pjsip:0 <?>: tsx0x7fde84e78 Failed to send Request msg REGISTER/cseq=6860 (tdta0x7fde84003d70)! err=320053 (DNS “Name Error” (PJLIB_UTIL_EDNS_NXDOMAIN))
[2019-11-11 13:42:45] WARNING[11541]: res_pjsip_outbound_registration.c:751 schedule_retry: No response received from ‘sip:xxxxxxxxxxxx@reg.sip-trunk.telekom.de:5060’ on registration attempt to ‘sip:+49zzzzzzzz@sip-trunk.telekom.de’, retrying in ‘60’
[2019-11-11 13:42:50] WARNING[11541]: pjsip:0 <?>: tsx0x7fde84e78 .Failed to send Request msg OPTIONS/cseq=9121 (tdta0x7fde84003d70)! err=320047 (No answer record in the DNS response (PJLIB_UTIL_EDNSNOANSWERREC))
[2019-11-11 13:42:50] ERROR[11541]: res_pjsip.c:3167 endpt_send_request: Error 320047 ‘No answer record in the DNS response (PJLIB_UTIL_EDNSNOANSWERREC)’ sending OPTIONS request to endpoint

Unfortunately “pjsip set logger on” does not shed more light on this.

Update:
May this be due to a bug in Asterisk < 14 (https://issues.asterisk.org/jira/browse/ASTERISK-25528)? We are still on 13.0.190.19 with Asterisk 13.7.1


(Joshua C. Colp) #15

The linked issue is not applicable to Asterisk 13. You’d need to look at the DNS lookups being done (packet capture would work) and the results, and see where it is falling apart.


#16

Capturing done, Wireshark and analysis follows.
I have to ask, this makes sense, even though we don’t have DNS resolution problems when using the same trunk with chan_sip?


(Joshua C. Colp) #17

Two different DNS clients, could also be different configuration resulting in different DNS lookups. As well the SRV support in Asterisk 13 (where the PJSIP built in support is used) is not as complete or predictable as that of Asterisk 16 and higher, so that could be playing a part.

I’ve seen this provider come up multiple times with people using both chan_sip and chan_pjsip and I don’t know if anyone has got it working perfectly for them these days.


#18

the problem seems to be that the SRV lookup in the pjsip case is using UDP instead of TCP:

DNS 94 Standard query 0x0062 SRV _sip._udp.reg.sip-trunk.telekom.de
DNS 170 Standard query response 0x0062 No such name SRV _sip._udp.reg.sip-trunk.telekom.de SOA dns00.dns.t-ipnet.de

I set the PJSIP trunks transport to 0.0.0.0-tcp and so far I don’t know how to force TCP. Is it maybe possible within the Client and Server URIs?


(Joshua C. Colp) #19

The “;transport=tcp” parameter likely needs to be added to the server URI. In a .conf file it also needs to be escaped with “” at front thus “;transport=tcp”


#20

my Server URI in the trunks PJSIP settings - advanced now looks as follows:
sip:xxxxxxxxxxx@reg.sip-trunk.telekom.de:5060“;transport=tcp”

I still get an
[2019-11-11 16:23:45] WARNING[14701]: pjsip:0 <?>: tsx0x7fde84e78 Failed to send Request msg REGISTER/cseq=6890 (tdta0x7fde84003d70)! err=320053 (DNS “Name Error” (PJLIB_UTIL_EDNS_NXDOMAIN))
[2019-11-11 16:23:45] WARNING[28479]: res_pjsip_outbound_registration.c:751 schedule_retry: No response received from ‘sip:xxxxxxxxxxxx@reg.sip-trunk.telekom.de:5060’ on registration attempt to ‘sip:+49zzzzzzzz@sip-trunk.telekom.de’, retrying in ‘60’
[2019-11-11 16:24:01] WARNING[28479]: pjsip:0 <?>: tsx0x7fde84e78 .Failed to send Request msg OPTIONS/cseq=50514 (tdta0x7fde84003d70)! err=320047 (No answer record in the DNS response (PJLIB_UTIL_EDNSNOANSWERREC))
[2019-11-11 16:24:01] ERROR[28479]: res_pjsip.c:3167 endpt_send_request: Error 320047 ‘No answer record in the DNS response (PJLIB_UTIL_EDNSNOANSWERREC)’ sending OPTIONS request to endpoint