Commit bf492b42 authored by Simon Morlat's avatar Simon Morlat

fix publish request, whose request uri must identify the resources for which...

fix publish request, whose request uri must identify the resources for which the event is to be published.
parent 2bab2ebf
......@@ -2317,7 +2317,7 @@ static void register_set_contact(osip_message_t *msg, const char *contact){
osip_uri_uparam_add(ct->url,osip_strdup("line"),line);
}
static void sal_register_add_route(osip_message_t *msg, const char *proxy){
void sal_message_add_route(osip_message_t *msg, const char *proxy){
osip_route_t *route;
osip_list_special_free(&msg->routes,(void (*)(void*))osip_route_free);
......@@ -2364,7 +2364,7 @@ int sal_register(SalOp *h, const char *proxy, const char *from, int expires){
h->rid=eXosip_register_build_initial_register(from,domain,NULL,expires,&msg);
if (msg){
if (contact) register_set_contact(msg,contact);
sal_register_add_route(msg,proxy);
sal_message_add_route(msg,proxy);
sal_add_register(h->base.root,h);
}else{
ms_error("Could not build initial register.");
......@@ -2374,7 +2374,7 @@ int sal_register(SalOp *h, const char *proxy, const char *from, int expires){
}else{
eXosip_lock();
eXosip_register_build_register(h->rid,expires,&msg);
sal_register_add_route(msg,proxy);
sal_message_add_route(msg,proxy);
}
if (msg){
eXosip_register_send_register(h->rid,msg);
......@@ -2412,7 +2412,7 @@ int sal_register_refresh(SalOp *op, int expires){
eXosip_register_build_register(op->rid,expires,&msg);
if (msg!=NULL){
if (contact) register_set_contact(msg,contact);
sal_register_add_route(msg,sal_op_get_route(op));
sal_message_add_route(msg,sal_op_get_route(op));
eXosip_register_send_register(op->rid,msg);
}else ms_error("Could not build REGISTER refresh message.");
eXosip_unlock();
......
......@@ -99,4 +99,6 @@ SalCustomHeader * sal_exosip_get_custom_headers(osip_message_t *msg);
void _osip_list_set_empty(osip_list_t *l, void (*freefunc)(void*));
void sal_message_add_route(osip_message_t *msg, const char *proxy);
#endif
......@@ -637,23 +637,26 @@ int sal_publish(SalOp *op, const char *from, const char *to, SalPresenceStatus p
osip_message_t *pub;
int i;
char buf[1024];
const char *route=sal_op_get_route(op);
mk_presence_body (presence_mode, from, buf, sizeof (buf), presence_style);
i = eXosip_build_publish(&pub,from, to, sal_op_get_route(op), "presence", "300",
i = eXosip_build_publish(&pub,to, from, NULL, "presence", "600",
presence_style ? "application/xpidf+xml" : "application/pidf+xml", buf);
if (i<0){
ms_warning("Failed to build publish request.");
return -1;
}
if (route)
sal_message_add_route(pub,route);
eXosip_lock();
i = eXosip_publish(pub, to); /* should update the sip-if-match parameter
from sip-etag from last 200ok of PUBLISH */
eXosip_unlock();
if (i<0){
ms_message("Failed to send publish request.");
return -1;
ms_message("Failed to send publish request.");
return -1;
}
sal_add_other(sal_op_get_sal(op),op,pub);
return 0;
......
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