Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

How to Build a .NET Softphone in C# with SIP, SDP, RTP and RTCP

, 18 Mar 2011 CPOL
Essay and tutorial about how to easily build a softphone application

Editorial Note

This article appears in the Third Party Products and Tools section. Articles in this section are for the members only and must not be used to promote or advertise products in any way, shape or form. Please report any spam or advertising.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Timers;
using VoIP;
//using VoIP;

namespace FunnyPhone
{
    class PongCallListener : IPhoneCallListener
    {
        public void DtmfReceived(object sender, VoIPEventArgs<DTMF> e)
        {
            var dtmf = e.Item;
            var call = (PhoneCall)sender;
            Console.WriteLine("Dtmf received");
            call.SendDTMFSignal(VoIPMediaType.Audio, e.Item);
        }

        public void CallErrorOccured(object sender, VoIPEventArgs<CallError> e)
        {
            var call = (PhoneCall)sender;
            Console.WriteLine("Call error occured: " + e.Item);
        }

        public void MediaDataReceived(object sender, VoIPEventArgs<VoIPMediaData> e)
        {
            var call = (PhoneCall)sender;
            call.SendMediaData(e.Item.MediaType, e.Item.PCMData);
        }

        public void CallStateChanged(object sender, VoIPEventArgs<CallState> e)
        {
            var call = (PhoneCall)sender;
            Console.WriteLine("Call state changed: " + e.Item);

            if (e.Item > CallState.InCall)
                call.DetachListener(this);
        }

        public void PlainMediaDataReceived(object sender, VoIPEventArgs<EncodedMediaData> e)
        {
        }

    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

No Biography provided

| Advertise | Privacy | Mobile
Web03 | 2.8.141022.2 | Last Updated 18 Mar 2011
Article Copyright 2011 by Esteban Murandi
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid