Can't Get DID from Trunk

Good morning folks.

After a painful couple of months, I’ve made the decision to switch phone service providers. I won’t go into details, but I’m working with a new provider now and attempting to use a test DID to ensure communication works before we port our numbers over.

I’m struggling getting the DID from their SIP trunk. I’ve reached out to them as well, but I thought you folks have seen a lot more than I have, and potentially them. I have another trunk with Voip.ms I used while configuring the system and testing things. The Voip.ms number seems to work just fine.

I’ve poked through Reports > Asterisk Logfiles, and watched the calls come in on both. With the new provider’s number, I just don’t see a DID coming through anywhere, just “s.” I’ve read to check the “To” header, which I’m not sure where to see that, but if I search the Asterisk Logfiles for the DID, it never appears. As a hail mary, I threw “from-pstn-toheader” into the trunk’s pjsip context, to no avail.

Any thoughts anyone? Is it possible this is just a provider misconfiguration issue? Or is there something on my end I should look for or check or reconfigure?

s is the value of Contact User. For many simple cases, this is what you set.

Otherwise you need to find out how they provide the DID to you. The To header is a common way of doing that, in which case there is an alternate initial context, named something like from-pstn-toheader, to handle that.

It doesn’t look like they are providing the DID to me. Is that even possible??

Here’s what I saw after a lot of digging

101352	ACK sip:[email protected]:PPPP;line=geayouh SIP/2.0	
101353	Via: SIP/2.0/UDP NN.NNN.NNN.NN;branch=z9hG4bK6b1a.e85d30cf2f81006d4d9960bbe09038b0.0	
101354	From: "KYLE BISIGNANI" <sip:[email protected]>;tag=8a95920f-0b74-4009-8196-8afb74479320	
101355	To: <sip:[email protected]>;tag=d830e93a-f456-4fca-8909-ddc4c84a0399	
101356	Call-ID: e7ec4c53-189f-4c40-85c3-2669929b1f8f	
101357	CSeq: 6264 ACK	
101358	Max-Forwards: 69	
101359	Content-Length: 0

Pretty sure I redacted everything to protect the innocent here…

This should not be a difficult problem. At the Asterisk command prompt (not a shell prompt) type
pjsip set logger on
and make a test call in. The Asterisk log will now include a SIP trace. Look at the incoming INVITE and report whether the DID appears anywhere. If so, you can set up a (possibly custom) context to fish it out from whereever.

If not, are you using registration or IP authentication? If IP auth, there is probably a per-DID setting on the provider’s portal that you can set to include the DID number. If registration, does the provider offer sub-accounts or similar? If so, you can put each DID into its own sub-account to distinguish them.

If none of the above are applicable, unless you have an NDA or simlar agreement with the provider, post details – someone reading this will likely know how to configure the trunk (or how to ask the provider to fix).

Look above that in the log for a packet that starts
INVITE sip:s
and report whether the DID appears anywhere.

If not:
What does 5555-ABCD represent? If it’s an account number, are there sub-accounts you can use (put each DID in a separate one)?

I think my provider is working on something at this point as I’m getting a busy signal at the test number now. And yes, 5555-ABCD represents an account number for the provider. Problem is the account number has no correlation to the DID, so trying to translate 150 sub accounts to 150 extensions wouldn’t be ideal.

And no, no NDA, but the problem is they are a small local provider in my area - Planet Networks. They’ve been super helpful with everything we’ve been going through. I just don’t want to use up all of the good-will.

On the trunk setup we’re using registration for outbound calls. But nothing for Inbound. We’re firewalling that to their list of server addresses. So I assume in this situation, it’s IP auth…

If you can specify your domain name or IP address on their portal, there should be an option to put a number before the @ in your SIP URI, which could be the DID number.

Well digging through again, I found the INVITE command and confirmed the DID is nowhere to be found. I searched the whole log and nothing.

If it helps, here’s what I’m seeing. I redacted stuff again, which makes this pointless I imagine, but here it is.

