This program is a very simple usage example of liblinphone. Desmonstrating how to initiate a SIP registration from a sip uri identity passed from the command line. first argument must be like sip:jehan.nosp@m.@sip.nosp@m..linp.nosp@m.hone.nosp@m..org , second must be password .
ex registration sip:jehan.nosp@m.@sip.nosp@m..linp.nosp@m.hone.nosp@m..org secret
Registration is cleared on SIGINT
#include "linphone/core.h"
#include <signal.h>
static bool_t running=TRUE;
static void stop(int signum){
running=FALSE;
}
printf("New registration state %s for user id [%s] at proxy [%s]\n"
,linphone_proxy_config_get_addr(cfg));
}
int main(int argc, char *argv[]){
char* identity=NULL;
char* password=NULL;
const char* server_addr;
if (argc>1){
identity=argv[1];
}
if (argc>2){
password=argv[2];
}
signal(SIGINT,stop);
#ifdef DEBUG
#endif
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){
}
while(running){
ms_usleep(50000);
}
ms_usleep(50000);
}
end:
printf("Shutting down...\n");
printf("Exited\n");
return 0;
}
enum _LinphoneRegistrationState LinphoneRegistrationState
LinphoneRegistrationState describes proxy registration states.
const char * linphone_registration_state_to_string(LinphoneRegistrationState cs)
Human readable version of the LinphoneRegistrationState.
#define linphone_core_set_default_proxy(lc, config)
Definition: core.h:1960
struct _LinphoneCore LinphoneCore
Linphone core main object created by function linphone_core_new() .
Definition: types.h:472
LinphoneStatus linphone_proxy_config_set_server_addr(LinphoneProxyConfig *cfg, const char *server_addr)
Sets the proxy address.
const char * linphone_address_get_username(const LinphoneAddress *u)
Returns the username.
void linphone_proxy_config_edit(LinphoneProxyConfig *cfg)
Starts editing a proxy configuration.
void linphone_address_unref(LinphoneAddress *addr)
Decrement reference count of LinphoneAddress object.
LINPHONE_DEPRECATED void linphone_core_enable_logs(FILE *file)
Enable logs in supplied FILE*.
struct _LinphoneProxyConfig LinphoneProxyConfig
The LinphoneProxyConfig object represents a proxy configuration to be used by the LinphoneCore object...
Definition: types.h:940
LinphoneRegistrationState linphone_proxy_config_get_state(const LinphoneProxyConfig *cfg)
Get the registration state of the given proxy config.
struct _LinphoneAuthInfo LinphoneAuthInfo
Object holding authentication information.
Definition: types.h:231
const LINPHONE_DEPRECATED char * linphone_proxy_config_get_identity(const LinphoneProxyConfig *cfg)
void linphone_proxy_config_enable_register(LinphoneProxyConfig *cfg, bool_t val)
Indicates either or not, REGISTRATION must be issued for this LinphoneProxyConfig .
void linphone_core_add_auth_info(LinphoneCore *lc, const LinphoneAuthInfo *info)
Adds authentication information to the LinphoneCore.
void linphone_core_iterate(LinphoneCore *lc)
Main loop function.
LinphoneAddress * linphone_address_new(const char *addr)
Constructs a LinphoneAddress object by parsing the user supplied address, given as a string.
LINPHONE_DEPRECATED LinphoneCore * linphone_core_new(const LinphoneCoreVTable *vtable, const char *config_path, const char *factory_config_path, void *userdata)
Instanciates a LinphoneCore object.
LinphoneAuthInfo * linphone_auth_info_new(const char *username, const char *userid, const char *passwd, const char *ha1, const char *realm, const char *domain)
Creates a LinphoneAuthInfo object with supplied information.
LINPHONE_DEPRECATED LinphoneProxyConfig * linphone_proxy_config_new(void)
Creates an empty proxy config.
LinphoneStatus linphone_proxy_config_done(LinphoneProxyConfig *cfg)
Commits modification made to the proxy configuration.
Unregistration succeeded.
Definition: types.h:999
LINPHONE_DEPRECATED LinphoneStatus linphone_proxy_config_set_identity(LinphoneProxyConfig *cfg, const char *identity)
struct SalAddress LinphoneAddress
Object that represents a SIP address.
Definition: types.h:186
const char * linphone_address_get_domain(const LinphoneAddress *u)
Returns the domain name.
This structure holds all callbacks that the application should implement.
Definition: core.h:180
LinphoneStatus linphone_core_add_proxy_config(LinphoneCore *lc, LinphoneProxyConfig *config)
Add a proxy configuration.
LinphoneCoreRegistrationStateChangedCb registration_state_changed
Notifies registration state changes.
Definition: core.h:182
LinphoneProxyConfig * linphone_core_get_default_proxy_config(LinphoneCore *lc)
LINPHONE_DEPRECATED void linphone_core_destroy(LinphoneCore *lc)
Destroys a LinphoneCore.