linphone-users
[Top][All Lists]
Advanced

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

[Linphone-users] I: Output of linphonec is not delivered as expected if


From: Davide Conforti
Subject: [Linphone-users] I: Output of linphonec is not delivered as expected if redirected
Date: Wed, 25 Nov 2015 19:31:51 +0100

Hello,

 

is there any news about this?

 

No one is expering the same issue?

 

 

Thank you in advance.

 


Da: Davide Conforti
Inviato: martedì 17 novembre 2015 12:38
A: address@hidden
Oggetto: Output of linphonec is not delivered as expected if redirected

 

 

Hello,


I'm using linphonec in Windows 10 along with visual studio professional 2015, using the code below.

 

Everything work really well, except from keeping all cmd outputs.

// START
public main()
{
    // Create the process info
    ProcessStartInfo startInfo = new ProcessStartInfo(@"c:\linphone\bin\linphonec.exe");
    startInfo.UseShellExecute = false;
    startInfo.RedirectStandardOutput = true;
    startInfo.RedirectStandardError = true;

    // Create the process info
    Process process = new Process();
    process.StartInfo = startInfo;
    process.OutputDataReceived += CaptureOutput;
    process.ErrorDataReceived += CaptureError;
}

static void CaptureOutput(object sender, DataReceivedEventArgs e)
{
    ShowOutput(e.Data, ConsoleColor.Green);
}
 
static void CaptureError(object sender, DataReceivedEventArgs e)
{
    ShowOutput(e.Data, ConsoleColor.Red);
}
 
static void ShowOutput(string data, ConsoleColor color)
{
    if (data != null)
    {
        ConsoleColor oldColor = Console.ForegroundColor;
        Console.ForegroundColor = color;
        Console.WriteLine("Received: {0}", data);
        Console.ForegroundColor = oldColor;
    }
}

process.Start();
process.BeginOutputReadLine();
process.BeginErrorReadLine();

// END

I can't understand why, but some of the output won't be raised, and I can't manage the result of the operations to do what i need.

In particular, when a call is incoming, linphonec put two line of output:
 1. The first one is telling that someone is calling
 2. The second one is telling that to the incoming call will be attacched the id "x" where x is the id of the call.

The second line of that output is fired only when you close the process, i can't figure out on how to get this line during process work, and i need it to manage the answer or decline with the given id.

So for completion here below the grep of the output from cmd with my comments:

 

     INPUT --> linphonec > output.txt

Ready

linphonec> Refreshing on sip:address@hidden

linphonec> Refreshing on sip:address@hidden

linphonec> Registration on <sip:address@hidden;transport=udp> successful.

linphonec> Registration on <sip:address@hidden;transport=tcp> successful.

     CALLING FROM A LINPHONE FOR ANDROID WITH ADDRESS SIP:101

linphonec> sip:address@hidden is contacting you.

     INPUT (after two or three seconds from the android call begin) --> quit

linphonec> Call ended

linphonec> Unregistration on <sip:address@hidden;transport=udp> done.

linphonec> Unregistration on <sip:address@hidden;transport=tcp> done.

linphonec> Warning: video is disabled in linphonec, use -V or -C or -D to enable.

     THIS BELOW IS THE LINE I NEED, THAT SEEMS TO BE FIRED ALWAYS AFTER QUIT

Receiving new incoming call from sip:address@hidden, assigned id 1        

Terminating...

Call 1 with sip:address@hidden ended (Call declined).

 

 

I think that the stream of the output in c# is managed differently from other languages, but i really googled a lot and haven't found anything useful (i've altered the c# code, taking the output in different ways, but without luck) to solve this.

 

Please note that if i run the linphonec from cmd without redirecting output, all the lines are correctly showed in the expected order.

 

Your help is really appreciated! 


Thank you in advance and best regards.

Fin3

 

 


reply via email to

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