本文整理汇总了C++中Endpoint::libCreate方法的典型用法代码示例。如果您正苦于以下问题:C++ Endpoint::libCreate方法的具体用法?C++ Endpoint::libCreate怎么用?C++ Endpoint::libCreate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Endpoint
的用法示例。
在下文中一共展示了Endpoint::libCreate方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mainProg3
void mainProg3() throw(Error)
{
Endpoint ep;
// Create library
ep.libCreate();
// Init library
EpConfig ep_cfg;
ep.libInit( ep_cfg );
// Start library
ep.libStart();
std::cout << "*** PJSUA2 STARTED ***" << std::endl;
// Create player and recorder
{
AudioMediaPlayer amp;
amp.createPlayer("../../tests/pjsua/wavs/input.16.wav");
AudioMediaRecorder amr;
amr.createRecorder("recorder_test_output.wav");
amp.startTransmit(ep.audDevManager().getPlaybackDevMedia());
amp.startTransmit(amr);
pj_thread_sleep(5000);
}
ep.libDestroy();
}
示例2: main
int main()
{
int ret = 0;
Endpoint ep;
try {
ep.libCreate();
mainProg3(ep);
ret = PJ_SUCCESS;
} catch (Error & err) {
std::cout << "Exception: " << err.info() << std::endl;
ret = 1;
}
try {
ep.libDestroy();
} catch(Error &err) {
std::cout << "Exception: " << err.info() << std::endl;
ret = 1;
}
if (ret == PJ_SUCCESS) {
std::cout << "Success" << std::endl;
} else {
std::cout << "Error Found" << std::endl;
}
return ret;
}
示例3: mainProg
void mainProg() throw(Error)
{
Endpoint ep;
// Create library
ep.libCreate();
string json_str;
{
JsonDocument jdoc;
AccountConfig accCfg;
accCfg.idUri = "\"Just Test\" <sip:[email protected]>";
accCfg.regConfig.registrarUri = "sip:pjsip.org";
SipHeader h;
h.hName = "X-Header";
h.hValue = "User header";
accCfg.regConfig.headers.push_back(h);
accCfg.sipConfig.proxies.push_back("<sip:sip.pjsip.org;transport=tcp>");
accCfg.sipConfig.proxies.push_back("<sip:sip.pjsip.org;transport=tls>");
accCfg.mediaConfig.transportConfig.tlsConfig.ciphers.push_back(1);
accCfg.mediaConfig.transportConfig.tlsConfig.ciphers.push_back(2);
accCfg.mediaConfig.transportConfig.tlsConfig.ciphers.push_back(3);
AuthCredInfo aci;
aci.scheme = "digest";
aci.username = "test";
aci.data = "passwd";
aci.realm = "*";
accCfg.sipConfig.authCreds.push_back(aci);
jdoc.writeObject(accCfg);
json_str = jdoc.saveString();
std::cout << "Original:" << std::endl;
std::cout << json_str << std::endl << std::endl;
}
{
JsonDocument rdoc;
rdoc.loadString(json_str);
AccountConfig accCfg;
rdoc.readObject(accCfg);
JsonDocument wdoc;
wdoc.writeObject(accCfg);
json_str = wdoc.saveString();
std::cout << "Parsed:" << std::endl;
std::cout << json_str << std::endl << std::endl;
}
ep.libDestroy();
}
示例4: mainProg2
void mainProg2() throw(Error)
{
Endpoint ep;
// Create library
ep.libCreate();
string json_str;
{
EpConfig epCfg;
JsonDocument jDoc;
epCfg.uaConfig.maxCalls = 61;
epCfg.uaConfig.userAgent = "Just JSON Test";
epCfg.uaConfig.stunServer.push_back("stun1.pjsip.org");
epCfg.uaConfig.stunServer.push_back("stun2.pjsip.org");
epCfg.logConfig.filename = "THE.LOG";
jDoc.writeObject(epCfg);
json_str = jDoc.saveString();
std::cout << json_str << std::endl << std::endl;
}
{
EpConfig epCfg;
JsonDocument rDoc;
string output;
rDoc.loadString(json_str);
rDoc.readObject(epCfg);
JsonDocument wDoc;
wDoc.writeObject(epCfg);
json_str = wDoc.saveString();
std::cout << json_str << std::endl << std::endl;
wDoc.saveFile("jsontest.js");
}
{
EpConfig epCfg;
JsonDocument rDoc;
rDoc.loadFile("jsontest.js");
rDoc.readObject(epCfg);
pj_file_delete("jsontest.js");
}
ep.libDestroy();
}
示例5: prm
static void mainProg1() throw(Error)
{
Endpoint ep;
// Create library
ep.libCreate();
// Init library
EpConfig ep_cfg;
ep_cfg.logConfig.level = 4;
ep.libInit( ep_cfg );
// Transport
TransportConfig tcfg;
tcfg.port = 5060;
ep.transportCreate(PJSIP_TRANSPORT_UDP, tcfg);
// Start library
ep.libStart();
std::cout << "*** PJSUA2 STARTED ***" << std::endl;
// Add account
AccountConfig acc_cfg;
acc_cfg.idUri = "sip:[email protected]";
acc_cfg.regConfig.registrarUri = "sip:pjsip.org";
acc_cfg.sipConfig.authCreds.push_back( AuthCredInfo("digest", "*",
"test1", 0, "test1") );
std::auto_ptr<MyAccount> acc(new MyAccount);
acc->create(acc_cfg);
pj_thread_sleep(2000);
// Make outgoing call
Call *call = new MyCall(*acc);
acc->calls.push_back(call);
CallOpParam prm(true);
prm.opt.audioCount = 1;
prm.opt.videoCount = 0;
call->makeCall("sip:[email protected]", prm);
// Hangup all calls
pj_thread_sleep(8000);
ep.hangupAllCalls();
pj_thread_sleep(4000);
// Destroy library
std::cout << "*** PJSUA2 SHUTTING DOWN ***" << std::endl;
}
示例6: handleEndpoint
void MyCppinterface::handleEndpoint()
{
int ret = 0;
Endpoint ep;
// create
try {
ep.libCreate();
} catch (Error & err) {
cout << "Exception: " << err.info() << endl;
ret = 1;
}
// init
EpConfig ep_cfg;
ep_cfg.logConfig.level = 5;
ep_cfg.uaConfig.maxCalls = 4;
// ep_cfg.mediaConfig.sndClockRate = 16000;
try {
ep.libInit(ep_cfg);
} catch (Error &err) {
cout << "Initialization error: " << err.info() << endl;
}
// config
try {
TransportConfig tcfg;
tcfg.port = 5060;
TransportId tid = ep.transportCreate(PJSIP_TRANSPORT_UDP, tcfg);
cout << "tid is----" << tid << endl;
} catch(Error& err) {
cout << "Transport creation error: " << err.info() << endl;
}
// start
try {
ep.libStart();
} catch(Error& err) {
cout << "Startup error: " << err.info() << endl;
}
}