IM Text > Festival output > outbound call

Hi

I am doing RND on IM. I want to type some text which will be in put for Festival and Festival will create a .wav file. I want to dial some number and play that wav file. this process should be done through a automated program.
All I mean is IM message should be played to some number.

Input fields

Text : Hello This is test
Number:

generating wav file
echo “$Text” | text2wave -scale 50 -o msg.wav

Program or shell script should get $Text and process it with Festival generate .wav file, now the $number should be dialed and the .wav file should be played.

Please help me how this can be possible using shell script or any other program.

Thanks & Regards,
Shaan