forked from mirrors/linphone-iphone
Merge branch 'master' of belledonne-communications.com:linphone-private
This commit is contained in:
commit
a61a62b090
8 changed files with 67 additions and 7 deletions
|
|
@ -136,5 +136,11 @@ void linphone_address_destroy(LinphoneAddress *u){
|
|||
sal_address_destroy(u);
|
||||
}
|
||||
|
||||
int linphone_address_get_port_int(const LinphoneAddress *u) {
|
||||
return sal_address_get_port_int(u);
|
||||
}
|
||||
const char* linphone_address_get_port(const LinphoneAddress *u) {
|
||||
return sal_address_get_port(u);
|
||||
}
|
||||
|
||||
/** @} */
|
||||
|
|
|
|||
|
|
@ -646,9 +646,16 @@ static void sip_config_read(LinphoneCore *lc)
|
|||
}
|
||||
linphone_core_enable_ipv6(lc,ipv6);
|
||||
memset(&tr,0,sizeof(tr));
|
||||
tr.udp_port=lp_config_get_int(lc->config,"sip","sip_port",5060);
|
||||
tr.tcp_port=lp_config_get_int(lc->config,"sip","sip_tcp_port",0);
|
||||
|
||||
if (lp_config_get_int(lc->config,"sip","sip_random_port",0)) {
|
||||
tr.udp_port=(0xDFF&+random())+1024;
|
||||
} else {
|
||||
tr.udp_port=lp_config_get_int(lc->config,"sip","sip_port",5060);
|
||||
}
|
||||
if (lp_config_get_int(lc->config,"sip","sip_tcp_random_port",0)) {
|
||||
tr.tcp_port=(0xDFF&+random())+1024;
|
||||
} else {
|
||||
tr.tcp_port=lp_config_get_int(lc->config,"sip","sip_tcp_port",0);
|
||||
}
|
||||
/*start listening on ports*/
|
||||
linphone_core_set_sip_transports(lc,&tr);
|
||||
|
||||
|
|
@ -1553,7 +1560,7 @@ int linphone_core_set_sip_transports(LinphoneCore *lc, const LCSipTransports * t
|
|||
* is not used.
|
||||
* @ingroup network_parameters
|
||||
**/
|
||||
int linphone_core_get_sip_transport(LinphoneCore *lc, LCSipTransports *tr){
|
||||
int linphone_core_get_sip_transports(LinphoneCore *lc, LCSipTransports *tr){
|
||||
memcpy(tr,&lc->sip_conf.transports,sizeof(*tr));
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1639,6 +1646,16 @@ static void monitor_network_state(LinphoneCore *lc, time_t curtime){
|
|||
|
||||
static void proxy_update(LinphoneCore *lc){
|
||||
ms_list_for_each(lc->sip_conf.proxies,(void (*)(void*))&linphone_proxy_config_update);
|
||||
MSList* list=ms_list_copy(lc->sip_conf.deleted_proxies);
|
||||
for(;list!=NULL;list=list->next){
|
||||
LinphoneProxyConfig* cfg = (LinphoneProxyConfig*) list->data;
|
||||
if (ms_time(NULL) - cfg->deletion_date > 5) {
|
||||
lc->sip_conf.deleted_proxies =ms_list_remove(lc->sip_conf.deleted_proxies,(void *)cfg);
|
||||
ms_message("clearing proxy config for [%s]",linphone_proxy_config_get_addr(cfg));
|
||||
linphone_proxy_config_destroy(cfg);
|
||||
}
|
||||
}
|
||||
ms_list_free(list);
|
||||
}
|
||||
|
||||
static void assign_buddy_info(LinphoneCore *lc, BuddyInfo *info){
|
||||
|
|
|
|||
|
|
@ -75,6 +75,15 @@ const char *linphone_address_get_scheme(const LinphoneAddress *u);
|
|||
const char *linphone_address_get_display_name(const LinphoneAddress* u);
|
||||
const char *linphone_address_get_username(const LinphoneAddress *u);
|
||||
const char *linphone_address_get_domain(const LinphoneAddress *u);
|
||||
/**
|
||||
* Get port number as an integer value.
|
||||
*
|
||||
*/
|
||||
int linphone_address_get_port_int(const LinphoneAddress *u);
|
||||
/**
|
||||
* Get port number, null if not present.
|
||||
*/
|
||||
const char* linphone_address_get_port(const LinphoneAddress *u);
|
||||
void linphone_address_set_display_name(LinphoneAddress *u, const char *display_name);
|
||||
void linphone_address_set_username(LinphoneAddress *uri, const char *username);
|
||||
void linphone_address_set_domain(LinphoneAddress *uri, const char *host);
|
||||
|
|
|
|||
|
|
@ -207,6 +207,7 @@ struct _LinphoneProxyConfig
|
|||
bool_t publish;
|
||||
bool_t dial_escape_plus;
|
||||
void* user_data;
|
||||
time_t deletion_date;
|
||||
};
|
||||
|
||||
struct _LinphoneAuthInfo
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ Copyright (C) 2000 Simon MORLAT (simon.morlat@linphone.org)
|
|||
#include "sipsetup.h"
|
||||
#include "lpconfig.h"
|
||||
#include "private.h"
|
||||
#include "mediastreamer2/mediastream.h"
|
||||
|
||||
|
||||
#include <ctype.h>
|
||||
|
|
@ -244,7 +245,13 @@ static char *guess_contact_for_register(LinphoneProxyConfig *obj){
|
|||
contact=linphone_address_new(obj->reg_identity);
|
||||
linphone_address_set_domain (contact,localip);
|
||||
linphone_address_set_port_int(contact,linphone_core_get_sip_port(obj->lc));
|
||||
ret=linphone_address_as_string_uri_only (contact);
|
||||
linphone_address_set_display_name(contact,NULL);
|
||||
LCSipTransports tr;
|
||||
linphone_core_get_sip_transports(obj->lc,&tr);
|
||||
if (tr.udp_port <= 0 && tr.tcp_port>0) {
|
||||
sal_address_add_param(contact,"transport","tcp");
|
||||
}
|
||||
ret=linphone_address_as_string(contact);
|
||||
linphone_address_destroy(contact);
|
||||
}
|
||||
linphone_address_destroy (proxy);
|
||||
|
|
@ -499,6 +506,7 @@ void linphone_core_remove_proxy_config(LinphoneCore *lc, LinphoneProxyConfig *cf
|
|||
lc->sip_conf.proxies=ms_list_remove(lc->sip_conf.proxies,(void *)cfg);
|
||||
/* add to the list of destroyed proxies, so that the possible unREGISTER request can succeed authentication */
|
||||
lc->sip_conf.deleted_proxies=ms_list_append(lc->sip_conf.deleted_proxies,(void *)cfg);
|
||||
cfg->deletion_date=ms_time(NULL);
|
||||
/* this will unREGISTER */
|
||||
linphone_proxy_config_edit(cfg);
|
||||
if (lc->default_proxy==cfg){
|
||||
|
|
@ -787,3 +795,4 @@ void * linphone_proxy_config_get_user_data(LinphoneProxyConfig *cr) {
|
|||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -48,6 +48,9 @@ const char *sal_address_get_display_name(const SalAddress* addr);
|
|||
char *sal_address_get_display_name_unquoted(const SalAddress *addr);
|
||||
const char *sal_address_get_username(const SalAddress *addr);
|
||||
const char *sal_address_get_domain(const SalAddress *addr);
|
||||
const char * sal_address_get_port(const SalAddress *addr);
|
||||
int sal_address_get_port_int(const SalAddress *uri);
|
||||
|
||||
void sal_address_set_display_name(SalAddress *addr, const char *display_name);
|
||||
void sal_address_set_username(SalAddress *addr, const char *username);
|
||||
void sal_address_set_domain(SalAddress *addr, const char *host);
|
||||
|
|
@ -57,7 +60,7 @@ void sal_address_clean(SalAddress *addr);
|
|||
char *sal_address_as_string(const SalAddress *u);
|
||||
char *sal_address_as_string_uri_only(const SalAddress *u);
|
||||
void sal_address_destroy(SalAddress *u);
|
||||
|
||||
void sal_address_add_param(SalAddress *u,const char* name,const char* value);
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1749,6 +1749,9 @@ char *sal_address_as_string_uri_only(const SalAddress *u){
|
|||
osip_free(tmp);
|
||||
return ret;
|
||||
}
|
||||
void sal_address_add_param(SalAddress *u,const char* name,const char* value) {
|
||||
osip_uri_uparam_add (((osip_from_t*)u)->url,ms_strdup(name),ms_strdup(value));
|
||||
}
|
||||
|
||||
void sal_address_destroy(SalAddress *u){
|
||||
osip_from_free((osip_from_t*)u);
|
||||
|
|
@ -1758,4 +1761,16 @@ void sal_set_keepalive_period(Sal *ctx,unsigned int value) {
|
|||
ctx->keepalive_period=value;
|
||||
eXosip_set_option (EXOSIP_OPT_UDP_KEEP_ALIVE, &value);
|
||||
}
|
||||
const char * sal_address_get_port(const SalAddress *addr) {
|
||||
const osip_from_t *u=(const osip_from_t*)addr;
|
||||
return null_if_empty(u->url->port);
|
||||
}
|
||||
int sal_address_get_port_int(const SalAddress *uri) {
|
||||
const char* port = sal_address_get_port(uri);
|
||||
if (port != NULL) {
|
||||
return atoi(port);
|
||||
} else {
|
||||
return 5060;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -61,5 +61,5 @@ abstract public class LinphoneCoreFactory {
|
|||
*/
|
||||
abstract public void setDebugMode(boolean enable);
|
||||
|
||||
//abstract public void setLogHandler(LinphoneLogHandler handler);
|
||||
abstract public void setLogHandler(LinphoneLogHandler handler);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue