]> git.pld-linux.org Git - packages/linphone.git/blob - linphone-exosip-4.0.0.patch
Version: 3.6.0
[packages/linphone.git] / linphone-exosip-4.0.0.patch
1 diff -dur linphone-3.6.0.orig/coreapi/sal_eXosip2.c linphone-3.6.0/coreapi/sal_eXosip2.c
2 --- linphone-3.6.0.orig/coreapi/sal_eXosip2.c   2013-06-17 11:11:08.000000000 +0200
3 +++ linphone-3.6.0/coreapi/sal_eXosip2.c        2013-06-17 11:21:40.000000000 +0200
4 @@ -36,6 +36,8 @@
5  static void update_contact_from_response(SalOp *op, osip_message_t *response);
6  
7  
8 +struct eXosip_t *eXo = 0;
9 +
10  void _osip_list_set_empty(osip_list_t *l, void (*freefunc)(void*)){
11         void *data;
12         while(!osip_list_eol(l,0)) {
13 @@ -46,7 +48,7 @@
14  }
15  
16  void sal_get_default_local_ip(Sal *sal, int address_family,char *ip, size_t iplen){
17 -       if (eXosip_guess_localip(address_family,ip,iplen)<0){
18 +       if (eXosip_guess_localip(eXo,address_family,ip,iplen)<0){
19                 /*default to something */
20                 strncpy(ip,address_family==AF_INET6 ? "::1" : "127.0.0.1",iplen);
21                 ms_error("Could not find default routable ip address !");
22 @@ -192,7 +194,7 @@
23                 eXosip_event_free(op->pending_auth);
24         if (op->rid!=-1){
25                 sal_remove_register(op->base.root,op->rid);
26 -               eXosip_register_remove(op->rid);
27 +               eXosip_register_remove(eXo,op->rid);
28         }
29         if (op->cid!=-1){
30                 ms_message("Cleaning cid %i",op->cid);
31 @@ -273,7 +275,8 @@
32                 osip_trace_initialize_func (OSIP_INFO4,&_osip_trace_func);
33                 firsttime=FALSE;
34         }
35 -       eXosip_init();
36 +       eXo=eXosip_malloc();
37 +       eXosip_init(eXo);
38         sal=ms_new0(Sal,1);
39         sal->keepalive_period=30;
40         sal->double_reg=TRUE;
41 @@ -290,7 +293,8 @@
42  }
43  
44  void sal_uninit(Sal* sal){
45 -       eXosip_quit();
46 +       eXosip_quit(eXo);
47 +       free(eXo);
48         if (sal->rootCa)
49                 ms_free(sal->rootCa);
50         ms_free(sal);
51 @@ -348,8 +352,8 @@
52  
53  int sal_unlisten_ports(Sal *ctx){
54         if (ctx->running){
55 -               eXosip_quit();
56 -               eXosip_init();
57 +               eXosip_quit(eXo);
58 +               eXosip_init(eXo);
59                 ctx->running=FALSE;
60         }
61         return 0;
62 @@ -359,7 +363,7 @@
63  #ifdef HAVE_EXOSIP_RESET_TRANSPORTS
64         if (ctx->running){
65                 ms_message("Exosip transports reset.");
66 -               eXosip_reset_transports();
67 +               eXosip_reset_transports(eXo);
68         }
69         return 0;
70  #else
71 @@ -374,10 +378,10 @@
72                 eXosip_tls_ctx_t tlsCtx;
73                 memset(&tlsCtx, 0, sizeof(tlsCtx));
74                 snprintf(tlsCtx.root_ca_cert, sizeof(tlsCtx.client.cert), "%s", ctx->rootCa);
75 -               eXosip_set_tls_ctx(&tlsCtx);
76 +               eXosip_set_option(eXo, EXOSIP_OPT_SET_TLS_CERTIFICATES_INFO, (void*)&tlsCtx);
77         }                       
78  #ifdef HAVE_EXOSIP_TLS_VERIFY_CERTIFICATE
79 -       eXosip_tls_verify_certificate(ctx->verify_server_certs);
80 +       eXosip_set_option(eXo, EXOSIP_OPT_SET_TLS_VERIFY_CERTIFICATE, (void*)&ctx->verify_server_certs);
81  #endif
82  #ifdef HAVE_EXOSIP_TLS_VERIFY_CN
83         eXosip_tls_verify_cn(ctx->verify_server_cn);
84 @@ -402,13 +406,13 @@
85         switch (tr) {
86         case SalTransportUDP:
87                 proto=IPPROTO_UDP;
88 -               eXosip_set_option (EXOSIP_OPT_UDP_KEEP_ALIVE, &keepalive);
89 +               eXosip_set_option (eXo, EXOSIP_OPT_UDP_KEEP_ALIVE, &keepalive); 
90                 break;
91         case SalTransportTCP:
92         case SalTransportTLS:
93                 proto= IPPROTO_TCP;
94                 if (!ctx->tcp_tls_keepalive) keepalive=-1;
95 -               eXosip_set_option (EXOSIP_OPT_UDP_KEEP_ALIVE,&keepalive);
96 +               eXosip_set_option (eXo, EXOSIP_OPT_UDP_KEEP_ALIVE,&keepalive);
97                 set_tls_options(ctx);
98                 break;
99         default:
100 @@ -416,9 +420,9 @@
101         }
102         /*see if it looks like an IPv6 address*/
103         int use_rports = ctx->use_rports; // Copy char to int to avoid bad alignment
104 -       eXosip_set_option(EXOSIP_OPT_USE_RPORT,&use_rports);
105 -       int dont_use_101 = !ctx->use_101; // Copy char to int to avoid bad alignment
106 -       eXosip_set_option(EXOSIP_OPT_DONT_SEND_101,&dont_use_101);
107 +       eXosip_set_option(eXo, EXOSIP_OPT_USE_RPORT,&use_rports);
108 +       //int dont_use_101 = !ctx->use_101; // Copy char to int to avoid bad alignment
109 +       //eXosip_set_option(eXo, EXOSIP_OPT_DONT_SEND_101,&dont_use_101); // FIXME is this possible with eXosip2 >= 4.0.0?
110         sal_set_dscp(ctx,ctx->dscp);
111         sal_use_dates(ctx,ctx->add_dates);
112  
113 @@ -429,14 +433,14 @@
114                 ms_fatal("SIP over DTLS is not supported yet.");
115                 return -1;
116         }
117 -       err=eXosip_listen_addr(proto, addr, port, ipv6 ?  PF_INET6 : PF_INET, is_secure);
118 +       err=eXosip_listen_addr(eXo, proto, addr, port, ipv6 ?  PF_INET6 : PF_INET, is_secure);
119         ctx->running=TRUE;
120         return err;
121  }
122  
123  ortp_socket_t sal_get_socket(Sal *ctx){
124  #ifdef HAVE_EXOSIP_GET_SOCKET
125 -       return eXosip_get_socket(IPPROTO_UDP);
126 +       return eXosip_get_socket(eXo, IPPROTO_UDP);
127  #else
128         ms_warning("Sorry, eXosip does not have eXosip_get_socket() method");
129         return -1;
130 @@ -444,7 +448,7 @@
131  }
132  
133  void sal_set_user_agent(Sal *ctx, const char *user_agent){
134 -       eXosip_set_user_agent(user_agent);
135 +       eXosip_set_user_agent(eXo, user_agent);
136  }
137  
138  void sal_use_session_timers(Sal *ctx, int expires){
139 @@ -472,7 +476,7 @@
140  #ifdef EXOSIP_OPT_REGISTER_WITH_DATE
141         {
142                 int tmp=enabled;
143 -               eXosip_set_option(EXOSIP_OPT_REGISTER_WITH_DATE,&tmp);
144 +               eXosip_set_option(eXo,EXOSIP_OPT_REGISTER_WITH_DATE,&tmp);
145         }
146  #else
147         if (enabled) ms_warning("Exosip does not support EXOSIP_OPT_REGISTER_WITH_DATE option.");
148 @@ -500,7 +504,7 @@
149  void sal_verify_server_certificates(Sal *ctx, bool_t verify){
150         ctx->verify_server_certs=verify;
151  #ifdef HAVE_EXOSIP_TLS_VERIFY_CERTIFICATE
152 -       eXosip_tls_verify_certificate(verify);
153 +       eXosip_set_option(eXo, EXOSIP_OPT_SET_TLS_VERIFY_CERTIFICATE, (void*)&verify);
154  #endif
155  }
156  
157 @@ -638,7 +642,7 @@
158         h->terminated = FALSE;
159  
160         route = sal_op_get_route(h);
161 -       err=eXosip_call_build_initial_invite(&invite,to,from,route,"Phone call");
162 +       err=eXosip_call_build_initial_invite(eXo,&invite,to,from,route,"Phone call");
163         if (err!=0){
164                 ms_error("Could not create call. Error %d (from=%s to=%s route=%s)",
165                                 err, from, to, route);
166 @@ -664,9 +668,9 @@
167                         osip_message_set_header(invite,"Referred-By",h->referred_by);
168         }
169         
170 -       eXosip_lock();
171 -       err=eXosip_call_send_initial_invite(invite);
172 -       eXosip_unlock();
173 +       eXosip_lock(eXo);
174 +       err=eXosip_call_send_initial_invite(eXo,invite);
175 +       eXosip_unlock(eXo);
176         h->cid=err;
177         if (err<0){
178                 ms_error("Fail to send invite ! Error code %d", err);
179 @@ -688,8 +692,8 @@
180         /*if early media send also 180 and 183 */
181         if (early_media){
182                 msg=NULL;
183 -               eXosip_lock();
184 -               eXosip_call_build_answer(h->tid,183,&msg);
185 +               eXosip_lock(eXo);
186 +               eXosip_call_build_answer(eXo,h->tid,183,&msg);
187                 if (msg){
188                         sdp_process(h);
189                         if (h->sdp_answer){
190 @@ -697,13 +701,13 @@
191                                 sdp_message_free(h->sdp_answer);
192                                 h->sdp_answer=NULL;
193                         }
194 -                       eXosip_call_send_answer(h->tid,183,msg);
195 +                       eXosip_call_send_answer(eXo,h->tid,183,msg);
196                 }
197 -               eXosip_unlock();
198 +               eXosip_unlock(eXo);
199         }else{
200 -               eXosip_lock();
201 -               eXosip_call_send_answer(h->tid,180,NULL);
202 -               eXosip_unlock();
203 +               eXosip_lock(eXo);
204 +               eXosip_call_send_answer(eXo,h->tid,180,NULL);
205 +               eXosip_unlock(eXo);
206         }
207         return 0;
208  }
209 @@ -712,7 +716,7 @@
210         osip_message_t *msg;
211         const char *contact=sal_op_get_contact(h);
212         /* sends a 200 OK */
213 -       int err=eXosip_call_build_answer(h->tid,200,&msg);
214 +       int err=eXosip_call_build_answer(eXo,h->tid,200,&msg);
215         if (err<0 || msg==NULL){
216                 ms_error("Fail to build answer for call: err=%i",err);
217                 return -1;
218 @@ -741,38 +745,38 @@
219         }else{
220                 ms_error("You are accepting a call but not defined any media capabilities !");
221         }
222 -       eXosip_call_send_answer(h->tid,200,msg);
223 +       eXosip_call_send_answer(eXo,h->tid,200,msg);
224         return 0;
225  }
226  
227  int sal_call_decline(SalOp *h, SalReason reason, const char *redirect){
228         if (reason==SalReasonBusy){
229 -               eXosip_lock();
230 -               eXosip_call_send_answer(h->tid,486,NULL);
231 -               eXosip_unlock();
232 +               eXosip_lock(eXo);
233 +               eXosip_call_send_answer(eXo,h->tid,486,NULL);
234 +               eXosip_unlock(eXo);
235         }
236         else if (reason==SalReasonTemporarilyUnavailable){
237 -               eXosip_lock();
238 -               eXosip_call_send_answer(h->tid,480,NULL);
239 -               eXosip_unlock();
240 +               eXosip_lock(eXo);
241 +               eXosip_call_send_answer(eXo,h->tid,480,NULL);
242 +               eXosip_unlock(eXo);
243         }else if (reason==SalReasonDoNotDisturb){
244 -               eXosip_lock();
245 -               eXosip_call_send_answer(h->tid,600,NULL);
246 -               eXosip_unlock();
247 +               eXosip_lock(eXo);
248 +               eXosip_call_send_answer(eXo,h->tid,600,NULL);
249 +               eXosip_unlock(eXo);
250         }else if (reason==SalReasonMedia){
251 -               eXosip_lock();
252 -               eXosip_call_send_answer(h->tid,415,NULL);
253 -               eXosip_unlock();
254 +               eXosip_lock(eXo);
255 +               eXosip_call_send_answer(eXo,h->tid,415,NULL);
256 +               eXosip_unlock(eXo);
257         }else if (redirect!=NULL && reason==SalReasonRedirect){
258                 osip_message_t *msg;
259                 int code;
260                 if (strstr(redirect,"sip:")!=0) code=302;
261                 else code=380;
262 -               eXosip_lock();
263 -               eXosip_call_build_answer(h->tid,code,&msg);
264 +               eXosip_lock(eXo);
265 +               eXosip_call_build_answer(eXo,h->tid,code,&msg);
266                 osip_message_set_contact(msg,redirect);
267 -               eXosip_call_send_answer(h->tid,code,msg);
268 -               eXosip_unlock();
269 +               eXosip_call_send_answer(eXo,h->tid,code,msg);
270 +               eXosip_unlock(eXo);
271         }else sal_call_terminate(h);
272         return 0;
273  }
274 @@ -798,18 +802,18 @@
275  
276  static int send_notify_for_refer(int did, const char *sipfrag){
277         osip_message_t *msg;
278 -       eXosip_lock();
279 -       eXosip_call_build_notify(did,EXOSIP_SUBCRSTATE_ACTIVE,&msg);
280 +       eXosip_lock(eXo);
281 +       eXosip_call_build_notify(eXo,did,EXOSIP_SUBCRSTATE_ACTIVE,&msg);
282         if (msg==NULL){
283 -               eXosip_unlock();
284 +               eXosip_unlock(eXo);
285                 ms_warning("Could not build NOTIFY for refer.");
286                 return -1;
287         }
288         osip_message_set_content_type(msg,"message/sipfrag");
289         osip_message_set_header(msg,"Event","refer");
290         osip_message_set_body(msg,sipfrag,strlen(sipfrag));
291 -       eXosip_call_send_request(did,msg);
292 -       eXosip_unlock();
293 +       eXosip_call_send_request(eXo,did,msg);
294 +       eXosip_unlock(eXo);
295         return 0;
296  }
297  
298 @@ -845,7 +849,7 @@
299         sal_op_set_to(op,to);
300         sal_exosip_fix_route(op);
301  
302 -       eXosip_options_build_request (&options, sal_op_get_to(op),
303 +       eXosip_options_build_request (eXo, &options, sal_op_get_to(op),
304                         sal_op_get_from(op),sal_op_get_route(op));
305         if (options){
306                 if (op->base.root->session_expires!=0){
307 @@ -853,7 +857,7 @@
308                         osip_message_set_supported(options, "timer");
309                 }
310                 sal_add_other(sal_op_get_sal(op),op,options);
311 -               return eXosip_options_send_request(options);
312 +               return eXosip_options_send_request(eXo, options);
313         }
314         return -1;
315  }
316 @@ -861,11 +865,11 @@
317  int sal_call_refer(SalOp *h, const char *refer_to){
318         osip_message_t *msg=NULL;
319         int err=0;
320 -       eXosip_lock();
321 -       eXosip_call_build_refer(h->did,refer_to, &msg);
322 -       if (msg) err=eXosip_call_send_request(h->did, msg);
323 +       eXosip_lock(eXo);
324 +       eXosip_call_build_refer(eXo,h->did,refer_to, &msg);
325 +       if (msg) err=eXosip_call_send_request(eXo,h->did, msg);
326         else err=-1;
327 -       eXosip_unlock();
328 +       eXosip_unlock(eXo);
329         return err;
330  }
331  
332 @@ -873,26 +877,26 @@
333         osip_message_t *msg=NULL;
334         char referto[256]={0};
335         int err=0;
336 -       eXosip_lock();
337 -       if (eXosip_call_get_referto(other_call_h->did,referto,sizeof(referto)-1)!=0){
338 +       eXosip_lock(eXo);
339 +       if (eXosip_call_get_referto(eXo,other_call_h->did,referto,sizeof(referto)-1)!=0){
340                 ms_error("eXosip_call_get_referto() failed for did=%i",other_call_h->did);
341 -               eXosip_unlock();
342 +               eXosip_unlock(eXo);
343                 return -1;
344         }
345 -       eXosip_call_build_refer(h->did,referto, &msg);
346 +       eXosip_call_build_refer(eXo,h->did,referto, &msg);
347         osip_message_set_header(msg,"Referred-By",h->base.from);
348 -       if (msg) err=eXosip_call_send_request(h->did, msg);
349 +       if (msg) err=eXosip_call_send_request(eXo,h->did, msg);
350         else err=-1;
351 -       eXosip_unlock();
352 +       eXosip_unlock(eXo);
353         return err;
354  }
355  
356  SalOp *sal_call_get_replaces(SalOp *h){
357         if (h!=NULL && h->replaces!=NULL){
358                 int cid;
359 -               eXosip_lock();
360 -               cid=eXosip_call_find_by_replaces(h->replaces);
361 -               eXosip_unlock();
362 +               eXosip_lock(eXo);
363 +               cid=eXosip_call_find_by_replaces(eXo,h->replaces);
364 +               eXosip_unlock(eXo);
365                 if (cid>0){
366                         SalOp *ret=sal_find_call(h->base.root,cid);
367                         return ret;
368 @@ -906,17 +910,17 @@
369         char dtmf_body[128];
370         char clen[10];
371  
372 -       eXosip_lock();
373 -       eXosip_call_build_info(h->did,&msg);
374 +       eXosip_lock(eXo);
375 +       eXosip_call_build_info(eXo,h->did,&msg);
376         if (msg){
377                 snprintf(dtmf_body, sizeof(dtmf_body), "Signal=%c\r\nDuration=250\r\n", dtmf);
378                 osip_message_set_body(msg,dtmf_body,strlen(dtmf_body));
379                 osip_message_set_content_type(msg,"application/dtmf-relay");
380                 snprintf(clen,sizeof(clen),"%lu",(unsigned long)strlen(dtmf_body));
381                 osip_message_set_content_length(msg,clen);              
382 -               eXosip_call_send_request(h->did,msg);
383 +               eXosip_call_send_request(eXo,h->did,msg);
384         }
385 -       eXosip_unlock();
386 +       eXosip_unlock(eXo);
387         return 0;
388  }
389  
390 @@ -925,23 +929,23 @@
391         if (info->userid==NULL || info->userid[0]=='\0') userid=info->username;
392         else userid=info->userid;
393         ms_message("Authentication info for username [%s], id[%s], realm [%s] added to eXosip", info->username,userid, info->realm);
394 -       eXosip_add_authentication_info (info->username,userid,
395 +       eXosip_add_authentication_info (eXo,info->username,userid,
396                                    info->password, NULL,info->realm);
397  }
398  /*
399   * Just for symmetry ;-)
400   */
401  static void pop_auth_from_exosip() {
402 -       eXosip_clear_authentication_info();
403 +       eXosip_clear_authentication_info(eXo);
404  }
405  
406  int sal_call_terminate(SalOp *h){
407         int err;
408         if (h == NULL) return -1;
409         if (h->auth_info) push_auth_to_exosip(h->auth_info);
410 -       eXosip_lock();
411 -       err=eXosip_call_terminate(h->cid,h->did);
412 -       eXosip_unlock();
413 +       eXosip_lock(eXo);
414 +       err=eXosip_call_terminate(eXo,h->cid,h->did);
415 +       eXosip_unlock(eXo);
416         if (!h->base.root->reuse_authorization) pop_auth_from_exosip();
417         if (err!=0){
418                 ms_warning("Exosip could not terminate the call: cid=%i did=%i", h->cid,h->did);
419 @@ -967,9 +971,9 @@
420          };
421         */
422                 update_contact_from_response(h,h->pending_auth->response);
423 -               eXosip_lock();
424 -               eXosip_default_action(h->pending_auth);
425 -               eXosip_unlock();
426 +               eXosip_lock(eXo);
427 +               eXosip_default_action(eXo,h->pending_auth);
428 +               eXosip_unlock(eXo);
429                 ms_message("eXosip_default_action() done");
430                 if (!h->base.root->reuse_authorization) pop_auth_from_exosip();
431                 
432 @@ -1210,9 +1214,9 @@
433  
434         if (op==NULL || op->terminated==TRUE) {
435                 ms_warning("This call has been canceled.");
436 -               eXosip_lock();
437 -               eXosip_call_terminate(ev->cid,ev->did);
438 -               eXosip_unlock();
439 +               eXosip_lock(eXo);
440 +               eXosip_call_terminate(eXo,ev->cid,ev->did);
441 +               eXosip_unlock(eXo);
442                 return -1;
443         }
444         if (ev->did>0)
445 @@ -1249,9 +1253,9 @@
446         
447         if (op==NULL || op->terminated==TRUE) {
448                 ms_warning("This call has been already terminated.");
449 -               eXosip_lock();
450 -               eXosip_call_terminate(ev->cid,ev->did);
451 -               eXosip_unlock();
452 +               eXosip_lock(eXo);
453 +               eXosip_call_terminate(eXo,ev->cid,ev->did);
454 +               eXosip_unlock(eXo);
455                 return ;
456         }
457  
458 @@ -1266,12 +1270,12 @@
459                 sdp_message_free(sdp);
460                 if (op->base.local_media) sdp_process(op);
461         }
462 -       eXosip_call_build_ack(ev->did,&msg);
463 +       eXosip_call_build_ack(eXo,ev->did,&msg);
464         if (msg==NULL) {
465                 ms_warning("This call has been already terminated.");
466 -               eXosip_lock();
467 -               eXosip_call_terminate(ev->cid,ev->did);
468 -               eXosip_unlock();
469 +               eXosip_lock(eXo);
470 +               eXosip_call_terminate(eXo,ev->cid,ev->did);
471 +               eXosip_unlock(eXo);
472                 return ;
473         }
474         contact=sal_op_get_contact(op);
475 @@ -1284,7 +1288,7 @@
476                 sdp_message_free(op->sdp_answer);
477                 op->sdp_answer=NULL;
478         }
479 -       eXosip_call_send_ack(ev->did,msg);
480 +       eXosip_call_send_ack(eXo,ev->did,msg);
481         sal->callbacks.call_accepted(op);
482  }
483  
484 @@ -1458,7 +1462,7 @@
485                         sr=SalReasonMedia;
486                 break;
487                 case 422:
488 -                       eXosip_default_action(ev);
489 +                       eXosip_default_action(eXo,ev);
490                         return TRUE;
491                 break;
492                 case 480:
493 @@ -1508,17 +1512,17 @@
494  
495         char clen[10];
496  
497 -       eXosip_lock();
498 -       eXosip_call_build_info(h->did,&msg);
499 +       eXosip_lock(eXo);
500 +       eXosip_call_build_info(eXo,h->did,&msg);
501         if (msg){
502                 osip_message_set_body(msg,info_body,strlen(info_body));
503                 osip_message_set_content_type(msg,"application/media_control+xml");
504                 snprintf(clen,sizeof(clen),"%lu",(unsigned long)strlen(info_body));
505                 osip_message_set_content_length(msg,clen);
506 -               eXosip_call_send_request(h->did,msg);
507 +               eXosip_call_send_request(eXo,h->did,msg);
508                 ms_message("Sending VFU request !");
509         }
510 -       eXosip_unlock();
511 +       eXosip_unlock(eXo);
512  }
513  
514  static void process_media_control_xml(Sal *sal, eXosip_event_t *ev){
515 @@ -1537,20 +1541,20 @@
516                 ms_message("Receiving VFU request !");
517                 if (sal->callbacks.vfu_request){
518                         sal->callbacks.vfu_request(op);
519 -                       eXosip_call_build_answer(ev->tid,200,&ans);
520 +                       eXosip_call_build_answer(eXo,ev->tid,200,&ans);
521                         if (ans)
522 -                               eXosip_call_send_answer(ev->tid,200,ans);
523 +                               eXosip_call_send_answer(eXo,ev->tid,200,ans);
524                         return;
525                 }
526         }
527         /*in all other cases we must say it is not implemented.*/
528         {
529                 osip_message_t *ans=NULL;
530 -               eXosip_lock();
531 -               eXosip_call_build_answer(ev->tid,501,&ans);
532 +               eXosip_lock(eXo);
533 +               eXosip_call_build_answer(eXo,ev->tid,501,&ans);
534                 if (ans)
535 -                       eXosip_call_send_answer(ev->tid,501,ans);
536 -               eXosip_unlock();
537 +                       eXosip_call_send_answer(eXo,ev->tid,501,ans);
538 +               eXosip_unlock(eXo);
539         }
540  }
541  
542 @@ -1579,11 +1583,11 @@
543                                         sal->callbacks.dtmf_received(op, tmp[0]);
544                         }
545                 }
546 -               eXosip_lock();
547 -               eXosip_call_build_answer(ev->tid,200,&ans);
548 +               eXosip_lock(eXo);
549 +               eXosip_call_build_answer(eXo,ev->tid,200,&ans);
550                 if (ans)
551 -                       eXosip_call_send_answer(ev->tid,200,ans);
552 -               eXosip_unlock();
553 +                       eXosip_call_send_answer(eXo,ev->tid,200,ans);
554 +               eXosip_unlock(eXo);
555         }
556  }
557  
558 @@ -1628,11 +1632,11 @@
559                         osip_free(tmp);
560                         osip_from_free(from);
561                 }
562 -               eXosip_lock();
563 -               eXosip_call_build_answer(ev->tid,202,&ans);
564 +               eXosip_lock(eXo);
565 +               eXosip_call_build_answer(eXo,ev->tid,202,&ans);
566                 if (ans)
567 -                       eXosip_call_send_answer(ev->tid,202,ans);
568 -               eXosip_unlock();
569 +                       eXosip_call_send_answer(eXo,ev->tid,202,ans);
570 +               eXosip_unlock(eXo);
571         }
572         else
573         {
574 @@ -1677,11 +1681,11 @@
575                 }
576         }
577         /*answer that we received the notify*/
578 -       eXosip_lock();
579 -       eXosip_call_build_answer(ev->tid,200,&ans);
580 +       eXosip_lock(eXo);
581 +       eXosip_call_build_answer(eXo,ev->tid,200,&ans);
582         if (ans)
583 -               eXosip_call_send_answer(ev->tid,200,ans);
584 -       eXosip_unlock();
585 +               eXosip_call_send_answer(eXo,ev->tid,200,ans);
586 +       eXosip_unlock(eXo);
587         osip_free(from);
588  }
589  
590 @@ -1699,28 +1703,28 @@
591                                 else {
592                                         ms_message("Unhandled SIP INFO.");
593                                         /*send an "Not implemented" answer*/
594 -                                       eXosip_lock();
595 -                                       eXosip_call_build_answer(ev->tid,501,&ans);
596 +                                       eXosip_lock(eXo);
597 +                                       eXosip_call_build_answer(eXo,ev->tid,501,&ans);
598                                         if (ans)
599 -                                               eXosip_call_send_answer(ev->tid,501,ans);
600 -                                       eXosip_unlock();
601 +                                               eXosip_call_send_answer(eXo,ev->tid,501,ans);
602 +                                       eXosip_unlock(eXo);
603                                 }
604                         }else{
605                                 /*empty SIP INFO, probably to test we are alive. Send an empty answer*/
606 -                               eXosip_lock();
607 -                               eXosip_call_build_answer(ev->tid,200,&ans);
608 +                               eXosip_lock(eXo);
609 +                               eXosip_call_build_answer(eXo,ev->tid,200,&ans);
610                                 if (ans)
611 -                                       eXosip_call_send_answer(ev->tid,200,ans);
612 -                               eXosip_unlock();
613 +                                       eXosip_call_send_answer(eXo,ev->tid,200,ans);
614 +                               eXosip_unlock(eXo);
615                         }
616                 }else if(MSG_IS_MESSAGE(ev->request)){
617                         /* SIP messages could be received into call */
618                         text_received(sal, ev);
619 -                       eXosip_lock();
620 -                       eXosip_call_build_answer(ev->tid,200,&ans);
621 +                       eXosip_lock(eXo);
622 +                       eXosip_call_build_answer(eXo,ev->tid,200,&ans);
623                         if (ans)
624 -                               eXosip_call_send_answer(ev->tid,200,ans);
625 -                       eXosip_unlock();
626 +                               eXosip_call_send_answer(eXo,ev->tid,200,ans);
627 +                       eXosip_unlock(eXo);
628                 }else if(MSG_IS_REFER(ev->request)){
629                         SalOp *op=find_op(sal,ev);
630                         
631 @@ -1729,13 +1733,13 @@
632                 }else if(MSG_IS_NOTIFY(ev->request)){
633                         process_notify(sal,ev);
634                 }else if (MSG_IS_OPTIONS(ev->request)){
635 -                       eXosip_lock();
636 -                       eXosip_call_build_answer(ev->tid,200,&ans);
637 +                       eXosip_lock(eXo);
638 +                       eXosip_call_build_answer(eXo,ev->tid,200,&ans);
639                         if (ans){
640                                 fill_options_answer(ans);
641 -                               eXosip_call_send_answer(ev->tid,200,ans);
642 +                               eXosip_call_send_answer(eXo,ev->tid,200,ans);
643                         }
644 -                       eXosip_unlock();
645 +                       eXosip_unlock(eXo);
646                 }
647         }else ms_warning("call_message_new: No request ?");
648  }
649 @@ -1743,11 +1747,11 @@
650  static void inc_update(Sal *sal, eXosip_event_t *ev){
651         osip_message_t *msg=NULL;
652         ms_message("Processing incoming UPDATE");
653 -       eXosip_lock();
654 -       eXosip_message_build_answer(ev->tid,200,&msg);
655 +       eXosip_lock(eXo);
656 +       eXosip_message_build_answer(eXo,ev->tid,200,&msg);
657         if (msg!=NULL)
658 -               eXosip_message_send_answer(ev->tid,200,msg);
659 -       eXosip_unlock();
660 +               eXosip_message_send_answer(eXo,ev->tid,200,msg);
661 +       eXosip_unlock(eXo);
662  }
663  
664  static bool_t comes_from_local_if(osip_message_t *msg){
665 @@ -1874,12 +1878,12 @@
666         if (ev->request==NULL) return;
667         if (strcmp(ev->request->sip_method,"MESSAGE")==0){
668                 text_received(sal,ev);
669 -               eXosip_message_send_answer(ev->tid,200,NULL);
670 +               eXosip_message_send_answer(eXo,ev->tid,200,NULL);
671         }else if (strcmp(ev->request->sip_method,"OPTIONS")==0){
672                 osip_message_t *options=NULL;
673 -               eXosip_options_build_answer(ev->tid,200,&options);
674 +               eXosip_options_build_answer(eXo,ev->tid,200,&options);
675                 fill_options_answer(options);
676 -               eXosip_options_send_answer(ev->tid,200,options);
677 +               eXosip_options_send_answer(eXo,ev->tid,200,options);
678         }else if (strncmp(ev->request->sip_method, "REFER", 5) == 0){
679                 ms_message("Receiving REFER request !");
680                 if (comes_from_local_if(ev->request)) {
681 @@ -1896,7 +1900,7 @@
682                         osip_free(tmp);
683                 }
684                 /*answer with a 501 Not implemented*/
685 -               eXosip_message_send_answer(ev->tid,501,NULL);
686 +               eXosip_message_send_answer(eXo,ev->tid,501,NULL);
687         }
688  }
689  
690 @@ -2007,25 +2011,25 @@
691                 ms_message("Contact do not match, resending register.");
692         else return FALSE;
693  
694 -       eXosip_lock();
695 -       eXosip_register_build_register(op->rid,op->expires,&msg);
696 +       eXosip_lock(eXo);
697 +       eXosip_register_build_register(eXo,op->rid,op->expires,&msg);
698         if (msg==NULL){
699 -           eXosip_unlock();
700 +           eXosip_unlock(eXo);
701             ms_warning("Fail to create a contact updated register.");
702             return FALSE;
703         }
704         if (fix_message_contact(op,msg,last_answer,op->base.root->expire_old_contact)) {
705 -               eXosip_register_send_register(op->rid,msg);
706 -               eXosip_unlock();  
707 +               eXosip_register_send_register(eXo,op->rid,msg);
708 +               eXosip_unlock(eXo);  
709                 ms_message("Resending new register with updated contact");
710                 update_contact_from_response(op,last_answer);
711                 return TRUE;
712         } else {
713             ms_warning("Fail to send updated register.");
714 -           eXosip_unlock();
715 +           eXosip_unlock(eXo);
716             return FALSE;
717         }
718 -       eXosip_unlock();
719 +       eXosip_unlock(eXo);
720         return FALSE;
721  }
722  
723 @@ -2078,10 +2082,10 @@
724                                         if (val>op->expires)
725                                                 op->expires=val;
726                                 }else op->expires*=2;
727 -                               eXosip_lock();
728 -                               eXosip_register_build_register(op->rid,op->expires,&msg);
729 -                               eXosip_register_send_register(op->rid,msg);
730 -                               eXosip_unlock();
731 +                               eXosip_lock(eXo);
732 +                               eXosip_register_build_register(eXo,op->rid,op->expires,&msg);
733 +                               eXosip_register_send_register(eXo,op->rid,msg);
734 +                               eXosip_unlock(eXo);
735                         }
736                 break;
737                 case 606: /*Not acceptable, workaround for proxies that don't like private addresses
738 @@ -2156,7 +2160,9 @@
739                         ms_message("CALL_CLOSED or CANCELLED\n");
740                         call_terminated(sal,ev);
741                         break;
742 +#ifdef EXOSIP_CALL_TIMEOUT
743                 case EXOSIP_CALL_TIMEOUT:
744 +#endif
745                 case EXOSIP_CALL_NOANSWER:
746                         ms_message("CALL_TIMEOUT or NOANSWER\n");
747                         return call_failure(sal,ev);
748 @@ -2184,7 +2190,7 @@
749                         break;
750                 case EXOSIP_CALL_REDIRECTED:
751                         ms_message("CALL_REDIRECTED");
752 -                       eXosip_default_action(ev);
753 +                       eXosip_default_action(eXo, ev);
754                         break;
755                 case EXOSIP_CALL_PROCEEDING:
756                         ms_message("CALL_PROCEEDING");
757 @@ -2213,13 +2219,17 @@
758                         ms_message("CALL_IN_SUBSCRIPTION_NEW ");
759                         sal_exosip_subscription_recv(sal,ev);
760                         break;
761 +#ifdef EXOSIP_IN_SUBSCRIPTION_RELEASED
762                 case EXOSIP_IN_SUBSCRIPTION_RELEASED:
763                         ms_message("CALL_SUBSCRIPTION_NEW ");
764                         sal_exosip_in_subscription_closed(sal,ev);
765                         break;
766 +#endif
767 +#ifdef EXOSIP_SUBSCRIPTION_UPDATE
768                 case EXOSIP_SUBSCRIPTION_UPDATE:
769                         ms_message("CALL_SUBSCRIPTION_UPDATE");
770                         break;
771 +#endif
772                 case EXOSIP_SUBSCRIPTION_NOTIFY:
773                         ms_message("CALL_SUBSCRIPTION_NOTIFY");
774                         sal_exosip_notify_recv(sal,ev);
775 @@ -2228,10 +2238,6 @@
776                         ms_message("EXOSIP_SUBSCRIPTION_ANSWERED, ev->sid=%i, ev->did=%i\n",ev->sid,ev->did);
777                         sal_exosip_subscription_answered(sal,ev);
778                         break;
779 -               case EXOSIP_SUBSCRIPTION_CLOSED:
780 -                       ms_message("EXOSIP_SUBSCRIPTION_CLOSED\n");
781 -                       sal_exosip_subscription_closed(sal,ev);
782 -                       break;
783                 case EXOSIP_SUBSCRIPTION_REQUESTFAILURE:   /**< announce a request failure      */
784                         if (ev->response && (ev->response->status_code == 407 || ev->response->status_code == 401)){
785                                 return process_authentication(sal,ev);
786 @@ -2266,7 +2272,7 @@
787                                         case 401:
788                                                 return process_authentication(sal,ev);
789                                         case 412: {
790 -                                               eXosip_automatic_action ();
791 +                                               eXosip_automatic_action (eXo);
792                                                 return 1;
793                                         }
794                                 }
795 @@ -2282,21 +2288,21 @@
796  
797  int sal_iterate(Sal *sal){
798         eXosip_event_t *ev;
799 -       while((ev=eXosip_event_wait(0,0))!=NULL){
800 +       while((ev=eXosip_event_wait(eXo,0,0))!=NULL){
801                 if (process_event(sal,ev))
802                         eXosip_event_free(ev);
803         }
804  #ifdef HAVE_EXOSIP_TRYLOCK
805         if (eXosip_trylock()==0){
806 -               eXosip_automatic_refresh();
807 -               eXosip_unlock();
808 +               eXosip_automatic_refresh(eXo);
809 +               eXosip_unlock(eXo);
810         }else{
811                 ms_warning("eXosip_trylock busy.");
812         }
813  #else
814 -       eXosip_lock();
815 -       eXosip_automatic_refresh();
816 -       eXosip_unlock();
817 +       eXosip_lock(eXo);
818 +       eXosip_automatic_refresh(eXo);
819 +       eXosip_unlock(eXo);
820  #endif
821         return 0;
822  }
823 @@ -2361,26 +2367,26 @@
824                 }
825                 if (uri) ms_free(uri);
826                 sal_address_destroy(from_parsed);
827 -               eXosip_lock();
828 -               h->rid=eXosip_register_build_initial_register(from,domain,NULL,expires,&msg);
829 +               eXosip_lock(eXo);
830 +               h->rid=eXosip_register_build_initial_register(eXo,from,domain,NULL,expires,&msg);
831                 if (msg){
832                         if (contact) register_set_contact(msg,contact);
833                         sal_message_add_route(msg,proxy);
834                         sal_add_register(h->base.root,h);
835                 }else{
836                         ms_error("Could not build initial register.");
837 -                       eXosip_unlock();
838 +                       eXosip_unlock(eXo);
839                         return -1;
840                 }
841         }else{
842 -               eXosip_lock();
843 -               eXosip_register_build_register(h->rid,expires,&msg);
844 +               eXosip_lock(eXo);
845 +               eXosip_register_build_register(eXo,h->rid,expires,&msg);
846                 sal_message_add_route(msg,proxy);
847         }
848         if (msg){
849 -               eXosip_register_send_register(h->rid,msg);
850 +               eXosip_register_send_register(eXo,h->rid,msg);
851         }
852 -       eXosip_unlock();
853 +       eXosip_unlock(eXo);
854         h->expires=expires;
855         return (msg != NULL) ? 0 : -1;
856  }
857 @@ -2399,7 +2405,7 @@
858                 /*iOS hack: in the keep alive handler, we have no more than 10 seconds to refresh registers, otherwise the application is suspended forever.
859                 * In order to prevent this case that can occur when the exosip thread is busy with DNS while network isn't in a good shape, we try to take
860                 * the exosip lock in a non blocking way, and give up if it takes too long*/
861 -               while (eXosip_trylock()!=0){
862 +               while (eXosip_trylock(eXo)!=0){
863                         ms_usleep(100000);
864                         tries++;
865                         if (tries>30) {/*after 3 seconds, give up*/
866 @@ -2409,26 +2415,26 @@
867                 }
868         }
869  #else
870 -       eXosip_lock();
871 +       eXosip_lock(eXo);
872  #endif
873 -       eXosip_register_build_register(op->rid,expires,&msg);
874 +       eXosip_register_build_register(eXo,op->rid,expires,&msg);
875         if (msg!=NULL){
876                 if (contact) register_set_contact(msg,contact);
877                 sal_message_add_route(msg,sal_op_get_route(op));
878 -               eXosip_register_send_register(op->rid,msg);
879 +               eXosip_register_send_register(eXo,op->rid,msg);
880         }else ms_error("Could not build REGISTER refresh message.");
881 -       eXosip_unlock();
882 +       eXosip_unlock(eXo);
883         return (msg != NULL) ? 0 : -1;
884  }
885  
886  
887  int sal_unregister(SalOp *h){
888         osip_message_t *msg=NULL;
889 -       eXosip_lock();
890 -       eXosip_register_build_register(h->rid,0,&msg);
891 -       if (msg) eXosip_register_send_register(h->rid,msg);
892 +       eXosip_lock(eXo);
893 +       eXosip_register_build_register(eXo,h->rid,0,&msg);
894 +       if (msg) eXosip_register_send_register(eXo,h->rid,msg);
895         else ms_warning("Could not build unREGISTER !");
896 -       eXosip_unlock();
897 +       eXosip_unlock(eXo);
898         return 0;
899  }
900  
901 @@ -2598,7 +2604,7 @@
902                 default:
903                         break;
904         }
905 -       eXosip_set_option (EXOSIP_OPT_UDP_KEEP_ALIVE, &ctx->keepalive_period);
906 +       eXosip_set_option (eXo, EXOSIP_OPT_UDP_KEEP_ALIVE, &ctx->keepalive_period);
907  }
908  unsigned int sal_get_keepalive_period(Sal *ctx) {
909         return ctx->keepalive_period;
910 @@ -2636,12 +2642,12 @@
911         int err=0;
912         osip_message_t *reinvite=NULL;
913  
914 -       eXosip_lock();
915 -       if(eXosip_call_build_request(h->did,"INVITE",&reinvite) != 0 || reinvite==NULL){
916 -               eXosip_unlock();
917 +       eXosip_lock(eXo);
918 +       if(eXosip_call_build_request(eXo,h->did,"INVITE",&reinvite) != 0 || reinvite==NULL){
919 +               eXosip_unlock(eXo);
920                 return -1;
921         }
922 -       eXosip_unlock();
923 +       eXosip_unlock(eXo);
924         osip_message_set_subject(reinvite,subject);
925         osip_message_set_allow(reinvite, "INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO");
926         if (h->base.contact){
927 @@ -2656,9 +2662,9 @@
928                 h->sdp_offering=TRUE;
929                 set_sdp_from_desc(reinvite,h->base.local_media);
930         }else h->sdp_offering=FALSE;
931 -       eXosip_lock();
932 -       err = eXosip_call_send_request(h->did, reinvite);
933 -       eXosip_unlock();
934 +       eXosip_lock(eXo);
935 +       err = eXosip_call_send_request(eXo, h->did, reinvite);
936 +       eXosip_unlock(eXo);
937         return err;
938  }
939  
940 diff -dur linphone-3.6.0.orig/coreapi/sal_eXosip2_presence.c linphone-3.6.0/coreapi/sal_eXosip2_presence.c
941 --- linphone-3.6.0.orig/coreapi/sal_eXosip2_presence.c  2013-06-17 11:11:08.000000000 +0200
942 +++ linphone-3.6.0/coreapi/sal_eXosip2_presence.c       2013-06-17 11:12:12.000000000 +0200
943 @@ -32,6 +32,8 @@
944   */
945  static presence_type_t presence_style = PIDF;
946  
947 +extern struct eXosip_t *eXo;
948 +
949  SalOp * sal_find_out_subscribe(Sal *sal, int sid){
950         const MSList *elem;
951         SalOp *op;
952 @@ -113,8 +115,8 @@
953                         sal_op_set_to(op,to);
954  
955                 sal_exosip_fix_route(op);
956 -               eXosip_lock();
957 -               eXosip_message_build_request(&sip,"MESSAGE",sal_op_get_to(op),
958 +               eXosip_lock(eXo);
959 +               eXosip_message_build_request(eXo,&sip,"MESSAGE",sal_op_get_to(op),
960                         sal_op_get_from(op),sal_op_get_route(op));
961                 if (sip!=NULL){
962                         sal_exosip_add_custom_headers(sip,op->base.custom_headers);
963 @@ -122,30 +124,30 @@
964                         osip_message_set_content_type(sip,content_type);
965                         if (msg) osip_message_set_body(sip,msg,strlen(msg));
966                         sal_add_other(op->base.root,op,sip);
967 -                       eXosip_message_send_request(sip);
968 +                       eXosip_message_send_request(eXo,sip);
969                 }else{
970                         ms_error("Could not build MESSAGE request !");
971                 }
972 -               eXosip_unlock();
973 +               eXosip_unlock(eXo);
974         }
975         else
976         {
977                 /* we are currently in communication with the destination */
978 -               eXosip_lock();
979 +               eXosip_lock(eXo);
980                 //First we generate an INFO message to get the current call_id and a good cseq
981 -               eXosip_call_build_request(op->did,"MESSAGE",&sip);
982 +               eXosip_call_build_request(eXo,op->did,"MESSAGE",&sip);
983                 if(sip == NULL)
984                 {
985                         ms_warning("could not get a build info to send MESSAGE, maybe no previous call established ?");
986 -                       eXosip_unlock();
987 +                       eXosip_unlock(eXo);
988                         return -1;
989                 }
990                 sal_exosip_add_custom_headers(sip,op->base.custom_headers);
991                 msg_add_current_date(sip);
992                 osip_message_set_content_type(sip,content_type);
993                 if (msg) osip_message_set_body(sip,msg,strlen(msg));
994 -               eXosip_call_send_request(op->did,sip);
995 -               eXosip_unlock();
996 +               eXosip_call_send_request(eXo,op->did,sip);
997 +               eXosip_unlock(eXo);
998         }
999         return 0;
1000  }
1001 @@ -161,20 +163,20 @@
1002         if (to)
1003                 sal_op_set_to(op,to);
1004         sal_exosip_fix_route(op);
1005 -       eXosip_lock();
1006 -       eXosip_subscribe_build_initial_request(&msg,sal_op_get_to(op),sal_op_get_from(op),
1007 +       eXosip_lock(eXo);
1008 +       eXosip_subscribe_build_initial_request(eXo,&msg,sal_op_get_to(op),sal_op_get_from(op),
1009                 sal_op_get_route(op),"presence",600);
1010         if (msg==NULL){
1011                 ms_error("Could not build subscribe request to %s",to);
1012 -               eXosip_unlock();
1013 +               eXosip_unlock(eXo);
1014                 return -1;
1015         }
1016         if (op->base.contact){
1017                 _osip_list_set_empty(&msg->contacts,(void (*)(void*))osip_contact_free);
1018                 osip_message_set_contact(msg,op->base.contact);
1019         }
1020 -       op->sid=eXosip_subscribe_send_initial_request(msg);
1021 -       eXosip_unlock();
1022 +       op->sid=eXosip_subscribe_send_initial_request(eXo,msg);
1023 +       eXosip_unlock(eXo);
1024         if (op->sid==-1){
1025                 osip_message_free(msg);
1026                 return -1;
1027 @@ -189,39 +191,39 @@
1028                 ms_error("cannot unsubscribe, no dialog !");
1029                 return -1;
1030         }
1031 -       eXosip_lock();
1032 -       eXosip_subscribe_build_refresh_request(op->did,&msg);
1033 +       eXosip_lock(eXo);
1034 +       eXosip_subscribe_build_refresh_request(eXo,op->did,&msg);
1035         if (msg){
1036                 osip_message_set_expires(msg,"0");
1037 -               eXosip_subscribe_send_refresh_request(op->did,msg);
1038 +               eXosip_subscribe_send_refresh_request(eXo,op->did,msg);
1039         }else ms_error("Could not build subscribe refresh request ! op->sid=%i, op->did=%i",
1040                 op->sid,op->did);
1041 -       eXosip_unlock();
1042 +       eXosip_unlock(eXo);
1043         return 0;
1044  }
1045  
1046  int sal_subscribe_accept(SalOp *op){
1047         osip_message_t *msg=NULL;
1048 -       eXosip_lock();
1049 -       eXosip_insubscription_build_answer(op->tid,202,&msg);
1050 +       eXosip_lock(eXo);
1051 +       eXosip_insubscription_build_answer(eXo,op->tid,202,&msg);
1052         if (msg==NULL){
1053                 ms_error("Fail to build answer to subscribe.");
1054 -               eXosip_unlock();
1055 +               eXosip_unlock(eXo);
1056                 return -1;
1057         }
1058         if (op->base.contact){
1059                 _osip_list_set_empty(&msg->contacts,(void (*)(void*))osip_contact_free);
1060                 osip_message_set_contact(msg,op->base.contact);
1061         }
1062 -       eXosip_insubscription_send_answer(op->tid,202,msg);
1063 -       eXosip_unlock();
1064 +       eXosip_insubscription_send_answer(eXo,op->tid,202,msg);
1065 +       eXosip_unlock(eXo);
1066         return 0;
1067  }
1068  
1069  int sal_subscribe_decline(SalOp *op){
1070 -       eXosip_lock();
1071 -       eXosip_insubscription_send_answer(op->tid,401,NULL);
1072 -       eXosip_unlock();
1073 +       eXosip_lock(eXo);
1074 +       eXosip_insubscription_send_answer(eXo,op->tid,401,NULL);
1075 +       eXosip_unlock(eXo);
1076         return 0;
1077  }
1078  
1079 @@ -597,39 +599,39 @@
1080  
1081  int sal_notify_presence(SalOp *op, SalPresenceStatus status, const char *status_message){
1082         osip_message_t *msg=NULL;
1083 -       eXosip_ss_t ss=EXOSIP_SUBCRSTATE_ACTIVE;
1084 +       int ss=EXOSIP_SUBCRSTATE_ACTIVE;
1085         if (op->nid==-1){
1086                 ms_warning("Cannot notify, subscription was closed.");
1087                 return -1;
1088         }
1089         
1090 -       eXosip_lock();
1091 -       eXosip_insubscription_build_notify(op->did,ss,DEACTIVATED,&msg);
1092 +       eXosip_lock(eXo);
1093 +       eXosip_insubscription_build_notify(eXo,op->did,ss,DEACTIVATED,&msg);
1094         if (msg!=NULL){
1095                 const char *identity=sal_op_get_contact(op);
1096                 if (identity==NULL) identity=sal_op_get_to(op);
1097                 _osip_list_set_empty(&msg->contacts,(void (*)(void*))osip_contact_free);
1098                 osip_message_set_contact(msg,identity);
1099                 add_presence_body(msg,status);
1100 -               eXosip_insubscription_send_request(op->did,msg);
1101 +               eXosip_insubscription_send_request(eXo,op->did,msg);
1102         }else ms_error("could not create notify for incoming subscription.");
1103 -       eXosip_unlock();
1104 +       eXosip_unlock(eXo);
1105         return 0;
1106  }
1107  
1108  int sal_notify_close(SalOp *op){
1109         osip_message_t *msg=NULL;
1110 -       eXosip_lock();
1111 -       eXosip_insubscription_build_notify(op->did,EXOSIP_SUBCRSTATE_TERMINATED,DEACTIVATED,&msg);
1112 +       eXosip_lock(eXo);
1113 +       eXosip_insubscription_build_notify(eXo,op->did,EXOSIP_SUBCRSTATE_TERMINATED,DEACTIVATED,&msg);
1114         if (msg!=NULL){
1115                 const char *identity=sal_op_get_contact(op);
1116                 if (identity==NULL) identity=sal_op_get_to(op);
1117                 osip_message_set_contact(msg,identity);
1118                 add_presence_body(msg,SalPresenceOffline);
1119 -               eXosip_insubscription_send_request(op->did,msg);
1120 +               eXosip_insubscription_send_request(eXo,op->did,msg);
1121         }else ms_error("sal_notify_close(): could not create notify for incoming subscription"
1122             " did=%i, nid=%i",op->did,op->nid);
1123 -       eXosip_unlock();
1124 +       eXosip_unlock(eXo);
1125         return 0;
1126  }
1127  
1128 @@ -641,7 +643,7 @@
1129  
1130         mk_presence_body (presence_mode, from, buf, sizeof (buf), presence_style);
1131  
1132 -       i = eXosip_build_publish(&pub,to, from, NULL, "presence", "600", 
1133 +       i = eXosip_build_publish(eXo,&pub,to, from, NULL, "presence", "600", 
1134                 presence_style ? "application/xpidf+xml" : "application/pidf+xml", buf);
1135         if (i<0){
1136                 ms_warning("Failed to build publish request.");
1137 @@ -650,10 +652,10 @@
1138         if (route)
1139                 sal_message_add_route(pub,route);
1140         
1141 -       eXosip_lock();
1142 -       i = eXosip_publish(pub, to); /* should update the sip-if-match parameter
1143 +       eXosip_lock(eXo);
1144 +       i = eXosip_publish(eXo, pub, to); /* should update the sip-if-match parameter
1145                                     from sip-etag  from last 200ok of PUBLISH */
1146 -       eXosip_unlock();
1147 +       eXosip_unlock(eXo);
1148         if (i<0){
1149                 ms_message("Failed to send publish request.");
1150                 return -1;
1151 @@ -693,10 +695,10 @@
1152                 }else {
1153                         osip_message_t *msg=NULL;
1154                         ms_warning("Probably a refresh subscribe");
1155 -                       eXosip_lock();
1156 -                       eXosip_insubscription_build_answer(ev->tid,202,&msg);
1157 -                       eXosip_insubscription_send_answer(ev->tid,202,msg);
1158 -                       eXosip_unlock();
1159 +                       eXosip_lock(eXo);
1160 +                       eXosip_insubscription_build_answer(eXo,ev->tid,202,&msg);
1161 +                       eXosip_insubscription_send_answer(eXo,ev->tid,202,msg);
1162 +                       eXosip_unlock(eXo);
1163                 }
1164         }else _sal_exosip_subscription_recv(sal,ev);
1165  }
This page took 0.209815 seconds and 3 git commands to generate.