sdp_message_t *_eXosip_get_local_sdp(osip_transaction_t * invite_tr) { osip_message_t *message; if (invite_tr == NULL) return NULL; if (invite_tr->ctx_type == IST || invite_tr->ctx_type == NIST) message = invite_tr->last_response; else if (invite_tr->ctx_type == ICT || invite_tr->ctx_type == NICT) message = invite_tr->orig_request; else return NULL; return eXosip_get_sdp_info(message); }
Call * call_new(Sipomatic *root, eXosip_event_t *ev) { Call *obj; char *sdpans; int status; sdp_message_t *sdp; sdp_context_t *sdpc; sdp=eXosip_get_sdp_info(ev->request); sdpc=sdp_handler_create_context(&sipomatic_sdp_handler,NULL,"sipomatic"); obj=ms_new0(Call,1); obj->profile=rtp_profile_new("remote"); eXosip_call_send_answer(ev->tid,100,NULL); sdp_context_set_user_pointer(sdpc,obj); sdpans=sdp_context_get_answer(sdpc,sdp); if (sdpans!=NULL){ eXosip_call_send_answer(ev->tid,180,NULL); }else{ status=sdp_context_get_status(sdpc); eXosip_call_send_answer(ev->tid,status,NULL); sdp_context_free(sdpc); rtp_profile_destroy(obj->profile); ms_free(obj); return NULL; } obj->sdpc=sdpc; obj->did=ev->did; obj->tid=ev->tid; obj->time=time(NULL); obj->audio_stream=NULL; obj->state=CALL_STATE_INIT; obj->eof=0; obj->root=root; root->calls=ms_list_append(root->calls,obj); return obj; }