Try this for the *31*04xxxxxxxx# cases in additon to 04xxxxxxxx:
Physical Interfaces -> LINE Port -> DigitMap : (<+>(04xxxxxxxx|*31*04xxxxxxxx#)|...)
Physical Interfaces -> PHONE Port -> OutboundCall Route:
...,{(<#:>|<+:#0,,,,,>(04xxxxxxxx|*31*04xxxxxxxx#)|911):li},...
Voice Services -> OBiTALK Service -> InboundCallRoute:
{(Mcot)>(<#0,,,,,>(04xxxxxxxx|*31*04xxxxxxxx#)):li},{(Mcot)>(Mpli):pli},{(Mcot)>(<*1:>(Msp1)):sp1},
{(Mcot)>(<*2:>(Msp2)):sp2},{(Mcot)>(<*8:>(<#0,,,,,>(04xxxxxxxx|*31*04xxxxxxxx#))):li},
{(Mcot)>(<*8:>(Mli)):li},{(Mcot)>(<*9:>(Mpp)):pp},{(Mcot)>(<**1:>(Msp1)):sp1},
{(Mcot)>(<**2:>(Msp2)):sp2},{(Mcot)>(<**8:>(<#0,,,,,>(04xxxxxxxx|*31*04xxxxxxxx#))):li},
{(Mcot)>(<**8:>(Mli)):li},{(Mcot)>(<**9:>(Mpp)):pp},{(Mcot):aa},{ph}
Replace pli above (2 places) with the desired PrimaryLine for your OBiON App (sp1, sp2, li, or pp).
User Settings -> User Defined Digit Maps -> User Defined Digit MapX
Label : cot
DigitMap : (290123456)
where 290123456 is your OBiON App OBiTALK number.
I don't have any experience with how OBiON App's handle dialing #, so the *31*04xxxxxxxx# calls may not work from there (there's no DigitMap or other configuration option in an OBiON App).