linphone-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Linphone-users] How to control linphonec with other aplication? pip


From: Sander de Bruijne
Subject: Re: [Linphone-users] How to control linphonec with other aplication? pipes?
Date: Thu, 16 Oct 2008 21:13:42 +0200
User-agent: Thunderbird 2.0.0.17 (X11/20080925)

Hi Samuel,

You can write a small script in Perl which executes linphonec though the Perl module Expect. This way, you can monitor the output of linphonec and watch for status messages. If you use the Perl module Thread, you can start a new thread which waits for new commands received via a socket, which you can open via the Perl module IO::Socket. The Perl script can send the received commands via Expect to linphonec. This way, you can easily integrate linphonec in your application, without modifying linphonec, so you won't violate the GPL and you can easily upgrade linphone without modifying the code again and again. The overhead is minimal and this is easy to setup.

Sander

Samuel Ayet San Andres wrote:
Hi all,

I have been testing many things and I have solved the problem and you dont need
to do nothing to control linphonec with other app (just pipes...). You can
control linphonec trhu other app with just a pipe. It´s more easy than I
think!!! For example (dumy example), I want than linphonec shows every 1 second
the proxy list and I want that a program called 'hello' controls linpehonec to
do it.

- Here we have the hello.c program:

#include <stdio.h>

int main(){
    while(1){
      usleep(100000);        // Pause for 1 second
      printf("proxy list\n");  // write in stdout any comand followed by '\n'
that is the INTRO(then we will redirect this to the input of the pipe)
      fflush(NULL);          // Flush the stdout (if you don´t do this you will
have to waint until the pipe is full and then make an autoflush)
    }
}

- We compile it

gcc hello.c -o hello

- And now we use pipes!!! and this is just:

bash> ./hello | linphonec


That´s all!!! The problem I had is that i didn´t use fflush so until the pipe
was full I didn´t saw the result on the screen... Tahnk you for all!!!







_______________________________________________
Linphone-users mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/linphone-users





reply via email to

[Prev in Thread] Current Thread [Next in Thread]