This program is a very simple usage example of liblinphone, demonstrating how to initiate SIP subscriptions and receive notifications from a sip uri identity passed from the command line.
More...
This program is a very simple usage example of liblinphone, demonstrating how to initiate SIP subscriptions and receive notifications from a sip uri identity passed from the command line.
Argument must be like sip:jehan.nosp@m.@sip.nosp@m..linp.nosp@m.hone.nosp@m..org .
ex budy_list sip:jehan.nosp@m.@sip.nosp@m..linp.nosp@m.hone.nosp@m..org
Subscription is cleared on SIGINT
#include "linphone/core.h"
#include <signal.h>
static bool_t running=TRUE;
static void stop(int signum){
running=FALSE;
}
if (friend_address != NULL) {
printf("New state state [%s] for user id [%s] \n"
,activity_str
,str);
ms_free(str);
}
}
if (friend_address != NULL) {
printf(" [%s] wants to see your status, accepting\n", str);
ms_free(str);
}
linphone_core_add_friend(lc,friend);
}
printf("New registration state %s for user id [%s] at proxy [%s]"
,linphone_proxy_config_get_addr(cfg));
}
int main(int argc, char *argv[]){
char* dest_friend=NULL;
char* identity=NULL;
char* password=NULL;
if (argc>1){
dest_friend=argv[1];
}
if (argc>2){
identity=argv[2];
}
if (argc>3){
password=argv[3];
}
signal(SIGINT,stop);
#ifdef DEBUG_LOGS
linphone_core_enable_logs(NULL);
#endif
if (identity != NULL) {
if (from==NULL){
printf("%s not a valid sip uri, must be like sip:toto@sip.linphone.org \n",identity);
goto end;
}
if (password!=NULL){
}
do {
ms_usleep(100000);
}
}
if (dest_friend) {
if (my_friend == NULL) {
printf("bad destination uri for friend [%s]\n",dest_friend);
goto end;
}
linphone_core_add_friend(lc,my_friend);
}
while(running){
ms_usleep(50000);
}
end:
printf("Shutting down...\n");
printf("Exited\n");
return 0;
}