Firstly (and possibly a little off topic) there is actually a built-in WM6 feature for allowing calls to be routed either over the cell network or over SIP using the built-in dialer. If SIP calling (or "Internet Calling" as the UI has it) is enabled and there is a WiFi connection the call will be routed over SIP, if not it will route over GSM in the normal way. There is actually also a registry setting that enables the calls to routed over SIP if there is a 3G/HSDPA connection available too.
Most manufacturers do not ship the part of the WM6 OS that enables this functionality on their device ROMs (presumably mindful of their call revenue), however it can easily be installed on most WM6 devices.
Secondly if this is not what you are after (if you don't want to use SIP but use a calling card or need to have the choice after you place the call) I can tell you it must be possible to do what you want to do because this app does it - magicall. One way I can think of doing this is to get notification of the call, immedialety end it, wipe it from the log, put up your PBX or Cell dialog, and then place the call again in the way the user requested. This has the disadvantage that if the original call was started programmatically the app that did so will think the call was ended prematurely. It may also be possible using another technique, but that is where my knowledge runs out...