How to compile my AGI Script

hello,

i have written my AGI script…

and i have called the agi script like this in extension.conf

extensions.conf
exten => 1,2,agi,testagi.c

and i have got the results like this…

– Executing AGI(“OSS/dsp”, “agi-test.php”) in new stack
– Launched AGI Script /var/lib/asterisk/agi-bin/agi-test.php
AGI Tx >> agi_request: agi-test.php
AGI Tx >> agi_channel: OSS/dsp
AGI Tx >> agi_language: en
AGI Tx >> agi_type: Console
AGI Tx >> agi_uniqueid: 1175232172.4
AGI Tx >> agi_callerid: unknown
AGI Tx >> agi_calleridname: unknown
AGI Tx >> agi_callingpres: 0
AGI Tx >> agi_callingani2: 0
AGI Tx >> agi_callington: 0
AGI Tx >> agi_callingtns: 0
AGI Tx >> agi_dnid: unknown
AGI Tx >> agi_rdnis: unknown
AGI Tx >> agi_context: local
AGI Tx >> agi_extension: s
AGI Tx >> agi_priority: 1
AGI Tx >> agi_enhanced: 0.0
AGI Tx >> agi_accountcode:
AGI Tx >> CLI>
– AGI Script agi-test.php completed, returning 0

and i donno know whether this script s correct or wrong…

i need to compile these script…

is there any option to compile my agi script which s written in C???

or

can you tell me how to execute my AGi script???

can u help me out plzzzzzzz

You can compile with gcc compiler. It will show you the errors if that file has. For more info, use man gcc

my agi script is

#include<stdio.h>
main()
{
char *res;

fprintf(stdout, "starting the script\n");
   res = run_command(EXEC Dial SIP/1222);
            if(!res)

                   {
                      fprintf(stderr, "Failed to execute command\n");

                        return -1;
                  }
	fprintf(stderr, "Failed to execute command\n");
                        return 0;

}

static char *run_command(char *command)
{
fprintf(stdout, “%s\n”, command);
return wait_result();
}

i conpiled the script using gcc

i got the results like this

testagi.c: In function ‘main’:
testagi.c:7: error: ‘EXEC’ undeclared (first use in this function)
testagi.c:7: error: (Each undeclared identifier is reported only once
testagi.c:7: error: for each function it appears in.)
testagi.c:7: error: expected ‘)’ before ‘Dial’
testagi.c:7: warning: assignment makes pointer from integer without a cast
testagi.c: At top level:
testagi.c:21: error: conflicting types for ‘run_command’
testagi.c:7: error: previous implicit declaration of ‘run_command’ was here
testagi.c: In function ‘run_command’:
testagi.c:23: warning: return makes pointer from integer without a cast

can u tell me ur suggestions

don’t you think it’s really outside the scope of an Asterisk forum to advise you on how to write and compile C apps ?

if you don’t know how to compile this, perhaps this isn’t the best way to start. maybe using Perl or PHP would suit you better ?