fix publish request, whose request uri must identify the resources for which the event is to be published.

This commit is contained in:
Simon Morlat 2013-04-17 15:49:34 +02:00
parent 2bab2ebf2b
commit bf492b4278
3 changed files with 13 additions and 8 deletions

View file

@ -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();

View file

@ -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

View file

@ -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;