blob: cb2e8b7a79194ba8241095c31867e91e1acdeffd [file] [log] [blame]
Benny Prijono268ca612006-02-07 12:34:11 +00001/* $Id$ */
2/*
3 * Copyright (C) 2003-2006 Benny Prijono <benny@prijono.org>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
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.
14 *
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
18 */
19#ifndef __PJSUA_H__
20#define __PJSUA_H__
21
22/* Include all PJSIP core headers. */
23#include <pjsip.h>
24
25/* Include all PJMEDIA headers. */
26#include <pjmedia.h>
27
Benny Prijono1f9afba2006-02-10 15:57:32 +000028/* Include all PJMEDIA-CODEC headers. */
29#include <pjmedia-codec.h>
30
Benny Prijono268ca612006-02-07 12:34:11 +000031/* Include all PJSIP-UA headers */
32#include <pjsip_ua.h>
33
Benny Prijono834aee32006-02-19 01:38:06 +000034/* Include all PJSIP-SIMPLE headers */
35#include <pjsip_simple.h>
36
Benny Prijono268ca612006-02-07 12:34:11 +000037/* Include all PJLIB-UTIL headers. */
38#include <pjlib-util.h>
39
40/* Include all PJLIB headers. */
41#include <pjlib.h>
42
43
Benny Prijono1a01ad32006-02-07 21:13:28 +000044PJ_BEGIN_DECL
45
Benny Prijono632ce712006-02-09 14:01:40 +000046
Benny Prijonof3195072006-02-14 21:15:30 +000047/**
48 * Max buddies in buddy list.
49 */
Benny Prijonoa91a0032006-02-26 21:23:45 +000050#ifndef PJSUA_MAX_BUDDIES
Benny Prijonodc39fe82006-05-26 12:17:46 +000051# define PJSUA_MAX_BUDDIES 256
Benny Prijonoa91a0032006-02-26 21:23:45 +000052#endif
53
Benny Prijonof3195072006-02-14 21:15:30 +000054
Benny Prijonof04ffdd2006-02-21 00:11:18 +000055/**
56 * Max simultaneous calls.
57 */
Benny Prijonoa91a0032006-02-26 21:23:45 +000058#ifndef PJSUA_MAX_CALLS
59# define PJSUA_MAX_CALLS 256
60#endif
61
62
63/**
Benny Prijonoa91a0032006-02-26 21:23:45 +000064 * Maximum accounts.
65 */
66#ifndef PJSUA_MAX_ACC
Benny Prijonodc39fe82006-05-26 12:17:46 +000067# define PJSUA_MAX_ACC 32
Benny Prijonoa91a0032006-02-26 21:23:45 +000068#endif
69
70
Benny Prijonoa91a0032006-02-26 21:23:45 +000071/**
Benny Prijonodc39fe82006-05-26 12:17:46 +000072 * Account configuration.
73 */
74struct pjsua_acc_config
75{
76 /** SIP URL for account ID (mandatory) */
77 pj_str_t id;
78
79 /** Registrar URI (mandatory) */
80 pj_str_t reg_uri;
81
82 /** Optional contact URI */
83 pj_str_t contact;
84
85 /** Service proxy (default: none) */
86 pj_str_t proxy;
87
88 /** Default timeout (mandatory) */
89 pj_int32_t reg_timeout;
90
91 /** Number of credentials. */
92 unsigned cred_count;
93
94 /** Array of credentials. */
95 pjsip_cred_info cred_info[4];
96
97};
98
99
100/**
101 * @see pjsua_acc_config
102 */
103typedef struct pjsua_acc_config pjsua_acc_config;
104
105
106/**
Benny Prijonodc39fe82006-05-26 12:17:46 +0000107 * PJSUA settings.
108 */
109struct pjsua_config
110{
111 /** SIP UDP signaling port. Set to zero to disable UDP signaling,
112 * which in this case application must manually add a transport
113 * to SIP endpoint.
114 * (default: 5060)
115 */
116 unsigned udp_port;
117
118 /** Optional hostname or IP address to publish as the host part of
119 * Contact header. This must be specified if UDP transport is
120 * disabled.
121 * (default: NULL)
122 */
123 pj_str_t sip_host;
124
125 /** Optional port number to publish in the port part of Contact header.
126 * This must be specified if UDP transport is disabled.
127 * (default: 0)
128 */
129 unsigned sip_port;
130
131 /** Start of RTP port. Set to zero to prevent pjsua from creating
132 * media transports, which in this case application must manually
133 * create media transport for each calls.
134 * (default: 4000)
135 */
136 unsigned start_rtp_port;
137
138 /** Maximum calls to support (default: 4) */
139 unsigned max_calls;
140
141 /** Maximum slots in the conference bridge (default: 0/calculated
142 * as max_calls*2
143 */
144 unsigned conf_ports;
145
146 /** Number of worker threads (default: 1) */
147 unsigned thread_cnt;
148
149 /** First STUN server IP address. When STUN is configured, then the
150 * two STUN server settings must be fully set.
151 * (default: none)
152 */
153 pj_str_t stun_srv1;
154
155 /** First STUN port number */
156 unsigned stun_port1;
157
158 /** Second STUN server IP address */
159 pj_str_t stun_srv2;
160
161 /** Second STUN server port number */
162 unsigned stun_port2;
163
Benny Prijono9fc735d2006-05-28 14:58:12 +0000164 /** Sound player device ID (default: 0) */
165 unsigned snd_player_id;
166
167 /** Sound capture device ID (default: 0) */
168 unsigned snd_capture_id;
169
Benny Prijonodc39fe82006-05-26 12:17:46 +0000170 /** Internal clock rate (to be applied to sound devices and conference
171 * bridge, default is 0/follows the codec, or 44100 for MacOS).
172 */
173 unsigned clock_rate;
174
175 /** Do not use sound device (default: 0). */
176 pj_bool_t null_audio;
177
178 /** WAV file to load for auto_play (default: NULL) */
179 pj_str_t wav_file;
180
181 /** Auto play WAV file for calls? (default: no) */
182 pj_bool_t auto_play;
183
184 /** Auto loopback calls? (default: no) */
185 pj_bool_t auto_loop;
186
187 /** Automatically put calls to conference? (default: no) */
188 pj_bool_t auto_conf;
189
190 /** Speex codec complexity? (default: 10) */
191 unsigned complexity;
192
193 /** Speex codec quality? (default: 10) */
194 unsigned quality;
195
196 /** Codec ptime? (default: 0 (follows the codec)) */
197 unsigned ptime;
198
199 /** Number of additional codecs/"--add-codec" with pjsua (default: 0) */
200 unsigned codec_cnt;
201
202 /** Additional codecs/"--add-codec" options */
203 pj_str_t codec_arg[32];
204
205 /** SIP status code to be automatically sent to incoming calls
206 * (default: 100).
207 */
208 unsigned auto_answer;
209
210 /** Periodic time to refresh call with re-INVITE (default: 0)
211 */
212 unsigned uas_refresh;
213
214 /** Maximum incoming call duration (default: 3600) */
215 unsigned uas_duration;
216
217 /** Outbound proxy (default: none) */
218 pj_str_t outbound_proxy;
219
220 /** URI to call. */
221 pj_str_t uri_to_call;
222
223 /** Number of SIP accounts */
224 unsigned acc_cnt;
225
226 /** SIP accounts configuration */
227 pjsua_acc_config acc_config[32];
228
229 /** Logging verbosity (default: 5). */
230 unsigned log_level;
231
232 /** Logging to be displayed to stdout (default: 4) */
233 unsigned app_log_level;
234
235 /** Log decoration */
236 unsigned log_decor;
237
238 /** Optional log filename (default: NULL) */
239 pj_str_t log_filename;
240
241 /** Number of buddies in address book (default: 0) */
242 unsigned buddy_cnt;
243
244 /** Buddies URI */
245 pj_str_t buddy_uri[256];
246};
247
248
249/**
250 * @see pjsua_config
251 */
252typedef struct pjsua_config pjsua_config;
253
254
255
256/**
257 * Application callbacks.
258 */
259struct pjsua_callback
260{
261 /**
Benny Prijono9fc735d2006-05-28 14:58:12 +0000262 * Notify application when invite state has changed.
263 * Application may then query the call info to get the
264 * detail call states.
Benny Prijonodc39fe82006-05-26 12:17:46 +0000265 */
266 void (*on_call_state)(int call_index, pjsip_event *e);
267
268 /**
Benny Prijono9fc735d2006-05-28 14:58:12 +0000269 * Notify application on call being transfered.
270 * Application can decide to accept/reject transfer request
271 * by setting the code (default is 200). When this callback
272 * is not defined, the default behavior is to accept the
273 * transfer.
274 */
275 void (*on_call_transfered)(int call_index,
276 const pj_str_t *dst,
277 pjsip_status_code *code);
278
279 /**
280 * Notify application when registration status has changed.
281 * Application may then query the account info to get the
282 * registration details.
Benny Prijonodc39fe82006-05-26 12:17:46 +0000283 */
284 void (*on_reg_state)(int acc_index);
285
286 /**
Benny Prijono9fc735d2006-05-28 14:58:12 +0000287 * Notify application when the buddy state has changed.
288 * Application may then query the buddy into to get the details.
289 */
290 void (*on_buddy_state)(int buddy_index);
291
292 /**
293 * Notify application on incoming pager (i.e. MESSAGE request).
Benny Prijonodc39fe82006-05-26 12:17:46 +0000294 * Argument call_index will be -1 if MESSAGE request is not related to an
295 * existing call.
296 */
297 void (*on_pager)(int call_index, const pj_str_t *from,
298 const pj_str_t *to, const pj_str_t *txt);
299
300 /**
Benny Prijono9fc735d2006-05-28 14:58:12 +0000301 * Notify application about typing indication.
Benny Prijonodc39fe82006-05-26 12:17:46 +0000302 */
303 void (*on_typing)(int call_index, const pj_str_t *from,
304 const pj_str_t *to, pj_bool_t is_typing);
305
306};
307
308/**
309 * @see pjsua_callback
310 */
311typedef struct pjsua_callback pjsua_callback;
312
313
Benny Prijono9fc735d2006-05-28 14:58:12 +0000314/**
315 * Call info.
316 */
317struct pjsua_call_info
Benny Prijono268ca612006-02-07 12:34:11 +0000318{
Benny Prijono9fc735d2006-05-28 14:58:12 +0000319 unsigned index;
320 pj_bool_t active;
321 pjsip_role_e role;
322 pj_str_t local_info;
323 pj_str_t remote_info;
324 pjsip_inv_state state;
325 pj_str_t state_text;
326 pj_time_val connect_duration;
327 pj_time_val total_duration;
328 pjsip_status_code cause;
329 pj_str_t cause_text;
330 pj_bool_t has_media;
331 unsigned conf_slot;
Benny Prijono1a01ad32006-02-07 21:13:28 +0000332};
Benny Prijono268ca612006-02-07 12:34:11 +0000333
Benny Prijono9fc735d2006-05-28 14:58:12 +0000334typedef struct pjsua_call_info pjsua_call_info;
Benny Prijono95196582006-02-09 00:13:40 +0000335
Benny Prijono9fc735d2006-05-28 14:58:12 +0000336
337enum pjsua_buddy_status
338{
339 PJSUA_BUDDY_STATUS_UNKNOWN,
340 PJSUA_BUDDY_STATUS_ONLINE,
341 PJSUA_BUDDY_STATUS_OFFLINE,
342};
343
344typedef enum pjsua_buddy_status pjsua_buddy_status;
345
346
347/**
348 * Buddy info.
349 */
350struct pjsua_buddy_info
351{
352 unsigned index;
353 pj_bool_t is_valid;
354 pj_str_t name;
355 pj_str_t display_name;
356 pj_str_t host;
357 unsigned port;
358 pj_str_t uri;
359 pjsua_buddy_status status;
360 pj_str_t status_text;
361 pj_bool_t monitor;
362};
363
364typedef struct pjsua_buddy_info pjsua_buddy_info;
365
366
367/**
368 * Account info.
369 */
370struct pjsua_acc_info
371{
372 unsigned index;
373 pj_str_t acc_id;
374 pj_bool_t has_registration;
375 int expires;
376 pjsip_status_code status;
377 pj_str_t status_text;
378 pj_bool_t online_status;
379 char buf[PJ_ERR_MSG_SIZE];
380};
381
382typedef struct pjsua_acc_info pjsua_acc_info;
383
384
385typedef int pjsua_player_id;
386typedef int pjsua_recorder_id;
Benny Prijono95196582006-02-09 00:13:40 +0000387
388
Benny Prijono268ca612006-02-07 12:34:11 +0000389
390/*****************************************************************************
Benny Prijono84126ab2006-02-09 09:30:09 +0000391 * PJSUA API (defined in pjsua_core.c).
Benny Prijono268ca612006-02-07 12:34:11 +0000392 */
393
394/**
395 * Initialize pjsua settings with default parameters.
396 */
Benny Prijonodc39fe82006-05-26 12:17:46 +0000397PJ_DECL(void) pjsua_default_config(pjsua_config *cfg);
Benny Prijono268ca612006-02-07 12:34:11 +0000398
399
400/**
Benny Prijono9fc735d2006-05-28 14:58:12 +0000401 * Validate configuration.
Benny Prijono268ca612006-02-07 12:34:11 +0000402 */
Benny Prijonodc39fe82006-05-26 12:17:46 +0000403PJ_DECL(pj_status_t) pjsua_test_config(const pjsua_config *cfg,
404 char *errmsg,
405 int len);
Benny Prijono268ca612006-02-07 12:34:11 +0000406
407
408/**
Benny Prijono9fc735d2006-05-28 14:58:12 +0000409 * Instantiate pjsua application. This initializes pjlib/pjlib-util, and
410 * creates memory pool factory to be used by application.
Benny Prijonodc39fe82006-05-26 12:17:46 +0000411 */
412PJ_DECL(pj_status_t) pjsua_create(void);
413
414
415/**
416 * Initialize pjsua application with the specified settings.
Benny Prijonoccf95622006-02-07 18:48:01 +0000417 *
418 * This will initialize all libraries, create endpoint instance, and register
Benny Prijonodc39fe82006-05-26 12:17:46 +0000419 * pjsip modules.
Benny Prijonoccf95622006-02-07 18:48:01 +0000420 *
421 * Application may register module after calling this function.
Benny Prijono268ca612006-02-07 12:34:11 +0000422 */
Benny Prijonodc39fe82006-05-26 12:17:46 +0000423PJ_DECL(pj_status_t) pjsua_init(const pjsua_config *cfg,
424 const pjsua_callback *cb);
Benny Prijono268ca612006-02-07 12:34:11 +0000425
426
427/**
Benny Prijonoccf95622006-02-07 18:48:01 +0000428 * Start pjsua stack. Application calls this after pjsua settings has been
429 * configured.
430 *
431 * This will start the transport, worker threads (if any), and registration
432 * process, if registration is configured.
433 */
Benny Prijonodc39fe82006-05-26 12:17:46 +0000434PJ_DECL(pj_status_t) pjsua_start(void);
Benny Prijonoccf95622006-02-07 18:48:01 +0000435
Benny Prijonoccf95622006-02-07 18:48:01 +0000436/**
Benny Prijono268ca612006-02-07 12:34:11 +0000437 * Destroy pjsua.
438 */
Benny Prijonodc39fe82006-05-26 12:17:46 +0000439PJ_DECL(pj_status_t) pjsua_destroy(void);
Benny Prijonoa91a0032006-02-26 21:23:45 +0000440
Benny Prijono9fc735d2006-05-28 14:58:12 +0000441/**
442 * Get SIP endpoint instance.
443 * Only valid after pjsua_init().
444 */
445PJ_DECL(pjsip_endpoint*) pjsua_get_pjsip_endpt(void);
446
447/**
448 * Get media endpoint instance.
449 * Only valid after pjsua_init().
450 */
451PJ_DECL(pjmedia_endpt*) pjsua_get_pjmedia_endpt(void);
452
453/**
454 * Replace media transport.
455 */
456PJ_DECL(pj_status_t) pjsua_set_call_media_transport(unsigned call_index,
457 const pjmedia_sock_info *i,
458 pjmedia_transport *tp);
459
Benny Prijonoa91a0032006-02-26 21:23:45 +0000460
461/*****************************************************************************
462 * PJSUA Call API (defined in pjsua_call.c).
463 */
464
465/**
Benny Prijono9fc735d2006-05-28 14:58:12 +0000466 * Get maximum number of calls configured in pjsua.
467 */
468PJ_DECL(unsigned) pjsua_get_max_calls(void);
469
470/**
471 * Get current number of active calls.
472 */
473PJ_DECL(unsigned) pjsua_get_call_count(void);
474
475/**
476 * Check if the specified call has active INVITE session and the INVITE
477 * session has not been disconnected.
478 */
479PJ_DECL(pj_bool_t) pjsua_call_is_active(unsigned call_index);
480
481
482/**
483 * Check if call has a media session.
484 */
485PJ_DECL(pj_bool_t) pjsua_call_has_media(unsigned call_index);
486
487
488/**
489 * Get call info.
490 */
491PJ_DECL(pj_status_t) pjsua_get_call_info(unsigned call_index,
492 pjsua_call_info *info);
493
494
495/**
496 * Duplicate call info.
497 */
498PJ_DECL(void) pjsua_dup_call_info(pj_pool_t *pool,
499 pjsua_call_info *dst_info,
500 const pjsua_call_info *src_info);
501
502
503/**
Benny Prijono268ca612006-02-07 12:34:11 +0000504 * Make outgoing call.
505 */
Benny Prijono9fc735d2006-05-28 14:58:12 +0000506PJ_DECL(pj_status_t) pjsua_make_call(unsigned acc_index,
507 const pj_str_t *dst_uri,
Benny Prijonodc39fe82006-05-26 12:17:46 +0000508 int *p_call_index);
Benny Prijono84126ab2006-02-09 09:30:09 +0000509
510
511/**
Benny Prijonoa91a0032006-02-26 21:23:45 +0000512 * Answer call.
513 */
Benny Prijonodc39fe82006-05-26 12:17:46 +0000514PJ_DECL(void) pjsua_call_answer(int call_index, int code);
Benny Prijonoa91a0032006-02-26 21:23:45 +0000515
516/**
Benny Prijono26ff9062006-02-21 23:47:00 +0000517 * Hangup call.
518 */
Benny Prijonodc39fe82006-05-26 12:17:46 +0000519PJ_DECL(void) pjsua_call_hangup(int call_index);
Benny Prijono26ff9062006-02-21 23:47:00 +0000520
521
522/**
523 * Put call on-hold.
524 */
Benny Prijonodc39fe82006-05-26 12:17:46 +0000525PJ_DECL(void) pjsua_call_set_hold(int call_index);
Benny Prijono26ff9062006-02-21 23:47:00 +0000526
527
528/**
529 * Send re-INVITE (to release hold).
530 */
Benny Prijonodc39fe82006-05-26 12:17:46 +0000531PJ_DECL(void) pjsua_call_reinvite(int call_index);
Benny Prijono26ff9062006-02-21 23:47:00 +0000532
533
534/**
535 * Transfer call.
536 */
Benny Prijono9fc735d2006-05-28 14:58:12 +0000537PJ_DECL(void) pjsua_call_xfer(unsigned call_index, const pj_str_t *dest);
538
539/**
540 * Dial DTMF.
541 */
542PJ_DECL(pj_status_t) pjsua_call_dial_dtmf(unsigned call_index,
543 const pj_str_t *digits);
Benny Prijono26ff9062006-02-21 23:47:00 +0000544
545
546/**
Benny Prijonob0808372006-03-02 21:18:58 +0000547 * Send instant messaging inside INVITE session.
548 */
Benny Prijono9fc735d2006-05-28 14:58:12 +0000549PJ_DECL(void) pjsua_call_send_im(int call_index, const pj_str_t *text);
Benny Prijonob0808372006-03-02 21:18:58 +0000550
551
552/**
553 * Send IM typing indication inside INVITE session.
554 */
Benny Prijonodc39fe82006-05-26 12:17:46 +0000555PJ_DECL(void) pjsua_call_typing(int call_index, pj_bool_t is_typing);
Benny Prijonob0808372006-03-02 21:18:58 +0000556
557/**
Benny Prijono834aee32006-02-19 01:38:06 +0000558 * Terminate all calls.
559 */
Benny Prijonodc39fe82006-05-26 12:17:46 +0000560PJ_DECL(void) pjsua_call_hangup_all(void);
Benny Prijono834aee32006-02-19 01:38:06 +0000561
562
Benny Prijono268ca612006-02-07 12:34:11 +0000563/*****************************************************************************
Benny Prijono9fc735d2006-05-28 14:58:12 +0000564 * PJSUA Account and Client Registration API (defined in pjsua_reg.c).
Benny Prijonoccf95622006-02-07 18:48:01 +0000565 */
566
Benny Prijono9fc735d2006-05-28 14:58:12 +0000567
568/**
569 * Get number of accounts.
570 */
571PJ_DECL(unsigned) pjsua_get_acc_count(void);
572
573/**
574 * Get account info.
575 */
576PJ_DECL(pj_status_t) pjsua_acc_get_info(unsigned acc_index,
577 pjsua_acc_info *info);
578
579/**
580 * Add a new account.
581 * This function should be called after pjsua_init().
582 * Application should call pjsua_acc_set_registration() to start
583 * registration for this account.
584 */
585PJ_DECL(pj_status_t) pjsua_acc_add(const pjsua_acc_config *cfg,
586 int *acc_index);
587
588
589/**
590 * Set account's presence status.
591 * Must call pjsua_pres_refresh() after this.
592 */
593PJ_DECL(pj_status_t) pjsua_acc_set_online_status(unsigned acc_index,
594 pj_bool_t is_online);
595
596
Benny Prijonoccf95622006-02-07 18:48:01 +0000597/**
Benny Prijonoccf95622006-02-07 18:48:01 +0000598 * Update registration or perform unregistration. If renew argument is zero,
599 * this will start unregistration process.
600 */
Benny Prijono9fc735d2006-05-28 14:58:12 +0000601PJ_DECL(void) pjsua_acc_set_registration(unsigned acc_index, pj_bool_t renew);
Benny Prijonoccf95622006-02-07 18:48:01 +0000602
603
Benny Prijono834aee32006-02-19 01:38:06 +0000604
605
606/*****************************************************************************
607 * PJSUA Presence (pjsua_pres.c)
608 */
609
610/**
Benny Prijono9fc735d2006-05-28 14:58:12 +0000611 * Get buddy count.
612 */
613PJ_DECL(unsigned) pjsua_get_buddy_count(void);
614
615
616/**
617 * Get buddy info.
618 */
619PJ_DECL(pj_status_t) pjsua_buddy_get_info(unsigned buddy_index,
620 pjsua_buddy_info *info);
621
622/**
623 * Add new buddy.
624 */
625PJ_DECL(pj_status_t) pjsua_buddy_add(const pj_str_t *uri,
626 int *buddy_index);
627
628
629/**
630 * Enable/disable buddy's presence monitoring.
631 * Must call pjsua_pres_refresh() after this.
632 */
633PJ_DECL(pj_status_t) pjsua_buddy_subscribe_pres(unsigned buddy_index,
634 pj_bool_t monitor);
635
636
637/**
Benny Prijono834aee32006-02-19 01:38:06 +0000638 * Refresh both presence client and server subscriptions.
639 */
Benny Prijonodc39fe82006-05-26 12:17:46 +0000640PJ_DECL(void) pjsua_pres_refresh(int acc_index);
Benny Prijono834aee32006-02-19 01:38:06 +0000641
642/**
643 * Dump presence subscriptions.
644 */
Benny Prijonodc39fe82006-05-26 12:17:46 +0000645PJ_DECL(void) pjsua_pres_dump(pj_bool_t detail);
Benny Prijono834aee32006-02-19 01:38:06 +0000646
647
Benny Prijonoccf95622006-02-07 18:48:01 +0000648/*****************************************************************************
Benny Prijonob0808372006-03-02 21:18:58 +0000649 * PJSUA Instant Messaging (pjsua_im.c)
650 */
651
652/**
653 * The MESSAGE method (defined in pjsua_im.c)
654 */
655extern const pjsip_method pjsip_message_method;
656
657
Benny Prijonob0808372006-03-02 21:18:58 +0000658
659/**
660 * Send IM outside dialog.
661 */
Benny Prijono9fc735d2006-05-28 14:58:12 +0000662PJ_DECL(pj_status_t) pjsua_im_send(int acc_index, const pj_str_t *dst_uri,
663 const pj_str_t *text);
Benny Prijonob0808372006-03-02 21:18:58 +0000664
665
666/**
667 * Send typing indication outside dialog.
668 */
Benny Prijono9fc735d2006-05-28 14:58:12 +0000669PJ_DECL(pj_status_t) pjsua_im_typing(int acc_index, const pj_str_t *dst_uri,
Benny Prijonodc39fe82006-05-26 12:17:46 +0000670 pj_bool_t is_typing);
Benny Prijonob0808372006-03-02 21:18:58 +0000671
672
Benny Prijonof3195072006-02-14 21:15:30 +0000673
674/*****************************************************************************
Benny Prijono9fc735d2006-05-28 14:58:12 +0000675 * Media.
676 */
677
678/**
679 * Get maxinum number of conference ports.
680 */
681PJ_DECL(unsigned) pjsua_conf_max_ports(void);
682
683
684/**
685 * Enum all conference ports.
686 */
687PJ_DECL(pj_status_t) pjsua_conf_enum_ports(unsigned *count,
688 pjmedia_conf_port_info info[]);
689
690
691/**
692 * Connect conference port.
693 */
694PJ_DECL(pj_status_t) pjsua_conf_connect(unsigned src_port,
695 unsigned dst_port);
696
697
698/**
699 * Connect conference port connection.
700 */
701PJ_DECL(pj_status_t) pjsua_conf_disconnect(unsigned src_port,
702 unsigned dst_port);
703
704
705/**
706 * Create a file player.
707 */
708PJ_DECL(pj_status_t) pjsua_player_create(const pj_str_t *filename,
709 pjsua_player_id *id);
710
711
712/**
713 * Get conference port associated with player.
714 */
715PJ_DECL(unsigned) pjsua_player_get_conf_port(pjsua_player_id id);
716
717
718/**
719 * Set playback position.
720 */
721PJ_DECL(pj_status_t) pjsua_player_set_pos(pjsua_player_id id,
722 pj_uint32_t samples);
723
724
725/**
726 * Destroy player.
727 */
728PJ_DECL(pj_status_t) pjsua_player_destroy(pjsua_player_id id);
729
730
731
732/**
733 * Create a file recorder.
734 */
735PJ_DECL(pj_status_t) pjsua_recorder_create(const pj_str_t *filename,
736 pjsua_recorder_id *id);
737
738
739/**
740 * Get conference port associated with recorder.
741 */
742PJ_DECL(unsigned) pjsua_recorder_get_conf_port(pjsua_recorder_id id);
743
744
745/**
746 * Destroy recorder (will complete recording).
747 */
748PJ_DECL(pj_status_t) pjsua_recorder_destroy(pjsua_recorder_id id);
749
750
751/**
752 * Enum sound devices.
753 */
754PJ_DECL(pj_status_t) pjsua_enum_snd_devices(unsigned *count,
755 pjmedia_snd_dev_info info[]);
756
757
758/**
759 * Select or change sound device.
760 * This will only change the device ID in configuration (not changing
761 * the current device).
762 */
763PJ_DECL(pj_status_t) pjsua_set_snd_dev(int snd_capture_id,
764 int snd_player_id);
765
766
767/*****************************************************************************
Benny Prijonof3195072006-02-14 21:15:30 +0000768 * Utilities.
769 *
770 */
771
772/** String to describe invite session states */
773extern const char *pjsua_inv_state_names[];
774
775/**
776 * Parse arguments (pjsua_opt.c).
777 */
Benny Prijonodc39fe82006-05-26 12:17:46 +0000778PJ_DECL(pj_status_t) pjsua_parse_args(int argc, char *argv[],
779 pjsua_config *cfg);
Benny Prijonof3195072006-02-14 21:15:30 +0000780
781/**
782 * Load settings from a file.
783 */
Benny Prijonodc39fe82006-05-26 12:17:46 +0000784PJ_DECL(pj_status_t) pjsua_load_settings(const char *filename,
785 pjsua_config *cfg);
Benny Prijonof3195072006-02-14 21:15:30 +0000786
787/**
Benny Prijono9fc735d2006-05-28 14:58:12 +0000788 * Get pjsua running config.
789 */
790PJ_DECL(const pjsua_config*) pjsua_get_config(void);
791
792
793/**
Benny Prijonoa91a0032006-02-26 21:23:45 +0000794 * Dump settings.
Benny Prijono9fc735d2006-05-28 14:58:12 +0000795 * If cfg is NULL, it will dump current settings.
Benny Prijonoa91a0032006-02-26 21:23:45 +0000796 */
Benny Prijonodc39fe82006-05-26 12:17:46 +0000797PJ_DECL(int) pjsua_dump_settings(const pjsua_config *cfg,
798 char *buf, pj_size_t max);
Benny Prijonoa91a0032006-02-26 21:23:45 +0000799
800/**
Benny Prijonof3195072006-02-14 21:15:30 +0000801 * Save settings to a file.
802 */
Benny Prijonodc39fe82006-05-26 12:17:46 +0000803PJ_DECL(pj_status_t) pjsua_save_settings(const char *filename,
804 const pjsua_config *cfg);
Benny Prijonof3195072006-02-14 21:15:30 +0000805
806
807/*
808 * Verify that valid SIP url is given.
809 * @return PJ_SUCCESS if valid.
810 */
Benny Prijonodc39fe82006-05-26 12:17:46 +0000811PJ_DECL(pj_status_t) pjsua_verify_sip_url(const char *c_url);
Benny Prijonof3195072006-02-14 21:15:30 +0000812
813/*
814 * Dump application states.
815 */
Benny Prijonodc39fe82006-05-26 12:17:46 +0000816PJ_DECL(void) pjsua_dump(pj_bool_t detail);
817
818/**
819 * Display error message for the specified error code.
820 */
821PJ_DECL(void) pjsua_perror(const char *sender, const char *title,
822 pj_status_t status);
823
824
Benny Prijonof3195072006-02-14 21:15:30 +0000825
Benny Prijono268ca612006-02-07 12:34:11 +0000826
Benny Prijono1a01ad32006-02-07 21:13:28 +0000827PJ_END_DECL
828
Benny Prijonof3195072006-02-14 21:15:30 +0000829
Benny Prijono268ca612006-02-07 12:34:11 +0000830#endif /* __PJSUA_H__ */