[Asterisk-Dev] AGI IDE

Eric Bart btk-adm at byortek.com
Wed Sep 29 00:24:51 MST 2004


> From: "oi geli" <oigeli2000 at yahoo.com>
>
> Is there a AGI IDE out there? Or anybody working on it?

I'm working on a C++ program called axra. axra is an interface 
program that dialogs with asterisk both through agis and through 
the manager api.

>From axra you can either send agi commands or manager api commands.
You can wait for either agi events or manager api events. Each agi 
is an instance of a class. 

I'm currently rewriting it and making it multi-threaded. Next 
release in a week or two.

I've written a new app within axra : Talking caller id 

Briefly, here's how it works :

- In the dialplan, have an extension calling the generic agi 
  with CDial (consultative dial) and Dial args as parameters.

- Axra receives the request and launch the cdial app in a new 
  thread. The agi instance is named 'as'. 

- If needed computes the caller id audio (Festival or Mbrola)
- Answer the agi : as->SendStringToAgi("answer");
- Play the ringing signal : as->SendStringToAgi("exec Playtones ring");
- Create a local channel with an agi on both ends : 
    BKrobotPair RpAnn(as->agi_uniqueid, as->agi_callerid);
- wait for the pair to be built : while(!RpAnn.IsBuilt());
- Register a manager api link event to watch the next dial command : 
    BKastRegEv BKlinkAnn1(Link, RpAnn.AS(1)->agi_channel);
- Dial the wanted one on leg1 :
    RpAnn.AS(1)->SendStringToAgi("exec Dial " + dialargs);
- Wait for the manager api link event ( ie dial success) :
    while( BKlinkAnn1.CheckGroup()==0 );
- Stores the dialed channel : dialedChannel=BKlinkAnn1.GetEventLine(1);  
- Play beep while the audio computes and the audio cid when computed :
     while ( (ttsaudiofile=getTtsAudioFileName(contfile))=="")
        RpAnn.AS(2)->SendStringToAgi("get data beep 2000 1");
     else
        RpAnn.AS(2)->SendStringToAgi("get data " +  ttsaudiofile + " 1500 1");
- Get the dialed key and choose action. Either send the key to dialplan or
  connect both parties. Here's how it connects : 
-   as->SendStringToAgi("exec StopPlaytones");
-   linkAgiWithChannel(as, dialedChannel);
-   as->AgiExit(0);
-   as->AuthorizeDeletion();

I am now programming exceptions so that each time the program is waiting 
for an event, it will also wait for special event such as hangup or agi
close. These special events will throw exceptions that will be used to
properly close the app.

Ain't it cool ?



More information about the asterisk-dev mailing list