Connect PSTN to asteriskwith SIP trunk

I have a physical SIP trunk and PBX now, and I connected the SIP trunk to the PBX with RJ45 LAN port.
Now, how can I config the SIP in Asterisk pjsip?

here is my pjsip.conf




here is my extensions.conf

exten => 100,1,Answer()
same => n,Wait(1)
same => n,Playback(hello-world)
same => n,Hangup()

exten => _X.,1,Dial(${LOCAL}/hkbn/${EXTEN})

Although the settings seem incomplete and somewhat confusing, I would not think this is right. might be right.

Same here, but also I would not expect the XXXXXXXX@ part to be used. If they really have a proxy, you mighta actually need another address, or a domain name here.

Please provide the definition of LOCAL and explain what the whole line is trying to achieve. I would have expected PJSIP/${EXTEN}@hkbn (last example in Dialing PJSIP Channels - Asterisk Documentation ).

Can the PBX IP reach SIP proxy?

I think that is why they have given the gateway address. There needs to be an explicit route to the proxy via that gateway.,

Port 3 on that router I have to assume is programmed to provide the path to the SIP proxy over a VPN, in addition; that hardware is likely expecting your PBX to be a specific IP. This is less VoIP specific and more general networking.

You don’t interact with, that’s a gateway. You have to configure Asterisk to hit the SIP Proxy’s private IP.

I can ping but not

You’re correct, the line in extensions.conf should be changed to PJSIP/${EXTEN}@hkbn.

However, I’m still encountering issues with the configuration. I understand that the ITSP settings should be configured in pjsip_wizard.conf. Could you clarify if my physical SIP trunk qualifies as an ITSP, or does ITSP specifically refer to cloud-based SIP providers?

Additionally, I’ve come across other PBX configurations involving my SIP provider. Could you please advise on where to input the following information within Asterisk?

HKBN-configuration.pdf (

Have to contact to HKBN about route connection between WAN router port to SIP Proxy (probably they will offer a VPN service).

I consider them still to be in the cloud, just a private part of it.

That information says that the contact should be and that you need a proxy defining (probably either sip:\;lr or sip:\;lr\;hide. It doesn’t make clear what should be used for match=

You will need a route to added through

My starting point for match= would be

Apologies, I’m still struggling to grasp the configuration process. The guideline provided by my SIP provider is meant to cover all necessary steps, but it’s leaving me perplexed.

Some sources suggest registering in the pjsip_wizard.conf, while others advocate for creating endpoints in pjsip.conf. My SIP service encompasses 8 Channels and 20 PSTN numbers, all managed by 3 digital DIDs.

I’m uncertain about which components should be configured in pjsip and which in pjsip_wizard.

I’d suggest you start by trying to make an incoming call and capture everything that appears on the LAN. There are certain guesses I can make, but actually seeing a request from them will give a more definitive answer.

You should be able to use tcpdump, in promiscuous mode. You should, at the very least see an ARP, even though you don’t have broadcast media, and that will tell you what IP address you need to set on your interface to the stub LAN.

If Contact-URI is what I think it is, the router is set for NAT operation, which complicates things.

Can you make a ping or traceroute to IP From HKBN private IP 10.xx.xx.xx network interface?
Is the router (for 3 to PBX) provided by HKBN?

The router (for 3 to PBX) is provided by HKBN

I can NOT ping

ping -I enp1s0
ping: Name or service not known

DNS problem, this hostname doesn’t resolve at all

but seem i dont have the host IP? Any tools can search the server IP address?

Ask your provider to give you the right hostname or the IP

Most likely does not allow ping.
If on your asterisk ippbx trunk is configured (without registration as indicated on specification) could capture packets and analyze (wireshark).

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