[SIPForum-discussion] asterisk c script

Karthik Arumugam rtskarthik at gmail.com
Mon Apr 2 15:02:44 UTC 2007


HI

I am new to asterisk world. My c script is not executing.
I have done the following stuffss:
1) created a file called cscript.c
   #include <stdio.h>
   #include <string.h>
   main() {
       char        line[80];
       /* use line buffering */
       setlinebuf(stdout);
       setlinebuf(stderr);
       /* read and ignore AGI environment */
       while (1) {
           fgets(line,80,stdin);
           if (strlen(line) <= 1) break;
       }
      printf("SAY NUMBER 1234567891 \"\"\n");
     fgets(line,80,stdin);
     fputs(line,stderr);
}
2)compiled it using gcc compiler at the agi-bin directory

3) used the following statement at the extension.conf file
exten => 1234,1,Answer()
exten => 1234,2,AGI(cscript.c)

4)the i dialed using the dial string 1234 at incoming

5) The output from asterisk console is
 -- Executing AGI("OSS/dsp", "cscript.c") in new stack
    -- Launched AGI Script /var/lib/asterisk/agi-bin/cscript.c
    -- AGI Script cscript.c completed, returning 0
 == Auto fallthrough, channel 'OSS/dsp' status is 'UNKNOWN'
 << Hangup on console >>

But when i tried to run the sample perl file it executed rightly..

What is wrong with the following scenario

Please help me. I have no clues

Regards
Karthik
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://sipforum.org/pipermail/discussion/attachments/20070402/5191772f/attachment-0002.html>


More information about the discussion mailing list