void eXosip_call_free(eXosip_call_t *jc) { /* ... */ eXosip_dialog_t *jd; for (jd = jc->c_dialogs; jd!=NULL; jd=jc->c_dialogs) { REMOVE_ELEMENT(jc->c_dialogs, jd); eXosip_dialog_free(jd); } __eXosip_delete_jinfo(jc->c_inc_tr); __eXosip_delete_jinfo(jc->c_out_tr); if (jc->c_inc_tr!=NULL) osip_list_add_nodup(eXosip.j_transactions, jc->c_inc_tr, 0); if (jc->c_out_tr!=NULL) osip_list_add_nodup(eXosip.j_transactions, jc->c_out_tr, 0); __eXosip_delete_jinfo(jc->c_inc_options_tr); __eXosip_delete_jinfo(jc->c_out_options_tr); if (jc->c_inc_options_tr!=NULL) osip_list_add_nodup(eXosip.j_transactions, jc->c_inc_options_tr, 0); if (jc->c_out_options_tr!=NULL) osip_list_add_nodup(eXosip.j_transactions, jc->c_out_options_tr, 0); osip_negotiation_ctx_free(jc->c_ctx); osip_free(jc); }
int test_sdp_message (char *msg, int verbose) { sdp_message_t *sdp; { char *result; sdp_message_init (&sdp); if (sdp_message_parse (sdp, msg) != 0) { fprintf (stdout, "ERROR: failed while parsing!\n"); sdp_message_free (sdp); /* try to free msg, even if it failed! */ /* this seems dangerous..... */ return -1; } else { int i; i = sdp_message_to_str (sdp, &result); test_accessor_get_api (sdp); if (i == -1) { fprintf (stdout, "ERROR: failed while printing message!\n"); sdp_message_free (sdp); return -1; } else { if (verbose) fprintf (stdout, "%s", result); if (strlen (result) != strlen (msg)) fprintf (stdout, "length differ from original message!\n"); if (0 == strncmp (result, msg, strlen (result))) fprintf (stdout, "result equals msg!!\n"); osip_free (result); { osip_negotiation_ctx_t *context; sdp_message_t *dest; i = osip_negotiation_ctx_init (&context); i = osip_negotiation_ctx_set_mycontext (context, (void *) ua_context); { sdp_message_t *sdp; osip_negotiation_sdp_build_offer (osip_negotiation, context, &sdp, ua_context->m_audio_port, ua_context->m_video_port); sdp_message_to_str (sdp, &result); fprintf (stdout, "Here is the offer:\n%s\n", result); osip_free (result); osip_negotiation_sdp_message_put_on_hold (sdp); sdp_message_to_str (sdp, &result); fprintf (stdout, "Here is the offer on hold:\n%s\n", result); osip_free (result); sdp_message_free (sdp); } i = osip_negotiation_ctx_set_remote_sdp (context, sdp); if (i != 0) { fprintf (stdout, "Initialisation of context failed. Could not negociate\n"); } else { fprintf (stdout, "Trying to execute a SIP negotiation:\n"); i = osip_negotiation_ctx_execute_negotiation (osip_negotiation, context); fprintf (stdout, "return code: %i\n", i); if (i == 200) { dest = osip_negotiation_ctx_get_local_sdp (context); fprintf (stdout, "SDP answer:\n"); i = sdp_message_to_str (dest, &result); if (i != 0) fprintf (stdout, "Error found in SDP answer while printing\n"); else fprintf (stdout, "%s\n", result); osip_free (result); } osip_negotiation_ctx_free (context); return 0; } } } sdp_message_free (sdp); } } return 0; }