Question

I got a problem changing liblinphone server port. I need to change both 'from' and 'to' ports. I could change from port but can not change 'to' port. Destination port.

Here is method that i use linphone_address_set_port_int

Here is code implementation from linphone project:

static void update_primary_contact(LinphoneCore *lc){
char *guessed=NULL;
char tmp[LINPHONE_IPADDR_SIZE];

LinphoneAddress *url;
if (lc->sip_conf.guessed_contact!=NULL){
    ms_free(lc->sip_conf.guessed_contact);
    lc->sip_conf.guessed_contact=NULL;
}
url=linphone_address_new(lc->sip_conf.contact);
if (!url){
    ms_error("Could not parse identity contact !");
    url=linphone_address_new("sip:unknown@unkwownhost");
}
linphone_core_get_local_ip(lc, NULL, tmp);
if (strcmp(tmp,"127.0.0.1")==0 || strcmp(tmp,"::1")==0 ){
    ms_warning("Local loopback network only !");
    lc->sip_conf.loopback_only=TRUE;
}else lc->sip_conf.loopback_only=FALSE;
linphone_address_set_domain(url,tmp);
linphone_address_set_port_int(url,linphone_core_get_sip_port (lc));
guessed=linphone_address_as_string(url);
lc->sip_conf.guessed_contact=guessed;
linphone_address_destroy(url);

}

But it is not working for me.

Was it helpful?

Solution

please use int linphone_proxy_config_set_server_addr

and read Basic registration Demo

You should put your server address like this:

linphone_proxy_config_set_server_addr(proxy_cfg,@"sip:192.168.1.1:5060");

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top