예제 #1
0
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
0
pj_status_t AudioMediaPlayer::eof_cb(pjmedia_port *port,
                                     void *usr_data)
{
    PJ_UNUSED_ARG(port);
    AudioMediaPlayer *player = (AudioMediaPlayer*)usr_data;
    return player->onEof() ? PJ_SUCCESS : PJ_EEOF;
}
예제 #3
0
void SIPController::AddRingtones () {

	if (_RingtoneFilename.length() > 0) {
		std::string AbsolutePath = _AbsolutePath;
		std::string Ringtone = AbsolutePath.append("data/").append(_RingtoneFilename);
		if (this->FileExist(Ringtone) && _Ringtone == true) {
			AudioMediaPlayer *AudioIncomingTone = new AudioMediaPlayer();
			AudioIncomingTone->createPlayer(Ringtone);

			_SIP_Account->SetAudioPlayer(AudioIncomingTone, SIPAccount::AudioTypeIncomingCall);
		}
	}
}
예제 #4
0
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);
    }
}