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");
}
}
} }
_______________________________________________
Asterisk-Users mailing list
[email protected]
http://lists.digium.com/mailman/listinfo/asterisk-users
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users
