# How do I configure Asterisk for sipgate trunking?

These are the settings for the basic configuration of Asterisk for sipgate trunking.\
For general Asterisk configuration instructions with sipgate **team** accounts please click [here](https://teamhelp.sipgate.co.uk/hc/en-gb/articles/204547911) instead.

{% hint style="info" %}
**Note:** Please replace your SIPID to SIP-ID and PASSWD to SIP Password respectively.
{% endhint %}

**Please enter the following in sip.conf:**

{% code title="sip.conf" %}

```ini
[sipconnect.sipgate.co.uk]
type=peer
host=sipconnect.sipgate.co.uk
outboundproxy=sipconnect.sipgate.co.uk
port=5060
username=SIP-ID
fromuser=SIP-ID
fromdomain=sipconnect.sipgate.co.uk
secret=SIP Password
dtmfmode=rfc2833
insecure=port,invite
canreinvite=no
registertimeout=600
disallow=all
allow=alaw
allow=ulaw
```

{% endcode %}

The information under **outboundproxy** is particularly important as it ensures your PBX is connected with the correct server. Your Asterisk must be registered with our server in order to receive incoming calls.

Equally important is that the peer sipconnect.sipgate.co.uk is

{% code title="Registration" %}

```
register => SIP-ID:SIP password@sipconnect.sipgate.co.uk/SIP-ID
```

{% endcode %}

If you now run the debug command on your Asterisk console, the REGISTER packets should be sent to the IP address **217.10.68.149**.

For outgoing calls, please enter the sender number in E.164 format (i.e. international format without the leading zeros or plus (+) sign) as a new header P-Preferred-Identity:

{% code title="Outgoing Caller ID" %}

```
SIPAddHeader(P-Preferred-Identity: <sip:4420300000000@sipconnect.sipgate.co.uk>)
```

{% endcode %}

**Important CLIP/Outgoing Caller ID information:** At this time, only sipgate-provided phone numbers can be set as the outgoing identity (Caller ID).

Should you wish to block your telephone number, you can do so by using:

{% code title="Number Suppression" %}

```
SipAddHeader(P-Preferred-Identity: <sip:4420300000000@sipconnect.sipgate.co.uk>)
SipAddHeader(Privacy: id)
```

{% endcode %}

Incoming calls are signalled to you with the fully selected E.164 number in the Request URI. This way you can work with the the variable ${EXTEN} without issues. It is not necessary to remove the number for the To-URI.

It is also possible to enable call forwarding on your PBX. To do this, please use the Diversion-Header and enter the originally dialled number.

**Note**: The following example was written in ORIGEXTEN:

{% code title="Call Forwarding" %}

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

{% endcode %}
