# Setting Up IP Telephony in Twilio for GudHub CRM

**IP telephony in GudHub** allows you to handle calls directly in your CRM: make and receive calls, assign phone numbers to system users, and work with customer and lead contacts.

To set up telephony, you need to configure a **SIP Trunk** in **Twilio** and connect it to your GudHub profile. Below is a step-by-step guide to setting up telephony in GudHub CRM.

## Setting Up a SIP Trunk

To connect IP telephony to your CRM through Twilio, first purchase a phone number and create a SIP Trunk. Then, configure it in GudHub.

IP telephony in a CRM works through a SIP Trunk – a virtual channel that routes calls between the phone system and the CRM. Internet telephony allows you to make and receive calls directly within the system.

## Purchasing a Phone Number

Go to the **Active Numbers** tab under **Manage**. If you have not used Twilio before, this tab will be empty.
![tw_1](https://app.gudhub.com:443/userdata/41557/1196213.png)
Click **“Buy a number”**.
![tw_2(1)](https://app.gudhub.com:443/userdata/41557/1196221.jpeg)
Select the phone number you want and purchase it by clicking **“Buy”**.
![tw_2(2)](https://app.gudhub.com:443/userdata/41557/1196223.jpeg)
The purchased number will then appear in the **Active Numbers** tab.

## Creating a SIP Trunk

To connect the purchased phone number to IP telephony in your CRM, you need to create a **SIP Trunk**.

Go to the **Overview** tab under **Elastic SIP Trunking**.

On the page that opens, click **“+”**.

Enter a name for the **SIP Trunk**.
![tw_3(1)](https://app.gudhub.com:443/userdata/41557/1196229.jpeg)
After creating the **SIP Trunk**, the **General Settings** page will open automatically.
![tw_4](https://app.gudhub.com:443/userdata/41557/1196239.png)

## Setting Up Incoming Calls

Go to the **Origination** tab.

**Origination** is used for incoming calls.

Enter the address of the server that will receive these calls in the **"Origination URL"** field.
![tw_5(1)](https://app.gudhub.com:443/userdata/41557/1196246.jpeg)
You can find this address in the settings on the GudHub platform.

At this point, switch to your CRM and open **Settings**.
![tw_19(1)](https://app.gudhub.com:443/userdata/41557/1196252.jpeg)
Open the **VOIP Telephony** section.
![tw_20(1)](https://app.gudhub.com:443/userdata/41557/1196261.jpeg)
Click **“Add Trunk”**.
![tw_21](https://app.gudhub.com:443/userdata/41557/1196269.png)
Select **Twilio** as the provider and enter a name for the **Trunk**.
![tw_22](https://app.gudhub.com:443/userdata/41557/1196276.png)
The server address is shown in the first field, **“GudHub SIP URI (Origination)”**. Copy it and return to Twilio.
![tw_23(1)](https://app.gudhub.com:443/userdata/41557/1196287.jpeg)
Paste the copied address into the **"Origination URL"** field.
![tw_5(2)](https://app.gudhub.com:443/userdata/41557/1196293.jpeg)

## Setting Up Outgoing Calls

Now configure the settings for outgoing calls.

In Twilio, go to the **Termination** tab.
![tw_27](https://app.gudhub.com:443/userdata/41557/1196309.png)
**Termination** is used for outgoing calls.

Click **“+”** to create a **Credential List**.
![tw_6](https://app.gudhub.com:443/userdata/41557/1196325.png)
**Credential List** contains the credentials that the CRM uses to authenticate and make outgoing calls.

In the window that opens, enter a name for the **Credential List**, **Username**, and **Password**.
![tw_7](https://app.gudhub.com:443/userdata/41557/1196329.png)
Save the settings, copy the credentials you created, and return to GudHub.

In the **Trunk Info** tab, enter them in the corresponding fields.
![tw_12(1)](https://app.gudhub.com:443/userdata/41557/1196340.jpeg)
The basic **SIP Trunk** setup is now complete. Next, you need to add a phone number so that the telephony service can be fully operational.

## Adding a Phone Number

In Twilio, go to the **Numbers** tab.
![tw_8](https://app.gudhub.com:443/userdata/41557/1196346.png)
Click **“Add number”**. In the window that opens, select the phone number you purchased earlier.
![tw_9(1)](https://app.gudhub.com:443/userdata/41557/1196348.jpeg)
Now return to GudHub and open the **Numbers** tab under **VOIP Telephony**, then click **“Add number”**.
![tw_24](https://app.gudhub.com:443/userdata/41557/1196354.png)
Enter the purchased number in the corresponding field and select the system users to whom the phone number will be assigned.
![tw_25](https://app.gudhub.com:443/userdata/41557/1196370.png)
Assigning a number to specific users determines which users will receive incoming calls to that number.
![tw_13](https://app.gudhub.com:443/userdata/41557/1196381.png)

## Managing a SIP Trunk

On the GudHub platform, you can configure access permissions for SIP Trunk administration.

After completing the previous setup steps, open the **Trunk Info** tab and enable telephony by clicking **“Enabled”**.
![tw_10(1)](https://app.gudhub.com:443/userdata/41557/1196391.jpeg)
![tw_11](https://app.gudhub.com:443/userdata/41557/1196397.png)
Then click **“Add Admin”** and select the system user you want to grant access to SIP Trunk administration.
![tw_12](https://app.gudhub.com:443/userdata/41557/1196399.jpeg)

## Connecting Apps to a SIP Trunk

You can connect CRM apps that contain customer or lead data to the telephony service.

To do this, go to the **Connected Apps** tab.
![tw_14](https://app.gudhub.com:443/userdata/41557/1196405.png)
Click **“Add Connected App”**.

In the window that opens, select the app you want to connect to the telephony service.

In the **Phone number field(s)** field, select **“Phone”**.
![tw_26](https://app.gudhub.com:443/userdata/41557/1196416.png)
In the **Caller name** field, select **“First name”** and click **“Add”**.
![tw_15](https://app.gudhub.com:443/userdata/41557/1196424.png)
This setup provides two main benefits:

* For outgoing calls, you can select the customer or lead you want to call, and their phone number will automatically be added to the ІР telephony interface.
* For incoming calls, if the caller’s phone number is saved in the CRM, the system will display both their phone number and name.

Connected business telephony allows you to manage calls and customer contacts centrally within your CRM.
Your **SIP Trunk** setup is now complete. The telephony service is ready to use: you can make and receive calls through GudHub, work with customers directly from your CRM, and keep track of your call history.