mirror of
https://gitlab.gnome.org/GNOME/calls.git
synced 2025-01-07 12:25:31 +00:00
call: Introduce protocol property
This commit is contained in:
parent
503e5c2154
commit
53f69b06dd
7 changed files with 71 additions and 0 deletions
|
@ -95,6 +95,12 @@ calls_dummy_call_get_inbound (CallsCall *call)
|
||||||
return self->inbound;
|
return self->inbound;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const char*
|
||||||
|
calls_dummy_call_get_protocol (CallsCall *call)
|
||||||
|
{
|
||||||
|
return "tel";
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
calls_dummy_call_answer (CallsCall *call)
|
calls_dummy_call_answer (CallsCall *call)
|
||||||
{
|
{
|
||||||
|
@ -223,6 +229,7 @@ calls_dummy_call_class_init (CallsDummyCallClass *klass)
|
||||||
call_class->get_number = calls_dummy_call_get_number;
|
call_class->get_number = calls_dummy_call_get_number;
|
||||||
call_class->get_state = calls_dummy_call_get_state;
|
call_class->get_state = calls_dummy_call_get_state;
|
||||||
call_class->get_inbound = calls_dummy_call_get_inbound;
|
call_class->get_inbound = calls_dummy_call_get_inbound;
|
||||||
|
call_class->get_protocol = calls_dummy_call_get_protocol;
|
||||||
call_class->answer = calls_dummy_call_answer;
|
call_class->answer = calls_dummy_call_answer;
|
||||||
call_class->hang_up = calls_dummy_call_hang_up;
|
call_class->hang_up = calls_dummy_call_hang_up;
|
||||||
|
|
||||||
|
|
|
@ -216,6 +216,12 @@ calls_mm_call_get_inbound (CallsCall *call)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const char *
|
||||||
|
calls_mm_call_get_protocol (CallsCall *self)
|
||||||
|
{
|
||||||
|
return "tel";
|
||||||
|
}
|
||||||
|
|
||||||
struct CallsMMOperationData
|
struct CallsMMOperationData
|
||||||
{
|
{
|
||||||
const gchar *desc;
|
const gchar *desc;
|
||||||
|
@ -375,6 +381,7 @@ calls_mm_call_class_init (CallsMMCallClass *klass)
|
||||||
call_class->get_number = calls_mm_call_get_number;
|
call_class->get_number = calls_mm_call_get_number;
|
||||||
call_class->get_state = calls_mm_call_get_state;
|
call_class->get_state = calls_mm_call_get_state;
|
||||||
call_class->get_inbound = calls_mm_call_get_inbound;
|
call_class->get_inbound = calls_mm_call_get_inbound;
|
||||||
|
call_class->get_protocol = calls_mm_call_get_protocol;
|
||||||
call_class->answer = calls_mm_call_answer;
|
call_class->answer = calls_mm_call_answer;
|
||||||
call_class->hang_up = calls_mm_call_hang_up;
|
call_class->hang_up = calls_mm_call_hang_up;
|
||||||
call_class->tone_start = calls_mm_call_tone_start;
|
call_class->tone_start = calls_mm_call_tone_start;
|
||||||
|
|
|
@ -114,6 +114,12 @@ calls_ofono_call_get_inbound (CallsCall *call)
|
||||||
return self->inbound;
|
return self->inbound;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const char *
|
||||||
|
calls_ofono_call_get_protocol (CallsCall *call)
|
||||||
|
{
|
||||||
|
return "tel";
|
||||||
|
}
|
||||||
|
|
||||||
struct CallsCallOperationData
|
struct CallsCallOperationData
|
||||||
{
|
{
|
||||||
const gchar *desc;
|
const gchar *desc;
|
||||||
|
@ -351,6 +357,7 @@ calls_ofono_call_class_init (CallsOfonoCallClass *klass)
|
||||||
call_class->get_name = calls_ofono_call_get_name;
|
call_class->get_name = calls_ofono_call_get_name;
|
||||||
call_class->get_state = calls_ofono_call_get_state;
|
call_class->get_state = calls_ofono_call_get_state;
|
||||||
call_class->get_inbound = calls_ofono_call_get_inbound;
|
call_class->get_inbound = calls_ofono_call_get_inbound;
|
||||||
|
call_class->get_protocol = calls_ofono_call_get_protocol;
|
||||||
call_class->answer = calls_ofono_call_answer;
|
call_class->answer = calls_ofono_call_answer;
|
||||||
call_class->hang_up = calls_ofono_call_hang_up;
|
call_class->hang_up = calls_ofono_call_hang_up;
|
||||||
call_class->tone_start = calls_ofono_call_tone_start;
|
call_class->tone_start = calls_ofono_call_tone_start;
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
#include "calls-sip-media-manager.h"
|
#include "calls-sip-media-manager.h"
|
||||||
#include "calls-sip-media-pipeline.h"
|
#include "calls-sip-media-pipeline.h"
|
||||||
#include "calls-sip-util.h"
|
#include "calls-sip-util.h"
|
||||||
|
#include "util.h"
|
||||||
|
|
||||||
#include <glib/gi18n.h>
|
#include <glib/gi18n.h>
|
||||||
|
|
||||||
|
@ -143,6 +144,15 @@ calls_sip_call_get_inbound (CallsCall *call)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static const char *
|
||||||
|
calls_sip_call_get_protocol (CallsCall *call)
|
||||||
|
{
|
||||||
|
CallsSipCall *self = CALLS_SIP_CALL (call);
|
||||||
|
|
||||||
|
return get_protocol_from_address (self->number);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
calls_sip_call_answer (CallsCall *call)
|
calls_sip_call_answer (CallsCall *call)
|
||||||
{
|
{
|
||||||
|
@ -290,6 +300,7 @@ calls_sip_call_class_init (CallsSipCallClass *klass)
|
||||||
call_class->get_number = calls_sip_call_get_number;
|
call_class->get_number = calls_sip_call_get_number;
|
||||||
call_class->get_state = calls_sip_call_get_state;
|
call_class->get_state = calls_sip_call_get_state;
|
||||||
call_class->get_inbound = calls_sip_call_get_inbound;
|
call_class->get_inbound = calls_sip_call_get_inbound;
|
||||||
|
call_class->get_protocol = calls_sip_call_get_protocol;
|
||||||
call_class->answer = calls_sip_call_answer;
|
call_class->answer = calls_sip_call_answer;
|
||||||
call_class->hang_up = calls_sip_call_hang_up;
|
call_class->hang_up = calls_sip_call_hang_up;
|
||||||
|
|
||||||
|
|
|
@ -224,6 +224,8 @@ add_call (CallsSipOrigin *self,
|
||||||
|
|
||||||
g_debug ("Setting local SDP for outgoing call to %s:\n%s", address, local_sdp);
|
g_debug ("Setting local SDP for outgoing call to %s:\n%s", address, local_sdp);
|
||||||
|
|
||||||
|
/* TODO transform tel URI according to https://tools.ietf.org/html/rfc3261#section-19.1.6 */
|
||||||
|
|
||||||
/* TODO handle IPv4 vs IPv6 for nua_invite (SOATAG_TAG) */
|
/* TODO handle IPv4 vs IPv6 for nua_invite (SOATAG_TAG) */
|
||||||
nua_invite (self->oper->call_handle,
|
nua_invite (self->oper->call_handle,
|
||||||
SOATAG_AF (SOA_AF_IP4_IP6),
|
SOATAG_AF (SOA_AF_IP4_IP6),
|
||||||
|
|
|
@ -55,6 +55,7 @@ enum {
|
||||||
PROP_NUMBER,
|
PROP_NUMBER,
|
||||||
PROP_NAME,
|
PROP_NAME,
|
||||||
PROP_STATE,
|
PROP_STATE,
|
||||||
|
PROP_PROTOCOL,
|
||||||
N_PROPS,
|
N_PROPS,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -90,6 +91,12 @@ calls_call_real_get_inbound (CallsCall *self)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const char *
|
||||||
|
calls_call_real_get_protocol (CallsCall *self)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
calls_call_real_answer (CallsCall *self)
|
calls_call_real_answer (CallsCall *self)
|
||||||
{
|
{
|
||||||
|
@ -140,6 +147,10 @@ calls_call_get_property (GObject *object,
|
||||||
g_value_set_enum (value, calls_call_get_state (self));
|
g_value_set_enum (value, calls_call_get_state (self));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case PROP_PROTOCOL:
|
||||||
|
g_value_set_string (value, calls_call_get_protocol (self));
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
}
|
}
|
||||||
|
@ -156,6 +167,7 @@ calls_call_class_init (CallsCallClass *klass)
|
||||||
klass->get_name = calls_call_real_get_name;
|
klass->get_name = calls_call_real_get_name;
|
||||||
klass->get_state = calls_call_real_get_state;
|
klass->get_state = calls_call_real_get_state;
|
||||||
klass->get_inbound = calls_call_real_get_inbound;
|
klass->get_inbound = calls_call_real_get_inbound;
|
||||||
|
klass->get_protocol = calls_call_real_get_protocol;
|
||||||
klass->answer = calls_call_real_answer;
|
klass->answer = calls_call_real_answer;
|
||||||
klass->hang_up = calls_call_real_hang_up;
|
klass->hang_up = calls_call_real_hang_up;
|
||||||
klass->tone_start = calls_call_real_tone_start;
|
klass->tone_start = calls_call_real_tone_start;
|
||||||
|
@ -190,6 +202,13 @@ calls_call_class_init (CallsCallClass *klass)
|
||||||
CALLS_CALL_STATE_ACTIVE,
|
CALLS_CALL_STATE_ACTIVE,
|
||||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||||
|
|
||||||
|
properties[PROP_PROTOCOL] =
|
||||||
|
g_param_spec_string ("protocol",
|
||||||
|
"Protocol",
|
||||||
|
"The protocol used for this call",
|
||||||
|
NULL,
|
||||||
|
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||||
|
|
||||||
g_object_class_install_properties (object_class, N_PROPS, properties);
|
g_object_class_install_properties (object_class, N_PROPS, properties);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -313,6 +332,22 @@ calls_call_get_inbound (CallsCall *self)
|
||||||
return CALLS_CALL_GET_CLASS (self)->get_inbound (self);
|
return CALLS_CALL_GET_CLASS (self)->get_inbound (self);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* calls_call_get_protocol:
|
||||||
|
* @self: a #CallsCall
|
||||||
|
*
|
||||||
|
* Get the protocol of the call (i.e. "tel", "sip")
|
||||||
|
*
|
||||||
|
* Returns: The protocol used or %NULL when unknown
|
||||||
|
*/
|
||||||
|
const char *
|
||||||
|
calls_call_get_protocol (CallsCall *self)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (CALLS_IS_CALL (self), NULL);
|
||||||
|
|
||||||
|
return CALLS_CALL_GET_CLASS (self)->get_protocol (self);
|
||||||
|
}
|
||||||
|
|
||||||
static inline gboolean
|
static inline gboolean
|
||||||
tone_key_is_valid (gchar key)
|
tone_key_is_valid (gchar key)
|
||||||
{
|
{
|
||||||
|
|
|
@ -54,6 +54,7 @@ struct _CallsCallClass
|
||||||
const char *(*get_name) (CallsCall *self);
|
const char *(*get_name) (CallsCall *self);
|
||||||
CallsCallState (*get_state) (CallsCall *self);
|
CallsCallState (*get_state) (CallsCall *self);
|
||||||
gboolean (*get_inbound) (CallsCall *self);
|
gboolean (*get_inbound) (CallsCall *self);
|
||||||
|
const char *(*get_protocol) (CallsCall *self);
|
||||||
void (*answer) (CallsCall *self);
|
void (*answer) (CallsCall *self);
|
||||||
void (*hang_up) (CallsCall *self);
|
void (*hang_up) (CallsCall *self);
|
||||||
void (*tone_start) (CallsCall *self,
|
void (*tone_start) (CallsCall *self,
|
||||||
|
@ -66,6 +67,7 @@ const char *calls_call_get_number (CallsCall *self);
|
||||||
const char *calls_call_get_name (CallsCall *self);
|
const char *calls_call_get_name (CallsCall *self);
|
||||||
CallsCallState calls_call_get_state (CallsCall *self);
|
CallsCallState calls_call_get_state (CallsCall *self);
|
||||||
gboolean calls_call_get_inbound (CallsCall *self);
|
gboolean calls_call_get_inbound (CallsCall *self);
|
||||||
|
const char *calls_call_get_protocol (CallsCall *self);
|
||||||
void calls_call_answer (CallsCall *self);
|
void calls_call_answer (CallsCall *self);
|
||||||
void calls_call_hang_up (CallsCall *self);
|
void calls_call_hang_up (CallsCall *self);
|
||||||
void calls_call_tone_start (CallsCall *self,
|
void calls_call_tone_start (CallsCall *self,
|
||||||
|
|
Loading…
Reference in a new issue