]> sjero.net Git - linphone/commitdiff
properly build REGISTER refreshes
authorSimon Morlat <simon.morlat@linphone.org>
Tue, 17 May 2011 12:30:18 +0000 (14:30 +0200)
committerSimon Morlat <simon.morlat@linphone.org>
Tue, 17 May 2011 12:30:18 +0000 (14:30 +0200)
coreapi/linphonecore.c
coreapi/linphonecore.h
coreapi/proxy.c
coreapi/sal.h
coreapi/sal_eXosip2.c
mediastreamer2

index 8c950bd5ca1cbed0d06f041bb48c5ccf871cdcf7..43f662bb7786ea5bec51890b8eb55e70a74ff69c 100644 (file)
@@ -3946,12 +3946,11 @@ void linphone_core_refresh_registers(LinphoneCore* lc) {
        for(;elem!=NULL;elem=elem->next){
                LinphoneProxyConfig *cfg=(LinphoneProxyConfig*)elem->data;
                if (linphone_proxy_config_register_enabled(cfg) ) {
-                       cfg->registered=0;
-                       cfg->commit=TRUE;
+                       linphone_proxy_config_refresh_register(cfg);
                }
        }
-       
 }
+
 void linphone_core_set_network_reachable(LinphoneCore* lc,bool_t isReachable) {
        //first disable automatic mode
        if (lc->auto_net_state_mon) {
index 24f7efac62f938f98f9467035c76f180c2ce342c..5106533c67f7daa903a6cd767f235c66842cb1c6 100644 (file)
@@ -364,6 +364,7 @@ bool_t linphone_proxy_config_publish_enabled(const LinphoneProxyConfig *obj);
 const char *linphone_proxy_config_get_addr(const LinphoneProxyConfig *obj);
 int linphone_proxy_config_get_expires(const LinphoneProxyConfig *obj);
 bool_t linphone_proxy_config_register_enabled(const LinphoneProxyConfig *obj);
+void linphone_proxy_config_refresh_register(LinphoneProxyConfig *obj);
 struct _LinphoneCore * linphone_proxy_config_get_core(const LinphoneProxyConfig *obj);
 
 bool_t linphone_proxy_config_get_dial_escape_plus(const LinphoneProxyConfig *cfg);
index 674422be94f6eff437c2834759aa0f89033c42bf..00bbb12021404de7c4ba871058dace1bcaeb17c0 100644 (file)
@@ -290,6 +290,16 @@ static void linphone_proxy_config_register(LinphoneProxyConfig *obj){
        }
 }
 
+/**
+ * Refresh a proxy registration.
+ * This is useful if for example you resuming from suspend, thus IP address may have changed.
+**/
+void linphone_proxy_config_refresh_register(LinphoneProxyConfig *obj){
+       if (obj->reg_sendregister && obj->op){
+               sal_register_refresh(obj->op,obj->expires);
+       }
+}
+
 
 /**
  * Sets a dialing prefix to be automatically prepended when inviting a number with 
index c0b5f19b3f0d6d17fc8370906f1ff6b04cc9b960..ecb140b71a84c305716ec92da2a4147fdc01a09b 100644 (file)
@@ -315,6 +315,7 @@ void sal_call_send_vfu_request(SalOp *h);
 
 /*Registration*/
 int sal_register(SalOp *op, const char *proxy, const char *from, int expires);
+int sal_register_refresh(SalOp *op, int expires);
 int sal_unregister(SalOp *h);
 
 /*Messaging */
index 97f8b497fc809ea2988215b9d25308182ab3f045..34cfd44f52958b9f7bfcda5bf7442e593d23584d 100644 (file)
@@ -1908,6 +1908,25 @@ int sal_register(SalOp *h, const char *proxy, const char *from, int expires){
        return 0;
 }
 
+int sal_register_refresh(SalOp *op, int expires){
+       osip_message_t *msg=NULL;
+       const char *contact=sal_op_get_contact(op);
+       
+       if (op->rid==-1){
+               ms_error("Unexistant registration context, not possible to refresh.");
+               return -1;
+       }
+       eXosip_lock();
+       eXosip_register_build_register(op->rid,expires,&msg);
+       if (msg!=NULL){
+               if (contact) register_set_contact(msg,contact);
+               eXosip_register_send_register(op->rid,msg);
+       }else ms_error("Could not build REGISTER refresh message.");
+       eXosip_unlock();
+       return 0;
+}
+
+
 int sal_unregister(SalOp *h){
        osip_message_t *msg=NULL;
        eXosip_lock();
index 88d2500c0a1a01c136f0e7ebb8d9872262b57a41..e7e43f83d827eebc1b6989f0ec22a89c00f15627 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 88d2500c0a1a01c136f0e7ebb8d9872262b57a41
+Subproject commit e7e43f83d827eebc1b6989f0ec22a89c00f15627