[Freeswitch-users] Sound not OK (Choppy Sound) while using ManagedSession (.NET/C#)

Durmuş Ali Öztürk ali.stgt at gmail.com
Wed Jul 7 05:03:11 PDT 2010


Hello,

I have successfully entegrated a dll-module (written udner .Net / c#)
in fs which is loadable by the mod_managed component.

Now, if I try to stream a wav file to the callee then the sound is
very poor and choppy (also the file is played slower).

The fs is running under Windows XP and tested under Windows 2003 with
the same result.

Streaming by using FreeSWITCH.Native.Api() works without problems,
sound is perfect.

Samples which I have tried:



1 - This works fine but delegate mechanism is missing there:

FreeSWITCH.Native.Api fsApi = new FreeSWITCH.Native.Api();

string uuid = fsApi.ExecuteString("create_uuid");
string apiResult = fsApi.Execute("originate",
string.Format("{{ignore_early_media=false,absolute_codec_string='PCMU'}}[origination_uuid={0},origination_caller_id_number={1}]sofia/gateway/Test/{2}
&&playback({3}", uuid, callerID, phoneNumber, wavFile));




2 - ManagedSession is integrated but we have sound problems:

FreeSWITCH.Native.Api fsApi = new FreeSWITCH.Native.Api();

string uuid = fsApi.ExecuteString("create_uuid");

string apiResult = fsApi.Execute("originate",
string.Format("{{ignore_early_media=false,absolute_codec_string='PCMU'}}[origination_uuid={0},origination_caller_id_number={1}]sofia/gateway/Test/{2}
&park", uuid, callerID, phoneNumber));

FreeSWITCH.Native.ManagedSession blegSession = new
FreeSWITCH.Native.ManagedSession(uuid);

if (blegSession.IsAvailable)
{
    while (!blegSession.answered())
        {
        blegSession.sleep(500, 1);
    }

        if (blegSession.Ready() && blegSession.mediaReady())
        {
        //blegSession.Answer();
        //blegSession.Execute("playback",wavFile);
                blegSession.StreamFile(wavFile, 0);
        }

        blegSession.Hangup("Normal call clearing");
}




Is there a mistake in my code or do I have forgotten something? Can
you support me with some examples?


Another issue is, that I am not able to make a origination directly by
ManagedSession or CoreSession without using the
FreeSWITCH.Native.Api(). How can I create an instance of a CoreSession
object?


Many thanks for you help in advance.

Ali



More information about the FreeSWITCH-users mailing list