473,378 Members | 1,493 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 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 1579

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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.