Is it possible

Is it possible to have a setup where a Linux server, acting as a gateway,
with a voice modem (and eventually a sound card) and asterisk on it can
redirect call incoming, on the basis of an extension entered after the
modem has pick up the line.

if no. Why?

yes, sounds like you are defining an IVR, asterisk will do that just fine.