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(); }
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; }
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; } }
static void mainProg3(Endpoint &ep) throw(Error) { const char *paths[] = { "../../../../tests/pjsua/wavs/input.16.wav", "../../tests/pjsua/wavs/input.16.wav", "input.16.wav"}; unsigned i; const char *filename = NULL; // Init library EpConfig ep_cfg; ep.libInit( ep_cfg ); for (i=0; i<PJ_ARRAY_SIZE(paths); ++i) { if (pj_file_exists(paths[i])) { filename = paths[i]; break; } } if (!filename) { PJSUA2_RAISE_ERROR3(PJ_ENOTFOUND, "mainProg3()", "Could not locate input.16.wav"); } // Start library ep.libStart(); std::cout << "*** PJSUA2 STARTED ***" << std::endl; // Create player and recorder { AudioMediaPlayer amp; amp.createPlayer(filename); AudioMediaRecorder amr; amr.createRecorder("recorder_test_output.wav"); amp.startTransmit(ep.audDevManager().getPlaybackDevMedia()); amp.startTransmit(amr); pj_thread_sleep(5000); } }