How does FreeSWITCH know which endpoint module will handle a particular channel?
For incoming channels it's pretty simple. When an endpoint module is loaded, the call comes in via the endpoint, the endpoint then creates a channel so FreeSWITCH can start interacting with the channelit starts listening for connections using the information in the configuration file, the listener can be tied to an IP Address and port in case of a VoIP protocol, or it can be a physical port on a connected piece of hardware, in either case, the endpoint module that's listening on that port is the one that will handle the call.
For outgoing channels, you have to specify which endpoint to use. When you start an outgoing channel, you use a dialstring to identify the recipient. The dialstring starts with the identity of the endpoint module that should be used, followed (optionally) by additional information specific to the module, then finally the destination number. The components of a dialstring are separated by a "/" For example to make a call using the SIP protocol your dialstring would look something like