| |
| News & Reviews |
Welcome to the Voxilla VoIP Forum.
Voxilla has been a trusted source for accurate, up-to-date information on the IP Communications industry since 2002. A dedicated staff of reporters and engineers produce feature articles and product reviews to keep industry watchers abreast of the people, companies, and trends driving a fast moving market.
You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!
If you have any problems with the registration process or your account login, please contact contact us.
Voxilla VoIP Forum |
asterisk c scriptTechnical support, how-to guides, troubleshooting, and general assistance, from beginner to seasoned pro, this is where to discuss Asterisk, the most powerful open source PBX. |
| | LinkBack | Thread Tools | Rate Thread | Display Modes |
| |||
| 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@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 |
| |||
| HI Thanks for the reply, I have a file called a.out in the agi-bin directory. I replaced in extension.conf file and tried to run with the following line exten => 1234,1,Answer() exten => 1234,2,AGI(a.out) The script is running. Regards Karthik |
| |||
| Hi I worked out with renaming the file also. I would like to address one more difficulty when i make outboud call using ITSP account. The problem is that i couldnot get connected to the other party. My sip.conf file [sipprovider-out] username = my username secret= mypassword host= sip provider.com from domain = sip provider.com qualify = yes insecure= very nat=no disallow = all allow = ulaw allow = alaw allow = ilbc allow = g729 context = mycontext [1234] username = karthik secret = passdaword host = dynamic disallow = all allow = ulaw allow = alaw allow = ilbc allow = g729 context = mycontext My extensions.conf [mycontext] exten => _0.,1,Dial(SIP/${EXTEN:1}@sipprovider-out,20,r) exten => _0.,2,Hangup() My dial string from my asterisk console dial 01234654789@mycontext the output which i got in asterisk console Executing -----------> Dial(123456789@sipprovider-out) Called -------------> 123456789 Afterwhich i could hear the ringing sound for about 20 seconds Then it replied as "no bodypicked up in 20 seconds" Please help me Thanks in advance Regards Karthik |
| | |
| |||
| Hi Please ignore my previous mail. I would like to address one more difficulty when i make outboud call using ITSP account. The problem is that i couldnot get connected to the other party. My sip.conf file [sipprovider-out] type =friend username = my username secret= mypassword host= sip provider.com from domain = sip provider.com qualify = yes insecure= very nat=no disallow = all allow = ulaw allow = alaw allow = ilbc allow = g729 context = mycontext [1234] type =friend username = karthik secret = passdaword host = dynamic disallow = all allow = ulaw allow = alaw allow = ilbc allow = g729 context = mycontext My extensions.conf [mycontext] exten => _0.,1,Dial(SIP/${EXTEN:1}@sipprovider-out,20,r) exten => _0.,2,Hangup() My dial string from my asterisk console dial 01234654789@mycontext the output which i got in asterisk console Executing -----------> Dial(123456789@sipprovider-out) Called -------------> 123456789 Afterwhich i could hear the ringing sound for about 20 seconds Then it replied as "no bodypicked up in 20 seconds" Please help me Thanks in advance Regards Karthik |
| |||
| Quote:
I would suggest you temporarily remove the "r" at the end of the Dial() command. From this: exten => _0.,1,Dial(SIP/${EXTEN:1}@sipprovider-out,20,r)to this: exten => _0.,1,Dial(SIP/${EXTEN:1}@sipprovider-out,20)Then, at Asterisk Command Line Interface (CLI), issue the commands: set verbose 5 sip debug peer sip provider.comwhere sip provider.com is the sip provider you specified in your "host=..." line of "sipprovider-out". What you should see when you dialout will be:
I would suggest you open a new thread instead of continuing this one. In the new thread, you need to also include information about your network configuration (behind a home router or not, type of router, which ports are forwarded, what your sip.conf has configured for localnet/externip/externhost, etc). Additionally, a copy of the SIP dialog between your Asterisk box and your VSP would be very useful as well. See ya... d.c. |
| |||
| Hi Is the way passing the destination calling number to the c script? exten => _1.,1,AGI(cscript|${EXTEN}). How should the arguments be retrieved? I could not retrieve the arguments in the c script when i use the command line arguments Please provide me some samples. I could not find any examples through googling Regards Karthik |
| |||
| http://www.voip-info.org/wiki/view/Asterisk+AGI http://www.bitflipper.ca/Documentation/agi.html I assume you know how to access command line parameters from within a C program. If not, then I would suggest you grab a copy of the Kernighan and Ritchie book The C Programming Language or a C Tutorial. See ya... d.c. Last edited by chandave : April 18th, 2007 at 05:07 AM. Reason: Fighting with the editor about displaying URLs again |
| | |
| Thread Tools | |
| Display Modes | Rate This Thread |
| |
| | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Need Offhook script for CIT200 | greenman | Linksys (Sipura) VoIP Support Forum | 0 | January 19th, 2007 01:25 PM |
| Help with AA script on SPA9000 | JoWeaver | Linksys SPA9000/SPA400 Support Forum | 0 | June 28th, 2006 03:32 PM |
| AGI and a bash script | SpaceBass | Asterisk Support Forum | 2 | May 13th, 2006 04:31 PM |
| asterisk script help | hi_reach | Asterisk Support Forum | 1 | April 7th, 2006 04:32 PM |
| dial tone script | tassos | Linksys (Sipura) VoIP Support Forum | 1 | December 14th, 2005 10:15 PM |