472,989 Members | 2,983 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,989 software developers and data experts.

How to set TLS security using RTC API's

Hi,

I am developing simple peer-peer RTC application for monitoring the SDP packets and i need to set the TLS security for the transport.
But iam struggling to achieving this.

Iam using IP addresses as SIP URI for communication.

I am using IRTCClientProvisioning::GetProfile()
IRTCClientProfile::EnablePrsenceEx()
IRTCClientProvisioning::EnableProfileEx()
But iam not able to establish a connection between 2 endpoints as iam not able to register to the server.

This is the code snippet :

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using RTCCORELib;
using System.Xml;
using System.Xml.Serialization;

namespace RTC_1._api
{
public partial class Form1 : Form
{
RTCClientClass _rtc = new RTCClientClass();
IRTCClientProvisioning2 userCreation;
IRTCSession _session; //To create and initializes a session of communication.
IRTCProfile userprofile; //An object for the profile of the user
IRTCClientPresence2 presence;

public Form1()
{
InitializeComponent();
}

public void RTC_IRTCEventNotification_Event_Event(RTC_EVENT RTC_event, object pEvent)
{

switch (RTC_event)
{
case RTC_EVENT.RTCE_SESSION_STATE_CHANGE:
{
IRTCSessionStateChangeEvent sessionEvent = null;
sessionEvent = (IRTCSessionStateChangeEvent)pEvent;
OnIRTCSessionStateChangeEvent(sessionEvent);
break;
}
case RTC_EVENT.RTCE_MEDIA:
{
IRTCMediaEvent mediaEvent = null;
mediaEvent = (IRTCMediaEvent)pEvent;
OnIRTCMediaEvent(mediaEvent);
break;
}
case RTC_EVENT.RTCE_MESSAGING:
{
IRTCMessagingEvent IMEvent = null;
IMEvent = (IRTCMessagingEvent)pEvent;
OnIRTCIMEvent(IMEvent);
break;
}
case RTC_EVENT.RTCE_PROFILE:
{
MessageBox.Show("RTCE_PROFILE");
IRTCProfileEvent2 profileEvent = null;
profileEvent = (IRTCProfileEvent2)pEvent;
OnProfileEvent(profileEvent);
break;
}
case RTC_EVENT.RTCE_REGISTRATION_STATE_CHANGE:
{
MessageBox.Show("RTCE_REGISTRATION_STATE_CHANGE");
IRTCRegistrationStateChangeEvent regEvent = null;
regEvent = (IRTCRegistrationStateChangeEvent)pEvent;
OnRegChangeEvent(regEvent);
break;
}
case RTC_EVENT.RTCE_CLIENT:
{
IRTCClientEvent clientEvent;
clientEvent = (IRTCClientEvent)pEvent;
OnClientEvent(clientEvent);
break;
}
}
}

private void OnClientEvent(IRTCClientEvent clientEvent)
{
RTC_CLIENT_EVENT_TYPE clientState;
clientState = clientEvent.EventType;
if (clientState == RTC_CLIENT_EVENT_TYPE.RTCCET_ASYNC_CLEANUP_DONE)
{
MessageBox.Show("srinivas akella");
}
}

private void OnRegChangeEvent(IRTCRegistrationStateChangeEvent regEvent)
{
RTC_REGISTRATION_STATE regState;
regState = regEvent.State;
switch (regState)
{
case RTC_REGISTRATION_STATE.RTCRS_REGISTERING:
MessageBox.Show("RTCRS_REGISTERING");
break;
case RTC_REGISTRATION_STATE.RTCRS_REGISTERED:
MessageBox.Show("RTCRS_REGISTERED");
break;
case RTC_REGISTRATION_STATE.RTCRS_LOGGED_OFF:
MessageBox.Show("RTCRS_LOGGED_OFF");
break;
case RTC_REGISTRATION_STATE.RTCRS_ERROR:
MessageBox.Show("RTCRS_ERROR");
break;

}

}

private void OnProfileEvent(IRTCProfileEvent2 pEvent)
{
if(pEvent.EventType == RTC_PROFILE_EVENT_TYPE.RTCPFET_PROFILE_GET)
{
if (pEvent.StatusCode == 0)
{
MessageBox.Show("1");
userprofile = (IRTCProfile)pEvent.Profile;
presence.EnablePresenceEx(userprofile, "bb", 0);
presence.SetLocalPresenceInfo(RTC_PRESENCE_STATUS. RTCXS_PRESENCE_ONLINE, null);
userCreation.EnableProfileEx(userprofile, 0x0000000F, 0x0000000F);
MessageBox.Show("1");
}

}
}
void OnIRTCIMEvent(IRTCMessagingEvent IMEvent)
{
if (IMEvent.EventType == RTC_MESSAGING_EVENT_TYPE.RTCMSET_MESSAGE)
{
string messageReceivedFromUserUri = IMEvent.Participant.UserURI;
string messageHeader =IMEvent.MessageHeader;
string message = IMEvent.Message;
MessageBox.Show(messageReceivedFromUserUri + " : " + message);

}

}
void OnIRTCSessionStateChangeEvent(IRTCSessionStateChan geEvent sessionevent)
{

RTC_SESSION_STATE sessionState;
sessionState = sessionevent.State;
switch (sessionState)
{

case RTC_SESSION_STATE.RTCSS_IDLE:
textBox3.Text = "Session is IDLE";
break;

case RTC_SESSION_STATE.RTCSS_INCOMING:

textBox3.Text = "Session is INCOMING";
//Play a ring on the local PC to alert user of incoming call.
objRTC.PlayRing(RTC_RING_TYPE.RTCRT_PHONE, true);
//Get the incoming session.
objSession = sessionevent.Session;
objSession.Answer();
break;

case RTC_SESSION_STATE.RTCSS_ANSWERING:
textBox3.Text = "Session is ANSWERING";
// Stop the ringing
objRTC.PlayRing(RTC_RING_TYPE.RTCRT_PHONE, false);
break;

case RTC_SESSION_STATE.RTCSS_INPROGRESS:
textBox3.Text = "Session is INPROGRESS";
break;

case RTC_SESSION_STATE.RTCSS_CONNECTED:
textBox3.Text = "Session is CONNECTED";
break;

case RTC_SESSION_STATE.RTCSS_DISCONNECTED:
textBox3.Text = "Session is DISCONNECTED";
objSession = null;
break;
}
}

void OnIRTCMediaEvent(IRTCMediaEvent mediaEvent)
{
RTC_MEDIA_EVENT_TYPE mediaType;
IVideoWindow videoWindow = null;

mediaType = mediaEvent.EventType;
switch (mediaType)
{
case RTC_MEDIA_EVENT_TYPE.RTCMET_STARTED:
{
videoWindow = objRTC.get_IVideoWindow(RTC_VIDEO_DEVICE.RTCVD_REC EIVE);
videoWindow.SetWindowPosition(100, 100, 400, 400);
videoWindow.Visible = 1;
textBox4.Text = "Video Window is Openend";
break;
}

case RTC_MEDIA_EVENT_TYPE.RTCMET_FAILED:
{
textBox4.Text = "Video Session is failed";
break;
}

case RTC_MEDIA_EVENT_TYPE.RTCMET_STOPPED:
{
textBox4.Text = "Video Session is closed";
videoWindow.Visible = 0;
videoWindow = null;
break;

}
}
}
RTCClientClass objRTC = new RTCClientClass();
IRTCSession objSession;
private void Connect_Click(object sender, EventArgs e)
{
userCreation = _rtc;
presence = _rtc;
_rtc.Initialize();
_rtc.SetPreferredMediaTypes(0x0000001F, true);
_rtc.EventFilter = 0x00000080 | 0x00000004 | 0x00000020 | 0x00000400 | 0x00000002;
_rtc.IRTCEventNotification_Event_Event += new IRTCEventNotification_EventEventHandler(RTC_IRTCEv entNotification_Event_Event);
_rtc.ListenForIncomingSessions = RTC_LISTEN_MODE.RTCLM_BOTH;
userCreation.GetProfile(null, null, "172.25.218.48", "172.25.218.1", 4, 0);
MessageBox.Show("Over");
}

private void CreateSession_Click(object sender, EventArgs e)
{
_session = _rtc.CreateSession(RTC_SESSION_TYPE.RTCST_PC_TO_PC , null, userprofile, 0x00000001);
_session.AddParticipant("172.25.218.144", "srinivas");

}

}
}
what could be the problem in registering the profile with the server.

