blob: 6484d729dbae7eb005a1e7f95f6cfa54376c4bb7 [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 Prijonof04ffdd2006-02-21 00:11:18 +000071
Benny Prijono632ce712006-02-09 14:01:40 +000072/**
Benny Prijonoa91a0032006-02-26 21:23:45 +000073 * Structure to be attached to invite dialog.
Benny Prijono632ce712006-02-09 14:01:40 +000074 * Given a dialog "dlg", application can retrieve this structure
75 * by accessing dlg->mod_data[pjsua.mod.id].
76 */
Benny Prijonoa91a0032006-02-26 21:23:45 +000077struct pjsua_call
Benny Prijono632ce712006-02-09 14:01:40 +000078{
Benny Prijonoa91a0032006-02-26 21:23:45 +000079 unsigned index; /**< Index in pjsua array. */
Benny Prijonof04ffdd2006-02-21 00:11:18 +000080 pjsip_inv_session *inv; /**< The invite session. */
Benny Prijonoe21e7842006-04-09 16:46:05 +000081 pj_time_val start_time;/**< First INVITE sent/received. */
82 pj_time_val res_time; /**< First response sent/received. */
83 pj_time_val conn_time; /**< Connected/confirmed time. */
84 pj_time_val dis_time; /**< Disconnect time. */
Benny Prijonoa91a0032006-02-26 21:23:45 +000085 int acc_index; /**< Account index being used. */
Benny Prijonof04ffdd2006-02-21 00:11:18 +000086 pjmedia_session *session; /**< The media session. */
87 unsigned conf_slot; /**< Slot # in conference bridge. */
Benny Prijono26ff9062006-02-21 23:47:00 +000088 pjsip_evsub *xfer_sub; /**< Xfer server subscription, if this
89 call was triggered by xfer. */
Benny Prijonoa91a0032006-02-26 21:23:45 +000090 pjmedia_sock_info skinfo; /**< Preallocated media sockets. */
Benny Prijonob04c9e02006-05-17 17:17:39 +000091 pjmedia_transport *med_tp; /**< Media transport. */
Benny Prijonoa91a0032006-02-26 21:23:45 +000092 void *app_data; /**< Application data. */
Benny Prijono105217f2006-03-06 16:25:59 +000093 pj_timer_entry refresh_tm;/**< Timer to send re-INVITE. */
94 pj_timer_entry hangup_tm; /**< Timer to hangup call. */
Benny Prijono632ce712006-02-09 14:01:40 +000095};
96
Benny Prijonoa91a0032006-02-26 21:23:45 +000097typedef struct pjsua_call pjsua_call;
98
Benny Prijono632ce712006-02-09 14:01:40 +000099
Benny Prijono834aee32006-02-19 01:38:06 +0000100/**
101 * Buddy data.
102 */
103struct pjsua_buddy
104{
105 pj_str_t uri; /**< Buddy URI */
Benny Prijonoa91a0032006-02-26 21:23:45 +0000106 int acc_index; /**< Which account to use. */
Benny Prijono834aee32006-02-19 01:38:06 +0000107 pj_bool_t monitor; /**< Should we monitor? */
108 pjsip_evsub *sub; /**< Buddy presence subscription */
109 pjsip_pres_status status; /**< Buddy presence status. */
110};
111
112typedef struct pjsua_buddy pjsua_buddy;
113
114
115/**
116 * Server presence subscription list head.
117 */
118struct pjsua_srv_pres
119{
120 PJ_DECL_LIST_MEMBER(struct pjsua_srv_pres);
121 pjsip_evsub *sub;
122 char *remote;
123};
124
125typedef struct pjsua_srv_pres pjsua_srv_pres;
126
127
Benny Prijonoa91a0032006-02-26 21:23:45 +0000128/**
Benny Prijonodc39fe82006-05-26 12:17:46 +0000129 * Account configuration.
130 */
131struct pjsua_acc_config
132{
133 /** SIP URL for account ID (mandatory) */
134 pj_str_t id;
135
136 /** Registrar URI (mandatory) */
137 pj_str_t reg_uri;
138
139 /** Optional contact URI */
140 pj_str_t contact;
141
142 /** Service proxy (default: none) */
143 pj_str_t proxy;
144
145 /** Default timeout (mandatory) */
146 pj_int32_t reg_timeout;
147
148 /** Number of credentials. */
149 unsigned cred_count;
150
151 /** Array of credentials. */
152 pjsip_cred_info cred_info[4];
153
154};
155
156
157/**
158 * @see pjsua_acc_config
159 */
160typedef struct pjsua_acc_config pjsua_acc_config;
161
162
163/**
Benny Prijonoa91a0032006-02-26 21:23:45 +0000164 * Account
165 */
166struct pjsua_acc
167{
168 int index; /**< Index in accounts array. */
Benny Prijonoa91a0032006-02-26 21:23:45 +0000169 pj_str_t user_part; /**< User part of local URI. */
170 pj_str_t host_part; /**< Host part of local URI. */
Benny Prijonoa91a0032006-02-26 21:23:45 +0000171
Benny Prijonoa91a0032006-02-26 21:23:45 +0000172 pjsip_regc *regc; /**< Client registration session. */
Benny Prijonoa91a0032006-02-26 21:23:45 +0000173 pj_timer_entry reg_timer; /**< Registration timer. */
174 pj_status_t reg_last_err; /**< Last registration error. */
175 int reg_last_code; /**< Last status last register. */
176
Benny Prijonoa91a0032006-02-26 21:23:45 +0000177 pjsip_route_hdr route_set; /**< Route set. */
178
179 pj_bool_t online_status; /**< Our online status. */
180 pjsua_srv_pres pres_srv_list; /**< Server subscription list. */
181
182 void *app_data; /**< Application data. */
183};
184
185
Benny Prijonodc39fe82006-05-26 12:17:46 +0000186/**
187 * @see pjsua_acc
188 */
Benny Prijonoa91a0032006-02-26 21:23:45 +0000189typedef struct pjsua_acc pjsua_acc;
190
Benny Prijono632ce712006-02-09 14:01:40 +0000191
Benny Prijonodc39fe82006-05-26 12:17:46 +0000192/**
193 * PJSUA settings.
194 */
195struct pjsua_config
196{
197 /** SIP UDP signaling port. Set to zero to disable UDP signaling,
198 * which in this case application must manually add a transport
199 * to SIP endpoint.
200 * (default: 5060)
201 */
202 unsigned udp_port;
203
204 /** Optional hostname or IP address to publish as the host part of
205 * Contact header. This must be specified if UDP transport is
206 * disabled.
207 * (default: NULL)
208 */
209 pj_str_t sip_host;
210
211 /** Optional port number to publish in the port part of Contact header.
212 * This must be specified if UDP transport is disabled.
213 * (default: 0)
214 */
215 unsigned sip_port;
216
217 /** Start of RTP port. Set to zero to prevent pjsua from creating
218 * media transports, which in this case application must manually
219 * create media transport for each calls.
220 * (default: 4000)
221 */
222 unsigned start_rtp_port;
223
224 /** Maximum calls to support (default: 4) */
225 unsigned max_calls;
226
227 /** Maximum slots in the conference bridge (default: 0/calculated
228 * as max_calls*2
229 */
230 unsigned conf_ports;
231
232 /** Number of worker threads (default: 1) */
233 unsigned thread_cnt;
234
235 /** First STUN server IP address. When STUN is configured, then the
236 * two STUN server settings must be fully set.
237 * (default: none)
238 */
239 pj_str_t stun_srv1;
240
241 /** First STUN port number */
242 unsigned stun_port1;
243
244 /** Second STUN server IP address */
245 pj_str_t stun_srv2;
246
247 /** Second STUN server port number */
248 unsigned stun_port2;
249
250 /** Internal clock rate (to be applied to sound devices and conference
251 * bridge, default is 0/follows the codec, or 44100 for MacOS).
252 */
253 unsigned clock_rate;
254
255 /** Do not use sound device (default: 0). */
256 pj_bool_t null_audio;
257
258 /** WAV file to load for auto_play (default: NULL) */
259 pj_str_t wav_file;
260
261 /** Auto play WAV file for calls? (default: no) */
262 pj_bool_t auto_play;
263
264 /** Auto loopback calls? (default: no) */
265 pj_bool_t auto_loop;
266
267 /** Automatically put calls to conference? (default: no) */
268 pj_bool_t auto_conf;
269
270 /** Speex codec complexity? (default: 10) */
271 unsigned complexity;
272
273 /** Speex codec quality? (default: 10) */
274 unsigned quality;
275
276 /** Codec ptime? (default: 0 (follows the codec)) */
277 unsigned ptime;
278
279 /** Number of additional codecs/"--add-codec" with pjsua (default: 0) */
280 unsigned codec_cnt;
281
282 /** Additional codecs/"--add-codec" options */
283 pj_str_t codec_arg[32];
284
285 /** SIP status code to be automatically sent to incoming calls
286 * (default: 100).
287 */
288 unsigned auto_answer;
289
290 /** Periodic time to refresh call with re-INVITE (default: 0)
291 */
292 unsigned uas_refresh;
293
294 /** Maximum incoming call duration (default: 3600) */
295 unsigned uas_duration;
296
297 /** Outbound proxy (default: none) */
298 pj_str_t outbound_proxy;
299
300 /** URI to call. */
301 pj_str_t uri_to_call;
302
303 /** Number of SIP accounts */
304 unsigned acc_cnt;
305
306 /** SIP accounts configuration */
307 pjsua_acc_config acc_config[32];
308
309 /** Logging verbosity (default: 5). */
310 unsigned log_level;
311
312 /** Logging to be displayed to stdout (default: 4) */
313 unsigned app_log_level;
314
315 /** Log decoration */
316 unsigned log_decor;
317
318 /** Optional log filename (default: NULL) */
319 pj_str_t log_filename;
320
321 /** Number of buddies in address book (default: 0) */
322 unsigned buddy_cnt;
323
324 /** Buddies URI */
325 pj_str_t buddy_uri[256];
326};
327
328
329/**
330 * @see pjsua_config
331 */
332typedef struct pjsua_config pjsua_config;
333
334
335
336/**
337 * Application callbacks.
338 */
339struct pjsua_callback
340{
341 /**
342 * Notify UI when invite state has changed.
343 */
344 void (*on_call_state)(int call_index, pjsip_event *e);
345
346 /**
347 * Notify UI when registration status has changed.
348 */
349 void (*on_reg_state)(int acc_index);
350
351 /**
352 * Notify UI on incoming pager (i.e. MESSAGE request).
353 * Argument call_index will be -1 if MESSAGE request is not related to an
354 * existing call.
355 */
356 void (*on_pager)(int call_index, const pj_str_t *from,
357 const pj_str_t *to, const pj_str_t *txt);
358
359 /**
360 * Notify UI about typing indication.
361 */
362 void (*on_typing)(int call_index, const pj_str_t *from,
363 const pj_str_t *to, pj_bool_t is_typing);
364
365};
366
367/**
368 * @see pjsua_callback
369 */
370typedef struct pjsua_callback pjsua_callback;
371
372
Benny Prijono268ca612006-02-07 12:34:11 +0000373/* PJSUA application variables. */
Benny Prijono95196582006-02-09 00:13:40 +0000374struct pjsua
Benny Prijono268ca612006-02-07 12:34:11 +0000375{
376 /* Control: */
Benny Prijono95196582006-02-09 00:13:40 +0000377 pj_caching_pool cp; /**< Global pool factory. */
378 pjsip_endpoint *endpt; /**< Global endpoint. */
379 pj_pool_t *pool; /**< pjsua's private pool. */
380 pjsip_module mod; /**< pjsua's PJSIP module. */
Benny Prijonodc39fe82006-05-26 12:17:46 +0000381
Benny Prijono268ca612006-02-07 12:34:11 +0000382
Benny Prijonodc39fe82006-05-26 12:17:46 +0000383 /* Config: */
384 pjsua_config config; /**< PJSUA configs */
385
386 /* Application callback: */
387 pjsua_callback cb; /**< Application callback. */
Benny Prijono268ca612006-02-07 12:34:11 +0000388
Benny Prijono95196582006-02-09 00:13:40 +0000389 /* Media: */
Benny Prijonof04ffdd2006-02-21 00:11:18 +0000390 pjmedia_endpt *med_endpt; /**< Media endpoint. */
391 pjmedia_conf *mconf; /**< Media conference. */
Benny Prijono39879152006-02-23 02:09:10 +0000392 unsigned wav_slot; /**< WAV player slot in bridge */
Benny Prijonode380582006-03-15 19:32:41 +0000393 pjmedia_port *file_port; /**< WAV player port. */
Benny Prijono1c2bf462006-03-05 11:54:02 +0000394
Benny Prijonoa91a0032006-02-26 21:23:45 +0000395
Benny Prijonoa91a0032006-02-26 21:23:45 +0000396 /* Account: */
Benny Prijonoa91a0032006-02-26 21:23:45 +0000397 pjsua_acc acc[PJSUA_MAX_ACC]; /** Client regs array. */
Benny Prijonoccf95622006-02-07 18:48:01 +0000398
399
Benny Prijonof04ffdd2006-02-21 00:11:18 +0000400 /* Threading (optional): */
Benny Prijono268ca612006-02-07 12:34:11 +0000401 pj_thread_t *threads[8]; /**< Thread instances. */
402 pj_bool_t quit_flag; /**< To signal thread to quit. */
403
404 /* Transport (UDP): */
Benny Prijono268ca612006-02-07 12:34:11 +0000405 pj_sock_t sip_sock; /**< SIP UDP socket. */
406 pj_sockaddr_in sip_sock_name; /**< Public/STUN UDP socket addr. */
Benny Prijono268ca612006-02-07 12:34:11 +0000407
Benny Prijonof3195072006-02-14 21:15:30 +0000408
Benny Prijonoa91a0032006-02-26 21:23:45 +0000409 /* PJSUA Calls: */
Benny Prijonoa91a0032006-02-26 21:23:45 +0000410 int call_cnt; /**< Number of calls. */
411 pjsua_call calls[PJSUA_MAX_CALLS]; /** Calls array. */
Benny Prijonof3195072006-02-14 21:15:30 +0000412
413
Benny Prijono834aee32006-02-19 01:38:06 +0000414 /* SIMPLE and buddy status: */
Benny Prijonoa91a0032006-02-26 21:23:45 +0000415 int buddy_cnt;
416 pjsua_buddy buddies[PJSUA_MAX_BUDDIES];
Benny Prijono1a01ad32006-02-07 21:13:28 +0000417};
Benny Prijono268ca612006-02-07 12:34:11 +0000418
Benny Prijono95196582006-02-09 00:13:40 +0000419
420/** PJSUA instance. */
421extern struct pjsua pjsua;
422
423
Benny Prijono268ca612006-02-07 12:34:11 +0000424
425/*****************************************************************************
Benny Prijono84126ab2006-02-09 09:30:09 +0000426 * PJSUA API (defined in pjsua_core.c).
Benny Prijono268ca612006-02-07 12:34:11 +0000427 */
428
429/**
430 * Initialize pjsua settings with default parameters.
431 */
Benny Prijonodc39fe82006-05-26 12:17:46 +0000432PJ_DECL(void) pjsua_default_config(pjsua_config *cfg);
Benny Prijono268ca612006-02-07 12:34:11 +0000433
434
435/**
Benny Prijonodc39fe82006-05-26 12:17:46 +0000436 * Test configuration.
Benny Prijono268ca612006-02-07 12:34:11 +0000437 */
Benny Prijonodc39fe82006-05-26 12:17:46 +0000438PJ_DECL(pj_status_t) pjsua_test_config(const pjsua_config *cfg,
439 char *errmsg,
440 int len);
Benny Prijono268ca612006-02-07 12:34:11 +0000441
442
443/**
Benny Prijonodc39fe82006-05-26 12:17:46 +0000444 * Create pjsua application.
445 * This initializes pjlib/pjlib-util, and creates memory pool factory to
446 * be used by application.
447 */
448PJ_DECL(pj_status_t) pjsua_create(void);
449
450
451/**
452 * Initialize pjsua application with the specified settings.
Benny Prijonoccf95622006-02-07 18:48:01 +0000453 *
454 * This will initialize all libraries, create endpoint instance, and register
Benny Prijonodc39fe82006-05-26 12:17:46 +0000455 * pjsip modules.
Benny Prijonoccf95622006-02-07 18:48:01 +0000456 *
457 * Application may register module after calling this function.
Benny Prijono268ca612006-02-07 12:34:11 +0000458 */
Benny Prijonodc39fe82006-05-26 12:17:46 +0000459PJ_DECL(pj_status_t) pjsua_init(const pjsua_config *cfg,
460 const pjsua_callback *cb);
Benny Prijono268ca612006-02-07 12:34:11 +0000461
462
463/**
Benny Prijonoccf95622006-02-07 18:48:01 +0000464 * Start pjsua stack. Application calls this after pjsua settings has been
465 * configured.
466 *
467 * This will start the transport, worker threads (if any), and registration
468 * process, if registration is configured.
469 */
Benny Prijonodc39fe82006-05-26 12:17:46 +0000470PJ_DECL(pj_status_t) pjsua_start(void);
Benny Prijonoccf95622006-02-07 18:48:01 +0000471
472
473/**
Benny Prijono268ca612006-02-07 12:34:11 +0000474 * Destroy pjsua.
475 */
Benny Prijonodc39fe82006-05-26 12:17:46 +0000476PJ_DECL(pj_status_t) pjsua_destroy(void);
Benny Prijonoa91a0032006-02-26 21:23:45 +0000477
478
479/*****************************************************************************
480 * PJSUA Call API (defined in pjsua_call.c).
481 */
482
483/**
Benny Prijono268ca612006-02-07 12:34:11 +0000484 * Make outgoing call.
485 */
Benny Prijonodc39fe82006-05-26 12:17:46 +0000486PJ_DECL(pj_status_t) pjsua_make_call(int acc_index,
487 const char *cstr_dest_uri,
488 int *p_call_index);
Benny Prijono84126ab2006-02-09 09:30:09 +0000489
490
491/**
Benny Prijonoa91a0032006-02-26 21:23:45 +0000492 * Answer call.
493 */
Benny Prijonodc39fe82006-05-26 12:17:46 +0000494PJ_DECL(void) pjsua_call_answer(int call_index, int code);
Benny Prijonoa91a0032006-02-26 21:23:45 +0000495
496/**
Benny Prijono26ff9062006-02-21 23:47:00 +0000497 * Hangup call.
498 */
Benny Prijonodc39fe82006-05-26 12:17:46 +0000499PJ_DECL(void) pjsua_call_hangup(int call_index);
Benny Prijono26ff9062006-02-21 23:47:00 +0000500
501
502/**
503 * Put call on-hold.
504 */
Benny Prijonodc39fe82006-05-26 12:17:46 +0000505PJ_DECL(void) pjsua_call_set_hold(int call_index);
Benny Prijono26ff9062006-02-21 23:47:00 +0000506
507
508/**
509 * Send re-INVITE (to release hold).
510 */
Benny Prijonodc39fe82006-05-26 12:17:46 +0000511PJ_DECL(void) pjsua_call_reinvite(int call_index);
Benny Prijono26ff9062006-02-21 23:47:00 +0000512
513
514/**
515 * Transfer call.
516 */
Benny Prijonodc39fe82006-05-26 12:17:46 +0000517PJ_DECL(void) pjsua_call_xfer(int call_index, const char *dest);
Benny Prijono26ff9062006-02-21 23:47:00 +0000518
519
520/**
Benny Prijonob0808372006-03-02 21:18:58 +0000521 * Send instant messaging inside INVITE session.
522 */
Benny Prijonodc39fe82006-05-26 12:17:46 +0000523PJ_DECL(void) pjsua_call_send_im(int call_index, const char *text);
Benny Prijonob0808372006-03-02 21:18:58 +0000524
525
526/**
527 * Send IM typing indication inside INVITE session.
528 */
Benny Prijonodc39fe82006-05-26 12:17:46 +0000529PJ_DECL(void) pjsua_call_typing(int call_index, pj_bool_t is_typing);
Benny Prijonob0808372006-03-02 21:18:58 +0000530
531/**
Benny Prijono834aee32006-02-19 01:38:06 +0000532 * Terminate all calls.
533 */
Benny Prijonodc39fe82006-05-26 12:17:46 +0000534PJ_DECL(void) pjsua_call_hangup_all(void);
Benny Prijono834aee32006-02-19 01:38:06 +0000535
536
Benny Prijono268ca612006-02-07 12:34:11 +0000537/*****************************************************************************
Benny Prijono84126ab2006-02-09 09:30:09 +0000538 * PJSUA Client Registration API (defined in pjsua_reg.c).
Benny Prijonoccf95622006-02-07 18:48:01 +0000539 */
540
541/**
Benny Prijonoccf95622006-02-07 18:48:01 +0000542 * Update registration or perform unregistration. If renew argument is zero,
543 * this will start unregistration process.
544 */
Benny Prijonodc39fe82006-05-26 12:17:46 +0000545PJ_DECL(void) pjsua_regc_update(int acc_index, pj_bool_t renew);
Benny Prijonoccf95622006-02-07 18:48:01 +0000546
547
Benny Prijono834aee32006-02-19 01:38:06 +0000548
549
550/*****************************************************************************
551 * PJSUA Presence (pjsua_pres.c)
552 */
553
554/**
Benny Prijono834aee32006-02-19 01:38:06 +0000555 * Refresh both presence client and server subscriptions.
556 */
Benny Prijonodc39fe82006-05-26 12:17:46 +0000557PJ_DECL(void) pjsua_pres_refresh(int acc_index);
Benny Prijono834aee32006-02-19 01:38:06 +0000558
559/**
560 * Dump presence subscriptions.
561 */
Benny Prijonodc39fe82006-05-26 12:17:46 +0000562PJ_DECL(void) pjsua_pres_dump(pj_bool_t detail);
Benny Prijono834aee32006-02-19 01:38:06 +0000563
564
Benny Prijonoccf95622006-02-07 18:48:01 +0000565/*****************************************************************************
Benny Prijonob0808372006-03-02 21:18:58 +0000566 * PJSUA Instant Messaging (pjsua_im.c)
567 */
568
569/**
570 * The MESSAGE method (defined in pjsua_im.c)
571 */
572extern const pjsip_method pjsip_message_method;
573
574
Benny Prijonob0808372006-03-02 21:18:58 +0000575
576/**
577 * Send IM outside dialog.
578 */
Benny Prijonodc39fe82006-05-26 12:17:46 +0000579PJ_DECL(pj_status_t) pjsua_im_send(int acc_index, const char *dst_uri,
580 const char *text);
Benny Prijonob0808372006-03-02 21:18:58 +0000581
582
583/**
584 * Send typing indication outside dialog.
585 */
Benny Prijonodc39fe82006-05-26 12:17:46 +0000586PJ_DECL(pj_status_t) pjsua_im_typing(int acc_index, const char *dst_uri,
587 pj_bool_t is_typing);
Benny Prijonob0808372006-03-02 21:18:58 +0000588
589
Benny Prijonof3195072006-02-14 21:15:30 +0000590
591/*****************************************************************************
592 * Utilities.
593 *
594 */
595
596/** String to describe invite session states */
597extern const char *pjsua_inv_state_names[];
598
599/**
600 * Parse arguments (pjsua_opt.c).
601 */
Benny Prijonodc39fe82006-05-26 12:17:46 +0000602PJ_DECL(pj_status_t) pjsua_parse_args(int argc, char *argv[],
603 pjsua_config *cfg);
Benny Prijonof3195072006-02-14 21:15:30 +0000604
605/**
606 * Load settings from a file.
607 */
Benny Prijonodc39fe82006-05-26 12:17:46 +0000608PJ_DECL(pj_status_t) pjsua_load_settings(const char *filename,
609 pjsua_config *cfg);
Benny Prijonof3195072006-02-14 21:15:30 +0000610
611/**
Benny Prijonoa91a0032006-02-26 21:23:45 +0000612 * Dump settings.
613 */
Benny Prijonodc39fe82006-05-26 12:17:46 +0000614PJ_DECL(int) pjsua_dump_settings(const pjsua_config *cfg,
615 char *buf, pj_size_t max);
Benny Prijonoa91a0032006-02-26 21:23:45 +0000616
617/**
Benny Prijonof3195072006-02-14 21:15:30 +0000618 * Save settings to a file.
619 */
Benny Prijonodc39fe82006-05-26 12:17:46 +0000620PJ_DECL(pj_status_t) pjsua_save_settings(const char *filename,
621 const pjsua_config *cfg);
Benny Prijonof3195072006-02-14 21:15:30 +0000622
623
624/*
625 * Verify that valid SIP url is given.
626 * @return PJ_SUCCESS if valid.
627 */
Benny Prijonodc39fe82006-05-26 12:17:46 +0000628PJ_DECL(pj_status_t) pjsua_verify_sip_url(const char *c_url);
Benny Prijonof3195072006-02-14 21:15:30 +0000629
630/*
631 * Dump application states.
632 */
Benny Prijonodc39fe82006-05-26 12:17:46 +0000633PJ_DECL(void) pjsua_dump(pj_bool_t detail);
634
635/**
636 * Display error message for the specified error code.
637 */
638PJ_DECL(void) pjsua_perror(const char *sender, const char *title,
639 pj_status_t status);
640
641
Benny Prijonof3195072006-02-14 21:15:30 +0000642
Benny Prijono268ca612006-02-07 12:34:11 +0000643
Benny Prijono1a01ad32006-02-07 21:13:28 +0000644PJ_END_DECL
645
Benny Prijonof3195072006-02-14 21:15:30 +0000646
Benny Prijono268ca612006-02-07 12:34:11 +0000647#endif /* __PJSUA_H__ */