Loading Makefile +2 −2 Original line number Diff line number Diff line CXX = g++ CXXFLAGS = -Wall -g -std=c++14 -MD CXXFLAGS = -Wall -g -std=c++14 -MD -fPIC $(shell pkg-config --cflags libpjproject) LIBS = -lpthread -lrt LIBS = -lrt $(shell pkg-config --libs libpjproject) SRCS = $(wildcard src/*.cpp) Loading src/account.cpp 0 → 100644 +29 −0 Original line number Diff line number Diff line /** * This file is part of 3phone * Copyright (C) 2015 Gabriel Margiani * * 3phone is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * 3phone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with 3phone. If not, see <http://www.gnu.org/licenses/>. **/ #include "account.h" p3::account::account() {}; p3::account::~account() {}; void p3::account::onRegState(pj::OnRegStateParam &prm) { } void p3::account::onIncomingCall(pj::OnIncomingCallParam &iprm) { } src/account.h +2 −2 Original line number Diff line number Diff line Loading @@ -25,8 +25,8 @@ namespace p3 { class account : public pj::Account { public: account() {}; ~account() {}; account(); ~account(); virtual void onRegState(pj::OnRegStateParam &prm); virtual void onIncomingCall(pj::OnIncomingCallParam &iprm); Loading src/call.cpp +20 −2 Original line number Diff line number Diff line Loading @@ -17,15 +17,33 @@ **/ #include "call.h" #include "sipphone.h" p3::call::call(p3::account &acc, int call_id) : Call(acc, call_id) { } p3::call::call(p3::sipphone &p, p3::account &acc, int call_id) : Call(acc, call_id), phone(p) {} p3::call::~call() { } void p3::call::onCallState(pj::OnCallStateParam& prm) { pj::CallInfo ci = getInfo(); if (ci.state == PJSIP_INV_STATE_DISCONNECTED) { phone.delete_call(getId()); } } void p3::call::onCallMediaState(pj::OnCallMediaStateParam& prm) { pj::CallInfo ci = getInfo(); for (unsigned i = 0; i < ci.media.size(); i++) { if (ci.media[i].type==PJMEDIA_TYPE_AUDIO && getMedia(i)) { pj::AudioMedia *aud_med = static_cast<pj::AudioMedia*>(getMedia(i)); pj::AudDevManager& mgr = pj::Endpoint::instance().audDevManager(); aud_med->startTransmit(mgr.getPlaybackDevMedia()); mgr.getCaptureDevMedia().startTransmit(*aud_med); } } } src/call.h +6 −1 Original line number Diff line number Diff line Loading @@ -24,9 +24,14 @@ #include "account.h" namespace p3 { class sipphone; class call : public pj::Call { p3::sipphone & phone; public: call(p3::account& acc, int call_id = PJSUA_INVALID_ID); call(sipphone& p, account& acc, int call_id = PJSUA_INVALID_ID); ~call(); Loading Loading
Makefile +2 −2 Original line number Diff line number Diff line CXX = g++ CXXFLAGS = -Wall -g -std=c++14 -MD CXXFLAGS = -Wall -g -std=c++14 -MD -fPIC $(shell pkg-config --cflags libpjproject) LIBS = -lpthread -lrt LIBS = -lrt $(shell pkg-config --libs libpjproject) SRCS = $(wildcard src/*.cpp) Loading
src/account.cpp 0 → 100644 +29 −0 Original line number Diff line number Diff line /** * This file is part of 3phone * Copyright (C) 2015 Gabriel Margiani * * 3phone is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * 3phone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with 3phone. If not, see <http://www.gnu.org/licenses/>. **/ #include "account.h" p3::account::account() {}; p3::account::~account() {}; void p3::account::onRegState(pj::OnRegStateParam &prm) { } void p3::account::onIncomingCall(pj::OnIncomingCallParam &iprm) { }
src/account.h +2 −2 Original line number Diff line number Diff line Loading @@ -25,8 +25,8 @@ namespace p3 { class account : public pj::Account { public: account() {}; ~account() {}; account(); ~account(); virtual void onRegState(pj::OnRegStateParam &prm); virtual void onIncomingCall(pj::OnIncomingCallParam &iprm); Loading
src/call.cpp +20 −2 Original line number Diff line number Diff line Loading @@ -17,15 +17,33 @@ **/ #include "call.h" #include "sipphone.h" p3::call::call(p3::account &acc, int call_id) : Call(acc, call_id) { } p3::call::call(p3::sipphone &p, p3::account &acc, int call_id) : Call(acc, call_id), phone(p) {} p3::call::~call() { } void p3::call::onCallState(pj::OnCallStateParam& prm) { pj::CallInfo ci = getInfo(); if (ci.state == PJSIP_INV_STATE_DISCONNECTED) { phone.delete_call(getId()); } } void p3::call::onCallMediaState(pj::OnCallMediaStateParam& prm) { pj::CallInfo ci = getInfo(); for (unsigned i = 0; i < ci.media.size(); i++) { if (ci.media[i].type==PJMEDIA_TYPE_AUDIO && getMedia(i)) { pj::AudioMedia *aud_med = static_cast<pj::AudioMedia*>(getMedia(i)); pj::AudDevManager& mgr = pj::Endpoint::instance().audDevManager(); aud_med->startTransmit(mgr.getPlaybackDevMedia()); mgr.getCaptureDevMedia().startTransmit(*aud_med); } } }
src/call.h +6 −1 Original line number Diff line number Diff line Loading @@ -24,9 +24,14 @@ #include "account.h" namespace p3 { class sipphone; class call : public pj::Call { p3::sipphone & phone; public: call(p3::account& acc, int call_id = PJSUA_INVALID_ID); call(sipphone& p, account& acc, int call_id = PJSUA_INVALID_ID); ~call(); Loading