Commit c6fe394e authored by smorlat's avatar smorlat
Browse files

work in progress.

git-svn-id: svn+ssh:// 3f6dc0c8-ddfe-455d-9043-3cd528dc4637
parent 89296a7e
......@@ -18,7 +18,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "sipsetup.h"
#include "linphonecore.h"
#include "p2pproxy.h"
typedef struct _FonisContext{
......@@ -49,14 +50,33 @@ static bool_t fonis_init(void){
return TRUE;
static bool_t fonis_check_connected(SipSetupContext *ctx){
int retries;
LinphoneCore *lc=linphone_proxy_config_get_core(sip_setup_context_get_proxy_config(ctx));
if (p2pproxy_application_get_state()==P2PPROXY_CONNECTED){
if (retries>0) linphone_core_stop_waiting(lc);
return TRUE;
if (retries==0){
ms_message("Waiting for p2pproxy to connect to the network...");
linphone_core_start_waiting(lc,"Trying to connect to the fonis network...");
}else linphone_core_update_progress(lc,NULL,-1);
return FALSE;
static int fonis_create_account(const char *uri, const char *passwd){
int err=p2pproxy_accountmgt_createAccount(uri);
static int fonis_create_account(SipSetupContext *ctx, const char *uri, const char *passwd){
int err;
if (!fonis_check_connected(ctx)) return -1;
if (err<0) return -1;
return 0;
static int fonis_login_account(SipSetupContext * ctx,const char *uri, const char *passwd){
if (!fonis_check_connected(ctx)) return -1;
if (p2pproxy_accountmgt_isValidAccount(uri)==P2PPROXY_ACCOUNTMGT_USER_EXIST) {
return 0;
......@@ -64,7 +84,9 @@ static int fonis_login_account(SipSetupContext * ctx,const char *uri, const char
static int fonis_get_proxy(SipSetupContext *ctx, const char *domain, char *proxy, size_t sz){
int err=p2pproxy_resourcemgt_lookup_sip_proxy(proxy,sz,(char*)domain);
int err;
if (!fonis_check_connected(ctx)) return -1;
if (err==0) return 0;
else return -1;
......@@ -94,6 +116,10 @@ static int fonis_get_relay(SipSetupContext *ctx, char *relay, size_t size){
return ret;
static void fonis_exit(){
static SipSetup fonis_sip_setup={
......@@ -105,7 +131,7 @@ static SipSetup fonis_sip_setup={
void libfonisprovider_init(void){
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment