Nakar81,
I think that too many things are changing at each attempt to get a clear idea of what is happening. I suggest that I give you a configuration which will work mostly as you want, then you fine tune it one step at a time after you have proved it works.
This assumes that PrimaryLine = PSTN
Phone Port DigitMap:
([1-9]x?*(Mpli)|[1-9]S9|[1-9][0-9]S9|112|**0|***|#|**1(Msp1)|**2(Msp2)|**8(Mli)|**9(Mpp)|(Mpli))
Phone Port OutboundCallRoute:
{([1-9]x?*(Mpli)):pp},{(<#:>|112):li},{**0:aa},{***:aa2},{(<**1:>(Msp1)):sp1},{(<**2:>(Msp2)):sp2},{(<**8:>(Mli)):li},{(<**9:>(Mpp)):pp},{(Mpli):pli}
ITSP A
DigitMap (Msp1)
(0035[5-9]xx.|(Mipd)|[^*#]@@.'@'@@.)
ITSP B
DigitMap (Msp2)
(00xx.|(Mipd)|[^*#]@@.'@'@@.)
Line Port
DigitMap (Mli) In this case Mli = Mpli
(<**1>(Msp1)|<**2>(Msp2)|xx.)
After you have proved this works, then Mli can be improved by replacing the xx. rule with what suits the Spanish numbering system.
I have left in rules such as [^*#]@@.'@'@@. from default digit maps as you may require them in the future.
After each "submit and reboot" I suggest waiting a couple of minutes to let the Obi servers to catch up. They seem to get confused if we do too many changes too quickly
Now, dialling directly from the phone with no ** codes you should have:
0035 go directly to sp1
00 go directly to sp2
All other numbers go to PSTN via line port.