Register Trunk for each FXS port on GXW4224?

I am setting up a trunk between a Grandstream GXW4224 FXS gateway and FreePBX.
Everything works, but only if I register each FXS port separately on Asterisk with extension as the SIP user ID/username

Now that means I have to build a trunk for each FXS port and that seems overkill.

I want to register all ports on the gateway to Asterisk with the same credentials and when a call from Asterisk goes to the Grandstream, it should route it to the right FXS port according to what number was dialed.
So match by called number or by some other method. Is there a way to do that?

There is an intrinsic SIP trunk on the ip address of the gateway, you can define that trunk once in the gui using the from-internal context, no user, password nor registration tequored, but you can use them if you set up the gateway appropriatly, and route calls to the ‘users’ at the end just like sny other trunk, another way that works :-

Each fxs port can have a defined ‘user id’ , for example 2001-2024

define custom extentions like:-

Dial(SIP/[email protected])

Map incoming did’s to these extensions,
Call them directly from local extensions.

When I call into the gateway using the trunk, it always rings the same FXS port, no matter what number I dial.
Same on the Dial(SIP/[email protected]). Calls out from gateway to Asterisk are fine.
Apparently the mapping on the GW isn’t working.

Welll its been a while since i used a grandstream but i remember that the authenticate id equates to your sip secret, so all the same if you use it, blank otherwise, the trunk should be a friend and you shouldn’t need to qualify, escaping @ seems a confusing double negative, also is your sip using 5060, you might want make sure both ends agree. A sip set debug ip should also help

Figured it out.
I have to create each FXS phone as a SIP extension in FreePBX and have the gateway register.

Quick question, do these GXW4224 work ok? Thinking about buying a couple

Don’t know yet.
The proper config was far from obvious but I got it now.
I think Grandstream gateways are generally not considered to be very good if you read what people are saying in forums etc, but I will find out soon.

I’m ready for disappointment somewhere between “depressing” and “bitter”. But they are cheap enough to try.