This program is a very simple usage example of liblinphone.
More...
This program is a very simple usage example of liblinphone.
It just takes a sip-uri as first argument and attempts to call it
#include "linphone/core.h"
#include <signal.h>
static bool_t running = TRUE;
static void stop(int signum) {
running = FALSE;
}
switch (cstate) {
case LinphoneCallOutgoingRinging:
printf("It is now ringing remotely !\n");
break;
case LinphoneCallOutgoingEarlyMedia:
printf("Receiving some early media\n");
break;
case LinphoneCallConnected:
printf("We are connected !\n");
break;
case LinphoneCallStreamsRunning:
printf("Media streams established !\n");
break;
case LinphoneCallEnd:
printf("Call is terminated.\n");
break;
case LinphoneCallError:
printf("Call failure !");
break;
default:
printf("Unhandled notification %i\n", cstate);
}
}
int main(int argc, char *argv[]) {
const char *dest = NULL;
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);
}
while (running) {
ms_usleep(50000);
}
printf("Terminating the call...\n");
}
end:
printf("Shutting down...\n");
printf("Exited\n");
return 0;
}