- language:nodejs - sdk:compatibility - product:voice # SIP Voicemail - Node.js Having voicemail available is an important part of any phone system, and calls to SIP endpoints are no exception. There are a couple different ways to handle voicemails for SIP. You could use a [Domain Application](/voice/getting-started/sip/sip-domain-applications) set up with two cXML application webhooks. The first would dial your SIP endpoint with a timeout parameter. The second would record a voicemail if the call was not answered within the timeout time. To demonstrate how to set this up without a Domain application, this example will accomplish the same task with the [Compatibility SDK with Node.js](https://docs.signalwire.com/reference/compatibility-sdks/v3/#compatibility-rest-api-client-libraries-and-sdks-nodejs). We will configure a DID (SignalWire phone number) to accept incoming calls and dial our SIP endpoint, then record a voicemail if the call is unanswered. You can clone the [GitHub repo](https://github.com/signalwire/examples/tree/main/Voice/SIP%20Voicemail%20with%20NodeJS) to follow along, test, and change to meet your needs. ## Setup Your Environment First, you need to provide the application with environmental variables. Copy the contents of env.example and save them in a new file called .env. Fill in your SignalWire credentials. # Project ID copied from the API Credentials in your SignalWire Space PROJECT_ID= # API token copied from the API Credentials in your SignalWire Space API_TOKEN= # Your SignalWire Space URL copied from the API Credentials in your SignalWire Space SIGNALWIRE_URL= If you need help finding this information, check out our guide to [Navigating Your SignalWire Space](/platform/dashboard/getting-started/navigating-your-space#api). The Compatibility SDK will pull these environmental variables from the .env file without any import statement as long as the .env file is in the same parent directory. ## Run Your Express Server This example serves our webhooks using an [Express](https://expressjs.com/en/starter/installing.html) server. After your environmental variables are set, you can install dependencies with npm install then start the Express server with npm run start. If you prefer to use Docker, build the image with docker build -t sipvoicemail . and run it with docker run --p 3000:3000 --env-file .env sipvoicemail. ## Test Endpoints with Ngrok Now, we need a way for our SignalWire service to reach those webhooks. SignalWire requires that your webhooks be publicly accessible for them to be used with our services. So, we recommend using [Ngrok](https://ngrok.com/download) to provide an HTTPS URL for testing. In your Ngrok CLI, run ngrok http 3000, where 3000 is the port we set in our Express server. It will return a secure URL you can copy for the next step. ## Configure a Number to Accept Incoming Calls For this voicemail setup, a phone number is the intermediary that accepts incoming calls and dials your SIP endpoint. In your SignalWire Dashboard, you can purchase a phone number and edit its settings to direct calls to the Ngrok URL. The settings for your phone number of choice will look something like this: