Asterisk- any script to write

I have asterisk Installed in my Ubuntu-9.04.

Is it possible for me make a call, establish a connection and terminate once done, if I have a asterix IP with my hardphone extension number as my password.

How do I write a script to establish this or else is there any other way.

Any help would be great!