SalMediaDescription * sal_call_get_final_media_description(SalOp *h);
int sal_refer(SalOp *h, const char *refer_to);
int sal_refer_accept(SalOp *h);
+/* returns the SalOp of a call that should be replaced by h, if any */
+SalOp *sal_call_get_replaces(SalOp *h);
int sal_call_send_dtmf(SalOp *h, char dtmf);
int sal_call_terminate(SalOp *h);
bool_t sal_call_autoanswer_asked(SalOp *op);
op->sdp_answer=NULL;
op->reinvite=FALSE;
op->call_id=NULL;
+ op->replaces=NULL;
op->masquerade_via=FALSE;
op->auto_answer_asked=FALSE;
return op;
sal_remove_other(op->base.root,op);
osip_call_id_free(op->call_id);
}
+ if (op->replaces){
+ ms_free(op->replaces);
+ }
__sal_op_free(op);
}
return err;
}
+SalOp *sal_call_get_replaces(SalOp *h){
+ if (h->replaces!=NULL){
+ int cid;
+ eXosip_lock();
+ cid=eXosip_call_find_by_replaces(h->replaces);
+ eXosip_unlock();
+ if (cid>0){
+ SalOp *ret=sal_find_call(h->base.root,cid);
+ return ret;
+ }
+ }
+ return NULL;
+}
+
int sal_call_send_dtmf(SalOp *h, char dtmf){
osip_message_t *msg=NULL;
char dtmf_body[128];
}
}
+static void set_replaces(SalOp *op, osip_message_t *req){
+ osip_header_t *h=NULL;
+
+ if (op->replaces){
+ ms_free(op->replaces);
+ op->replaces=NULL;
+ }
+ osip_message_header_get_byname(req,"replaces",0,&h);
+ if (h){
+ if (h->hvalue && h->hvalue[0]!='\0'){
+ op->replaces=ms_strdup(h->hvalue);
+ }
+ }
+}
+
static SalOp *find_op(Sal *sal, eXosip_event_t *ev){
if (ev->cid>0){
return sal_find_call(sal,ev->cid);
if (ev->rid>0){
return sal_find_register(sal,ev->rid);
}
+ if (ev->sid>0){
+ return sal_find_out_subscribe(sal,ev->sid);
+ }
if (ev->response) return sal_find_other(sal,ev->response);
return NULL;
}
set_network_origin(op,ev->request);
set_remote_ua(op,ev->request);
+ set_replaces(op,ev->request);
if (sdp){
op->sdp_offering=FALSE;
eXosip_event_t *pending_auth;
osip_call_id_t *call_id; /*used for out of calls transaction in order
to retrieve the operation when receiving a response*/
+ char *replaces;
bool_t supports_session_timers;
bool_t sdp_offering;
bool_t reinvite;
void sal_exosip_subscription_closed(Sal *sal,eXosip_event_t *ev);
void sal_exosip_in_subscription_closed(Sal *sal, eXosip_event_t *ev);
-
+SalOp * sal_find_out_subscribe(Sal *sal, int sid);
void sal_exosip_fix_route(SalOp *op);