telepathy-rakia: Transform TP reason into appropriate SIP reasons
Olivier Crête
tester at kemper.freedesktop.org
Tue May 8 10:03:04 PDT 2012
Module: telepathy-rakia
Branch: master
Commit: 86f1d77943a377053f06d898767535f36a3f0a24
URL: http://cgit.freedesktop.org/telepathy/telepathy-rakia/commit/?id=86f1d77943a377053f06d898767535f36a3f0a24
Author: Olivier Crête <olivier.crete at collabora.com>
Date: Thu Apr 5 20:38:52 2012 -0400
Transform TP reason into appropriate SIP reasons
---
rakia/call-channel.c | 65 +++++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 59 insertions(+), 6 deletions(-)
diff --git a/rakia/call-channel.c b/rakia/call-channel.c
index 11eee5a..51267f2 100644
--- a/rakia/call-channel.c
+++ b/rakia/call-channel.c
@@ -22,12 +22,15 @@
#include "rakia/call-channel.h"
+#include <string.h>
+
#include "rakia/call-content.h"
#include "rakia/sip-session.h"
#define DEBUG_FLAG RAKIA_DEBUG_CALL
#include "rakia/debug.h"
+
#include <telepathy-glib/exportable-channel.h>
@@ -53,7 +56,7 @@ static TpBaseCallContent * rakia_call_channel_add_content (
GError **error);
static void rakia_call_channel_hangup (
TpBaseCallChannel *base,
- guint reason,
+ TpCallStateChangeReason reason,
const gchar *detailed_reason,
const gchar *message);
static void rakia_call_channel_set_ringing (TpBaseCallChannel *base);
@@ -389,16 +392,66 @@ rakia_call_channel_add_content (
static void
rakia_call_channel_hangup (
TpBaseCallChannel *base,
- guint reason,
+ TpCallStateChangeReason reason,
const gchar *detailed_reason,
const gchar *message)
{
RakiaCallChannel *self = RAKIA_CALL_CHANNEL (base);
RakiaCallChannelPrivate *priv = self->priv;
-
- /* FIXME: We need to convert the dbus reason into a SIP status code */
-
- rakia_sip_session_terminate (priv->session, 480, "Terminated");
+ guint status = 486;
+ const gchar *sipmessage;
+
+ switch (reason) {
+ break;
+ case TP_CALL_STATE_CHANGE_REASON_NO_ANSWER:
+ status = 480;
+ sipmessage = "No answer";
+ break;
+ case TP_CALL_STATE_CHANGE_REASON_INVALID_CONTACT:
+ sipmessage = "Not Found";
+ break;
+ case TP_CALL_STATE_CHANGE_REASON_PERMISSION_DENIED:
+ sipmessage = "Permission denied";
+ break;
+ case TP_CALL_STATE_CHANGE_REASON_REJECTED:
+ sipmessage = "Rejected";
+ break;
+ case TP_CALL_STATE_CHANGE_REASON_BUSY:
+ sipmessage = "Busy";
+ break;
+ case TP_CALL_STATE_CHANGE_REASON_INTERNAL_ERROR:
+ status = 480;
+ sipmessage = "Internal Error";
+ break;
+ case TP_CALL_STATE_CHANGE_REASON_SERVICE_ERROR:
+ sipmessage = "Service Error";
+ break;
+ case TP_CALL_STATE_CHANGE_REASON_NETWORK_ERROR:
+ status = 480;
+ sipmessage = "Network error";
+ break;
+ case TP_CALL_STATE_CHANGE_REASON_MEDIA_ERROR:
+ status = 488;
+ if (!strcmp (detailed_reason, TP_ERROR_STR_MEDIA_UNSUPPORTED_TYPE))
+ sipmessage = "Unsupported type";
+ else if (!strcmp (detailed_reason, TP_ERROR_STR_MEDIA_CODECS_INCOMPATIBLE))
+ sipmessage = "Codecs Incompatible";
+ else
+ sipmessage = "Media error";
+ break;
+ case TP_CALL_STATE_CHANGE_REASON_CONNECTIVITY_ERROR:
+ sipmessage = "Connectivity Error";
+ break;
+ case TP_CALL_STATE_CHANGE_REASON_USER_REQUESTED:
+ sipmessage = "User ended call";
+ break;
+ case TP_CALL_STATE_CHANGE_REASON_PROGRESS_MADE:
+ case TP_CALL_STATE_CHANGE_REASON_UNKNOWN:
+ default:
+ sipmessage = "Terminated by unknown reason";
+ }
+
+ rakia_sip_session_terminate (priv->session, status, sipmessage);
}
static void
More information about the telepathy-commits
mailing list