creating an outbound trunk with a local SIP provid...
# ask-ai
c
creating an outbound trunk with a local SIP provider (MTN) here in Ghana for outbound calls and call transfer purposes. Unlike Twilio which give you the platform create an elastic sip trunk with authentication and ip address settings. The local SIP provider only shares a user ID and password for trunk registration. You don't have the luxury of enabling SIP REFER as required for agent assisted transfer. How do we go ahead to configure the outbound trunk with the local SIP provider considering this disparity in between Local SIP provider and popular providers like Twilio trunk setup.
t
Thanks for reaching out, John. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
I'd be happy to help you set up an outbound trunk with your local SIP provider using a user ID and password for trunk registration. Let's walk through the steps together: 1. Required Parameters: • Name: This is a friendly, human-readable name for your trunk. • Address: The hostname or IP address of your SIP provider’s endpoint (for example, sip.provider.com). • Numbers: One or more phone numbers assigned by your SIP provider. • authUsername: The username your SIP provider gave you. • authPassword: The password from your SIP provider. 2. Configuration Methods: You have a few options to configure your trunk. Choose whichever feels most comfortable for you: Method 1: Using the LiveKit CLI 1. Create a JSON file (for example, outbound-trunk.json) with this content:
Copy code
{
  "trunk": {
    "name": "My outbound trunk",
    "address": "sip.provider.com",
    "numbers": [
      "+15105550100"
    ],
    "authUsername": "your_username",
    "authPassword": "your_password"
  }
}
Just replace the placeholders with your SIP provider’s details. 1. Then, run this command:
lk sip outbound create outbound-trunk.json
. Method 2: Using the LiveKit Server SDK
Copy code
import { SipClient } from 'livekit-server-sdk';

const sipClient = new SipClient(
  process.env.LIVEKIT_URL,
  process.env.LIVEKIT_API_KEY,
  process.env.LIVEKIT_API_SECRET
);

const trunk = await sipClient.createSipOutboundTrunk(
  'My trunk',
  'sip.provider.com',
  ['+15105550100'],
  {
    auth_username: 'your_username',
    auth_password: 'your_password'
  }
);
Method 3: Using the LiveKit Cloud Dashboard 1. Sign in to LiveKit Cloud. 2. Navigate to Telephony → Configuration. 3. Click Create new → Trunk. 4. Choose Outbound as the trunk direction. 5. Switch to the JSON editor tab and paste your JSON configuration. 6. Click Create. If you have any questions along the way or need help tailoring this to your specific setup, please don’t hesitate to reach out. I’m here to support you! Sources: SIP outbound trunk | LiveKit docs | Making outbound calls | LiveKit docs
I'm sorry to hear you're encountering the SIP 603 Declined error, which means the destination has explicitly declined the call. Let’s work through some steps together to get this sorted out: 1. Verify Number Format: Please double-check that the destination number is in the full international E.164 format (for example, +233554804690). It’s important to remove any prefixes like 0, 00, or 011 to avoid issues. 2. Check Authentication: Let’s make sure the username and password in your trunk configuration are correct. Sometimes, authentication hiccups can cause calls to fail. 3. Review Provider Logs: Taking a look at your SIP provider’s logs can be really helpful—they often reveal the exact reason why the call was declined. 4. Check LiveKit Call Logs: Don’t forget to review the telephony call logs in your LiveKit Cloud dashboard. This can confirm the request details and the response you received. 5. Provider-Specific Issues: Some providers might decline calls due to things like account settings, rate limits, or geographic restrictions. It’s a good idea to reach out to your SIP provider to see if any of these apply to your account. Please feel free to share any additional details or let me know if you’d like me to guide you through any of these steps. I’m here to help! Sources: livekit/livekit_sip.pb.go | Making outbound calls | LiveKit docs | Create and configure a Plivo SIP trunk | LiveKit docs | Using Wavix to accept and make calls | LiveKit docs
c
{ "sipTrunkId": "ST_S9qm****Rhj", "name": "MTN-SIP-Trunk", "address": "196.210.50.139", "numbers": [ "+233552******" ], "authUsername": "1903453", "authPassword": "dgfl***" } here's the outbound configuration on livekit. here's a call log;
{callId: "SCL_kpYdLYt3c8wL"
trunkId: "ST_gCHP*****"
region: "ofrankfurt1b"
roomName: "my-sip-room"
participantIdentity: "sip-test"
participantAttributes: {
sip.callID: "SCL_kpYdLYt3c8wL"
sip.callStatus: "dialing"
sip.phoneNumber: "233554804690"
sip.trunkID: "ST_gCHPmcMdpH3h"
sip.trunkPhoneNumber: "+233552571977"
}
fromUri: {
user: "+2335*****"
host: "10jm****.sip.livekit.cloud"
ip: "161.115.161.21"
port: 9000
}
toUri: {
user: "233554****"
host: "196.210.50.139"
port: 5060
transport: "SIP_TRANSPORT_UDP"
}
callDirection: "SCD_OUTBOUND"
callStatus: "SCS_ERROR"
createdAtNs: "1762897182501595889"
endedAtNs: "1762897182714979543"
error: "unexpected status from INVITE response: sip status: 603: Declined"
callStatusCode: {
code: "SIP_STATUS_GLOBAL_DECLINE"
status: "Declined"
}
}
t
I'm sorry to hear you're encountering the SIP 603 Declined error, which means the destination party is rejecting the call. Let's work through this together with some steps that might help resolve the issue based on your configuration and logs: 1. Verify Destination Party Configuration: Please check that the destination number or SIP endpoint is properly set up to receive calls from your LiveKit instance. 2. Check Number Format: Make sure the number is in the correct E.164 format (for example, +233554804690). It's important to remove any leading zeros or country access codes. 3. Review Trunk Configuration: Take a moment to double-check your SIP trunk settings — including address, username, password, and phone number — and confirm they match what your SIP provider has given you. 4. Analyze Call Logs: It can be really helpful to look through the LiveKit call logs and your SIP provider’s logs for any clues like authentication problems, network issues, or policy restrictions. 5. Test with Different Numbers: Trying to call other numbers can help us figure out if this is happening with just certain destinations or all calls. 6. Contact SIP Provider Support: If the problem continues, reaching out to your SIP provider is a great next step. They usually have more insights into why calls might be getting declined. Please don’t hesitate to ask if you want me to guide you through any of these steps or if you need any further assistance. I’m here to help! Sources: Using Wavix to accept and make calls | LiveKit docs | Create and configure a Plivo SIP trunk | LiveKit docs