Unable to receive incoming calls

I have an analogic line that I connect to my gateway is a Grandstream GXW4104 I’m able to do the connection with PBX and able to dial out without problems, the problem is when I call to that phone number the calls never go thru. I configure my inbound route and looks okay to me.
I open the port 5060 on my modem but still not able to receive the calls how I can ensure that my configuration is the right one.
PD: I configure a Trunk to do the connection with the analogic line. This are my outgoing settings:
type=friend
secret=****
qualify=yes
port=5060
host=gatewayip
dtmfmode=rfc2833
disallow=all
context=from-trunk
canreinvite=no
allow=ulaw
Incoming are blank.(I tried to add a configuration there but nothing change it.)

Thanks in advance

You need to verify the configuration on the gxw4104. The most important parameter is unconditional forward to VoIP. If you post your configuration I can try to help. Also, add insecure=port,invite to the trunk definition.

And you have Chan_SIP listening on 5060? Because that is assigned to PJSIP unless you update the port bindings.

This are my settings on the Grandstream GXW4104
Channel Dialing to VoIP

  1. Unconditional Call Forward:
    User ID:ch1-4:Analogicphonenumber;
    Sip Server:ch1-4:p1;
    Sip Destination Port:ch1-4:5060;

This are my settings on the Grandstream GXW4104
Channel Dialing to VoIP

  1. Unconditional Call Forward:
    User ID:ch1-4:Analogicphonenumber;
    Sip Server:ch1-4:p1;
    Sip Destination Port:ch1-4:5060;

I also add my settings on the Free PBX for inbound
DID Number : analogicphonenumber
Set Destination: Extensions
An extension that i configure on X-lite.

Thanks for all your suggenstions.
thank you so much.

Im using extensions type pjsip I will open the port 5160 thats the default for CHAN_SIP and i will try thank you.

Well that’s going to be the problem with this. The GX410 does not allow you to specify a port on the device. It uses 5060 for listening and sending requests. You need to use a PJSIP trunk.

You can use any port, just define the server with IP and port, for example 192.168.10.20:5160

If you are using authentication, you must use an all numerical value for the username, which must match the trunk name on FreePBX, otherwise the gxw will fail to authenticate.

I have configured many of this specific gateway, let me know if you would like me to help you remotely.

This was my problem im able to receive calls now, question can you please help me with a brief explanation diferrence between SIP_chan and PJSIP, because im not able to use softphones with SIP_chan.
Thank you so much for all your help

Question, it is possible to connect my analogic line to a VPS with Freepbx configure. if so how i can specified my gateway host?
Thanks in advance.

You just need to point your gateway to your FreePBX instance and configure the trunk accordingly.

I did but how i can point the trunk to my Grandstream GXW4104 if they are in different network.

It’s probably easiest if the GXW registers to the PBX. In your trunk configuration, replace
host=gatewayip
with
host=dynamic
add
username=(analog phone number)
and remove the port=5060 setting.

On the Grandstream side, configure it with the PBX domain name or IP address, set SIP Registration to Yes, set both SIP User ID and Authentication ID to match username for the trunk, and set Authen Password to match secret for the trunk.

Confirm that the GXW registers ok and test. If you have trouble, post details from log.

It seems as if you don’t provide full info regarding your scenario. On every post you add additional info. It would be easier for us to help if you provide all the info on one post.

My bad, I’m able to do outbound and inbound calls with the grandstream using pjsip trunk with my freepbx configure locally. Now I would like to implement the same configuration on a VPS But im not able to link the grandstream and the pbx i’m using Sip not pjsip.
This is my configuration on the trunk:
type=friend
username=analogicphonenumber
secret=*****
qualify=yes
host=dynamic
dtmfmode=rfc2833
disallow=all
context=from-trunk
canreinvite=no
allow=ulaw

On my grandstream I have this:
Channel Dialing to VoIP

  1. Unconditional Call Forward:
    User ID:ch1-4:Analogicphonenumber;
    Sip Server:ch1-4:p1;
    Sip Destination Port:ch1-4:5060;

SIP User ID: analogicphonenumber
Password: same that i use on the Trunk.

Thank you for all your help.

Is the GXW registered to the PBX? If not, did you set up the PBX to have chan_sip on port 5060? Does anything get logged on the PBX when the Grandstream attempts to register?

If it is registered ok, what goes wrong on incoming calls? On outgoing calls?

Does anything get logged on the PBX when the Grandstream attempts to register?
Not sure how to check.
GXW is pointing to my vps server.
SIP Server = myserverip
Outbound Proxy: = myserverip
Yes I change chan_sip to port 5060
Bind Port 5060
TLS Bind Port 5060
I’m able to registry or connect to my vps on a phone, when I do the outbound call its says all circuits are busy now, please try call later.
Incoming nothing happend just rang and that’s it.
My outbound route :
Trunk Sequence for Matched Routes: my trunk chan_sip
Inbound route:
DID Number: analogicnphonenumber
Set Destination: my extension

You are missing insecure=port,invite
You also need to make sure that the trunk name matches the username and it is all numbers, otherwise GXW won’t register.

That’s not relevant here. My system has two remote FXO devices and I don’t use insecure with either. On an incoming call from the PSTN, the device sends an INVITE, Asterisk challenges and the device resends the INVITE with a proper Authorization header.

To the OP:

Be sure that in the GXW you have SIP Registration set to Yes and Authentication ID set the same as SIP User ID.

The Grandstream has a device status page where you can check registration. See

p. 25.

If it’s not registered, at the Asterisk console, type
sip set debug on
then reboot the GXW so it tries to register. Report what appears on the console.

Believe me that for GXW4104 you need it.