Create a gist now

Instantly share code, notes, and snippets.

Patch against telepathy rakia 0.7.4 to make it support 3pcc INVITEs
diff -ur telepathy-rakia-0.7.4.orig/rakia/call-channel.c telepathy-rakia-0.7.4/rakia/call-channel.c
--- telepathy-rakia-0.7.4.orig/rakia/call-channel.c 2012-05-08 18:51:51.000000000 +0200
+++ telepathy-rakia-0.7.4/rakia/call-channel.c 2012-09-10 23:06:47.180994786 +0200
@@ -690,6 +690,7 @@
media_added_cb (RakiaSipSession *session, RakiaSipMedia *media,
RakiaCallChannel *self)
{
+ TpBaseChannel *bc = TP_BASE_CHANNEL(self);
TpCallContentDisposition disposition;
const gchar *name;
@@ -702,8 +703,11 @@
{
case RAKIA_SIP_SESSION_STATE_CREATED:
case RAKIA_SIP_SESSION_STATE_INVITE_RECEIVED:
- disposition = TP_CALL_CONTENT_DISPOSITION_INITIAL;
- break;
+ if (!tp_base_channel_is_registered(self))
+ {
+ disposition = TP_CALL_CONTENT_DISPOSITION_INITIAL;
+ break;
+ }
default:
disposition = TP_CALL_CONTENT_DISPOSITION_NONE;
}
diff -ur telepathy-rakia-0.7.4.orig/rakia/sip-session.c telepathy-rakia-0.7.4/rakia/sip-session.c
--- telepathy-rakia-0.7.4.orig/rakia/sip-session.c 2012-05-08 18:51:51.000000000 +0200
+++ telepathy-rakia-0.7.4/rakia/sip-session.c 2012-09-10 23:42:17.553094286 +0200
@@ -141,6 +141,7 @@
GPtrArray *medias;
gboolean incoming; /* Is this an incoming call ? (or outgoing */
+ gboolean invite_3pcc; /* did we receive a 3pcc invite? (or normal) */
RakiaBaseConnection *conn;
nua_saved_event_t saved_event[1]; /* Saved incoming request event */
@@ -657,6 +658,7 @@
{
g_assert (self->priv->incoming);
+ self->priv->invite_3pcc = sdp == NULL;
rakia_sip_session_receive_invite (self);
/* Tell the factory to emit NewChannel(s) */
@@ -1202,7 +1204,7 @@
g_return_if_fail (priv->nua_op != NULL);
{
- GString *user_sdp = priv_session_generate_sdp (session, FALSE);
+ GString *user_sdp = priv_session_generate_sdp (session, priv->invite_3pcc);
g_free (priv->local_sdp);
priv->local_sdp = g_string_free (user_sdp, FALSE);
@@ -1687,6 +1689,14 @@
priv->accepted = TRUE;
+ if (priv->invite_3pcc && !priv->medias->len)
+ {
+ /* We've received a 3pcc INVITE and have no media at all. Simply trigger creation of
+ * a audio stream locally and propose that. */
+ SESSION_DEBUG (self, "incoming session is a 3pcc INVITE call");
+ rakia_sip_session_add_media(self, TP_MEDIA_STREAM_TYPE_AUDIO, NULL, RAKIA_DIRECTION_BIDIRECTIONAL);
+ }
+
/* Will change session state to active when streams are ready */
priv_request_response_step (self);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment