You need use FastAGI or AGI(fastagi faster but slighly more complex) to control call flow of your channel.
http://www.voip-info.org/wiki/view/Asterisk+FastAGI
In AGI you can get call info, decide where to place it, after that make call using Dial command. Calls will be bridged automaticaly.
http://www.voip-info.org/wiki/view/Asterisk+cmd+Dial
Also you can use Bridge ami action to bridge 2 channels, but that is not how it have be created. Correct way - via Dial.
http://www.voip-info.org/wiki/view/Asterisk+cmd+Bridge
Also you can use in dialplan CURL function to request help via http on external API. That will have same cost as fastagi, but can be simpler for your since you like node.js
If you use Originate ami command, you can add to that command any variables via
"Set" => "variablename=somethign"
PS actually almost anything can be calculated inside asterisk, sure if you have enought knowledge about that. Asterisk have full language(mean you can describe any algorithm in dialplan), have function to request db info etc.
DISCLAIMER: I recommend read asterisk book like "Asterisk the future of telephony" BEFORE creating any design of application with use of asterisk pbx. If you ignore this warning, your app can be unstable and require full rewrite after you put it in production.