Commit e0a60bfd authored by Gabriel Margiani's avatar Gabriel Margiani
Browse files

fixed copyright year, added some more hooks.

parent c205a4a4
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
/**
 * This file is part of 3phone
 * Copyright (C) 2015 Gabriel Margiani
 * Copyright (C) 2016 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
@@ -23,6 +23,7 @@ p3::account::account(sipphone& p) : phone(p) {};
p3::account::~account() {};

void p3::account::onRegState(pj::OnRegStateParam &prm) {
	phone.handle_registration_change(prm.code);
}

void p3::account::onIncomingCall(pj::OnIncomingCallParam &iprm) {
+1 −1
Original line number Diff line number Diff line
/**
 * This file is part of 3phone
 * Copyright (C) 2015 Gabriel Margiani
 * Copyright (C) 2016 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
+9 −4
Original line number Diff line number Diff line
/**
 * This file is part of 3phone
 * Copyright (C) 2015 Gabriel Margiani
 * Copyright (C) 2016 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
@@ -44,15 +44,16 @@ void p3::call::onCallState(pj::OnCallStateParam& prm) {
	pj::CallInfo ci = getInfo();
    switch (ci.state) {
		case PJSIP_INV_STATE_DISCONNECTED:
			phone.get_event_hook().run_hook("disconnected", p3id, get_nr());
			phone.get_event_hook().run_call_hook("disconnected", p3id, get_nr());
			state = p3::callState::NONE;
			phone.delete_call(p3id);
			break;
		case PJSIP_INV_STATE_CALLING:
			phone.get_event_hook().run_call_hook("calling", p3id, get_nr());
			state = p3::callState::CALLING;
			phone.get_event_hook().run_hook("calling", p3id, get_nr());
			break;
		case PJSIP_INV_STATE_CONFIRMED:
			phone.get_event_hook().run_call_hook("confirmed", p3id, get_nr());
			state = p3::callState::RUNNING;
			if (ringing) {
				phone.stop_ringing();
@@ -61,12 +62,12 @@ void p3::call::onCallState(pj::OnCallStateParam& prm) {
			break;
		case PJSIP_INV_STATE_EARLY:
			if (ci.role == PJSIP_ROLE_UAS) {
				phone.get_event_hook().run_call_hook("incoming", p3id, get_nr());
				if (!ringing) {
					phone.start_ringing();
					ringing = true;
				}
				state = p3::callState::INCOMING;
				phone.get_event_hook().run_hook("incoming", p3id, get_nr());
			}
			break;
		case PJSIP_INV_STATE_NULL:
@@ -166,3 +167,7 @@ void p3::call::mute_toggle() {
pj::AudioMedia* p3::call::get_audio_media() {
	return aud_med;
}

void p3::call::onDtmfDigit(pj::OnDtmfDigitParam &prm) {
	phone.get_event_hook().run_call_hook("dtmf", p3id, get_nr(), prm.digit);
}
+3 −1
Original line number Diff line number Diff line
/**
 * This file is part of 3phone
 * Copyright (C) 2015 Gabriel Margiani
 * Copyright (C) 2016 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
@@ -60,6 +60,8 @@ namespace p3 {

			void onCallMediaState(pj::OnCallMediaStateParam &prm);

			void onDtmfDigit(pj::OnDtmfDigitParam &prm);

			pj::AudioMedia* get_audio_media();

			int get_id();
+2 −2
Original line number Diff line number Diff line
/**
 * This file is part of 3phone
 * Copyright (C) 2015 Gabriel Margiani
 * Copyright (C) 2016 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
@@ -73,7 +73,7 @@ p3::client::client(int ac, char *av[]) : argv(av, av+ac), interactive(false), ve

		connection = new mQueue(id, true, (verbose >= 4));
		ma.send(p3::protocol::HELLO, id);
		p3::mQueueMessage m = connection->receive(30);
		p3::mQueueMessage m = connection->receive(3);

		if (m.get_command() != p3::protocol::OK) {
			throw new p3::perror("client.connection", "cannot connect to server " + m.get_value());
Loading