3
Copyright (C) 2000 Simon MORLAT (simon.morlat@free.fr)
5
This program is free software; you can redistribute it and/or
6
modify it under the terms of the GNU General Public License
7
as published by the Free Software Foundation; either version 2
8
of the License, or (at your option) any later version.
10
This program is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
GNU General Public License for more details.
15
You should have received a copy of the GNU General Public License
16
along with this program; if not, write to the Free Software
17
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19
#ifndef LINPHONECORE_H
20
#define LINPHONECORE_H
33
#define _(String) gettext(String)
49
#ifndef PayloadType_defined
50
#define PayloadType_defined
51
typedef struct _PayloadType PayloadType;
54
gboolean payload_type_enabled(struct _PayloadType *pt);
55
gboolean payload_type_usable(struct _PayloadType *pt);
56
void payload_type_set_enable(struct _PayloadType *pt,gint value);
57
void payload_type_set_usable(struct _PayloadType *pt,gint value);
58
gchar *payload_type_get_description(struct _PayloadType *pt);
59
gint payload_type_get_bitrate(PayloadType *pt);
60
const gchar *payload_type_get_mime(PayloadType *pt);
61
gint payload_type_get_rate(PayloadType *pt);
65
#define CONNECTION_TYPE_28KMODEM 0
66
#define CONNECTION_TYPE_56KMODEM 1
67
#define CONNECTION_TYPE_NUMERIS 2
68
#define CONNECTION_TYPE_ADSL 3
69
#define CONNECTION_TYPE_ETHERNET 4
71
extern const double bandwidths[5];
73
typedef struct registrar_config
75
char *registrar; /*or proxy */
80
guint32 use_registrar:1; /* general flag */
81
guint32 as_proxy:1; /* is the registrar also an outbound proxy */
85
typedef struct sip_config
90
registrar_config_t reg_conf;
94
typedef struct rtp_config
96
guint16 audio_rtp_port;
97
guint16 video_rtp_port;
98
gint audio_jitt_comp; /*jitter compensation*/
99
gint video_jitt_comp; /*jitter compensation*/
102
typedef struct _interface_t
114
typedef struct net_config
116
GList *interfaces; /* list of interface_t */
118
double bandwidth; /* the bandwidth in bit/s of the selected interface*/ /*unused*/
121
gint con_type; /* type of connection 28k 56k 128k adsl ...*/
125
typedef struct sound_config
127
SndCard *sndcard; /* the sndcard currently used */
128
gint dev_id; /* sound device id */
129
gint latency; /* latency in samples of the current used sound device */
136
int autokill:1; /* 1= automatically free access to sound device by killing artsd and esd*/
139
typedef struct codecs_config
141
GList *audio_codecs; /* list of audio codecs in order of preference*/
142
GList *video_codecs; /* for later use*/
145
typedef struct video_config{
151
typedef struct ui_config
156
guint timer_id; /* the timer id for registration */
161
typedef struct autoreplier_config
164
gint after_seconds; /* accept the call after x seconds*/
165
gint max_users; /* maximum number of user that can call simultaneously */
166
gint max_rec_time; /* the max time of incoming voice recorded */
167
gint max_rec_msg; /* maximum number of recorded messages */
168
gchar *message; /* the path of the file to be played */
169
}autoreplier_config_t;
171
typedef struct _StreamParams
181
typedef struct _LinphoneDialogParams
183
StreamParams audio_params;
184
StreamParams video_params;
185
struct _RtpProfile *profile; /*points to the local_profile or to the remote "guessed" profile*/
186
} LinphoneDialogParams;
188
LinphoneDialogParams * linphone_dialog_params_new();
189
void linphone_dialog_params_destroy(LinphoneDialogParams *obj);
190
struct _LinphoneCore;
192
typedef void (*ShowInterfaceCb)(struct _LinphoneCore *lc);
193
typedef void (*InviteReceivedCb)(struct _LinphoneCore *lc, char *from);
194
typedef void (*ByeReceivedCb)(struct _LinphoneCore *lc, char *from);
195
typedef void (*DisplayStatusCb)(struct _LinphoneCore *lc, char *message);
196
typedef void (*DisplayMessageCb)(struct _LinphoneCore *lc, char *message);
197
typedef void (*DisplayUrlCb)(struct _LinphoneCore *lc, char *message,char *url);
198
typedef void (*DisplayQuestionCb)(struct _LinphoneCore *lc, char *message);
199
typedef void (*LinphoneCoreCbFunc)(struct _LinphoneCore *lc,gpointer user_data);
200
typedef void (*NotifyReceivedCb)(struct _LinphoneCore *lc, const char *url, const char *status);
202
typedef struct _LinphoneVTable
204
ShowInterfaceCb show;
205
InviteReceivedCb inv_recv;
206
ByeReceivedCb bye_recv;
207
NotifyReceivedCb notify_recv;
208
DisplayStatusCb display_status;
209
DisplayMessageCb display_message;
210
DisplayMessageCb display_warning;
211
DisplayUrlCb display_url;
212
DisplayQuestionCb display_question;
213
} LinphoneCoreVTable;
215
typedef struct _LCCallbackObj
217
LinphoneCoreCbFunc _func;
222
typedef struct _LinphoneCore
224
LinphoneCoreVTable vtable;
225
net_config_t net_conf;
226
sip_config_t sip_conf;
227
rtp_config_t rtp_conf;
228
sound_config_t sound_conf;
229
video_config_t video_conf;
230
codecs_config_t codecs_conf;
232
autoreplier_config_t autoreplier_conf;
233
struct _RingStream *ringstream;
234
LCCallbackObj preview_finished_cb;
235
gboolean preview_finished;
236
OsipUA *ua; /* the osip user agent*/
237
OsipDialog *call; /* the current dialog, in the future it will be a list of dialog (conferencing)*/
238
GList *queued_calls; /* used by the autoreplier */
239
BodyHandler *sdph; /* the sdp handler */
240
struct _AudioStream *audiostream; /**/
241
transaction_t *current_trn; /* REVISIT LATER */
242
struct _RtpProfile *local_profile;
249
LinphoneCore *linphone_core_new(LinphoneCoreVTable *vtable,
250
gchar *config_path, gpointer userdata);
252
void linphone_core_init(LinphoneCore *lc,LinphoneCoreVTable *vtable,
253
gchar *config_path, gpointer userdata);
255
int linphone_core_set_primary_contact(LinphoneCore *lc, gchar *contact);
257
gchar *linphone_core_get_primary_contact(LinphoneCore *lc);
259
from_t *linphone_core_get_primary_contact_parsed(LinphoneCore *lc);
262
#ifdef LINPHONE_DEPRECATED
263
GList * linphone_core_get_net_interfaces(LinphoneCore *lc);
265
interface_t * linphone_core_get_selected_interface(LinphoneCore *lc);
268
void linphone_core_select_net_interface(LinphoneCore *lc, gint index);
270
void linphone_core_select_net_interface(LinphoneCore *lc, gchar *ifname);
275
void linphone_core_set_connection_type(LinphoneCore *lc, int type);
277
int linphone_core_get_connection_type(LinphoneCore *lc);
279
int linphone_core_invite(LinphoneCore *lc, char *url);
281
gboolean linphone_core_inc_invite_pending(LinphoneCore*lc);
283
int linphone_core_accept_dialog(LinphoneCore *lc, const char *url);
285
int linphone_core_terminate_dialog(LinphoneCore *lc, const char *url);
287
void linphone_core_send_dtmf(LinphoneCore *lc,gchar dtmf);
289
/* returns a GList of MSCodecInfo */
290
GList *linphone_core_get_audio_codecs(LinphoneCore *lc);
292
int linphone_core_set_audio_codecs(LinphoneCore *lc, GList *codecs);
294
/* returns a GList of MSCodecInfo */
295
GList *linphone_core_get_video_codecs(LinphoneCore *lc);
297
int linphone_core_set_video_codecs(LinphoneCore *lc, GList *codecs);
299
GList * linphone_core_get_address_list(LinphoneCore *lc);
301
int linphone_core_set_address_list(LinphoneCore *lc, GList *addresses);
303
char *linphone_core_get_registrar_addr(LinphoneCore *lc);
305
char *linphone_core_get_registrar_passwd(LinphoneCore *lc);
307
void linphone_core_set_registrar_passwd(LinphoneCore *lc, gchar *passwd);
309
char *linphone_core_get_addr_of_rec(LinphoneCore *lc);
311
int linphone_core_set_registrar_addr(LinphoneCore *lc, char *url,char*addr_of_rec);
313
int linphone_core_register(LinphoneCore *lc, char *url);
315
void linphone_core_get_registrar_usage(LinphoneCore *lc, gboolean *enabled, gboolean *as_proxy, gint*expires);
317
void linphone_core_set_registrar_usage(LinphoneCore *lc, gboolean enabled, gboolean as_proxy, gint expires);
319
int linphone_core_get_audio_jittcomp(LinphoneCore *lc);
321
int linphone_core_get_audio_port(LinphoneCore *lc);
323
void linphone_core_set_audio_jittcomp(LinphoneCore *lc, int value);
325
void linphone_core_set_audio_port(LinphoneCore *lc, int port);
327
int linphone_core_get_sip_port(LinphoneCore *lc);
329
void linphone_core_set_sip_port(LinphoneCore *lc,int port);
331
void linphone_core_set_nat_address(LinphoneCore *lc, gchar *addr, gboolean use);
333
gchar *linphone_core_get_nat_address(LinphoneCore *lc, gboolean *use);
335
void linphone_core_force_ip_address(LinphoneCore *lc, gchar *ipaddr);
337
/* function to be periodically called in a main loop */
338
void linphone_core_iterate(LinphoneCore *lc);
340
/* sound functions */
341
SndCardManager * linphone_core_get_card_manager(LinphoneCore *lc);
342
gint linphone_core_get_play_level(LinphoneCore *lc);
343
gint linphone_core_get_rec_level(LinphoneCore *lc);
344
void linphone_core_set_play_level(LinphoneCore *lc, gint level);
345
void linphone_core_set_rec_level(LinphoneCore *lc, gint level);
346
gint linphone_core_get_sound_device(LinphoneCore *lc);
347
gint linphone_core_set_sound_device(LinphoneCore *lc, gint devid);
348
gint linphone_core_set_sound_device_from_name(LinphoneCore *lc,gchar *name);
349
gchar linphone_core_get_sound_source(LinphoneCore *lc);
350
void linphone_core_set_sound_source(LinphoneCore *lc, gchar source);
351
void linphone_core_set_ring(LinphoneCore *lc,gchar *path);
352
gchar *linphone_core_get_ring(LinphoneCore *lc);
353
gint linphone_core_preview_ring(LinphoneCore *lc, const gchar *ring,LinphoneCoreCbFunc func,gpointer userdata);
354
typedef enum {RINGBACK_TYPE_FR,RINGBACK_TYPE_US} RingBackType;
355
void linphone_core_set_ringback(LinphoneCore *lc,RingBackType type);
356
RingBackType linphone_core_get_ringback(LinphoneCore *lc);
358
void linphone_core_set_presence_info(LinphoneCore *lc,gint minutes_away,
362
#define linphone_core_is_in_main_thread(lc) ((lc)->in_main_thread)
364
void linphone_core_uninit(LinphoneCore *lc);
365
void linphone_core_destroy(LinphoneCore *lc);
367
/*internal use only */
368
#define linphone_core_thread_enter(lc) (lc)->in_main_thread=0
369
#define linphone_core_thread_leave(lc) (lc)->in_main_thread=1
370
#define linphone_core_lock(lc) g_mutex_lock((lc)->lock)
371
#define linphone_core_unlock(lc) g_mutex_unlock((lc)->lock)