Commit 6fdaf454 authored by jehan's avatar jehan

make sure publish proxy config has same From/To

parent c03dd6f3
......@@ -272,13 +272,35 @@ LinphoneStatus linphone_event_notify(LinphoneEvent *lev, const LinphoneContent *
return sal_notify(lev->op, body_handler);
}
LinphoneEvent *linphone_core_create_publish(LinphoneCore *lc, const LinphoneAddress *resource, const char *event, int expires){
LinphoneEvent *lev=linphone_event_new(lc,LinphoneSubscriptionInvalidDir, event,expires);
linphone_configure_op(lc,lev->op,resource,NULL,lp_config_get_int(lc->config,"sip","publish_msg_with_contact",0));
static LinphoneEvent *_linphone_core_create_publish(LinphoneCore *core, LinphoneProxyConfig *cfg, const LinphoneAddress *resource, const char *event, int expires){
LinphoneCore *lc = core;
LinphoneEvent *lev;
if (!lc && cfg) {
if (cfg->lc)
lc = cfg->lc;
else {
ms_error("Cannot create publish from proxy config [%p] not attached to any core",cfg);
return NULL;
}
}
if (!resource && cfg)
resource = linphone_proxy_config_get_identity_address(cfg);
lev = linphone_event_new(lc,LinphoneSubscriptionInvalidDir, event,expires);
linphone_configure_op_with_proxy(lc,lev->op,resource,NULL,lp_config_get_int(lc->config,"sip","publish_msg_with_contact",0),cfg);
sal_op_set_manual_refresher_mode(lev->op,!lp_config_get_int(lc->config,"sip","refresh_generic_publish",1));
return lev;
}
LinphoneEvent *linphone_core_create_publish(LinphoneCore *lc, const LinphoneAddress *resource, const char *event, int expires){
return _linphone_core_create_publish(lc, NULL, resource, event, expires);
}
LinphoneEvent *linphone_proxy_config_create_publish(LinphoneProxyConfig *cfg, const char *event, int expires) {
return _linphone_core_create_publish(NULL, cfg,NULL, event, expires);
}
LinphoneEvent *linphone_core_create_one_shot_publish(LinphoneCore *lc, const LinphoneAddress *resource, const char *event){
LinphoneEvent *lev = linphone_core_create_publish(lc, resource, event, -1);
lev->oneshot = TRUE;
......
......@@ -3446,9 +3446,8 @@ static void linphone_transfer_routes_to_op(bctbx_list_t *routes, SalOp *op){
bctbx_list_free(routes);
}
void linphone_configure_op(LinphoneCore *lc, SalOp *op, const LinphoneAddress *dest, SalCustomHeader *headers, bool_t with_contact){
void linphone_configure_op_with_proxy(LinphoneCore *lc, SalOp *op, const LinphoneAddress *dest, SalCustomHeader *headers, bool_t with_contact, LinphoneProxyConfig *proxy){
bctbx_list_t *routes=NULL;
LinphoneProxyConfig *proxy=linphone_core_lookup_known_proxy(lc,dest);
const char *identity;
if (proxy){
identity=linphone_proxy_config_get_identity(proxy);
......@@ -3478,6 +3477,9 @@ void linphone_configure_op(LinphoneCore *lc, SalOp *op, const LinphoneAddress *d
}
sal_op_cnx_ip_to_0000_if_sendonly_enable(op,lp_config_get_default_int(lc->config,"sip","cnx_ip_to_0000_if_sendonly_enabled",0)); /*also set in linphone_call_new_incoming*/
}
void linphone_configure_op(LinphoneCore *lc, SalOp *op, const LinphoneAddress *dest, SalCustomHeader *headers, bool_t with_contact) {
linphone_configure_op_with_proxy(lc, op, dest, headers,with_contact,linphone_core_lookup_known_proxy(lc,dest));
}
LinphoneCall * linphone_core_invite_address_with_params(LinphoneCore *lc, const LinphoneAddress *addr, const LinphoneCallParams *params){
const char *from=NULL;
......
......@@ -454,7 +454,7 @@ void linphone_proxy_config_write_all_to_config_file(LinphoneCore *lc);
void _linphone_proxy_config_release(LinphoneProxyConfig *cfg);
void _linphone_proxy_config_unpublish(LinphoneProxyConfig *obj);
void linphone_proxy_config_notify_publish_state_changed(LinphoneProxyConfig *cfg, LinphonePublishState state);
LinphoneEvent *linphone_proxy_config_create_publish(LinphoneProxyConfig *cfg, const char *event, int expires);
/*
* returns service route as defined in as defined by rfc3608, might be a list instead of just one.
* Can be NULL
......@@ -1293,6 +1293,7 @@ void linphone_core_play_named_tone(LinphoneCore *lc, LinphoneToneID id);
bool_t linphone_core_tone_indications_enabled(LinphoneCore*lc);
const char *linphone_core_create_uuid(LinphoneCore *lc);
void linphone_configure_op(LinphoneCore *lc, SalOp *op, const LinphoneAddress *dest, SalCustomHeader *headers, bool_t with_contact);
void linphone_configure_op_with_proxy(LinphoneCore *lc, SalOp *op, const LinphoneAddress *dest, SalCustomHeader *headers, bool_t with_contact, LinphoneProxyConfig *proxy);
void linphone_call_create_op(LinphoneCall *call);
int linphone_call_prepare_ice(LinphoneCall *call, bool_t incoming_offer);
void linphone_core_notify_info_message(LinphoneCore* lc,SalOp *op, SalBodyHandler *body);
......
......@@ -856,8 +856,7 @@ int linphone_proxy_config_send_publish(LinphoneProxyConfig *proxy, LinphonePrese
LinphoneContent *content;
char *presence_body;
if (proxy->presence_publish_event==NULL){
proxy->presence_publish_event = linphone_core_create_publish(proxy->lc
, linphone_proxy_config_get_identity_address(proxy)
proxy->presence_publish_event = linphone_proxy_config_create_publish(proxy
, "presence"
, linphone_proxy_config_get_publish_expires(proxy));
linphone_event_ref(proxy->presence_publish_event);
......
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