[asterisk-users] asterisk-users Digest, Vol 51, Issue 51

Norman Franke norman at myasd.com
Thu Oct 16 10:23:52 CDT 2008


On Oct 16, 2008, at 2:36 AM, asterisk-users-request at lists.digium.com  
wrote:

> I want to call an extension like 88888 and invoke an external C  
> program upon
> calling, pass an constant integer like 1 to the C program.
>
> What I have done is:
>
> /etc/extensions.conf:
> exten => 88888,1,system(/usr/local/src/parallel/fire 1)
> exten => 88888,n, Dial(SIP/88888)
> exten => 88888,n,Hangup
>
> the C program under /usr/local/src/parallel/fire will wait for the  
> input, if
> it's 1 external LED light will be on, if it's 0 LED light will be off.
>
> I have changed the file ownership and group since my asterisk user is
> asterisk (with freepbx):
>
> [root at Fire-Station parallel]# ls -l fire*
> -rwxrwxrwx  1 asterisk asterisk 5882 Oct 16 09:18 fire
> -rw-rw-rw-  1 asterisk asterisk 2793 Oct 15 22:25 fire.c
>
>
> If I run the program separately everything is fine:
> ...
> However if I call to 88888 I can see it execute the system command  
> but it
> doesn't output an integer 1 to my 'fire' program.
>
> CLI:
> -- Executing System("SIP/10-09a63138", "/usr/local/src/parallel/fire  
> 1") in
> new stack
>
> Any ideas on this or I shouldn't use System() at all?


I do something similar, e.g.

exten => xxx,1,Answer()
exten => xxx,2,System(/usr/local/bin/door 1000 ${EXTEN:3})

It works great for me using Asterisk 1.4.19. If your app relies on  
some elements of the user environment it may not find that. Try just a  
simple application that writes the input to a file, e.g. /tmp/output  
and see if that works. Maybe the asterisk process can't open your  
parallel port? I'm using a USB-based device for digital IO and that  
works great.

Norman Franke
Answering Service for Directors, Inc.
www.myasd.com





More information about the asterisk-users mailing list