[Asterisk-Users] PHP/AGI Problem

Jon Farmer viperdude_uk at yahoo.co.uk
Thu May 26 00:46:40 MST 2005


Moises Silva wrote:

>what version of asterisk you are using?  i had some problems with agi
>until i upgrade to asterisk 1.0.7
>
>  
>
I am also using version 1.0.7. I installed it from the Xorcom CD ISO


>if you run simple agi scripts works?
>try using this 2, one is php, the other one is C, that will tell us if
>the problem is the script you are using, php, or AGI itself...
>  
>

OK both the PHP script and the C program worked as expected. The call 
connected, the numbers were read out and the * server hungup. The AGI 
script/program exited normally.

Now when I change the program to this

#include <stdio.h>
main()
{
        char line[80];
        setlinebuf(stdout);
        setlinebuf(stderr);
        while (1)
        {
                fgets(line,80,stdin);
                if ( strlen(line) <= 1 )
                {
                        break;
                }
        }
	while (1)
	{
        	printf("SAY NUMBER 55 \"\"\n");
        	fgets(line,80,stdin);

        	printf("SAY NUMBER 66 \"\"\n");
        	fgets(line,80,stdin);
	}
 }


The numbers are read out continuously as expected but If the caller 
hangs up the app does not exit. The console log say the caller hung up 
but the app still shows in the process list. The same happened if I 
changed the PHP script in the same way.

I am therefore assuming that AGI expects the script to detect the caller 
hung up and to act accordingly. Therefore I guess my question is how do 
I detect the caller hungup while a AGI script is running?

Regards

Jon





More information about the asterisk-users mailing list