Overview
As of writing this article, the only official documentation related to registering SIP clients with private Telekom.de landlines can be found here (archived version here).
The purpose of this article is to document for everyone interested in this topic (as well as for my future self) the configuration settings necessary to add these phone lines as trunks to FreePBX for inbound and outbound calls. There are a lot of incomplete, outdated, and non-functional configuration examples all across the internet. The settings documented below are what works for me as of writing this post and have been tested with multiple trunks and accounts.
FreePBX configuration
Add Trunk
- Log into the FreePBX admin interface
- Navigate to
Connectivity>Trunks - Click on
Add Trunk>Add SIP (chan_pjsip) Trunk
Configure TLS transport
- Navigate to
Settings>Asterisk SIP Settings - In the
General SIP Settingstab, ensure the following configuration values:Security SettingsAllow Anonymous Inbound SIP Calls> NoAllow SIP Guests> YesDefault TLS Port Assignment> PJSip
NAT SettingsExternal Address> set this to your fixed public IP address (if you have one), otherwise ignore this settingLocal networks> make sure to add your local network CIDRs here (e.g.,192.168.178.0/24)
- Everything else can be left on default values and/or empty
- Go to the
SIP Settings [chan_pjsip]tab - In the
tlssection, settls - {freepbx_ip} - {interface_name}(e.g.,tls - 10.100.20.10 - eth0) to Yes - Submit the configuration and restart FreePBX
Trunk configuration
General
On this config page, the number for the line you want to add needs to be in local/regional format, i.e., 0301234567, not in international format (+49301234567).
| Setting | Value |
|---|---|
| Trunk Name | Telekom-0301234567 |
| Hide CallerID | No |
| Outbound CallerID | 0301234567 |
| CID Options | Allow Any CID |
| Maximum Channels | 2 |
| Asterisk Trunk Dial Options | T and System |
| Continue if Busy | No |
| Disable Trunk | No |
| Monitor Trunk Failures | (empty) and No |
Dial Number Manipulation Rules
This needs only to be configured if the dialed number needs to be changed before sending it out the trunk, for example, in cases where you have multiple trunks configured and use a dial prefix on your phone to select the desired outbound line.
Don’t change anything here if you don’t know what you’re doing.
pjsip Settings
This is where the interesting stuff happens. All phone numbers entered in the following three sections need to be in * international format*, i.e., +49301234567.
General
| Setting | Value |
|---|---|
| Username | +49301234567 |
| Auth username | (empty; automatically uses value from Username field) |
| Secret | mySecretTelekomPassword (use your Kundencenter password here, i.e., the one you use to log into the Telekom.de website to view your invoices, not your router or PPPoE password) |
| Authentication | Outbound |
| Registration | Send |
| Language Code | Default |
| SIP Server | tel.t-online.de |
| SIP Server Port | (empty to use default port 5060) |
| Context | from-pstn |
| Transport | {freepbx_ip}-tls (if you cannot select this, check the Configure TLS transport section again) |
Advanced
| Setting | Value |
|---|---|
| DTMF Mode | RFC 4733 |
| Permanent Auth Rejection | Yes |
| Forbidden Retry Interval | 30 |
| Fatal Retry Interval | 30 |
| General Retry Interval | 60 |
| Expiration | 480 |
| Max Retries | 10 |
| Qualify Frequency | 60 |
| Outbound Proxy | sip:tel.t-online.de\;lr (The \;lr is especially important here as it forces the route URI to use loose routing. If this is not included, the connections will fail!) |
| User = Phone | Yes |
| Contact user | +49301234567 |
| From Domain | tel.t-online.de |
| From User | +49301234567 |
| Client URI | (empty) |
| Server URI | (empty) |
| Media Address | (empty) |
| AOR | (empty) |
| AOR Contact | (empty) |
| Match (Permit) | (empty) |
| 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 (unless this is your fax line, in which case you can set this to Yes) |
| Trust RPID/PAI | No |
| Send RPID/PAI | No |
| Send Private CallerID Information | No |
| Match Inbound Authentication | Default |
| Inband Progress | Yes |
| Direct Media | No |
| Rewrite Contact | Yes |
| RTP Symmetric | Yes |
| Media Encryption | SRTP via in-SDP (recommended) |
| Force rport | Yes |
| Message Context | (empty) |
Codecs
Enable the following codecs and bring them in exactly this order:
- g722
- alaw
- ulaw
- gsm
- g726
Disable everything else.
Inbound Routes configuration
- Navigate to
Connectivity>Inbound Routes - Click on
Add Inbound Route - Configure the inbound route as follows:
General
| Setting | Value |
|---|---|
| Description | Telekom 0301234567 (or anything you like) |
| DID Number | +49301234567 (international format) |
| CallerID Number | (empty, defaults to ANY) |
| CID Priority Route | No (only change if necessary and you know what you’re doing) |
| Alert Info | None |
| Ringer Volume Override | None |
| CID name prefix | (empty, unless you have multiple lines / trunks and need to be able to distinguish between them on your phone) |
| Music On Hold | Default (or any other playlist you have configured) |
| Set Destination | configure your inbound route destination here |
Advanced
| Setting | Value |
|---|---|
| Indication Zone Country | Default |
| Signal RINGING | No |
| Reject Reverse Charges | No |
| Force Answer | No |
| Pause Before Answer | (empty) |
Privacy
Configure as necessary.
Fax
Configure as necessary in case you want to use one of your phone numbers as a fax line. In this case, the Fax Detect
option for the respective trunk needs to be set to Yes (Trunk configuration > pjsip Settings > Advanced).
Other
Configure as necessary.
Outbound Routes configuration
- Navigate to
Connectivity>Outbound Routes - Click on
Add Outbound Route - Configure the outbound route as follows:
Route Settings
| Setting | Value |
|---|---|
| Route Name | give your route a name |
| Route CID | (empty) |
| Override Extension | as necessary, default No |
| Route Password | as necessary, default (empty) |
| Route Type | as necessary, default none selected |
| Music On Hold | select playlist as necessary or leave on default |
| Time Match Time Zone | Use System Timezone |
| Time Match Time Group | leave ---Permanent Route--- option, or change as necessary |
| Trunk Sequence for Matched Routes | add your previously configured trunk(s) here to be used for outbound call routing |
| Optional Destination on Congestion | leave Normal Congestion, or change as necessary |
Dial Patterns
If this is your default outbound route, the most basic outbound dial patterns would be as follows:
| ( prepend ) | prefix | | [ match pattern / | CallerID ] |
|---|---|---|---|
+49 | 0 | ZX. | |
+ | 00 | ZX. | |
Refer to the included documentation in FreePBX on how to configure the dial patterns for your specific use case.
Everything else
Configure Notifications and Additional Settings as necessary, or leave them on default values.