update rtt tutorials

This commit is contained in:
Jehan Monnier 2015-08-01 18:37:18 +02:00
parent 803d2052a1
commit 3dff4de12e
2 changed files with 17 additions and 19 deletions

View file

@ -1,8 +1,7 @@
/*
linphone
Copyright (C) 2010 Belledonne Communications SARL
(simon.morlat@linphone.org)
Copyright (C) 2015 Belledonne Communications SARL
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
@ -22,10 +21,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
/**
* @defgroup real_time_text Real Time Text Receiver
* @ingroup tutorials
This program is a _very_ simple usage example of liblinphone.
It just takes a sip-uri as first argument and attempts to call it
This program is able to receive chat message in real time on port 5060. Use realtimetext_sender to generate chat message
usage: ./realtimetext_receiver
@include helloworld.c
@include realtimetext_sender.c
*/
#ifdef IN_LINPHONE
#include "linphonecore.h"
@ -74,9 +73,8 @@ static void message_received(LinphoneCore *lc, LinphoneChatRoom *room, Linphone
*/
static void is_composing_received(LinphoneCore *lc, LinphoneChatRoom *room) {
LinphoneCall *call = linphone_chat_room_get_call(room); /*get corresponding call*/
uint32_t received_char;
if (call && linphone_call_params_realtime_text_enabled(linphone_call_get_current_params(call))) /*check if realtime text enabled for this call*/
printf("%c",received_char=linphone_chat_room_get_char(room));
printf("%c",linphone_chat_room_get_char(room));
/*else ignored*/
}
@ -95,9 +93,9 @@ int main(int argc, char *argv[]){
All are optional. Here we only use the call_state_changed callbacks
in order to get notifications about the progress of the call.
*/
vtable.call_state_changed=call_state_changed;
vtable.message_received=message_received;
vtable.is_composing_received=is_composing_received;
vtable.call_state_changed=call_state_changed; /*to receive incoming call*/
vtable.message_received=message_received; /*to receive committed messages*/
vtable.is_composing_received=is_composing_received; /*to receive char in real time*/
/*
Instanciate a LinphoneCore object given the LinphoneCoreVTable
*/

View file

@ -1,8 +1,7 @@
/*
linphone
Copyright (C) 2010 Belledonne Communications SARL
(simon.morlat@linphone.org)
Copyright (C) 2015 Belledonne Communications SARL
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
@ -20,12 +19,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/**
* @defgroup basic_call_tutorials Real Time Text Sender
* @defgroup real_time_text Real Time Text Sender
* @ingroup tutorials
This program is a _very_ simple usage example of liblinphone.
It just takes a sip-uri as first argument and attempts to call it
This program just send chat message in real time to dest uri. Use realtimetext_receiver to receive message.
usage: ./realtimetext_sender sip:localhost:5060
@include helloworld.c
@include realtimetext_sender.c
*/
#ifdef IN_LINPHONE
#include "linphonecore.h"
@ -94,7 +94,7 @@ int main(int argc, char *argv[]){
linphone_core_iterate(lc);
ms_usleep(50000);
}
/*check if call is establised*/
/*check if call is established*/
switch (linphone_call_get_state(call)) {
case LinphoneCallError:
case LinphoneCallReleased:
@ -112,7 +112,7 @@ int main(int argc, char *argv[]){
/* main loop for sending message and doing background linphonecore work: */
while(running){
char character;
system ("/bin/stty raw"); /*to disable buffing*/
system ("/bin/stty raw"); /*to disable terminal buffering*/
character = getchar();
system ("/bin/stty cooked");
if (character==0x03) {/*CTRL C*/
@ -126,7 +126,7 @@ int main(int argc, char *argv[]){
chat_message = linphone_chat_room_create_message(chat_room,""); /*create an empty message*/
}
if (character == '\r') {
/*new line, commiting message*/
/*new line, committing message*/
linphone_chat_room_send_chat_message(chat_room,chat_message);
chat_message = NULL; /*reset message*/
} else {