how to register for a server if IP addresses are used for peer-peer communication.

I would be greatful to u if u provide any pointers.

Jun 27 '08 #1
0 1561

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Nick | last post by:
I am working on an application for a client that will involve using remoting. They do not want to use integrated security so I was going to store usernames and hashed passwords in a SQL Database. ...
2
by: Lapchien | last post by:
Is it possible to restrict usage of a command button on a form to only certain users (i'm on a windows 2000 domain) or users with membership of a domain/group..? Lap
3
by: Jefferson Cowart | last post by:
Is there any way I can have a C# program check to see if Anti-Virus software is installed using the same methods that the Windows XP SP2 security center checks. I'm writing a program that verifys a...
1
by: Danko Greiner | last post by:
Thanx Willy, this was very helpful. But i also need (and want to know) how to do this from code. Can you plase give me right topic in MSDN? is there good example? Thanx p.s. this is...
2
by: Boris Condarco | last post by:
Hi gurus, I was reading some documentation about security in .NET Framework, it mention that it is possible to make custom Role Based security for example: check the authentication with Windows...
4
by: Dean Slindee | last post by:
I would like to provide a menu item that the users can click that launches the same "Windows Security" window that doing a Ctrl+Alt+Delete launches, but thru a Process.Start. Is this possible, and...
4
by: MSSQLServerDeveloper | last post by:
I am running in a windows 2000 environment and have the following scenario / question. I have a vb.net application. Before allowing the user the go into the app, I would like to validate...
8
by: Bryan Dickerson | last post by:
The full message is: Request for permission of the type 'System.Security.Permissions.RegistryPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed. ...
3
by: michael sorens | last post by:
In the interests of increasing security, I came upon the DPAPI security library available from the GotDotNet user samples repository. What I want to do is create an applications that accesses a...
2
by: Baheri | last post by:
If I use WSE3.0 security to authenticate my user does the client need to install WSE3.0 or any other installation? Does he need to use the WSE API to send requestes to my service?How does a Java...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...
3
SueHopson
by: SueHopson | last post by:
Hi All, I'm trying to create a single code (run off a button that calls the Private Sub) for our parts list report that will allow the user to filter by either/both PartVendor and PartType. On...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.