169983	[2023-10-02 11:55:32] VERBOSE[2276] res_pjsip_logger.c: <--- Received SIP request (1328 bytes) from UDP:NN.NNN.NNN.NN:PPPP --->	
169984	INVITE sip:[email protected]:PPPP;line=dcvangv SIP/2.0	
169985	Record-Route: <sip:NN.NNN.NNN.NN;lr=on;ftag=11e7a796-ec75-4b91-bdfb-2384a1fcb7fe;nat=yes>	
169986	Via: SIP/2.0/UDP NN.NNN.NNN.NN;branch=z9hG4bK6dea.5a488ea43ccc143570aeb2418783d959.0	
169987	Via: SIP/2.0/UDP NN.NNN.NNN.NN:PPPP;received=NN.NNN.NNN.NN;rport=PPPP;branch=z9hG4bKPje9113419-d9a7-42d1-b0cd-bde536f3a267	
169988	From: "KYLE BISIGNANI" <sip:[email protected]>;tag=11e7a796-ec75-4b91-bdfb-2384a1fcb7fe	
169989	To: <sip:[email protected]>	
169990	Contact: <sip:[email protected]:PPPP;alias=NN.NNN.NNN.NN~PPPP~1>	
169991	Call-ID: f6ae8147-0c8b-484a-a636-9668b7c30bd3	
169992	CSeq: 22187 INVITE	
169993	Allow: OPTIONS, REGISTER, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, REFER, MESSAGE	
169994	Supported: 100rel, timer, replaces, norefersub, histinfo	
169995	Session-Expires: 1800	
169996	Min-SE: 90	
169997	Remote-Party-ID: "KYLE BISIGNANI" <sip:[email protected]>;party=calling;privacy=off;screen=no	
169998	Max-Forwards: 69	
169999	User-Agent: Asterisk PBX 18.19.0	
170000	Content-Type: application/sdp	
170001	Content-Length: 286	
170002		
170003	v=0	
170004	o=- 1764026859 1764026859 IN IP4 NN.NNN.NNN.NN	
170005	s=Asterisk	
170006	c=IN IP4 NN.NNN.NNN.NN	
170007	t=0 0	
170008	m=audio 12206 RTP/AVP 0 8 3 101	
170009	a=rtpmap:0 PCMU/8000	
170010	a=rtpmap:8 PCMA/8000	
170011	a=rtpmap:3 GSM/8000	
170012	a=rtpmap:101 telephone-event/8000	
170013	a=fmtp:101 0-16	
170014	a=ptime:20	
170015	a=maxptime:150	
170016	a=sendrecv	
170017		
170018	[2023-10-02 11:55:32] VERBOSE[12969] res_pjsip_logger.c: <--- Transmitting SIP response (606 bytes) to UDP:NN.NNN.NNN.NN:PPPP --->	
170019	SIP/2.0 100 Trying	
170020	Via: SIP/2.0/UDP NN.NNN.NNN.NN;rport=PPPP;received=NN.NNN.NNN.NN;branch=z9hG4bK6dea.5a488ea43ccc143570aeb2418783d959.0	
170021	Via: SIP/2.0/UDP NN.NNN.NNN.NN:PPPP;rport=PPPP;received=NN.NNN.NNN.NN;branch=z9hG4bKPje9113419-d9a7-42d1-b0cd-bde536f3a267	
170022	Record-Route: <sip:NN.NNN.NNN.NN;lr;ftag=11e7a796-ec75-4b91-bdfb-2384a1fcb7fe;nat=yes>	
170023	Call-ID: f6ae8147-0c8b-484a-a636-9668b7c30bd3	
170024	From: "KYLE BISIGNANI" <sip:[email protected]>;tag=11e7a796-ec75-4b91-bdfb-2384a1fcb7fe	
170025	To: <sip:[email protected]>	
170026	CSeq: 22187 INVITE	
170027	Server: FPBX-16.0.40.4(18.19.0)	
170028	Content-Length: 0	

And thank you @Stewart1 for the suggestion. I’ll reach out to my provider and see if this is an option for them.

Digging this up as we’ve got it working. They had to make some tweaks on their end, and had me turn on “Trust RPID/PAI” and set “Send RPID/PAI” to Both. I assume these changes in conjunction with some changes they made on there end is what did the trick.

Thank you for those who pitched ideas and helped out. You helped keep me sane.

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.