This program just send chat message in real time to dest uri.
More...
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 "linphone/core.h"
#include <signal.h>
static bool_t running=TRUE;
static void stop(int signum){
running=FALSE;
}
int main(int argc, char *argv[]){
const char *dest=NULL;
LCSipTransports tp;
if (argc>1){
dest=argv[1];
}
signal(SIGINT,stop);
#ifdef DEBUG_LOGS
linphone_core_enable_logs(NULL);
#endif
if (dest){
if (call==NULL){
printf("Could not place call to %s\n",dest);
goto end;
}else printf("Call to %s is in progress...",dest);
}
ms_usleep(50000);
}
case LinphoneCallError:
case LinphoneCallReleased:
case LinphoneCallEnd:
printf("Could not place call to %s\n",dest);
goto end;
break;
default:
break;
}
while(running){
int character;
if (system ("/bin/stty raw") == -1){
ms_error("/bin/stty error");
}
character = getchar();
if (system("/bin/stty cooked") == -1){
ms_error("/bin/stty error");
}
if (character==0x03) {
running=0;
break;
}
if (character != EOF) {
if (chat_message == NULL) {
}
if (character == '\r') {
chat_message = NULL;
} else {
}
}
ms_usleep(50000);
}
printf("Terminating the call...\n");
}
end:
printf("Shutting down...\n");
printf("Exited\n");
return 0;
}