Same SIP Provider(same context) different DIDs

Hello everyone, I have a problem I need to solve, My Sip provider provides me with 5 DIDs numbers through the same SIP trunk, the problem is that I need to route incoming calls based on the DID the caller called, for instance if a caller calls xxxxx DID I want to send this caller to ext 303 and if it calls yyyyy DID I want this caller to be send to the 304 exten.

The problem is that it is the same trunk, which has the same context, how can I filter based on the DID that the caller is calling.

Thanks in advance.

exten => did,…

Thanks for the reply, I did what you told me but I get a misconfiguration error, let me put the dialplan.

[from-pstn]
include => incoming

[incoming]
exten => xxxxxxxxxx,1,Answer()
exten => xxxxxxxxxx,n,Goto([(a2billing,start,1)])
exten => yyyyyyyyyy,n,Answer()
exten => yyyyyyyyyy,n,Goto([internals,start,1])

[outside]
exten => _X.,1,Answer()
exten => _X.,n,Playback(press-pound-to-login-star-to-hangup)
exten => _X.,n,HangUp()

[internals]
exten => _X.,1,Answer()
exten => _X.,n,Playback(press-pound-to-login-star-to-hangup)
exten => _X.,n,HangUp()

You have no priority 1 for yyyyyyyyyyyy.

“start” will not match “_X.” in internals, as X only matches digits.

Also, the Answer for yyyyyy… is totally redundant, and that for internals is also redundant (in that case because there is an implied Answer in Playback. I don’t know if a2billing requires the call to be answered before it gains control.