Custom Phone - Inbound
# support
s
We're having big time figuring out how to integrate our customer's phone number with vapi. Our customer has a pbx offered by the local operator. - Inbound Call: * Steps Completed to achieve inbound calls: 1. Created through API a sip phone number : sip:navicom-alex@sip.vapi.ai. 2. Attached the phone number to an assistant. 3. In the customer's pbx, we forwarded the call from a specific number to the above sip uri, call gets dropped immediately with busy. * Steps taken to debug: 1. Removed the assistant, and set a serveruri on the account level, to get a webhook that might give us some clues on what's going on, performed the test calls, no webhooks triggered, no call logs recorded in the dashboard. 2.For testing purposes, we forwarded the same phone number to open test sip uris like 3333@sip2sip.info & 4444@sip2sip.info and everything works, which might suggest it's something on vapi's sip uri, that drops the call..
Also , i've noticed there is teh BYO Feature, which i assume we can use for our customer since he has a pbx and uses sip clients to connect... Tried creating one phone number, inbound doesnt even register in vapi logs, outbound says it failed. Here is some ID's to trace it : - BYO Phone Number ID (ca924cce-35e1-4c4a-b8be-40639586e2e1 , c210da24-5a50-46e0-a555-8c0c6a004eb1) - Below are the vapi outbound call id's , made through the above numbers: 9904e173-f24e-44cd-b9b7-bfea5e3c1d68 a18cf8a7-df18-4ea1-a232-e16ad71c902f 6993c262-3dd7-4651-aeee-f1f399edd0a5 488d10a0-3513-4c7d-8ee9-83285950650e
s
hey @supershift checking if you are able to make progress post our call?
s
Hey @Shubham Bajaj , Thanks for the call , i have sent the infos to the client's sip provider , now waiting for a reply there.
s
The server expects plain username and password in the
Authorization
header instead of Base64-encoded
Basic
format, the issue is likely caused by a mismatch between what the client sends and what the server expects. Here’s how to analyze and resolve the problem: ### Analysis 1. What is Sent by You - The client is sending this header:
Copy code
Authorization: Basic a2FtYWxpbzpuYXZpY29t
-
a2FtYWxpbzpuYXZpY29t
is Base64-encoded, representing
kamalio:navicom
(username:password). 2. What the Server Expects - If the server expects the username and password to be sent in plain text (which is unconventional for
Authorization
headers), the header should look like:
Copy code
Authorization: kamalio:navicom
3. Mismatch - The server likely tries to decode the Base64 string as plain text, causing a misinterpretation or an internal server error.
### Steps to Resolve #### 1. Modify the Client's Authorization Header - Change the client behavior to send the username and password in plain text within the
Authorization
header. - Example header:
Copy code
Authorization: kamalio:navicom
- Ensure the client configuration explicitly avoids Base64 encoding for the
Authorization
value. #### 2. Debug with a Custom SIP Tool - Use a SIP debugging tool (e.g.,
sngrep
,
sip-cli
, or
curl
) to manually craft the request with the plain-text
Authorization
header. - Example:
Copy code
bash
     sip-cli -m INVITE -H "Authorization: kamalio:navicom" -r sip:vapi.ai -u kamalio
s
Hi @Shubham Bajaj
Thanks for elaborating it... Can you please run a test to navicom-alex@sip.vapi.ai? does the above example work for you ?
Im not sure what do you mean by cratting the request, if you don't know the proper request model how can i guess it ?
s
I use twilio and telenyx, do you want me to do it using them?
Can you share the PCAP file @supershift ? because I might be wrong here let's use PCAP as source of truth.
s
So i wrote a script to randomly test the sip ... The vapi's sip uri, expects the Authorization header to include Digest Authorization fields like realm, nonce, and a calculated response, which contradicts the basic or plain password authentication requirement you guys mentioned.. Here is what worked for forwarding the calls to sip uri, Example request with sipexer cli:
Copy code
./sipexer -invite \
  -ruri "sip:navicom-alex@sip.vapi.ai" \
  -fu "kamalio" \
  -fdomain "sip.vapi.ai" \
  -tu "navicom-alex" \
  -tdomain "sip.vapi.ai" \
  -xh "Authorization: Digest username=\"kamalio\", realm=\"<REALM>\", nonce=\"<NONCE>\", uri=\"sip:navicom-alex@sip.vapi.ai\", response=\"<CALCULATED_RESPONSE>\", algorithm=MD5" \
  udp:sip.vapi.ai:5060
also to workaround client's issue, I created a Kamailio middleware solution that acts as a middleman, it receives calls from the client pbx , manages the necessary transformations (including handling Digest Authorization), and forwards the requests seamlessly to VAPI. So case closed and customer happy. Thanks
9 Views