Dialplan using calling card

Hi,

I have installed an Asterisk 1.6.2.5 server for a few weeks now and I am still having some problems creating a dial plan using a calling card. The rest is perfect. The server is run under ubuntu 10.4.

So , for example, if I want to dial a local number I am using the following extension :
exten => _XXXXXXXXXX,1,Dial(SIP/${EXTEN}@mydialplan)
where XXXXXXXXXX is the number I wish to dial. Everything works fine.

However, for long distance calls I want to use a calling card. I can use the following extension for this, which works fine (I will call it STRATEGY 1):
exten => 0,1,Dial(SIP/YYYYYYYYYYY@mydialplan)
Thus, if I dial 0 at first, I will wait to connect to the YYYYYYYYYYY number (the calling card access number) and after that I am able to dial again the number I really want to dial which is ZZZZZZZZZZZ

But I would like to be able to ask asterisk to do this for me, so I will not have to wait for the dial tone of the calling card. I have tried the following extension (STRATEGY 2):
exten => ZZZZZZZZZZZ,1,Dial(SIP/YYYYYYYYYYY@mydialplan/${EXTEN})
in order to pass the ZZZZZZZZZZZ as an extension, once the YYYYYYYYYY number have been dialed.

However, the STRATEGY 2 fails. I am getting the following error message when I try to dial directly ZZZZZZZZZ from my phone:
*CLI>
WARNING[3058]: chan_sip.c:5329 create_addr: No such host: mydialplan/ZZZZZZZZZZZ
WARNING[3058]: app_dial.c:1745 dial_exec_full: Unable to create channel of type ‘SIP’ (cause 20 - Unknown)
== Everyone is busy/congested at this time (1:0/0/1)
– Auto fallthrough, channel ‘SIP/1000-00000000’ status is ‘CHANUNAVAIL’

Does my STRATEGY 2 have any problem ? Or is my implementation fallacious ? or both ? Failing to find a straightforward solution, I will still use the 1st STRATEGY. But I would like to be able to use the second one too.

Any help ?
Thank you in advance.

If the PSTN gateway insists on your waiting for secondary dialtone, I think the only way of doing this is with a goto, macro, or subroutine on the Dial application call. The call will always appear to be answered.