> For the complete documentation index, see [llms.txt](https://help.sipgate.de/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.sipgate.de/trunking/wie-konfiguriere-ich-asterisk-fuer-sipgate-trunking.md).

# Wie konfiguriere ich Asterisk für sipgate trunking?

Nachfolgend finden Sie Hinweise zur Konfiguration eines Asterisks. Ein entsprechender Peer könnte so aussehen:

```ini
[global]
endpoint_identifier_order = username,ip

[generic_transport]
type = transport
protocol = udp
bind = 0.0.0.0

[generic_endpoint](!)
type=endpoint
context=error
100rel=no
direct_media=no allow=!all,g722,alaw,ulaw,g726aal2,gsm,ilbc
g726_non_standard=yes
rtp_timeout=120
rtp_timeout_hold=900
transport=generic_transport
t38_udptl=yes
t38_udptl_ec=redundancy
fax_detect=no
t38_udptl_nat=yes
aors=generic_aor
moh_passthrough=yes
dtmf_mode=auto
allow_transfer=no
tos_audio=ef
cos_audio=5
sdp_session=VoIP
GW timers=no
send_diversion=no

[sipgateregister]
type = registration
server_uri = sip:#SIPID#@sipconnect.sipgate.de
client_uri = sip:#SIPID#@sipconnect.sipgate.de
contact_user = inbound-calls
outbound_auth = sipgateauthreg

[sipgateendpoint](generic_endpoint)
type = endpoint
aors = sipgateaor
context = inbound
;auth = sipgateauth
outbound_auth = sipgateauth
from_domain=sipconnect.sipgate.de
from_user=#SIPID#

[sipgateaor]
type = aor
contact = sip:sipconnect.sipgate.de

[sipgateidentify]
type = identify
match = sipconnect.sipgate.de
match = 217.10.68.150:5060
endpoint = sipgateendpoint

[sipgateauthreg]
type = auth
auth_type = userpass
username = #SIPID#
password = #SIPPASSWORD#

[sipgateauth]
type = auth
auth_type = userpass
username = #SIPID#
password = #SIPPASSWORD#
```

Für die Platzhalter **#SIPID#** und **#password#** geben Sie bitte Ihre **persönliche sip-ID** sowie Ihr **persönliches sip-Passwort** ein.

Besonders wichtig ist die Information in der Zeile **outbound\_auth**, damit gewährleistet wird, dass Sie auf dem richtigen Server landen. Für eingehende Gespräche muss sich der Asterisk an unserem Server registrieren. Wichtig ist dabei, dass der Peer **sipconnect.sipgate.de** heißt.

```ini
[general]
static=yes
writeprotect=yes

[outbound]
exten = _NX.,1,NoOp(dialout)
same = n,Dial(PJSIP/${EXTEN}@sipgateendpoint,120,trb(dialhook^s^1))

[dialhook]
exten = s,1,Set(PJSIP_HEADER(add,P-Preferred Identity) = <sip:49<someNiceNumber>@sipconnect.sipgate.de>)
same = n,Return()

[inbound]
exten = _X.,1,Dial(PJSIP/aPhone)
same = n,Playback(beep)
same = n,Hangup
```

Bei ausgehenden Gesprächen setzen Sie bitte die gewünschte Absenderrufnummer im E164-Format (also international ohne führende Nullen oder "+"-Zeichen) als neuen Header **P-Preferred-Identity**:

```
SipAddHeader(P-Preferred-Identity: <sip:492111234567@sipconnect.sipgate.de>)
```

Möchten Sie die **Rufnummer unterdrücken**, tragen Sie folgendes ein:

```
SipAddHeader(P-Preferred-Identity: <sip:492111234567@sipconnect.sipgate.de>)
SipAddHeader(Privacy: id)
```

Eingehende Anrufe werden Ihnen mit der vollen gewählten **E164-Nummer in der Request URI** signalisiert. So können Sie problemlos in der Variable `${EXTEN}` damit arbeiten. Ein Herausschneiden der Nummer aus der To-URI ist nicht nötig.

Wenn Sie in Ihrer Telefonanlage **Rufumleitungen schalten**, können Sie dies auch signaliseren. Dazu verwenden Sie bitte den Diversion-Header und tragen dort die original angerufene Nummer (im folgenden Beispiel wurde diese im Dialplan in die Variable ORIGEXTEN geschrieben) ein:

```
SipAddHeader(Diversion: <sip:${ORIGEXTEN}@sipconnect.sipgate.de>)
```

Weitere Informationen finden Sie in den [Konfigurationsanleitungen](https://app.sipgate.com/w0/team/faq/setup/index/id/219).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://help.sipgate.de/trunking/wie-konfiguriere-ich-asterisk-fuer-sipgate-trunking.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
