It's really hard for me to understand your questions. So my answers will be generic and based on what I could guess.
1. Yes, you can programmatically make a phone call using the RingOut or CallOut API
2. Yes, you can forward an incoming call to a call queue's phone number
3. Yes, you can forward an incoming call to a voice mailbox. It is the same way you forward a call to another extension but that extension's setting is accepting voicemail only.
To detect incoming call, you can subscribe for the telephony session notification to receive events.
If you can explain your problem better, I can help you better.
This is for inbound calls.
1. Inbound call to Ringcentral at phone number 123-123-1234.
2. Ringcentral sends a get message to an external url passing the phone number... Example: https://www.mycompany.com/GetExtension.aspx?phonenumber=1234567890
3. GetExtension.aspx returns a single extension.
4. Ringcentral directs the call to the extension specified via the url.
1. Inbound call to Ringcentral at phone number 123-123-1234.
=> Register for a presence event notification for the extension which owns the phone number "123-123-1234" or at the account level to receive incoming call notification.
// subscribe for extension presence notification
'/restapi/v1.0/account/~/extension/[extensionId]/presence?detailedTelephonyState=true'
// subscribe for account level notification
'/restapi/v1.0/account/~/presence?detailedTelephonyState=true'
2. Ringcentral sends a get message to an external url passing the phone number... Example: https://www.mycompany.com/GetExtension.aspx?phonenumber=1234567890
=> RingCentral does not send any GET request to external url. It is up to you to send GET request to any external server to get external information. And where is the phone number "1234567890" coming from? Who's number is that?
3. GetExtension.aspx returns a single extension.
=> What is this extension? Why it comes from "https://www.mycompany.com"
4. Ringcentral directs the call to the extension specified via the url.
=> There is no API to direct a call to an extension based on url. What URL is this? You can only forward an incoming call to a phone number using the telephoneySessionId and the partyId from the telephony session notification payload.