Calling out using a calling card

Hi,
I’m having an Freepbx updated to 2.9.07 and Asterisk 1.6.2.14
I also have a calling card to be used for international calls
The calling card request after dial the access number:

Local access number: 8 digit number
After answer (2 to 4 sec later)
Type of language, 1 digit (options are 1, 2 or 3)
Code / RIN, 12 digit number
Dial number, the eleven digit who origino this call.

Then the full string has to be:
Access number+type of Lang+Code/PIN+number to be dial.
If local access is 5555-4444
type of Lang is 1,2,3
PIN 123456789012
Number to call 18005558355 (as an example

The string should be for this dial number

90018008558355

SIP/$OUTNUM$@TRK
+1 + 123456789012 = $OUTNUM

IS there someone already done this?
I need helpto authomatize this dial plan to allow me use a caling card to call foreing numbers
I faild to do it, I was trying customs trunks in free pbx but nothing

Thanks