static void
call_content_setup_jingle (GabbleCallContent *self,
    GabbleCallMemberContent *mcontent)
{
  TpBaseCallContent *base = TP_BASE_CALL_CONTENT (self);
  GabbleJingleContent *jingle;
  GabbleCallStream *stream;
  gchar *path;
  JingleTransportType transport;
  JingleMediaDescription *md;
  GHashTable *tp_md;
  TpHandle contact;

  jingle = gabble_call_member_content_get_jingle_content (mcontent);

  if (jingle == NULL)
    return;

  transport = gabble_jingle_content_get_transport_type (jingle);
  path = g_strdup_printf ("%s/Stream%p",
      tp_base_call_content_get_object_path (base),
      jingle);
  stream = g_object_new (GABBLE_TYPE_CALL_STREAM,
      "object-path", path,
      "connection", tp_base_call_content_get_connection (base),
      "jingle-content", jingle,
      "transport", _jingle_to_tp_transport (transport),
      NULL);
  g_free (path);

  md = jingle_media_description_new ();

  /* FIXME: correct??? */
  contact = gabble_call_member_get_handle (
      gabble_call_member_content_get_member (mcontent));
  tp_md = tp_base_media_call_content_get_local_media_description (
      TP_BASE_MEDIA_CALL_CONTENT (self), contact);
  if (tp_md != NULL)
    {
      md->codecs = codec_array_to_list (tp_asv_get_boxed (tp_md,
          TP_PROP_CALL_CONTENT_MEDIA_DESCRIPTION_CODECS,
          TP_ARRAY_TYPE_CODEC_LIST));
    }

  if (md->codecs != NULL)
    jingle_media_rtp_set_local_media_description (
        GABBLE_JINGLE_MEDIA_RTP (jingle), md, TRUE, NULL);
  else
    jingle_media_description_free (md);

  tp_base_call_content_add_stream (base, TP_BASE_CALL_STREAM (stream));
  gabble_call_stream_update_member_states (stream);
  g_object_unref (stream);
}
static void
md_offer_cb (GObject *obj, GAsyncResult *res, gpointer user_data)
{
  RakiaCallContent *self = RAKIA_CALL_CONTENT (obj);
  RakiaCallContentPrivate *priv = self->priv;
  TpBaseMediaCallContent *bmcc = TP_BASE_MEDIA_CALL_CONTENT (self);
  GError *error = NULL;
  gboolean is_initial_offer = GPOINTER_TO_UINT (user_data);

  if (tp_base_media_call_content_offer_media_description_finish (bmcc,
          res, &error))
    {
      GHashTable *local_md =
          tp_base_media_call_content_get_local_media_description (bmcc,
              tp_base_channel_get_target_handle (TP_BASE_CHANNEL (priv->channel)));

      set_telepathy_codecs (self, local_md);
    }
  else
    {
      /* Only reject if the codecs where rejected */
      if (error->domain == TP_ERROR &&
          error->code == TP_ERROR_MEDIA_CODECS_INCOMPATIBLE)
        {
          g_assert (!is_initial_offer);

          rakia_sip_media_codecs_rejected (priv->media);

          DEBUG ("Codecs rejected: %s", error->message);

        }

      /* FIXME: We need to allow for partial failures */
      g_clear_error (&error);
    }
}