Jeremy Davis
2005-Feb-04 05:59 UTC
[Asterisk-Users] Microsoft RTC Client SDK with Asterisk
I'm using the the Microsoft Real-Time Communications Client API SDK using Visual Studio 6 and . NET 2003 SE to make SIP calls. Using the examples provided I can make unregistered SIP calls fine, however I am having trouble registering with Asterisk. I have to produce an XML Profile to use when registering with a registrar. The one I use is... <provision key="5B29C449-29EE-4fd8-9E3F-04AED077690E" name="Asterisk"> <user account="jmd" /> <sipsrv addr="1.0.1.7" protocol="udp" auth="basic" role="registrar"> <session party="first" type="pc2pc" /> <session party="first" type="pc2ph" /> <session party="first" type="ph2ph" /> </sipsrv> </provision> Anyway I fail to create my profile. In fact Asterisk doesn't even seem to get anything at all from my test program. Has anyone any experience using the Microsoft RTC Client that could provide an example please? TIA Jerry
Jeremy Davis
2005-Feb-08 03:27 UTC
[Asterisk-Users] Registering Microsoft RTC Client API SDK with Asterisk
Last week I asked how to register the Microsoft Real_time Communications Client with Asterisk. No replys came, however I managed to figure it out myself. I thought I'd just post the solution for anyone else in the future wanting to do the same. Regards Jerry CString gXMLProfile = "\ <provision key=\"5B29C449-29EE-4fd8-9E3F-04AED077690E\"\n\ name=\"Asterisk\">\n\ \n\ <user account=\"username\"\n\ uri=\"username\"\ />\n\ \n\ <sipsrv addr=\"Asterisk_Address\"\n\ protocol=\"udp\"\n\ auth=\"digest\"\n\ role=\"registrar\">\n\ <session party=\"first\" type=\"pc2ph\" />\n\ </sipsrv>\n\ \n\ </provision>\n"; IRTCClient2 *g_pClient = NULL; BSTR bstrXMLProfile; HRESULT hr = E_FAIL; // initialize COM. hr = CoInitialize(NULL); if (FAILED(hr)) { TRACE("CoInitialize failed:hr=%x\n", hr); return; } // Create the RTC client hr = CoCreateInstance( __uuidof(RTCClient), NULL, CLSCTX_INPROC_SERVER, __uuidof(IRTCClient2), (LPVOID *)&g_pClient ); if (FAILED(hr)) { TRACE("CoCreateInstance failed: hr=%x\n", hr); return; } hr = g_pClient->Initialize(); if (hr != S_OK) TRACE("Unable to initialise\n"); else { TRACE("Hello, RTC!\n"); TRACE("\nXML Schema = \n%s\n", gXMLProfile); IRTCClientProvisioning *pIRTCClientProvisioning = NULL; IRTCProfile *pIRTCProfile = NULL; bstrXMLProfile = gXMLProfile.AllocSysString(); // Perform QI for the Provisioning interface. hr = g_pClient->QueryInterface(IID_IRTCClientProvisioning, reinterpret_cast<void **>(&pIRTCClientProvisioning)); // If (hr != S_OK), process the error here. if (hr != S_OK) TRACE("QueryInterface failed\n"); else { // Create the Profile object. hr = pIRTCClientProvisioning->CreateProfile(bstrXMLProfile, &pIRTCProfile); // If (hr != S_OK), process the error here. if (hr != S_OK) TRACE("CreateProfile failed 0x%X\n", hr); else { // Enable the Profile and Register. hr = pIRTCClientProvisioning->EnableProfile(pIRTCProfile, RTCRF_REGISTER_ALL); // If (hr != S_OK), process the error here. if (hr != S_OK) { TRACE("Enable Profile failed\n"); } else { TRACE("ALL OK\n"); } } } }