mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-02-07 14:18:25 +00:00
allow contacts to be sent in publish, and better management of publish.
This commit is contained in:
parent
3fdf79fdc5
commit
ab2b7d0e38
2 changed files with 23 additions and 8 deletions
|
|
@ -45,6 +45,9 @@ int sal_publish_presence(SalOp *op, const char *from, const char *to, int expire
|
|||
|
||||
op->type=SalOpPublish;
|
||||
req=sal_op_build_request(op,"PUBLISH");
|
||||
if (sal_op_get_contact(op)){
|
||||
belle_sip_message_add_header(BELLE_SIP_MESSAGE(req),BELLE_SIP_HEADER(sal_op_create_contact(op)));
|
||||
}
|
||||
belle_sip_message_add_header(BELLE_SIP_MESSAGE(req),belle_sip_header_create("Event","presence"));
|
||||
sal_add_presence_info(op,BELLE_SIP_MESSAGE(req),presence);
|
||||
return sal_op_send_and_create_refresher(op,req,expires,publish_refresher_listener);
|
||||
|
|
@ -67,6 +70,9 @@ int sal_publish(SalOp *op, const char *from, const char *to, const char *eventna
|
|||
|
||||
op->type=SalOpPublish;
|
||||
req=sal_op_build_request(op,"PUBLISH");
|
||||
if (sal_op_get_contact(op)){
|
||||
belle_sip_message_add_header(BELLE_SIP_MESSAGE(req),BELLE_SIP_HEADER(sal_op_create_contact(op)));
|
||||
}
|
||||
belle_sip_message_add_header(BELLE_SIP_MESSAGE(req),belle_sip_header_create("Event",eventname));
|
||||
sal_op_add_body(op,BELLE_SIP_MESSAGE(req),body);
|
||||
return sal_op_send_and_create_refresher(op,req,expires,publish_refresher_listener);
|
||||
|
|
|
|||
|
|
@ -840,15 +840,22 @@ void linphone_proxy_config_set_realm(LinphoneProxyConfig *cfg, const char *realm
|
|||
}
|
||||
|
||||
int linphone_proxy_config_send_publish(LinphoneProxyConfig *proxy, LinphonePresenceModel *presence){
|
||||
int err;
|
||||
int err=0;
|
||||
|
||||
if (proxy->publish_op==NULL){
|
||||
proxy->publish_op=sal_op_new(proxy->lc->sal);
|
||||
sal_op_set_route(proxy->publish_op,proxy->reg_proxy);
|
||||
sal_op_set_from(proxy->publish_op,linphone_proxy_config_get_identity(proxy));
|
||||
sal_op_set_to(proxy->publish_op,linphone_proxy_config_get_identity(proxy));
|
||||
}
|
||||
err=sal_publish_presence(proxy->publish_op,NULL,NULL,proxy->expires,(SalPresenceModel *)presence);
|
||||
if (proxy->state==LinphoneRegistrationOk || proxy->state==LinphoneRegistrationCleared){
|
||||
if (proxy->publish_op==NULL){
|
||||
proxy->publish_op=sal_op_new(proxy->lc->sal);
|
||||
sal_op_set_route(proxy->publish_op,proxy->reg_proxy);
|
||||
sal_op_set_from(proxy->publish_op,linphone_proxy_config_get_identity(proxy));
|
||||
sal_op_set_to(proxy->publish_op,linphone_proxy_config_get_identity(proxy));
|
||||
if (lp_config_get_int(proxy->lc->config,"sip","publish_msg_with_contact",0)){
|
||||
SalAddress *addr=sal_address_new(NULL);
|
||||
sal_op_set_contact(proxy->publish_op,addr);
|
||||
sal_address_unref(addr);
|
||||
}
|
||||
}
|
||||
err=sal_publish_presence(proxy->publish_op,NULL,NULL,proxy->expires,(SalPresenceModel *)presence);
|
||||
}else proxy->send_publish=TRUE; /*otherwise do not send publish if registration is in progress, this will be done later*/
|
||||
return err;
|
||||
}
|
||||
|
||||
|
|
@ -1175,12 +1182,14 @@ void linphone_proxy_config_update(LinphoneProxyConfig *cfg){
|
|||
}
|
||||
if (can_register(cfg)){
|
||||
linphone_proxy_config_register(cfg);
|
||||
ms_message("***Registering...(%p)",cfg);
|
||||
cfg->commit=FALSE;
|
||||
if (cfg->publish) cfg->send_publish=TRUE;
|
||||
}
|
||||
}
|
||||
if (cfg->send_publish && (cfg->state==LinphoneRegistrationOk || cfg->state==LinphoneRegistrationCleared)){
|
||||
linphone_proxy_config_send_publish(cfg,lc->presence_model);
|
||||
ms_message("***Publishing...");
|
||||
cfg->send_publish=FALSE;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue