Dial out from AGI?


I am getting started with asterisk to create a phone system for my small business.  I am new to IP telephony but have experience in Linux system administration, networking, and programming.  I downloaded the source and compiled and installed it on my Slackware server.  As an old command line junkie, I am not using FreePBX or any GUI.

I have gotten a basic sip.conf and dialplan working. I can both originate and receive calls via a
SIP trunk.

Right now, I am working on a small IVR for my business. I am coding it in Perl via AGI. I decided to do it that way because IVR - by its nature - is mostly about flow control, and flow control is so much nicer in a “real” computer language. I chose Perl because I’ve written about a hundred thousand lines of it over the past few years.

In Perl, I was able to organize the IVR in a natural, understandable way, as a state machine, with one state for each recording. The state machine is a switch statement inside a loop, and to
"go" to a different state, you just change the state variable.

I have a prompt in the form of “punch 1 for bubkus onsite staff, punch 2 for wimpy onsite staff, punch 3 for the Owners”.

But it doesn’t work. Here’s the command:

$agi->exec( ‘Dial’,‘SIP/11234567890@mysipprovider,30,r’ );

The asterisk CLI says:

WARNING[18218][C-00001085]: app_dial.c:2437 dial_exec_full: Unable to create channel of type ‘SIP’ (cause 20 - Subscriber absent)

Yet a similar line in the dialplan (in context LocalSets) works fine.

I’m sure this is a FAQ, but I can’t find it. Different syntax for dials done from AGI? AGI script in wrong context?

     Thanks in advance
       - jerryk1234

Destination is not registered.