blob: fd5df1920d25b73d353a8a6b1d70fe0ea4ae9136 [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
Benny Prijono312aff92006-06-17 04:08:30 +000022/**
23 * @file pjsua.h
24 * @brief PJSUA API.
25 */
26
27
Benny Prijono268ca612006-02-07 12:34:11 +000028/* Include all PJSIP core headers. */
29#include <pjsip.h>
30
31/* Include all PJMEDIA headers. */
32#include <pjmedia.h>
33
Benny Prijono1f9afba2006-02-10 15:57:32 +000034/* Include all PJMEDIA-CODEC headers. */
35#include <pjmedia-codec.h>
36
Benny Prijono268ca612006-02-07 12:34:11 +000037/* Include all PJSIP-UA headers */
38#include <pjsip_ua.h>
39
Benny Prijono834aee32006-02-19 01:38:06 +000040/* Include all PJSIP-SIMPLE headers */
41#include <pjsip_simple.h>
42
Benny Prijono268ca612006-02-07 12:34:11 +000043/* Include all PJLIB-UTIL headers. */
44#include <pjlib-util.h>
45
46/* Include all PJLIB headers. */
47#include <pjlib.h>
48
49
Benny Prijonoe6ead542007-01-31 20:53:31 +000050PJ_BEGIN_DECL
51
52
Benny Prijono312aff92006-06-17 04:08:30 +000053/**
Benny Prijonoe6ead542007-01-31 20:53:31 +000054 * @defgroup PJSUA_LIB PJSUA API - High Level Softphone API for C/C++ and Python
Benny Prijono312aff92006-06-17 04:08:30 +000055 * @ingroup PJSIP
56 * @brief Very high level API for constructing SIP UA applications.
57 * @{
58 *
Benny Prijonoe6ead542007-01-31 20:53:31 +000059 * @section pjsua_api_intro A SIP User Agent API for C/C++ and Python
60 *
61 * PJSUA API is very high level API, available for C/C++ and Python language,
62 * for constructing SIP multimedia user agent
Benny Prijono312aff92006-06-17 04:08:30 +000063 * applications. It wraps together the signaling and media functionalities
64 * into an easy to use call API, provides account management, buddy
65 * management, presence, instant messaging, along with multimedia
66 * features such as conferencing, file streaming, local playback,
67 * voice recording, and so on.
68 *
Benny Prijonoe6ead542007-01-31 20:53:31 +000069 * @subsection pjsua_for_c_cpp C/C++ Binding
Benny Prijono312aff92006-06-17 04:08:30 +000070 * Application must link with <b>pjsua-lib</b> to use this API. In addition,
71 * this library depends on the following libraries:
72 * - <b>pjsip-ua</b>,
73 * - <b>pjsip-simple</b>,
74 * - <b>pjsip-core</b>,
75 * - <b>pjmedia</b>,
76 * - <b>pjmedia-codec</b>,
77 * - <b>pjlib-util</b>, and
78 * - <b>pjlib</b>,
79 *
Benny Prijonoe6ead542007-01-31 20:53:31 +000080 * so application must also link with these libraries as well. For more
81 * information, please refer to
82 * <A HREF="http://www.pjsip.org/using.htm">Getting Started with PJSIP</A>
83 * page.
Benny Prijono312aff92006-06-17 04:08:30 +000084 *
Benny Prijonoe6ead542007-01-31 20:53:31 +000085 * @subsection pjsua_for_python Python Binding
86 *
87 * The Python binding for PJSUA-API is implemented by <b>py_pjsua</b>
88 * module, in <tt>pjsip-apps/py_pjsua</tt> directory. This module is
89 * built by building <tt>py_pjsua</tt> project in <tt>pjsip_apps</tt>
90 * Visual Studio workspace, or by invoking the usual <tt>setup.py</tt>
91 * Python installer script.
92 *
93 * The Python script then can import the PJSUA-API Python module by
94 * using <b>import py_pjsua</b> construct as usual.
95 *
96 *
97 * @section pjsua_samples
98 *
99 * Few samples are provided both in C and Python.
100 *
101 - @ref page_pjsip_sample_simple_pjsuaua_c\n
102 Very simple SIP User Agent with registration, call, and media, using
103 PJSUA-API, all in under 200 lines of code.
104
105 - @ref page_pjsip_samples_pjsua\n
106 This is the reference implementation for PJSIP and PJMEDIA.
107 PJSUA is a console based application, designed to be simple enough
108 to be readble, but powerful enough to demonstrate all features
109 available in PJSIP and PJMEDIA.\n
110
111 - Python sample\n
112 For a real simple Python sample application, have a look at
113 <A HREF="http://www.pjsip.org/trac/browser/pjproject/trunk/pjsip-apps/src/py_pjsua/pjsua_app.py">
114 <tt>pjsip-apps/src/py_pjsua/pjsua_app.py</tt></A> file.
115
Benny Prijono312aff92006-06-17 04:08:30 +0000116 * @section root_using_pjsua_lib Using PJSUA API
117 *
Benny Prijonoe6ead542007-01-31 20:53:31 +0000118 * Please refer to @ref PJSUA_LIB_BASE on how to create and initialize the API.
119 * And then see the Modules on the bottom of this page for more information
120 * about specific subject.
Benny Prijono312aff92006-06-17 04:08:30 +0000121 */
122
Benny Prijonoa91a0032006-02-26 21:23:45 +0000123
Benny Prijonof3195072006-02-14 21:15:30 +0000124
Benny Prijono312aff92006-06-17 04:08:30 +0000125/*****************************************************************************
126 * BASE API
127 */
128
Benny Prijonof04ffdd2006-02-21 00:11:18 +0000129/**
Benny Prijonoe6ead542007-01-31 20:53:31 +0000130 * @defgroup PJSUA_LIB_BASE PJSUA-API Basic API
Benny Prijono312aff92006-06-17 04:08:30 +0000131 * @ingroup PJSUA_LIB
132 * @brief Basic application creation/initialization, logging configuration, etc.
133 * @{
134 *
135 * The base PJSUA API controls PJSUA creation, initialization, and startup, and
136 * also provides various auxiliary functions.
137 *
138 * @section using_pjsua_lib Using PJSUA Library
139 *
140 * @subsection creating_pjsua_lib Creating PJSUA
141 *
Benny Prijonoe6ead542007-01-31 20:53:31 +0000142 * Before anything else, application must create PJSUA by calling #pjsua_create()
143 * (or <tt>py_pjsua.create()</tt> from Python).
Benny Prijono312aff92006-06-17 04:08:30 +0000144 * This, among other things, will initialize PJLIB, which is crucial before
Benny Prijonoe6ead542007-01-31 20:53:31 +0000145 * any PJLIB functions can be called, PJLIB-UTIL, and create a SIP endpoint.
146 *
147 * After this function is called, application can create a memory pool (with
148 * #pjsua_pool_create()) and read configurations from command line or file to
149 * build the settings to initialize PJSUA below.
Benny Prijono312aff92006-06-17 04:08:30 +0000150 *
151 * @subsection init_pjsua_lib Initializing PJSUA
152 *
153 * After PJSUA is created, application can initialize PJSUA by calling
Benny Prijonoe6ead542007-01-31 20:53:31 +0000154 * #pjsua_init(). This function takes several optional configuration settings
155 * in the argument, if application wants to set them.
Benny Prijono312aff92006-06-17 04:08:30 +0000156 *
Benny Prijonoe6ead542007-01-31 20:53:31 +0000157 * @subsubsection init_pjsua_lib_c_cpp PJSUA-LIB Initialization (in C)
158 * Sample code to initialize PJSUA in C code:
Benny Prijono312aff92006-06-17 04:08:30 +0000159 \code
160
Benny Prijonob5388cf2007-01-04 22:45:08 +0000161 #include <pjsua-lib/pjsua.h>
162
163 #define THIS_FILE __FILE__
164
165 static pj_status_t app_init(void)
166 {
Benny Prijono312aff92006-06-17 04:08:30 +0000167 pjsua_config ua_cfg;
168 pjsua_logging_config log_cfg;
169 pjsua_media_config media_cfg;
Benny Prijonob5388cf2007-01-04 22:45:08 +0000170 pj_status_t status;
171
172 // Must create pjsua before anything else!
173 status = pjsua_create();
174 if (status != PJ_SUCCESS) {
175 pjsua_perror(THIS_FILE, "Error initializing pjsua", status);
176 return status;
177 }
Benny Prijono312aff92006-06-17 04:08:30 +0000178
179 // Initialize configs with default settings.
180 pjsua_config_default(&ua_cfg);
181 pjsua_logging_config_default(&log_cfg);
182 pjsua_media_config_default(&media_cfg);
183
184 // At the very least, application would want to override
185 // the call callbacks in pjsua_config:
186 ua_cfg.cb.on_incoming_call = ...
187 ua_cfg.cb.on_call_state = ..
188 ...
189
190 // Customize other settings (or initialize them from application specific
191 // configuration file):
192 ...
193
194 // Initialize pjsua
195 status = pjsua_init(&ua_cfg, &log_cfg, &media_cfg);
196 if (status != PJ_SUCCESS) {
197 pjsua_perror(THIS_FILE, "Error initializing pjsua", status);
198 return status;
199 }
Benny Prijonob5388cf2007-01-04 22:45:08 +0000200 .
201 ...
202 }
Benny Prijono312aff92006-06-17 04:08:30 +0000203 \endcode
204 *
Benny Prijonoe6ead542007-01-31 20:53:31 +0000205 *
206 * @subsubsection init_pjsua_lib_python PJSUA-LIB Initialization (in Python)
207 * Sample code to initialize PJSUA in Python code:
208
209 \code
210
211import py_pjsua
212
213#
214# Initialize pjsua.
215#
216def app_init():
217 # Create pjsua before anything else
218 status = py_pjsua.create()
219 if status != 0:
220 err_exit("pjsua create() error", status)
221
222 # We use default logging config for this sample
223 log_cfg = py_pjsua.logging_config_default()
224
225 # Create and initialize pjsua config
226 # Note: for this Python module, thread_cnt must be 0 since Python
227 # doesn't like to be called from alien thread (pjsua's thread
228 # in this case)
229 ua_cfg = py_pjsua.config_default()
230 ua_cfg.thread_cnt = 0
231 ua_cfg.user_agent = "PJSUA/Python 0.1"
232
233 # Override callbacks. At the very least application would want to
234 # override the call callbacks in pjsua_config
235 ua_cfg.cb.on_incoming_call = ...
236 ua_cfg.cb.on_call_state = ...
237
238 # Use default media config for this cample
239 med_cfg = py_pjsua.media_config_default()
240
241 #
242 # Initialize pjsua!!
243 #
244 status = py_pjsua.init(ua_cfg, log_cfg, med_cfg)
245 if status != 0:
246 err_exit("pjsua init() error", status)
247
248
249
250# Utility: display PJ error and exit
251#
252def err_exit(title, rc):
253 py_pjsua.perror(THIS_FILE, title, rc)
254 exit(1)
255
256 \endcode
257
258
Benny Prijono312aff92006-06-17 04:08:30 +0000259 * @subsection other_init_pjsua_lib Other Initialization
260 *
261 * After PJSUA is initialized with #pjsua_init(), application will normally
262 * need/want to perform the following tasks:
263 *
Benny Prijonoe6ead542007-01-31 20:53:31 +0000264 * - create SIP transport with #pjsua_transport_create(). Application would
265 * to call #pjsua_transport_create() for each transport types that it
266 * wants to support (for example, UDP, TCP, and TLS). Please see
Benny Prijono312aff92006-06-17 04:08:30 +0000267 * @ref PJSUA_LIB_TRANSPORT section for more info.
268 * - create one or more SIP accounts with #pjsua_acc_add() or
Benny Prijonoe6ead542007-01-31 20:53:31 +0000269 * #pjsua_acc_add_local(). The SIP account is used for registering with
270 * the SIP server, if any. Please see @ref PJSUA_LIB_ACC for more info.
Benny Prijono312aff92006-06-17 04:08:30 +0000271 * - add one or more buddies with #pjsua_buddy_add(). Please see
272 * @ref PJSUA_LIB_BUDDY section for more info.
273 * - optionally configure the sound device, codec settings, and other
274 * media settings. Please see @ref PJSUA_LIB_MEDIA for more info.
275 *
276 *
277 * @subsection starting_pjsua_lib Starting PJSUA
278 *
279 * After all initializations have been done, application must call
280 * #pjsua_start() to start PJSUA. This function will check that all settings
Benny Prijonoe6ead542007-01-31 20:53:31 +0000281 * have been properly configured, and apply default settings when they haven't,
282 * or report error status when it is unable to recover from missing settings.
Benny Prijono312aff92006-06-17 04:08:30 +0000283 *
284 * Most settings can be changed during run-time. For example, application
285 * may add, modify, or delete accounts, buddies, or change media settings
286 * during run-time.
Benny Prijonob5388cf2007-01-04 22:45:08 +0000287 *
Benny Prijonoe6ead542007-01-31 20:53:31 +0000288 * @subsubsection starting_pjsua_lib_c C Example for Starting PJSUA
Benny Prijonob5388cf2007-01-04 22:45:08 +0000289 * Sample code:
290 \code
291 static pj_status_t app_run(void)
292 {
293 pj_status_t status;
294
295 // Start pjsua
296 status = pjsua_start();
297 if (status != PJ_SUCCESS) {
298 pjsua_destroy();
299 pjsua_perror(THIS_FILE, "Error starting pjsua", status);
300 return status;
301 }
302
303 // Run application loop
304 while (1) {
305 char choice[10];
306
307 printf("Select menu: ");
308 fgets(choice, sizeof(choice), stdin);
309 ...
310 }
311 }
312 \endcode
Benny Prijonoe6ead542007-01-31 20:53:31 +0000313
314 * @subsubsection starting_pjsua_lib_python Python Example for starting PJSUA
315 * For Python, starting PJSUA-LIB takes one more step, that is to initialize
316 * Python worker thread to poll PJSUA-LIB. This step is necessary because
317 * Python doesn't like it when it is called by an "alien" thread (that is,
318 * thread that is not created using Python API).
319 *
320 * Because of this, we cannot use a worker thread in PJSUA-LIB, because then
321 * the Python callback will be called by an "alien" thread and this would
322 * crash Python (or raise assert() probably).
323 *
324 * So because worker thread is disabled, we need to create a worker thread
325 * in Python. Note that this may not be necessary if we're creating a
326 * GUI application, because then we can attach, for example, a GUI timer
327 * object to poll the PJSUA-LIB. But because we're creating a console
328 * application which will block at <tt>sys.stdin.readline()</tt>, we need
329 * to have a worker thread to poll PJSUA-LIB.
330
331 \code
332
333import thread
334
335C_QUIT = 0
336
337
338def app_start():
339 # Done with initialization, start pjsua!!
340 #
341 status = py_pjsua.start()
342 if status != 0:
343 py_pjsua.destroy()
344 err_exit("Error starting pjsua!", status)
345
346 # Start worker thread
347 thr = thread.start_new(worker_thread_main, (0,))
348
349 print "PJSUA Started!!"
350
351#
352# Worker thread function.
353# Python doesn't like it when it's called from an alien thread
354# (pjsua's worker thread, in this case), so for Python we must
355# disable worker thread in pjsua and poll pjsua from Python instead.
356#
357def worker_thread_main(arg):
358 global C_QUIT
359 thread_desc = 0
360 status = py_pjsua.thread_register("python worker", thread_desc)
361 if status != 0:
362 py_pjsua.perror(THIS_FILE, "Error registering thread", status)
363 else:
364 while C_QUIT == 0:
365 py_pjsua.handle_events(50)
366 print "Worker thread quitting.."
367 C_QUIT = 2
368
369
370 \endcode
Benny Prijonof04ffdd2006-02-21 00:11:18 +0000371 */
Benny Prijonoeebe9af2006-06-13 22:57:13 +0000372
Benny Prijono312aff92006-06-17 04:08:30 +0000373/** Constant to identify invalid ID for all sorts of IDs. */
374#define PJSUA_INVALID_ID (-1)
Benny Prijonoeebe9af2006-06-13 22:57:13 +0000375
376/** Call identification */
377typedef int pjsua_call_id;
378
Benny Prijono312aff92006-06-17 04:08:30 +0000379/** Account identification */
380typedef int pjsua_acc_id;
Benny Prijonoeebe9af2006-06-13 22:57:13 +0000381
382/** Buddy identification */
Benny Prijono8b1889b2006-06-06 18:40:40 +0000383typedef int pjsua_buddy_id;
Benny Prijonoeebe9af2006-06-13 22:57:13 +0000384
385/** File player identification */
Benny Prijono8b1889b2006-06-06 18:40:40 +0000386typedef int pjsua_player_id;
Benny Prijonoeebe9af2006-06-13 22:57:13 +0000387
388/** File recorder identification */
Benny Prijono8b1889b2006-06-06 18:40:40 +0000389typedef int pjsua_recorder_id;
Benny Prijonoeebe9af2006-06-13 22:57:13 +0000390
391/** Conference port identification */
Benny Prijono8b1889b2006-06-06 18:40:40 +0000392typedef int pjsua_conf_port_id;
393
394
Benny Prijonoeebe9af2006-06-13 22:57:13 +0000395
Benny Prijonoa91a0032006-02-26 21:23:45 +0000396/**
Benny Prijono312aff92006-06-17 04:08:30 +0000397 * Maximum proxies in account.
Benny Prijonodc39fe82006-05-26 12:17:46 +0000398 */
Benny Prijono312aff92006-06-17 04:08:30 +0000399#ifndef PJSUA_ACC_MAX_PROXIES
400# define PJSUA_ACC_MAX_PROXIES 8
401#endif
Benny Prijonoeebe9af2006-06-13 22:57:13 +0000402
403
404
405/**
Benny Prijonob5388cf2007-01-04 22:45:08 +0000406 * Logging configuration, which can be (optionally) specified when calling
407 * #pjsua_init(). Application must call #pjsua_logging_config_default() to
408 * initialize this structure with the default values.
Benny Prijonoe6ead542007-01-31 20:53:31 +0000409 *
410 * \par Sample Python Syntax:
411 * \code
412 # Python type: py_pjsua.Logging_Config
413
414 log_cfg = py_pjsua.logging_config_default()
415 log_cfg.level = 4
416 * \endcode
Benny Prijonoeebe9af2006-06-13 22:57:13 +0000417 */
418typedef struct pjsua_logging_config
419{
420 /**
421 * Log incoming and outgoing SIP message? Yes!
422 */
423 pj_bool_t msg_logging;
424
425 /**
426 * Input verbosity level. Value 5 is reasonable.
427 */
428 unsigned level;
429
430 /**
431 * Verbosity level for console. Value 4 is reasonable.
432 */
433 unsigned console_level;
434
435 /**
436 * Log decoration.
437 */
438 unsigned decor;
439
440 /**
441 * Optional log filename.
442 */
443 pj_str_t log_filename;
444
445 /**
446 * Optional callback function to be called to write log to
447 * application specific device. This function will be called for
448 * log messages on input verbosity level.
Benny Prijonoe6ead542007-01-31 20:53:31 +0000449 *
450 * \par Sample Python Syntax:
451 * \code
452 # level: integer
453 # data: string
454 # len: integer
455
456 def cb(level, data, len):
457 print data,
458 * \endcode
Benny Prijonoeebe9af2006-06-13 22:57:13 +0000459 */
460 void (*cb)(int level, const char *data, pj_size_t len);
461
462
463} pjsua_logging_config;
464
465
466/**
467 * Use this function to initialize logging config.
468 *
469 * @param cfg The logging config to be initialized.
Benny Prijonoe6ead542007-01-31 20:53:31 +0000470 *
471 * \par Python Syntax:
472 * The Python function instantiates and initialize the logging config:
473 * \code
474 logging_cfg = py_pjsua.logging_config_default()
475 * \endcode
Benny Prijonoeebe9af2006-06-13 22:57:13 +0000476 */
477PJ_INLINE(void) pjsua_logging_config_default(pjsua_logging_config *cfg)
478{
Benny Prijonoac623b32006-07-03 15:19:31 +0000479 pj_bzero(cfg, sizeof(*cfg));
Benny Prijonoeebe9af2006-06-13 22:57:13 +0000480
481 cfg->msg_logging = PJ_TRUE;
482 cfg->level = 5;
483 cfg->console_level = 4;
484 cfg->decor = PJ_LOG_HAS_SENDER | PJ_LOG_HAS_TIME |
485 PJ_LOG_HAS_MICRO_SEC | PJ_LOG_HAS_NEWLINE;
486}
487
488/**
489 * Use this function to duplicate logging config.
490 *
491 * @param pool Pool to use.
492 * @param dst Destination config.
493 * @param src Source config.
Benny Prijonoe6ead542007-01-31 20:53:31 +0000494 *
495 * \par Python Syntax:
496 * Not available (for now). Ideally we should be able to just assign
497 * one config to another, but this has not been tested.
Benny Prijonoeebe9af2006-06-13 22:57:13 +0000498 */
499PJ_INLINE(void) pjsua_logging_config_dup(pj_pool_t *pool,
500 pjsua_logging_config *dst,
501 const pjsua_logging_config *src)
502{
503 pj_memcpy(dst, src, sizeof(*src));
504 pj_strdup_with_null(pool, &dst->log_filename, &src->log_filename);
505}
506
507
Benny Prijonodc39fe82006-05-26 12:17:46 +0000508
509/**
Benny Prijonob5388cf2007-01-04 22:45:08 +0000510 * This structure describes application callback to receive various event
511 * notification from PJSUA-API. All of these callbacks are OPTIONAL,
512 * although definitely application would want to implement some of
513 * the important callbacks (such as \a on_incoming_call).
Benny Prijonoe6ead542007-01-31 20:53:31 +0000514 *
515 * \par Python Syntax:
516 * This callback structure is embedded on pjsua_config structure.
Benny Prijonodc39fe82006-05-26 12:17:46 +0000517 */
Benny Prijonoeebe9af2006-06-13 22:57:13 +0000518typedef struct pjsua_callback
Benny Prijonodc39fe82006-05-26 12:17:46 +0000519{
520 /**
Benny Prijono9fc735d2006-05-28 14:58:12 +0000521 * Notify application when invite state has changed.
522 * Application may then query the call info to get the
Benny Prijonoe6ead542007-01-31 20:53:31 +0000523 * detail call states by calling pjsua_call_get_info() function.
Benny Prijono0875ae82006-12-26 00:11:48 +0000524 *
525 * @param call_id The call index.
526 * @param e Event which causes the call state to change.
Benny Prijonoe6ead542007-01-31 20:53:31 +0000527 *
528 * \par Python Syntax:
529 * \code
530 # call_id: integer
531 # e: an opaque object
532
533 def on_call_state(call_id, e):
534 return
535 * \endcode
Benny Prijonodc39fe82006-05-26 12:17:46 +0000536 */
Benny Prijonoeebe9af2006-06-13 22:57:13 +0000537 void (*on_call_state)(pjsua_call_id call_id, pjsip_event *e);
Benny Prijonodc39fe82006-05-26 12:17:46 +0000538
539 /**
Benny Prijono8b1889b2006-06-06 18:40:40 +0000540 * Notify application on incoming call.
Benny Prijono0875ae82006-12-26 00:11:48 +0000541 *
542 * @param acc_id The account which match the incoming call.
543 * @param call_id The call id that has just been created for
544 * the call.
545 * @param rdata The incoming INVITE request.
Benny Prijonoe6ead542007-01-31 20:53:31 +0000546 *
547 * \par Python Syntax:
548 * \code
549 # acc_id: integer
550 # call_id: integer
551 # rdata: an opaque object
552
553 def on_incoming_call(acc_id, call_id, rdata):
554 return
555 * \endcode
Benny Prijono8b1889b2006-06-06 18:40:40 +0000556 */
Benny Prijonoeebe9af2006-06-13 22:57:13 +0000557 void (*on_incoming_call)(pjsua_acc_id acc_id, pjsua_call_id call_id,
Benny Prijono8b1889b2006-06-06 18:40:40 +0000558 pjsip_rx_data *rdata);
559
560 /**
Benny Prijonoeebe9af2006-06-13 22:57:13 +0000561 * Notify application when media state in the call has changed.
562 * Normal application would need to implement this callback, e.g.
563 * to connect the call's media to sound device.
Benny Prijono0875ae82006-12-26 00:11:48 +0000564 *
565 * @param call_id The call index.
Benny Prijonoe6ead542007-01-31 20:53:31 +0000566 *
567 * \par Python Syntax:
568 * \code
569 # call_id: integer
570
571 def on_call_media_state(call_id):
572 return
573 * \endcode
Benny Prijonoeebe9af2006-06-13 22:57:13 +0000574 */
575 void (*on_call_media_state)(pjsua_call_id call_id);
576
577 /**
Benny Prijono0875ae82006-12-26 00:11:48 +0000578 * Notify application upon incoming DTMF digits.
579 *
580 * @param call_id The call index.
581 * @param digit DTMF ASCII digit.
Benny Prijonoe6ead542007-01-31 20:53:31 +0000582 *
583 * \par Python Syntax:
584 * \code
585 # call_id: integer
586 # digit: integer
587
588 def on_dtmf_digit(call_id, digit):
589 return
590 * \endcode
Benny Prijono0875ae82006-12-26 00:11:48 +0000591 */
592 void (*on_dtmf_digit)(pjsua_call_id call_id, int digit);
593
594 /**
Benny Prijonob5388cf2007-01-04 22:45:08 +0000595 * Notify application on call being transfered (i.e. REFER is received).
Benny Prijono9fc735d2006-05-28 14:58:12 +0000596 * Application can decide to accept/reject transfer request
597 * by setting the code (default is 200). When this callback
598 * is not defined, the default behavior is to accept the
599 * transfer.
Benny Prijono0875ae82006-12-26 00:11:48 +0000600 *
601 * @param call_id The call index.
602 * @param dst The destination where the call will be
603 * transfered to.
604 * @param code Status code to be returned for the call transfer
605 * request. On input, it contains status code 200.
Benny Prijonoe6ead542007-01-31 20:53:31 +0000606 *
607 * \par Python Syntax:
608 * \code
609 # call_id: integer
610 # dst: string
611 # code: integer
612
613 def on_call_transfer_request(call_id, dst, code):
614 return code
615
616 * \endcode
Benny Prijono9fc735d2006-05-28 14:58:12 +0000617 */
Benny Prijono4ddad2c2006-10-18 17:16:34 +0000618 void (*on_call_transfer_request)(pjsua_call_id call_id,
619 const pj_str_t *dst,
620 pjsip_status_code *code);
621
622 /**
623 * Notify application of the status of previously sent call
624 * transfer request. Application can monitor the status of the
625 * call transfer request, for example to decide whether to
626 * terminate existing call.
627 *
628 * @param call_id Call ID.
Benny Prijonoe6ead542007-01-31 20:53:31 +0000629 * @param st_code Status progress of the transfer request.
630 * @param st_text Status progress text.
Benny Prijono4ddad2c2006-10-18 17:16:34 +0000631 * @param final If non-zero, no further notification will
Benny Prijonoe6ead542007-01-31 20:53:31 +0000632 * be reported. The st_code specified in
Benny Prijono4ddad2c2006-10-18 17:16:34 +0000633 * this callback is the final status.
634 * @param p_cont Initially will be set to non-zero, application
635 * can set this to FALSE if it no longer wants
636 * to receie further notification (for example,
637 * after it hangs up the call).
Benny Prijonoe6ead542007-01-31 20:53:31 +0000638 *
639 * \par Python Syntax:
640 * \code
641 # call_id: integer
642 # st_code: integer
643 # st_text: string
644 # final: integer
645 # cont: integer
646
647 # return: cont
648
649 def on_call_transfer_status(call_id, st_code, st_text, final, cont):
650 return cont
651 * \endcode
Benny Prijono4ddad2c2006-10-18 17:16:34 +0000652 */
653 void (*on_call_transfer_status)(pjsua_call_id call_id,
Benny Prijonoe6ead542007-01-31 20:53:31 +0000654 int st_code,
655 const pj_str_t *st_text,
Benny Prijono4ddad2c2006-10-18 17:16:34 +0000656 pj_bool_t final,
657 pj_bool_t *p_cont);
Benny Prijono9fc735d2006-05-28 14:58:12 +0000658
659 /**
Benny Prijono053f5222006-11-11 16:16:04 +0000660 * Notify application about incoming INVITE with Replaces header.
661 * Application may reject the request by setting non-2xx code.
662 *
663 * @param call_id The call ID to be replaced.
664 * @param rdata The incoming INVITE request to replace the call.
665 * @param st_code Status code to be set by application. Application
666 * should only return a final status (200-699).
667 * @param st_text Optional status text to be set by application.
Benny Prijonoe6ead542007-01-31 20:53:31 +0000668 *
669 * \par Python Syntax:
670 * \code
671 # call_id: integer
672 # rdata: an opaque object
673 # st_code: integer
674 # st_text: string
675
676 # return: (st_code, st_text) tuple
677
678 def on_call_replace_request(call_id, rdata, st_code, st_text):
679 return st_code, st_text
680 * \endcode
Benny Prijono053f5222006-11-11 16:16:04 +0000681 */
682 void (*on_call_replace_request)(pjsua_call_id call_id,
683 pjsip_rx_data *rdata,
684 int *st_code,
685 pj_str_t *st_text);
686
687 /**
688 * Notify application that an existing call has been replaced with
689 * a new call. This happens when PJSUA-API receives incoming INVITE
690 * request with Replaces header.
691 *
692 * After this callback is called, normally PJSUA-API will disconnect
693 * \a old_call_id and establish \a new_call_id.
694 *
695 * @param old_call_id Existing call which to be replaced with the
696 * new call.
697 * @param new_call_id The new call.
698 * @param rdata The incoming INVITE with Replaces request.
Benny Prijonoe6ead542007-01-31 20:53:31 +0000699 *
700 * \par Python Syntax:
701 * \code
702 # old_call_id: integer
703 # new_call_id: integer
704
705 def on_call_replaced(old_call_id, new_call_id):
706 return
707 * \endcode
Benny Prijono053f5222006-11-11 16:16:04 +0000708 */
709 void (*on_call_replaced)(pjsua_call_id old_call_id,
710 pjsua_call_id new_call_id);
711
712
713 /**
Benny Prijono9fc735d2006-05-28 14:58:12 +0000714 * Notify application when registration status has changed.
715 * Application may then query the account info to get the
716 * registration details.
Benny Prijono0875ae82006-12-26 00:11:48 +0000717 *
718 * @param acc_id Account ID.
Benny Prijonoe6ead542007-01-31 20:53:31 +0000719 *
720 * \par Python Syntax:
721 * \code
722 # acc_id: account ID (integer)
723
724 def on_reg_state(acc_id):
725 return
726 * \endcode
Benny Prijonodc39fe82006-05-26 12:17:46 +0000727 */
Benny Prijono8b1889b2006-06-06 18:40:40 +0000728 void (*on_reg_state)(pjsua_acc_id acc_id);
Benny Prijonodc39fe82006-05-26 12:17:46 +0000729
730 /**
Benny Prijono9fc735d2006-05-28 14:58:12 +0000731 * Notify application when the buddy state has changed.
732 * Application may then query the buddy into to get the details.
Benny Prijono0875ae82006-12-26 00:11:48 +0000733 *
734 * @param buddy_id The buddy id.
Benny Prijonoe6ead542007-01-31 20:53:31 +0000735 *
736 * \par Python Syntax:
737 * \code
738 # buddy_id: integer
739
740 def on_buddy_state(buddy_id):
741 return
742 * \endcode
Benny Prijono9fc735d2006-05-28 14:58:12 +0000743 */
Benny Prijono8b1889b2006-06-06 18:40:40 +0000744 void (*on_buddy_state)(pjsua_buddy_id buddy_id);
Benny Prijono9fc735d2006-05-28 14:58:12 +0000745
746 /**
747 * Notify application on incoming pager (i.e. MESSAGE request).
Benny Prijonoeebe9af2006-06-13 22:57:13 +0000748 * Argument call_id will be -1 if MESSAGE request is not related to an
Benny Prijonodc39fe82006-05-26 12:17:46 +0000749 * existing call.
Benny Prijono0875ae82006-12-26 00:11:48 +0000750 *
751 * @param call_id Containts the ID of the call where the IM was
752 * sent, or PJSUA_INVALID_ID if the IM was sent
753 * outside call context.
754 * @param from URI of the sender.
755 * @param to URI of the destination message.
756 * @param contact The Contact URI of the sender, if present.
757 * @param mime_type MIME type of the message.
758 * @param body The message content.
Benny Prijonoe6ead542007-01-31 20:53:31 +0000759 *
760 * \par Python Syntax:
761 * \code
762 # call_id: integer
763 # from: string
764 # to: string
765 # contact: string
766 # mime_type: string
767 # body: string
768
769 def on_pager(call_id, from, to, contact, mime_type, body):
770 return
771 * \endcode
Benny Prijonodc39fe82006-05-26 12:17:46 +0000772 */
Benny Prijonoeebe9af2006-06-13 22:57:13 +0000773 void (*on_pager)(pjsua_call_id call_id, const pj_str_t *from,
774 const pj_str_t *to, const pj_str_t *contact,
775 const pj_str_t *mime_type, const pj_str_t *body);
776
777 /**
778 * Notify application about the delivery status of outgoing pager
779 * request.
780 *
781 * @param call_id Containts the ID of the call where the IM was
782 * sent, or PJSUA_INVALID_ID if the IM was sent
783 * outside call context.
784 * @param to Destination URI.
785 * @param body Message body.
786 * @param user_data Arbitrary data that was specified when sending
787 * IM message.
788 * @param status Delivery status.
789 * @param reason Delivery status reason.
Benny Prijonoe6ead542007-01-31 20:53:31 +0000790 *
791 * \par Python Syntax
792 * \code
793 # call_id: integer
794 # to: string
795 # body: string
796 # user_data: string
797 # status: integer
798 # reason: string
799
800 def on_pager_status(call_id, to, body, user_data, status, reason):
801 return
802 * \endcode
Benny Prijonoeebe9af2006-06-13 22:57:13 +0000803 */
804 void (*on_pager_status)(pjsua_call_id call_id,
805 const pj_str_t *to,
806 const pj_str_t *body,
807 void *user_data,
808 pjsip_status_code status,
809 const pj_str_t *reason);
Benny Prijonodc39fe82006-05-26 12:17:46 +0000810
811 /**
Benny Prijono9fc735d2006-05-28 14:58:12 +0000812 * Notify application about typing indication.
Benny Prijono0875ae82006-12-26 00:11:48 +0000813 *
814 * @param call_id Containts the ID of the call where the IM was
815 * sent, or PJSUA_INVALID_ID if the IM was sent
816 * outside call context.
817 * @param from URI of the sender.
818 * @param to URI of the destination message.
819 * @param contact The Contact URI of the sender, if present.
820 * @param is_typing Non-zero if peer is typing, or zero if peer
821 * has stopped typing a message.
Benny Prijonoe6ead542007-01-31 20:53:31 +0000822 *
823 * \par Python Syntax
824 * \code
825 # call_id: string
826 # from: string
827 # to: string
828 # contact: string
829 # is_typing: integer
830
831 def on_typing(call_id, from, to, contact, is_typing):
832 return
833 * \endcode
Benny Prijonodc39fe82006-05-26 12:17:46 +0000834 */
Benny Prijonoeebe9af2006-06-13 22:57:13 +0000835 void (*on_typing)(pjsua_call_id call_id, const pj_str_t *from,
836 const pj_str_t *to, const pj_str_t *contact,
837 pj_bool_t is_typing);
Benny Prijonodc39fe82006-05-26 12:17:46 +0000838
Benny Prijonoeebe9af2006-06-13 22:57:13 +0000839} pjsua_callback;
840
841
842
Benny Prijonodc39fe82006-05-26 12:17:46 +0000843
844/**
Benny Prijonob5388cf2007-01-04 22:45:08 +0000845 * This structure describes the settings to control the API and
846 * user agent behavior, and can be specified when calling #pjsua_init().
847 * Before setting the values, application must call #pjsua_config_default()
848 * to initialize this structure with the default values.
Benny Prijonoe6ead542007-01-31 20:53:31 +0000849 *
850 * \par Python Sample Syntax:
851 * The pjsua_config type in Python is <tt>py_pjsua.Config</tt>. Application
852 * creates the instance by calling <tt>py_pjsua.config_default()</tt>:
853 * \code
854 cfg = py_pjsua.config_default()
855 * \endcode
Benny Prijonodc39fe82006-05-26 12:17:46 +0000856 */
Benny Prijonoeebe9af2006-06-13 22:57:13 +0000857typedef struct pjsua_config
858{
859
860 /**
Benny Prijonob5388cf2007-01-04 22:45:08 +0000861 * Maximum calls to support (default: 4). The value specified here
862 * must be smaller than the compile time maximum settings
863 * PJSUA_MAX_CALLS, which by default is 32. To increase this
864 * limit, the library must be recompiled with new PJSUA_MAX_CALLS
865 * value.
Benny Prijonoeebe9af2006-06-13 22:57:13 +0000866 */
867 unsigned max_calls;
868
869 /**
870 * Number of worker threads. Normally application will want to have at
871 * least one worker thread, unless when it wants to poll the library
872 * periodically, which in this case the worker thread can be set to
873 * zero.
874 */
875 unsigned thread_cnt;
876
877 /**
Benny Prijonofa9e5b12006-10-08 12:39:34 +0000878 * Number of nameservers. If no name server is configured, the SIP SRV
879 * resolution would be disabled, and domain will be resolved with
880 * standard pj_gethostbyname() function.
881 */
882 unsigned nameserver_count;
883
884 /**
885 * Array of nameservers to be used by the SIP resolver subsystem.
886 * The order of the name server specifies the priority (first name
887 * server will be used first, unless it is not reachable).
888 */
889 pj_str_t nameserver[4];
890
891 /**
Benny Prijonob5388cf2007-01-04 22:45:08 +0000892 * Number of outbound proxies in the \a outbound_proxy array.
Benny Prijonoeebe9af2006-06-13 22:57:13 +0000893 */
894 unsigned outbound_proxy_cnt;
895
896 /**
897 * Specify the URL of outbound proxies to visit for all outgoing requests.
898 * The outbound proxies will be used for all accounts, and it will
899 * be used to build the route set for outgoing requests. The final
900 * route set for outgoing requests will consists of the outbound proxies
901 * and the proxy configured in the account.
902 */
903 pj_str_t outbound_proxy[4];
904
905 /**
906 * Number of credentials in the credential array.
907 */
908 unsigned cred_count;
909
910 /**
911 * Array of credentials. These credentials will be used by all accounts,
Benny Prijonob5388cf2007-01-04 22:45:08 +0000912 * and can be used to authenticate against outbound proxies. If the
913 * credential is specific to the account, then application should set
914 * the credential in the pjsua_acc_config rather than the credential
915 * here.
Benny Prijonoeebe9af2006-06-13 22:57:13 +0000916 */
917 pjsip_cred_info cred_info[PJSUA_ACC_MAX_PROXIES];
918
919 /**
Benny Prijonob5388cf2007-01-04 22:45:08 +0000920 * Application callback to receive various event notifications from
921 * the library.
Benny Prijonoeebe9af2006-06-13 22:57:13 +0000922 */
923 pjsua_callback cb;
924
Benny Prijono56315612006-07-18 14:39:40 +0000925 /**
Benny Prijonob5388cf2007-01-04 22:45:08 +0000926 * Optional user agent string (default empty). If it's empty, no
927 * User-Agent header will be sent with outgoing requests.
Benny Prijono56315612006-07-18 14:39:40 +0000928 */
929 pj_str_t user_agent;
930
Benny Prijonoeebe9af2006-06-13 22:57:13 +0000931} pjsua_config;
932
933
934/**
935 * Use this function to initialize pjsua config.
936 *
937 * @param cfg pjsua config to be initialized.
Benny Prijonoe6ead542007-01-31 20:53:31 +0000938 *
939 * \par Python Sample Syntax:
940 * The corresponding Python function creates an instance of the config and
941 * initializes it to the default settings:
942 * \code
943 cfg = py_pjsua.config_default()
944 * \endcode
945
Benny Prijonoeebe9af2006-06-13 22:57:13 +0000946 */
947PJ_INLINE(void) pjsua_config_default(pjsua_config *cfg)
948{
Benny Prijonoac623b32006-07-03 15:19:31 +0000949 pj_bzero(cfg, sizeof(*cfg));
Benny Prijonoeebe9af2006-06-13 22:57:13 +0000950
951 cfg->max_calls = 4;
952 cfg->thread_cnt = 1;
953}
954
955
956/**
957 * Duplicate credential.
Benny Prijonoe6ead542007-01-31 20:53:31 +0000958 *
959 * @param pool The memory pool.
960 * @param dst Destination credential.
961 * @param src Source credential.
962 *
963 * \par Python:
964 * Not applicable (for now). Probably we could just assign one credential
965 * variable to another, but this has not been tested.
Benny Prijonoeebe9af2006-06-13 22:57:13 +0000966 */
967PJ_INLINE(void) pjsip_cred_dup( pj_pool_t *pool,
968 pjsip_cred_info *dst,
969 const pjsip_cred_info *src)
970{
971 pj_strdup_with_null(pool, &dst->realm, &src->realm);
972 pj_strdup_with_null(pool, &dst->scheme, &src->scheme);
973 pj_strdup_with_null(pool, &dst->username, &src->username);
974 pj_strdup_with_null(pool, &dst->data, &src->data);
975
976}
977
978
979/**
980 * Duplicate pjsua_config.
Benny Prijonoe6ead542007-01-31 20:53:31 +0000981 *
982 * @param pool The pool to get memory from.
983 * @param dst Destination config.
984 * @param src Source config.
Benny Prijonoeebe9af2006-06-13 22:57:13 +0000985 */
986PJ_INLINE(void) pjsua_config_dup(pj_pool_t *pool,
987 pjsua_config *dst,
988 const pjsua_config *src)
989{
990 unsigned i;
991
992 pj_memcpy(dst, src, sizeof(*src));
993
994 for (i=0; i<src->outbound_proxy_cnt; ++i) {
995 pj_strdup_with_null(pool, &dst->outbound_proxy[i],
996 &src->outbound_proxy[i]);
997 }
998
999 for (i=0; i<src->cred_count; ++i) {
1000 pjsip_cred_dup(pool, &dst->cred_info[i], &src->cred_info[i]);
1001 }
Benny Prijono56315612006-07-18 14:39:40 +00001002
1003 pj_strdup_with_null(pool, &dst->user_agent, &src->user_agent);
Benny Prijonoeebe9af2006-06-13 22:57:13 +00001004}
1005
1006
Benny Prijonoeebe9af2006-06-13 22:57:13 +00001007
1008/**
1009 * This structure describes additional information to be sent with
Benny Prijonob5388cf2007-01-04 22:45:08 +00001010 * outgoing SIP message. It can (optionally) be specified for example
1011 * with #pjsua_call_make_call(), #pjsua_call_answer(), #pjsua_call_hangup(),
1012 * #pjsua_call_set_hold(), #pjsua_call_send_im(), and many more.
1013 *
1014 * Application MUST call #pjsua_msg_data_init() to initialize this
1015 * structure before setting its values.
Benny Prijonoe6ead542007-01-31 20:53:31 +00001016 *
1017 * \par Python Syntax
1018 * The data type in Python is <tt>py_pjsua.Msg_Data</tt>. Application is
1019 * recommended to instantiate the structure by using this construct:
1020 * \code
1021 msg_data = py_pjsua.msg_data_init()
1022 * \endcode
Benny Prijonoeebe9af2006-06-13 22:57:13 +00001023 */
1024typedef struct pjsua_msg_data
1025{
1026 /**
1027 * Additional message headers as linked list.
Benny Prijonoe6ead542007-01-31 20:53:31 +00001028 *
1029 * \par Python:
1030 * This field is implemented as string linked-list in Python, where each
1031 * string describes the header. For example:
1032 \code
1033 msg_data = py_pjsua.Msg_Data()
1034 msg_data.hdr_list = ["Subject: Hello py_pjsua!", "Priority: very low"]
1035 \endcode
Benny Prijonoeebe9af2006-06-13 22:57:13 +00001036 */
1037 pjsip_hdr hdr_list;
1038
1039 /**
1040 * MIME type of optional message body.
1041 */
1042 pj_str_t content_type;
1043
1044 /**
1045 * Optional message body.
1046 */
1047 pj_str_t msg_body;
1048
1049} pjsua_msg_data;
1050
1051
1052/**
1053 * Initialize message data.
1054 *
1055 * @param msg_data Message data to be initialized.
Benny Prijonoe6ead542007-01-31 20:53:31 +00001056 *
1057 * \par Python
1058 * The corresponding Python function creates and initializes the structure:
1059 * \code
1060 msg_data = py_pjsua.msg_data_init()
1061 * \endcode
Benny Prijonoeebe9af2006-06-13 22:57:13 +00001062 */
1063PJ_INLINE(void) pjsua_msg_data_init(pjsua_msg_data *msg_data)
1064{
Benny Prijonoac623b32006-07-03 15:19:31 +00001065 pj_bzero(msg_data, sizeof(*msg_data));
Benny Prijonoeebe9af2006-06-13 22:57:13 +00001066 pj_list_init(&msg_data->hdr_list);
1067}
Benny Prijono8b1889b2006-06-06 18:40:40 +00001068
Benny Prijono268ca612006-02-07 12:34:11 +00001069
Benny Prijono268ca612006-02-07 12:34:11 +00001070
1071/**
Benny Prijonoeebe9af2006-06-13 22:57:13 +00001072 * Instantiate pjsua application. Application must call this function before
1073 * calling any other functions, to make sure that the underlying libraries
1074 * are properly initialized. Once this function has returned success,
1075 * application must call pjsua_destroy() before quitting.
1076 *
1077 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00001078 *
1079 * \par Python:
1080 * \code
1081 status = py_pjsua.create()
1082 * \endcode
Benny Prijonodc39fe82006-05-26 12:17:46 +00001083 */
1084PJ_DECL(pj_status_t) pjsua_create(void);
1085
1086
Benny Prijonoe6ead542007-01-31 20:53:31 +00001087/* Forward declaration */
1088typedef struct pjsua_media_config pjsua_media_config;
1089
1090
Benny Prijonodc39fe82006-05-26 12:17:46 +00001091/**
Benny Prijonoeebe9af2006-06-13 22:57:13 +00001092 * Initialize pjsua with the specified settings. All the settings are
1093 * optional, and the default values will be used when the config is not
1094 * specified.
Benny Prijonoccf95622006-02-07 18:48:01 +00001095 *
Benny Prijonob5388cf2007-01-04 22:45:08 +00001096 * Note that #pjsua_create() MUST be called before calling this function.
1097 *
Benny Prijonoeebe9af2006-06-13 22:57:13 +00001098 * @param ua_cfg User agent configuration.
1099 * @param log_cfg Optional logging configuration.
1100 * @param media_cfg Optional media configuration.
Benny Prijonoccf95622006-02-07 18:48:01 +00001101 *
Benny Prijonoeebe9af2006-06-13 22:57:13 +00001102 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00001103 *
1104 * \par Python:
1105 * The function is similar in Python:
1106 * \code
1107 status = py_pjsua.init(ua_cfg, log_cfg, media_cfg)
1108 * \endcode
1109 * Note that \a ua_cfg, \a log_cfg, and \a media_cfg are optional, and
1110 * the Python script may pass None if it doesn't want to configure the
1111 * setting.
Benny Prijono268ca612006-02-07 12:34:11 +00001112 */
Benny Prijonoeebe9af2006-06-13 22:57:13 +00001113PJ_DECL(pj_status_t) pjsua_init(const pjsua_config *ua_cfg,
1114 const pjsua_logging_config *log_cfg,
1115 const pjsua_media_config *media_cfg);
Benny Prijono268ca612006-02-07 12:34:11 +00001116
1117
1118/**
Benny Prijonoeebe9af2006-06-13 22:57:13 +00001119 * Application is recommended to call this function after all initialization
1120 * is done, so that the library can do additional checking set up
1121 * additional
Benny Prijonoccf95622006-02-07 18:48:01 +00001122 *
Benny Prijonob5388cf2007-01-04 22:45:08 +00001123 * Application may call this function anytime after #pjsua_init().
1124 *
Benny Prijonoeebe9af2006-06-13 22:57:13 +00001125 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00001126 *
1127 * \par Python:
1128 * The function is similar in Python:
1129 * \code
1130 status = py_pjsua.start()
1131 * \endcode
Benny Prijonoccf95622006-02-07 18:48:01 +00001132 */
Benny Prijonodc39fe82006-05-26 12:17:46 +00001133PJ_DECL(pj_status_t) pjsua_start(void);
Benny Prijonoccf95622006-02-07 18:48:01 +00001134
Benny Prijonoeebe9af2006-06-13 22:57:13 +00001135
Benny Prijonoccf95622006-02-07 18:48:01 +00001136/**
Benny Prijonob5388cf2007-01-04 22:45:08 +00001137 * Destroy pjsua. Application is recommended to perform graceful shutdown
1138 * before calling this function (such as unregister the account from the SIP
1139 * server, terminate presense subscription, and hangup active calls), however,
1140 * this function will do all of these if it finds there are active sessions
1141 * that need to be terminated. This function will approximately block for
1142 * one second to wait for replies from remote.
1143 *
1144 * Application.may safely call this function more than once if it doesn't
1145 * keep track of it's state.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00001146 *
1147 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00001148 *
1149 * \par Python:
1150 * The function is similar in Python:
1151 * \code
1152 status = py_pjsua.destroy()
1153 * \endcode
Benny Prijono268ca612006-02-07 12:34:11 +00001154 */
Benny Prijonodc39fe82006-05-26 12:17:46 +00001155PJ_DECL(pj_status_t) pjsua_destroy(void);
Benny Prijonoa91a0032006-02-26 21:23:45 +00001156
Benny Prijonoeebe9af2006-06-13 22:57:13 +00001157
Benny Prijono9fc735d2006-05-28 14:58:12 +00001158/**
Benny Prijonoeebe9af2006-06-13 22:57:13 +00001159 * Poll pjsua for events, and if necessary block the caller thread for
1160 * the specified maximum interval (in miliseconds).
1161 *
Benny Prijonob5388cf2007-01-04 22:45:08 +00001162 * Application doesn't normally need to call this function if it has
1163 * configured worker thread (\a thread_cnt field) in pjsua_config structure,
1164 * because polling then will be done by these worker threads instead.
1165 *
Benny Prijonoeebe9af2006-06-13 22:57:13 +00001166 * @param msec_timeout Maximum time to wait, in miliseconds.
1167 *
1168 * @return The number of events that have been handled during the
1169 * poll. Negative value indicates error, and application
Benny Prijonoe6ead542007-01-31 20:53:31 +00001170 * can retrieve the error as (status = -return_value).
1171 *
1172 * \par Python:
1173 * The function is similar in Python:
1174 * \code
1175 n = py_pjsua.handle_events(msec_timeout)
1176 * \endcode
Benny Prijonob9b32ab2006-06-01 12:28:44 +00001177 */
1178PJ_DECL(int) pjsua_handle_events(unsigned msec_timeout);
1179
1180
1181/**
Benny Prijonob5388cf2007-01-04 22:45:08 +00001182 * Create memory pool to be used by the application. Once application
1183 * finished using the pool, it must be released with pj_pool_release().
Benny Prijonoeebe9af2006-06-13 22:57:13 +00001184 *
1185 * @param name Optional pool name.
Benny Prijono312aff92006-06-17 04:08:30 +00001186 * @param init_size Initial size of the pool.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00001187 * @param increment Increment size.
1188 *
1189 * @return The pool, or NULL when there's no memory.
Benny Prijonoe6ead542007-01-31 20:53:31 +00001190 *
1191 * \par Python:
1192 * Python script may also create a pool object from the script:
1193 * \code
1194 pool = py_pjsua.pool_create(name, init_size, increment)
1195 * \endcode
Benny Prijonoeebe9af2006-06-13 22:57:13 +00001196 */
1197PJ_DECL(pj_pool_t*) pjsua_pool_create(const char *name, pj_size_t init_size,
1198 pj_size_t increment);
1199
1200
1201/**
1202 * Application can call this function at any time (after pjsua_create(), of
1203 * course) to change logging settings.
1204 *
1205 * @param c Logging configuration.
1206 *
1207 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00001208 *
1209 * \par Python:
1210 * The function is similar in Python:
1211 * \code
1212 status = py_pjsua.reconfigure_logging(log_cfg)
1213 * \endcode
Benny Prijonoeebe9af2006-06-13 22:57:13 +00001214 */
1215PJ_DECL(pj_status_t) pjsua_reconfigure_logging(const pjsua_logging_config *c);
1216
1217
1218/**
1219 * Internal function to get SIP endpoint instance of pjsua, which is
1220 * needed for example to register module, create transports, etc.
Benny Prijonob5388cf2007-01-04 22:45:08 +00001221 * Only valid after #pjsua_init() is called.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00001222 *
1223 * @return SIP endpoint instance.
Benny Prijonoe6ead542007-01-31 20:53:31 +00001224 *
1225 * \par Python:
1226 * Application may retrieve the SIP endpoint instance:
1227 * \code
1228 endpt = py_pjsua.get_pjsip_endpt()
1229 * \endcode
1230 * However currently the object is just an opaque object and does not have
1231 * any use for Python scripts.
Benny Prijono9fc735d2006-05-28 14:58:12 +00001232 */
1233PJ_DECL(pjsip_endpoint*) pjsua_get_pjsip_endpt(void);
1234
1235/**
Benny Prijonoeebe9af2006-06-13 22:57:13 +00001236 * Internal function to get media endpoint instance.
1237 * Only valid after #pjsua_init() is called.
1238 *
1239 * @return Media endpoint instance.
Benny Prijonoe6ead542007-01-31 20:53:31 +00001240 *
1241 * \par Python:
1242 * Application may retrieve the media endpoint instance:
1243 * \code
1244 endpt = py_pjsua.get_pjmedia_endpt()
1245 * \endcode
1246 * However currently the object is just an opaque object and does not have
1247 * any use for Python scripts.
Benny Prijono9fc735d2006-05-28 14:58:12 +00001248 */
1249PJ_DECL(pjmedia_endpt*) pjsua_get_pjmedia_endpt(void);
1250
Benny Prijono97b87172006-08-24 14:25:14 +00001251/**
1252 * Internal function to get PJSUA pool factory.
Benny Prijonob5388cf2007-01-04 22:45:08 +00001253 * Only valid after #pjsua_create() is called.
Benny Prijono97b87172006-08-24 14:25:14 +00001254 *
1255 * @return Pool factory currently used by PJSUA.
Benny Prijonoe6ead542007-01-31 20:53:31 +00001256 *
1257 * \par Python:
1258 * Application may retrieve the pool factory instance:
1259 * \code
1260 endpt = py_pjsua.get_pool_factory()
1261 * \endcode
1262 * However currently the object is just an opaque object and does not have
1263 * any use for Python scripts.
Benny Prijono97b87172006-08-24 14:25:14 +00001264 */
1265PJ_DECL(pj_pool_factory*) pjsua_get_pool_factory(void);
1266
1267
Benny Prijonoeebe9af2006-06-13 22:57:13 +00001268
1269/*****************************************************************************
Benny Prijono312aff92006-06-17 04:08:30 +00001270 * Utilities.
1271 *
Benny Prijono9fc735d2006-05-28 14:58:12 +00001272 */
Benny Prijonoeebe9af2006-06-13 22:57:13 +00001273
1274/**
Benny Prijonob5388cf2007-01-04 22:45:08 +00001275 * This is a utility function to verify that valid SIP url is given. If the
1276 * URL is valid, PJ_SUCCESS will be returned.
Benny Prijono312aff92006-06-17 04:08:30 +00001277 *
Benny Prijonoe6ead542007-01-31 20:53:31 +00001278 * @param url The URL, as NULL terminated string.
Benny Prijono312aff92006-06-17 04:08:30 +00001279 *
1280 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00001281 *
1282 * \par Python:
1283 * \code
1284 status = py_pjsua.verify_sip_url(url)
1285 * \endcode
Benny Prijono312aff92006-06-17 04:08:30 +00001286 */
Benny Prijonoe6ead542007-01-31 20:53:31 +00001287PJ_DECL(pj_status_t) pjsua_verify_sip_url(const char *url);
Benny Prijono312aff92006-06-17 04:08:30 +00001288
1289
1290/**
Benny Prijonob5388cf2007-01-04 22:45:08 +00001291 * This is a utility function to display error message for the specified
1292 * error code. The error message will be sent to the log.
Benny Prijono312aff92006-06-17 04:08:30 +00001293 *
1294 * @param sender The log sender field.
1295 * @param title Message title for the error.
1296 * @param status Status code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00001297 *
1298 * \par Python:
1299 * \code
1300 py_pjsua.perror(sender, title, status)
1301 * \endcode
Benny Prijono312aff92006-06-17 04:08:30 +00001302 */
1303PJ_DECL(void) pjsua_perror(const char *sender, const char *title,
1304 pj_status_t status);
1305
1306
1307
1308
1309/**
1310 * @}
1311 */
1312
1313
1314
1315/*****************************************************************************
1316 * TRANSPORT API
1317 */
1318
1319/**
Benny Prijonoe6ead542007-01-31 20:53:31 +00001320 * @defgroup PJSUA_LIB_TRANSPORT PJSUA-API Signaling Transport
Benny Prijono312aff92006-06-17 04:08:30 +00001321 * @ingroup PJSUA_LIB
1322 * @brief API for managing SIP transports
1323 * @{
Benny Prijonoe6ead542007-01-31 20:53:31 +00001324 *
1325 * PJSUA-API supports creating multiple transport instances, for example UDP,
1326 * TCP, and TLS transport. SIP transport must be created before adding an
1327 * account.
Benny Prijono312aff92006-06-17 04:08:30 +00001328 */
1329
1330
Benny Prijonoe6ead542007-01-31 20:53:31 +00001331/** SIP transport identification.
1332 */
Benny Prijono312aff92006-06-17 04:08:30 +00001333typedef int pjsua_transport_id;
1334
1335
1336/**
Benny Prijonob5388cf2007-01-04 22:45:08 +00001337 * This structure describes STUN configuration for SIP and media transport,
1338 * and is embedded inside pjsua_transport_config structure.
Benny Prijono312aff92006-06-17 04:08:30 +00001339 */
1340typedef struct pjsua_stun_config
1341{
1342 /**
1343 * The first STUN server IP address or hostname.
1344 */
1345 pj_str_t stun_srv1;
1346
1347 /**
1348 * Port number of the first STUN server.
1349 * If zero, default STUN port will be used.
1350 */
1351 unsigned stun_port1;
1352
1353 /**
1354 * Optional second STUN server IP address or hostname, for which the
1355 * result of the mapping request will be compared to. If the value
1356 * is empty, only one STUN server will be used.
1357 */
1358 pj_str_t stun_srv2;
1359
1360 /**
1361 * Port number of the second STUN server.
1362 * If zero, default STUN port will be used.
1363 */
1364 unsigned stun_port2;
1365
1366} pjsua_stun_config;
1367
1368
1369
1370/**
1371 * Call this function to initialize STUN config with default values.
Benny Prijonoe6ead542007-01-31 20:53:31 +00001372 * STUN config is normally embedded inside pjsua_transport_config, so
1373 * normally there is no need to call this function and rather just
1374 * call pjsua_transport_config_default() instead.
Benny Prijono312aff92006-06-17 04:08:30 +00001375 *
1376 * @param cfg The STUN config to be initialized.
Benny Prijonoe6ead542007-01-31 20:53:31 +00001377 *
1378 * \par Python:
1379 * The corresponding Python function creates and initialize the config:
1380 * \code
1381 stun_cfg = py_pjsua.stun_config_default()
1382 * \endcode
Benny Prijono312aff92006-06-17 04:08:30 +00001383 */
1384PJ_INLINE(void) pjsua_stun_config_default(pjsua_stun_config *cfg)
1385{
Benny Prijonoac623b32006-07-03 15:19:31 +00001386 pj_bzero(cfg, sizeof(*cfg));
Benny Prijono312aff92006-06-17 04:08:30 +00001387}
1388
1389
1390/**
Benny Prijono0a5cad82006-09-26 13:21:02 +00001391 * Transport configuration for creating transports for both SIP
Benny Prijonob5388cf2007-01-04 22:45:08 +00001392 * and media. Before setting some values to this structure, application
1393 * MUST call #pjsua_transport_config_default() to initialize its
1394 * values with default settings.
Benny Prijonoe6ead542007-01-31 20:53:31 +00001395 *
1396 * \par Python:
1397 * The data type in Python is <tt>py_pjsua.Transport_Config</tt>,
1398 * although application can just do this to create the instance:
1399 * \code
1400 transport_cfg = py_pjsua.transport_config_default()
1401 * \endcode
Benny Prijono312aff92006-06-17 04:08:30 +00001402 */
1403typedef struct pjsua_transport_config
1404{
1405 /**
1406 * UDP port number to bind locally. This setting MUST be specified
1407 * even when default port is desired. If the value is zero, the
1408 * transport will be bound to any available port, and application
1409 * can query the port by querying the transport info.
1410 */
1411 unsigned port;
1412
1413 /**
Benny Prijono0a5cad82006-09-26 13:21:02 +00001414 * Optional address to advertise as the address of this transport.
1415 * Application can specify any address or hostname for this field,
1416 * for example it can point to one of the interface address in the
1417 * system, or it can point to the public address of a NAT router
1418 * where port mappings have been configured for the application.
1419 *
1420 * Note: this option can be used for both UDP and TCP as well!
Benny Prijono312aff92006-06-17 04:08:30 +00001421 */
Benny Prijono0a5cad82006-09-26 13:21:02 +00001422 pj_str_t public_addr;
1423
1424 /**
1425 * Optional address where the socket should be bound to. This option
1426 * SHOULD only be used to selectively bind the socket to particular
1427 * interface (instead of 0.0.0.0), and SHOULD NOT be used to set the
1428 * published address of a transport (the public_addr field should be
1429 * used for that purpose).
1430 *
1431 * Note that unlike public_addr field, the address (or hostname) here
1432 * MUST correspond to the actual interface address in the host, since
1433 * this address will be specified as bind() argument.
1434 */
1435 pj_str_t bound_addr;
Benny Prijono312aff92006-06-17 04:08:30 +00001436
1437 /**
1438 * Flag to indicate whether STUN should be used.
1439 */
1440 pj_bool_t use_stun;
1441
1442 /**
1443 * STUN configuration, must be specified when STUN is used.
1444 */
1445 pjsua_stun_config stun_config;
1446
Benny Prijono6e0e54b2006-12-08 21:58:31 +00001447 /**
Benny Prijonob5388cf2007-01-04 22:45:08 +00001448 * This specifies TLS settings for TLS transport. It is only be used
1449 * when this transport config is being used to create a SIP TLS
1450 * transport.
Benny Prijono6e0e54b2006-12-08 21:58:31 +00001451 */
Benny Prijonof3bbc132006-12-25 06:43:59 +00001452 pjsip_tls_setting tls_setting;
Benny Prijono6e0e54b2006-12-08 21:58:31 +00001453
Benny Prijono312aff92006-06-17 04:08:30 +00001454} pjsua_transport_config;
1455
1456
1457/**
1458 * Call this function to initialize UDP config with default values.
1459 *
1460 * @param cfg The UDP config to be initialized.
Benny Prijonoe6ead542007-01-31 20:53:31 +00001461 *
1462 * \par Python:
1463 * The corresponding Python function is rather different:
1464 * \code
1465 transport_cfg = py_pjsua.transport_config_default()
1466 * \endcode
Benny Prijono312aff92006-06-17 04:08:30 +00001467 */
1468PJ_INLINE(void) pjsua_transport_config_default(pjsua_transport_config *cfg)
1469{
Benny Prijonoac623b32006-07-03 15:19:31 +00001470 pj_bzero(cfg, sizeof(*cfg));
Benny Prijonob5388cf2007-01-04 22:45:08 +00001471 pjsua_stun_config_default(&cfg->stun_config);
Benny Prijonof3bbc132006-12-25 06:43:59 +00001472 pjsip_tls_setting_default(&cfg->tls_setting);
Benny Prijono312aff92006-06-17 04:08:30 +00001473}
1474
1475
1476/**
Benny Prijonob5388cf2007-01-04 22:45:08 +00001477 * This is a utility function to normalize STUN config. It's only
1478 * used internally by the library.
1479 *
1480 * @param cfg The STUN config to be initialized.
Benny Prijonoe6ead542007-01-31 20:53:31 +00001481 *
1482 * \par Python:
1483 * \code
1484 py_pjsua.normalize_stun_config(cfg)
1485 * \code
Benny Prijono312aff92006-06-17 04:08:30 +00001486 */
1487PJ_INLINE(void) pjsua_normalize_stun_config( pjsua_stun_config *cfg )
1488{
1489 if (cfg->stun_srv1.slen) {
1490
1491 if (cfg->stun_port1 == 0)
1492 cfg->stun_port1 = 3478;
1493
1494 if (cfg->stun_srv2.slen == 0) {
1495 cfg->stun_srv2 = cfg->stun_srv1;
1496 cfg->stun_port2 = cfg->stun_port1;
1497 } else {
1498 if (cfg->stun_port2 == 0)
1499 cfg->stun_port2 = 3478;
1500 }
1501
1502 } else {
1503 cfg->stun_port1 = 0;
1504 cfg->stun_srv2.slen = 0;
1505 cfg->stun_port2 = 0;
1506 }
1507}
1508
1509
1510/**
1511 * Duplicate transport config.
Benny Prijonoe6ead542007-01-31 20:53:31 +00001512 *
1513 * @param pool The pool.
1514 * @param dst The destination config.
1515 * @param src The source config.
1516 *
1517 * \par Python:
1518 * Not applicable. One should be able to just copy one variable instance
1519 * to another in Python.
Benny Prijono312aff92006-06-17 04:08:30 +00001520 */
1521PJ_INLINE(void) pjsua_transport_config_dup(pj_pool_t *pool,
1522 pjsua_transport_config *dst,
1523 const pjsua_transport_config *src)
1524{
1525 pj_memcpy(dst, src, sizeof(*src));
1526
1527 if (src->stun_config.stun_srv1.slen) {
1528 pj_strdup_with_null(pool, &dst->stun_config.stun_srv1,
1529 &src->stun_config.stun_srv1);
1530 }
1531
1532 if (src->stun_config.stun_srv2.slen) {
1533 pj_strdup_with_null(pool, &dst->stun_config.stun_srv2,
1534 &src->stun_config.stun_srv2);
1535 }
1536
1537 pjsua_normalize_stun_config(&dst->stun_config);
1538}
1539
1540
1541
1542/**
Benny Prijonob5388cf2007-01-04 22:45:08 +00001543 * This structure describes transport information returned by
1544 * #pjsua_transport_get_info() function.
Benny Prijonoe6ead542007-01-31 20:53:31 +00001545 *
1546 * \par Python:
1547 * The corresponding data type in Python is <tt>py_pjsua.Transport_Info</tt>.
Benny Prijono312aff92006-06-17 04:08:30 +00001548 */
1549typedef struct pjsua_transport_info
1550{
1551 /**
1552 * PJSUA transport identification.
1553 */
1554 pjsua_transport_id id;
1555
1556 /**
1557 * Transport type.
1558 */
1559 pjsip_transport_type_e type;
1560
1561 /**
1562 * Transport type name.
1563 */
1564 pj_str_t type_name;
1565
1566 /**
1567 * Transport string info/description.
1568 */
1569 pj_str_t info;
1570
1571 /**
1572 * Transport flag (see ##pjsip_transport_flags_e).
1573 */
1574 unsigned flag;
1575
1576 /**
1577 * Local address length.
1578 */
1579 unsigned addr_len;
1580
1581 /**
1582 * Local/bound address.
1583 */
1584 pj_sockaddr local_addr;
1585
1586 /**
1587 * Published address (or transport address name).
1588 */
1589 pjsip_host_port local_name;
1590
1591 /**
1592 * Current number of objects currently referencing this transport.
1593 */
1594 unsigned usage_count;
1595
1596
1597} pjsua_transport_info;
1598
1599
1600/**
Benny Prijonob5388cf2007-01-04 22:45:08 +00001601 * Create and start a new SIP transport according to the specified
1602 * settings.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00001603 *
1604 * @param type Transport type.
1605 * @param cfg Transport configuration.
1606 * @param p_id Optional pointer to receive transport ID.
1607 *
1608 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00001609 *
1610 * \par Python:
1611 * The corresponding Python function returns (status,id) tuple:
1612 * \code
1613 status, transport_id = py_pjsua.transport_create(type, cfg)
1614 * \endcode
Benny Prijonoeebe9af2006-06-13 22:57:13 +00001615 */
1616PJ_DECL(pj_status_t) pjsua_transport_create(pjsip_transport_type_e type,
1617 const pjsua_transport_config *cfg,
1618 pjsua_transport_id *p_id);
1619
1620/**
Benny Prijonoe6ead542007-01-31 20:53:31 +00001621 * Register transport that has been created by application. This function
1622 * is useful if application wants to implement custom SIP transport and use
1623 * it with pjsua.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00001624 *
1625 * @param tp Transport instance.
1626 * @param p_id Optional pointer to receive transport ID.
1627 *
1628 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00001629 *
1630 * \par Python:
1631 * Not applicable (for now), because one cannot create a custom transport
1632 * from Python script.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00001633 */
1634PJ_DECL(pj_status_t) pjsua_transport_register(pjsip_transport *tp,
1635 pjsua_transport_id *p_id);
1636
1637
1638/**
Benny Prijonoe6ead542007-01-31 20:53:31 +00001639 * Enumerate all transports currently created in the system. This function
1640 * will return all transport IDs, and application may then call
1641 * #pjsua_transport_get_info() function to retrieve detailed information
1642 * about the transport.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00001643 *
1644 * @param id Array to receive transport ids.
1645 * @param count In input, specifies the maximum number of elements.
1646 * On return, it contains the actual number of elements.
1647 *
1648 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00001649 *
1650 * \par Python:
1651 * The function returns list of integers representing transport ids:
1652 * \code
1653 [int] = py_pjsua.enum_transports()
1654 * \endcode
Benny Prijonoeebe9af2006-06-13 22:57:13 +00001655 */
1656PJ_DECL(pj_status_t) pjsua_enum_transports( pjsua_transport_id id[],
1657 unsigned *count );
1658
1659
1660/**
1661 * Get information about transports.
1662 *
1663 * @param id Transport ID.
1664 * @param info Pointer to receive transport info.
1665 *
1666 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00001667 *
1668 * \par Python:
1669 * \code
1670 transport_info = py_pjsua.transport_get_info(id)
1671 * \endcode
1672 * The Python function returns None on error.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00001673 */
1674PJ_DECL(pj_status_t) pjsua_transport_get_info(pjsua_transport_id id,
1675 pjsua_transport_info *info);
1676
1677
1678/**
1679 * Disable a transport or re-enable it. By default transport is always
1680 * enabled after it is created. Disabling a transport does not necessarily
1681 * close the socket, it will only discard incoming messages and prevent
1682 * the transport from being used to send outgoing messages.
1683 *
1684 * @param id Transport ID.
1685 * @param enabled Non-zero to enable, zero to disable.
1686 *
1687 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00001688 *
1689 * \par Python:
1690 * \code
1691 status = py_pjsua.transport_set_enable(id, enabled)
1692 * \endcode
Benny Prijonoeebe9af2006-06-13 22:57:13 +00001693 */
1694PJ_DECL(pj_status_t) pjsua_transport_set_enable(pjsua_transport_id id,
1695 pj_bool_t enabled);
1696
1697
1698/**
1699 * Close the transport. If transport is forcefully closed, it will be
1700 * immediately closed, and any pending transactions that are using the
Benny Prijonob5388cf2007-01-04 22:45:08 +00001701 * transport may not terminate properly (it may even crash). Otherwise,
1702 * the system will wait until all transactions are closed while preventing
1703 * new users from using the transport, and will close the transport when
1704 * it is safe to do so.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00001705 *
1706 * @param id Transport ID.
1707 * @param force Non-zero to immediately close the transport. This
1708 * is not recommended!
1709 *
1710 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00001711 *
1712 * \par Python:
1713 * \code
1714 status = py_pjsua.transport_close(id, force)
1715 * \endcode
Benny Prijonoeebe9af2006-06-13 22:57:13 +00001716 */
1717PJ_DECL(pj_status_t) pjsua_transport_close( pjsua_transport_id id,
1718 pj_bool_t force );
Benny Prijono9fc735d2006-05-28 14:58:12 +00001719
Benny Prijonoeebe9af2006-06-13 22:57:13 +00001720/**
Benny Prijono312aff92006-06-17 04:08:30 +00001721 * @}
Benny Prijonoeebe9af2006-06-13 22:57:13 +00001722 */
Benny Prijonoeebe9af2006-06-13 22:57:13 +00001723
1724
Benny Prijonoeebe9af2006-06-13 22:57:13 +00001725
1726
1727/*****************************************************************************
Benny Prijono312aff92006-06-17 04:08:30 +00001728 * ACCOUNT API
Benny Prijonoa91a0032006-02-26 21:23:45 +00001729 */
1730
Benny Prijono312aff92006-06-17 04:08:30 +00001731
1732/**
Benny Prijonoe6ead542007-01-31 20:53:31 +00001733 * @defgroup PJSUA_LIB_ACC PJSUA-API Accounts Management
Benny Prijono312aff92006-06-17 04:08:30 +00001734 * @ingroup PJSUA_LIB
Benny Prijonoe6ead542007-01-31 20:53:31 +00001735 * @brief PJSUA Accounts management
Benny Prijono312aff92006-06-17 04:08:30 +00001736 * @{
Benny Prijonoe6ead542007-01-31 20:53:31 +00001737 *
Benny Prijono312aff92006-06-17 04:08:30 +00001738 * PJSUA accounts provide identity (or identities) of the user who is currently
Benny Prijonoe6ead542007-01-31 20:53:31 +00001739 * using the application. In SIP terms, the identity is used as the <b>From</b>
1740 * header in outgoing requests.
1741 *
1742 * PJSUA-API supports creating and managing multiple accounts. The maximum
1743 * number of accounts is limited by a compile time constant
1744 * <tt>PJSUA_MAX_ACC</tt>.
Benny Prijono312aff92006-06-17 04:08:30 +00001745 *
1746 * Account may or may not have client registration associated with it.
1747 * An account is also associated with <b>route set</b> and some <b>authentication
1748 * credentials</b>, which are used when sending SIP request messages using the
1749 * account. An account also has presence's <b>online status</b>, which
Benny Prijonoe6ead542007-01-31 20:53:31 +00001750 * will be reported to remote peer when they subscribe to the account's
1751 * presence, or which is published to a presence server if presence
1752 * publication is enabled for the account.
Benny Prijono312aff92006-06-17 04:08:30 +00001753 *
1754 * At least one account MUST be created in the application. If no user
1755 * association is required, application can create a userless account by
1756 * calling #pjsua_acc_add_local(). A userless account identifies local endpoint
Benny Prijonoe6ead542007-01-31 20:53:31 +00001757 * instead of a particular user, and it correspond with a particular
1758 * transport instance.
Benny Prijono312aff92006-06-17 04:08:30 +00001759 *
1760 * Also one account must be set as the <b>default account</b>, which is used as
1761 * the account to use when PJSUA fails to match a request with any other
1762 * accounts.
1763 *
1764 * When sending outgoing SIP requests (such as making calls or sending
1765 * instant messages), normally PJSUA requires the application to specify
1766 * which account to use for the request. If no account is specified,
1767 * PJSUA may be able to select the account by matching the destination
1768 * domain name, and fall back to default account when no match is found.
1769 */
1770
1771/**
1772 * Maximum accounts.
1773 */
1774#ifndef PJSUA_MAX_ACC
1775# define PJSUA_MAX_ACC 8
1776#endif
1777
1778
1779/**
1780 * Default registration interval.
1781 */
1782#ifndef PJSUA_REG_INTERVAL
1783# define PJSUA_REG_INTERVAL 55
1784#endif
1785
1786
1787/**
Benny Prijono3a5e1ab2006-08-15 20:26:34 +00001788 * Default PUBLISH expiration
1789 */
1790#ifndef PJSUA_PUBLISH_EXPIRATION
1791# define PJSUA_PUBLISH_EXPIRATION 600
1792#endif
1793
1794
1795/**
Benny Prijono093d3022006-09-24 00:07:11 +00001796 * Default account priority.
1797 */
1798#ifndef PJSUA_DEFAULT_ACC_PRIORITY
1799# define PJSUA_DEFAULT_ACC_PRIORITY 0
1800#endif
1801
1802
1803/**
Benny Prijonob5388cf2007-01-04 22:45:08 +00001804 * This structure describes account configuration to be specified when
1805 * adding a new account with #pjsua_acc_add(). Application MUST initialize
1806 * this structure first by calling #pjsua_acc_config_default().
Benny Prijonoe6ead542007-01-31 20:53:31 +00001807 *
1808 * \par Python:
1809 * The data type in Python is <tt>py_pjsua.Acc_Config</tt>, but normally
1810 * application can just use the snippet below to create and initialize
1811 * the account config:
1812 * \code
1813 acc_cfg = py_pjsua.acc_config_default()
1814 * \endcode
Benny Prijono312aff92006-06-17 04:08:30 +00001815 */
1816typedef struct pjsua_acc_config
1817{
Benny Prijono093d3022006-09-24 00:07:11 +00001818 /**
1819 * Account priority, which is used to control the order of matching
1820 * incoming/outgoing requests. The higher the number means the higher
1821 * the priority is, and the account will be matched first.
1822 */
1823 int priority;
1824
Benny Prijono312aff92006-06-17 04:08:30 +00001825 /**
1826 * The full SIP URL for the account. The value can take name address or
1827 * URL format, and will look something like "sip:account@serviceprovider".
1828 *
1829 * This field is mandatory.
1830 */
1831 pj_str_t id;
1832
1833 /**
1834 * This is the URL to be put in the request URI for the registration,
1835 * and will look something like "sip:serviceprovider".
1836 *
1837 * This field should be specified if registration is desired. If the
1838 * value is empty, no account registration will be performed.
1839 */
1840 pj_str_t reg_uri;
1841
Benny Prijono3a5e1ab2006-08-15 20:26:34 +00001842 /**
Benny Prijonob5388cf2007-01-04 22:45:08 +00001843 * If this flag is set, the presence information of this account will
1844 * be PUBLISH-ed to the server where the account belongs.
Benny Prijono3a5e1ab2006-08-15 20:26:34 +00001845 */
1846 pj_bool_t publish_enabled;
1847
Benny Prijono312aff92006-06-17 04:08:30 +00001848 /**
1849 * Optional URI to be put as Contact for this account. It is recommended
1850 * that this field is left empty, so that the value will be calculated
1851 * automatically based on the transport address.
1852 */
Benny Prijonob4a17c92006-07-10 14:40:21 +00001853 pj_str_t force_contact;
Benny Prijono312aff92006-06-17 04:08:30 +00001854
1855 /**
1856 * Number of proxies in the proxy array below.
Benny Prijonoe6ead542007-01-31 20:53:31 +00001857 *
1858 * \par Python:
1859 * Not applicable, as \a proxy is implemented as list of strings.
Benny Prijono312aff92006-06-17 04:08:30 +00001860 */
1861 unsigned proxy_cnt;
1862
1863 /**
1864 * Optional URI of the proxies to be visited for all outgoing requests
1865 * that are using this account (REGISTER, INVITE, etc). Application need
1866 * to specify these proxies if the service provider requires that requests
1867 * destined towards its network should go through certain proxies first
1868 * (for example, border controllers).
1869 *
1870 * These proxies will be put in the route set for this account, with
1871 * maintaining the orders (the first proxy in the array will be visited
Benny Prijonob5388cf2007-01-04 22:45:08 +00001872 * first). If global outbound proxies are configured in pjsua_config,
1873 * then these account proxies will be placed after the global outbound
1874 * proxies in the routeset.
Benny Prijonoe6ead542007-01-31 20:53:31 +00001875 *
1876 * \par Python:
1877 * This will be list of strings.
Benny Prijono312aff92006-06-17 04:08:30 +00001878 */
1879 pj_str_t proxy[PJSUA_ACC_MAX_PROXIES];
1880
1881 /**
1882 * Optional interval for registration, in seconds. If the value is zero,
1883 * default interval will be used (PJSUA_REG_INTERVAL, 55 seconds).
1884 */
1885 unsigned reg_timeout;
1886
1887 /**
1888 * Number of credentials in the credential array.
Benny Prijonoe6ead542007-01-31 20:53:31 +00001889 *
1890 * \par Python:
1891 * Not applicable, since \a cred_info is a list of credentials.
Benny Prijono312aff92006-06-17 04:08:30 +00001892 */
1893 unsigned cred_count;
1894
1895 /**
1896 * Array of credentials. If registration is desired, normally there should
1897 * be at least one credential specified, to successfully authenticate
1898 * against the service provider. More credentials can be specified, for
1899 * example when the requests are expected to be challenged by the
1900 * proxies in the route set.
Benny Prijonoe6ead542007-01-31 20:53:31 +00001901 *
1902 * \par Python:
1903 * This field is a list of credentials.
Benny Prijono312aff92006-06-17 04:08:30 +00001904 */
1905 pjsip_cred_info cred_info[PJSUA_ACC_MAX_PROXIES];
1906
Benny Prijono62c5c5b2007-01-13 23:22:40 +00001907 /**
1908 * Optionally bind this account to specific transport. This normally is
1909 * not a good idea, as account should be able to send requests using
1910 * any available transports according to the destination. But some
1911 * application may want to have explicit control over the transport to
1912 * use, so in that case it can set this field.
1913 *
1914 * Default: -1 (PJSUA_INVALID_ID)
1915 *
1916 * @see pjsua_acc_set_transport()
1917 */
1918 pjsua_transport_id transport_id;
1919
Benny Prijono312aff92006-06-17 04:08:30 +00001920} pjsua_acc_config;
1921
1922
1923/**
1924 * Call this function to initialize account config with default values.
1925 *
1926 * @param cfg The account config to be initialized.
Benny Prijonoe6ead542007-01-31 20:53:31 +00001927 *
1928 * \par Python:
1929 * In Python, this function both creates and initializes the account
1930 * config:
1931 * \code
1932 acc_cfg = py_pjsua.acc_config_default()
1933 * \endcode
Benny Prijono312aff92006-06-17 04:08:30 +00001934 */
1935PJ_INLINE(void) pjsua_acc_config_default(pjsua_acc_config *cfg)
1936{
Benny Prijonoac623b32006-07-03 15:19:31 +00001937 pj_bzero(cfg, sizeof(*cfg));
Benny Prijono312aff92006-06-17 04:08:30 +00001938
1939 cfg->reg_timeout = PJSUA_REG_INTERVAL;
Benny Prijono62c5c5b2007-01-13 23:22:40 +00001940 cfg->transport_id = PJSUA_INVALID_ID;
Benny Prijono312aff92006-06-17 04:08:30 +00001941}
1942
1943
1944
1945/**
1946 * Account info. Application can query account info by calling
1947 * #pjsua_acc_get_info().
Benny Prijonoe6ead542007-01-31 20:53:31 +00001948 *
1949 * \par Python:
1950 * The data type in Python is <tt>py_pjsua.Acc_Info</tt>.
Benny Prijono312aff92006-06-17 04:08:30 +00001951 */
1952typedef struct pjsua_acc_info
1953{
1954 /**
1955 * The account ID.
1956 */
1957 pjsua_acc_id id;
1958
1959 /**
1960 * Flag to indicate whether this is the default account.
1961 */
1962 pj_bool_t is_default;
1963
1964 /**
1965 * Account URI
1966 */
1967 pj_str_t acc_uri;
1968
1969 /**
1970 * Flag to tell whether this account has registration setting
1971 * (reg_uri is not empty).
1972 */
1973 pj_bool_t has_registration;
1974
1975 /**
1976 * An up to date expiration interval for account registration session.
1977 */
1978 int expires;
1979
1980 /**
1981 * Last registration status code. If status code is zero, the account
1982 * is currently not registered. Any other value indicates the SIP
1983 * status code of the registration.
1984 */
1985 pjsip_status_code status;
1986
1987 /**
1988 * String describing the registration status.
1989 */
1990 pj_str_t status_text;
1991
1992 /**
1993 * Presence online status for this account.
1994 */
1995 pj_bool_t online_status;
1996
1997 /**
1998 * Buffer that is used internally to store the status text.
1999 */
2000 char buf_[PJ_ERR_MSG_SIZE];
2001
2002} pjsua_acc_info;
2003
2004
2005
2006/**
2007 * Get number of current accounts.
2008 *
2009 * @return Current number of accounts.
Benny Prijonoe6ead542007-01-31 20:53:31 +00002010 *
2011 * \par Python:
2012 * \code
2013 count = py_pjsua.acc_get_count()
2014 * \endcode
Benny Prijono312aff92006-06-17 04:08:30 +00002015 */
2016PJ_DECL(unsigned) pjsua_acc_get_count(void);
2017
2018
2019/**
2020 * Check if the specified account ID is valid.
2021 *
2022 * @param acc_id Account ID to check.
2023 *
2024 * @return Non-zero if account ID is valid.
Benny Prijonoe6ead542007-01-31 20:53:31 +00002025 *
2026 * \par Python:
2027 * \code
2028 is_valid = py_pjsua.acc_is_valid(acc_id)
2029 * \endcode
Benny Prijono312aff92006-06-17 04:08:30 +00002030 */
2031PJ_DECL(pj_bool_t) pjsua_acc_is_valid(pjsua_acc_id acc_id);
2032
2033
2034/**
Benny Prijono21b9ad92006-08-15 13:11:22 +00002035 * Set default account to be used when incoming and outgoing
2036 * requests doesn't match any accounts.
2037 *
2038 * @param acc_id The account ID to be used as default.
2039 *
2040 * @return PJ_SUCCESS on success.
Benny Prijonoe6ead542007-01-31 20:53:31 +00002041 *
2042 * \par Python:
2043 * \code
2044 status = py_pjsua.acc_set_default(acc_id)
2045 * \endcode
Benny Prijono21b9ad92006-08-15 13:11:22 +00002046 */
2047PJ_DECL(pj_status_t) pjsua_acc_set_default(pjsua_acc_id acc_id);
2048
2049
2050/**
Benny Prijonob5388cf2007-01-04 22:45:08 +00002051 * Get default account to be used when receiving incoming requests (calls),
2052 * when the destination of the incoming call doesn't match any other
2053 * accounts.
Benny Prijono21b9ad92006-08-15 13:11:22 +00002054 *
2055 * @return The default account ID, or PJSUA_INVALID_ID if no
2056 * default account is configured.
Benny Prijonoe6ead542007-01-31 20:53:31 +00002057 *
2058 * \par Python:
2059 * \code
2060 acc_id = py_pjsua.acc_get_default()
2061 * \endcode
Benny Prijono21b9ad92006-08-15 13:11:22 +00002062 */
2063PJ_DECL(pjsua_acc_id) pjsua_acc_get_default(void);
2064
2065
2066/**
Benny Prijono312aff92006-06-17 04:08:30 +00002067 * Add a new account to pjsua. PJSUA must have been initialized (with
Benny Prijonob5388cf2007-01-04 22:45:08 +00002068 * #pjsua_init()) before calling this function. If registration is configured
2069 * for this account, this function would also start the SIP registration
2070 * session with the SIP registrar server. This SIP registration session
2071 * will be maintained internally by the library, and application doesn't
2072 * need to do anything to maintain the registration session.
2073 *
Benny Prijono312aff92006-06-17 04:08:30 +00002074 *
Benny Prijonoe6ead542007-01-31 20:53:31 +00002075 * @param acc_cfg Account configuration.
Benny Prijono312aff92006-06-17 04:08:30 +00002076 * @param is_default If non-zero, this account will be set as the default
2077 * account. The default account will be used when sending
2078 * outgoing requests (e.g. making call) when no account is
2079 * specified, and when receiving incoming requests when the
2080 * request does not match any accounts. It is recommended
2081 * that default account is set to local/LAN account.
2082 * @param p_acc_id Pointer to receive account ID of the new account.
2083 *
2084 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00002085 *
2086 * \par Python:
2087 * The function returns (status, account_id) tuple:
2088 * \code
2089 status, account_id = py_pjsua.acc_add(acc_cfg, is_default)
2090 * \endcode
Benny Prijono312aff92006-06-17 04:08:30 +00002091 */
Benny Prijonoe6ead542007-01-31 20:53:31 +00002092PJ_DECL(pj_status_t) pjsua_acc_add(const pjsua_acc_config *acc_cfg,
Benny Prijono312aff92006-06-17 04:08:30 +00002093 pj_bool_t is_default,
2094 pjsua_acc_id *p_acc_id);
2095
2096
2097/**
2098 * Add a local account. A local account is used to identify local endpoint
2099 * instead of a specific user, and for this reason, a transport ID is needed
2100 * to obtain the local address information.
2101 *
2102 * @param tid Transport ID to generate account address.
2103 * @param is_default If non-zero, this account will be set as the default
2104 * account. The default account will be used when sending
2105 * outgoing requests (e.g. making call) when no account is
2106 * specified, and when receiving incoming requests when the
2107 * request does not match any accounts. It is recommended
2108 * that default account is set to local/LAN account.
2109 * @param p_acc_id Pointer to receive account ID of the new account.
2110 *
2111 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00002112 *
2113 * \par Python:
2114 * The function returns (status, account_id) tuple:
2115 * \code
2116 status, account_id = py_pjsua.acc_add_local(tid, is_default)
2117 * \endcode
Benny Prijono312aff92006-06-17 04:08:30 +00002118 */
2119PJ_DECL(pj_status_t) pjsua_acc_add_local(pjsua_transport_id tid,
2120 pj_bool_t is_default,
2121 pjsua_acc_id *p_acc_id);
2122
2123/**
Benny Prijonob5388cf2007-01-04 22:45:08 +00002124 * Delete an account. This will unregister the account from the SIP server,
2125 * if necessary, and terminate server side presence subscriptions associated
2126 * with this account.
Benny Prijono312aff92006-06-17 04:08:30 +00002127 *
2128 * @param acc_id Id of the account to be deleted.
2129 *
2130 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00002131 *
2132 * \par Python:
2133 * \code
2134 status = py_pjsua.acc_del(acc_id)
2135 * \endcode
Benny Prijono312aff92006-06-17 04:08:30 +00002136 */
2137PJ_DECL(pj_status_t) pjsua_acc_del(pjsua_acc_id acc_id);
2138
2139
2140/**
2141 * Modify account information.
2142 *
2143 * @param acc_id Id of the account to be modified.
Benny Prijonoe6ead542007-01-31 20:53:31 +00002144 * @param acc_cfg New account configuration.
Benny Prijono312aff92006-06-17 04:08:30 +00002145 *
2146 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00002147 *
2148 * \par Python:
2149 * \code
2150 status = py_pjsua.acc_modify(acc_id, acc_cfg)
2151 * \endcode
Benny Prijono312aff92006-06-17 04:08:30 +00002152 */
2153PJ_DECL(pj_status_t) pjsua_acc_modify(pjsua_acc_id acc_id,
Benny Prijonoe6ead542007-01-31 20:53:31 +00002154 const pjsua_acc_config *acc_cfg);
Benny Prijono312aff92006-06-17 04:08:30 +00002155
2156
2157/**
2158 * Modify account's presence status to be advertised to remote/presence
Benny Prijonob5388cf2007-01-04 22:45:08 +00002159 * subscribers. This would trigger the sending of outgoing NOTIFY request
2160 * if there are server side presence subscription for this account.
Benny Prijono312aff92006-06-17 04:08:30 +00002161 *
2162 * @param acc_id The account ID.
2163 * @param is_online True of false.
2164 *
2165 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00002166 *
2167 * \par Python:
2168 * \code
2169 status = py_pjsua.acc_set_online_status(acc_id, is_online)
2170 * \endcode
Benny Prijono312aff92006-06-17 04:08:30 +00002171 */
2172PJ_DECL(pj_status_t) pjsua_acc_set_online_status(pjsua_acc_id acc_id,
2173 pj_bool_t is_online);
2174
2175
2176/**
Benny Prijonob5388cf2007-01-04 22:45:08 +00002177 * Update registration or perform unregistration. If registration is
2178 * configured for this account, then initial SIP REGISTER will be sent
2179 * when the account is added with #pjsua_acc_add(). Application normally
2180 * only need to call this function if it wants to manually update the
2181 * registration or to unregister from the server.
Benny Prijono312aff92006-06-17 04:08:30 +00002182 *
2183 * @param acc_id The account ID.
2184 * @param renew If renew argument is zero, this will start
2185 * unregistration process.
2186 *
2187 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00002188 *
2189 * \par Python:
2190 * \code
2191 status = py_pjsua.acc_set_registration(acc_id, renew)
2192 * \endcode
Benny Prijono312aff92006-06-17 04:08:30 +00002193 */
2194PJ_DECL(pj_status_t) pjsua_acc_set_registration(pjsua_acc_id acc_id,
2195 pj_bool_t renew);
2196
2197
2198/**
Benny Prijonob5388cf2007-01-04 22:45:08 +00002199 * Get information about the specified account.
Benny Prijono312aff92006-06-17 04:08:30 +00002200 *
2201 * @param acc_id Account identification.
2202 * @param info Pointer to receive account information.
2203 *
2204 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00002205 *
2206 * \par Python:
2207 * \code
2208 acc_info = py_pjsua.acc_get_info(acc_id)
2209 * \endcode
2210 * The function returns None if account ID is not valid.
Benny Prijono312aff92006-06-17 04:08:30 +00002211 */
2212PJ_DECL(pj_status_t) pjsua_acc_get_info(pjsua_acc_id acc_id,
2213 pjsua_acc_info *info);
2214
2215
2216/**
Benny Prijonob5388cf2007-01-04 22:45:08 +00002217 * Enumerate all account currently active in the library. This will fill
2218 * the array with the account Ids, and application can then query the
2219 * account information for each id with #pjsua_acc_get_info().
2220 *
2221 * @see pjsua_acc_enum_info().
Benny Prijono312aff92006-06-17 04:08:30 +00002222 *
2223 * @param ids Array of account IDs to be initialized.
2224 * @param count In input, specifies the maximum number of elements.
2225 * On return, it contains the actual number of elements.
2226 *
2227 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00002228 *
2229 * \par Python:
2230 * The function takes no argument and returns list of account Ids:
2231 * \code
2232 [acc_ids] = py_pjsua.enum_accs()
2233 * \endcode
Benny Prijono312aff92006-06-17 04:08:30 +00002234 */
2235PJ_DECL(pj_status_t) pjsua_enum_accs(pjsua_acc_id ids[],
2236 unsigned *count );
2237
2238
2239/**
Benny Prijonob5388cf2007-01-04 22:45:08 +00002240 * Enumerate account informations.
Benny Prijono312aff92006-06-17 04:08:30 +00002241 *
2242 * @param info Array of account infos to be initialized.
2243 * @param count In input, specifies the maximum number of elements.
2244 * On return, it contains the actual number of elements.
2245 *
2246 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00002247 *
2248 * \par Python:
2249 * The function takes no argument and returns list of account infos:
2250 * \code
2251 [acc_info] = py_pjsua.acc_enum_info()
2252 * \endcode
Benny Prijono312aff92006-06-17 04:08:30 +00002253 */
2254PJ_DECL(pj_status_t) pjsua_acc_enum_info( pjsua_acc_info info[],
2255 unsigned *count );
2256
2257
2258/**
2259 * This is an internal function to find the most appropriate account to
2260 * used to reach to the specified URL.
2261 *
2262 * @param url The remote URL to reach.
2263 *
2264 * @return Account id.
Benny Prijonoe6ead542007-01-31 20:53:31 +00002265 *
2266 * \par Python:
2267 * \code
2268 acc_id = py_pjsua.acc_find_for_outgoing(url)
2269 * \endcode
Benny Prijono312aff92006-06-17 04:08:30 +00002270 */
2271PJ_DECL(pjsua_acc_id) pjsua_acc_find_for_outgoing(const pj_str_t *url);
2272
2273
2274/**
2275 * This is an internal function to find the most appropriate account to be
2276 * used to handle incoming calls.
2277 *
2278 * @param rdata The incoming request message.
2279 *
2280 * @return Account id.
Benny Prijonoe6ead542007-01-31 20:53:31 +00002281 *
2282 * \par Python:
2283 * \code
2284 acc_id = py_pjsua.acc_find_for_outgoing(url)
2285 * \endcode
Benny Prijono312aff92006-06-17 04:08:30 +00002286 */
2287PJ_DECL(pjsua_acc_id) pjsua_acc_find_for_incoming(pjsip_rx_data *rdata);
2288
2289
Benny Prijonoc570f2d2006-07-18 00:33:02 +00002290/**
2291 * Create a suitable URI to be put as Contact based on the specified
2292 * target URI for the specified account.
2293 *
2294 * @param pool Pool to allocate memory for the string.
2295 * @param contact The string where the Contact URI will be stored.
2296 * @param acc_id Account ID.
2297 * @param uri Destination URI of the request.
2298 *
2299 * @return PJ_SUCCESS on success, other on error.
Benny Prijonoe6ead542007-01-31 20:53:31 +00002300 *
2301 * \par Python:
2302 * This function is still experimental in Python:
2303 * \code
2304 uri = py_pjsua.acc_create_uac_contact(pool, acc_id, uri)
2305 * \endcode
Benny Prijonoc570f2d2006-07-18 00:33:02 +00002306 */
2307PJ_DECL(pj_status_t) pjsua_acc_create_uac_contact( pj_pool_t *pool,
2308 pj_str_t *contact,
2309 pjsua_acc_id acc_id,
2310 const pj_str_t *uri);
2311
2312
2313
2314/**
2315 * Create a suitable URI to be put as Contact based on the information
2316 * in the incoming request.
2317 *
2318 * @param pool Pool to allocate memory for the string.
2319 * @param contact The string where the Contact URI will be stored.
2320 * @param acc_id Account ID.
2321 * @param rdata Incoming request.
2322 *
2323 * @return PJ_SUCCESS on success, other on error.
Benny Prijonoe6ead542007-01-31 20:53:31 +00002324 *
2325 * \par Python:
2326 * This function is still experimental in Python:
2327 * \code
2328 uri = py_pjsua.acc_create_uas_contact(pool, acc_id, rdata)
2329 * \endcode
Benny Prijonoc570f2d2006-07-18 00:33:02 +00002330 */
2331PJ_DECL(pj_status_t) pjsua_acc_create_uas_contact( pj_pool_t *pool,
2332 pj_str_t *contact,
2333 pjsua_acc_id acc_id,
2334 pjsip_rx_data *rdata );
2335
2336
Benny Prijono62c5c5b2007-01-13 23:22:40 +00002337/**
2338 * Lock/bind this account to a specific transport/listener. Normally
2339 * application shouldn't need to do this, as transports will be selected
2340 * automatically by the stack according to the destination.
2341 *
2342 * When account is locked/bound to a specific transport, all outgoing
2343 * requests from this account will use the specified transport (this
2344 * includes SIP registration, dialog (call and event subscription), and
2345 * out-of-dialog requests such as MESSAGE).
2346 *
2347 * Note that transport_id may be specified in pjsua_acc_config too.
2348 *
2349 * @param acc_id The account ID.
2350 * @param tp_id The transport ID.
2351 *
2352 * @return PJ_SUCCESS on success.
Benny Prijonoe6ead542007-01-31 20:53:31 +00002353 *
2354 * \par Python:
2355 * Not yet implemented.
Benny Prijono62c5c5b2007-01-13 23:22:40 +00002356 */
2357PJ_DECL(pj_status_t) pjsua_acc_set_transport(pjsua_acc_id acc_id,
2358 pjsua_transport_id tp_id);
2359
Benny Prijono312aff92006-06-17 04:08:30 +00002360
2361/**
2362 * @}
2363 */
2364
2365
2366/*****************************************************************************
2367 * CALLS API
2368 */
2369
2370
2371/**
Benny Prijonoe6ead542007-01-31 20:53:31 +00002372 * @defgroup PJSUA_LIB_CALL PJSUA-API Calls Management
Benny Prijono312aff92006-06-17 04:08:30 +00002373 * @ingroup PJSUA_LIB
2374 * @brief Call manipulation.
2375 * @{
2376 */
2377
2378/**
Benny Prijonob5388cf2007-01-04 22:45:08 +00002379 * Maximum simultaneous calls.
Benny Prijono312aff92006-06-17 04:08:30 +00002380 */
2381#ifndef PJSUA_MAX_CALLS
2382# define PJSUA_MAX_CALLS 32
2383#endif
2384
2385
2386
2387/**
Benny Prijonob5388cf2007-01-04 22:45:08 +00002388 * This enumeration specifies the media status of a call, and it's part
2389 * of pjsua_call_info structure.
Benny Prijono312aff92006-06-17 04:08:30 +00002390 */
2391typedef enum pjsua_call_media_status
2392{
Benny Prijonob5388cf2007-01-04 22:45:08 +00002393 /** Call currently has no media */
Benny Prijono312aff92006-06-17 04:08:30 +00002394 PJSUA_CALL_MEDIA_NONE,
Benny Prijonob5388cf2007-01-04 22:45:08 +00002395
2396 /** The media is active */
Benny Prijono312aff92006-06-17 04:08:30 +00002397 PJSUA_CALL_MEDIA_ACTIVE,
Benny Prijonob5388cf2007-01-04 22:45:08 +00002398
2399 /** The media is currently put on hold by local endpoint */
Benny Prijono312aff92006-06-17 04:08:30 +00002400 PJSUA_CALL_MEDIA_LOCAL_HOLD,
Benny Prijonob5388cf2007-01-04 22:45:08 +00002401
2402 /** The media is currently put on hold by remote endpoint */
Benny Prijono312aff92006-06-17 04:08:30 +00002403 PJSUA_CALL_MEDIA_REMOTE_HOLD,
Benny Prijonob5388cf2007-01-04 22:45:08 +00002404
Benny Prijono312aff92006-06-17 04:08:30 +00002405} pjsua_call_media_status;
2406
2407
2408/**
Benny Prijonob5388cf2007-01-04 22:45:08 +00002409 * This structure describes the information and current status of a call.
Benny Prijonoe6ead542007-01-31 20:53:31 +00002410 *
2411 * \par Python:
2412 * The type name is <tt>py_pjsua.Call_Info</tt>.
Benny Prijono312aff92006-06-17 04:08:30 +00002413 */
2414typedef struct pjsua_call_info
2415{
2416 /** Call identification. */
2417 pjsua_call_id id;
2418
2419 /** Initial call role (UAC == caller) */
2420 pjsip_role_e role;
2421
Benny Prijono90315512006-09-14 16:05:16 +00002422 /** The account ID where this call belongs. */
2423 pjsua_acc_id acc_id;
2424
Benny Prijono312aff92006-06-17 04:08:30 +00002425 /** Local URI */
2426 pj_str_t local_info;
2427
2428 /** Local Contact */
2429 pj_str_t local_contact;
2430
2431 /** Remote URI */
2432 pj_str_t remote_info;
2433
2434 /** Remote contact */
2435 pj_str_t remote_contact;
2436
2437 /** Dialog Call-ID string. */
2438 pj_str_t call_id;
2439
2440 /** Call state */
2441 pjsip_inv_state state;
2442
2443 /** Text describing the state */
2444 pj_str_t state_text;
2445
2446 /** Last status code heard, which can be used as cause code */
2447 pjsip_status_code last_status;
2448
2449 /** The reason phrase describing the status. */
2450 pj_str_t last_status_text;
2451
2452 /** Call media status. */
2453 pjsua_call_media_status media_status;
2454
2455 /** Media direction */
2456 pjmedia_dir media_dir;
2457
2458 /** The conference port number for the call */
2459 pjsua_conf_port_id conf_slot;
2460
2461 /** Up-to-date call connected duration (zero when call is not
2462 * established)
2463 */
2464 pj_time_val connect_duration;
2465
2466 /** Total call duration, including set-up time */
2467 pj_time_val total_duration;
2468
2469 /** Internal */
2470 struct {
2471 char local_info[128];
2472 char local_contact[128];
2473 char remote_info[128];
2474 char remote_contact[128];
2475 char call_id[128];
2476 char last_status_text[128];
2477 } buf_;
2478
2479} pjsua_call_info;
2480
2481
2482
Benny Prijonoa91a0032006-02-26 21:23:45 +00002483/**
Benny Prijono9fc735d2006-05-28 14:58:12 +00002484 * Get maximum number of calls configured in pjsua.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00002485 *
2486 * @return Maximum number of calls configured.
Benny Prijonoe6ead542007-01-31 20:53:31 +00002487 *
2488 * \par Python:
2489 * \code
2490 count = py_pjsua.call_get_max_count()
2491 * \endcode
Benny Prijono9fc735d2006-05-28 14:58:12 +00002492 */
Benny Prijono8b1889b2006-06-06 18:40:40 +00002493PJ_DECL(unsigned) pjsua_call_get_max_count(void);
Benny Prijono9fc735d2006-05-28 14:58:12 +00002494
2495/**
Benny Prijonoeebe9af2006-06-13 22:57:13 +00002496 * Get number of currently active calls.
2497 *
2498 * @return Number of currently active calls.
Benny Prijonoe6ead542007-01-31 20:53:31 +00002499 *
2500 * \par Python:
2501 * \code
2502 count = py_pjsua.call_get_count()
2503 * \endcode
Benny Prijono9fc735d2006-05-28 14:58:12 +00002504 */
Benny Prijono8b1889b2006-06-06 18:40:40 +00002505PJ_DECL(unsigned) pjsua_call_get_count(void);
Benny Prijono9fc735d2006-05-28 14:58:12 +00002506
2507/**
Benny Prijonob5388cf2007-01-04 22:45:08 +00002508 * Enumerate all active calls. Application may then query the information and
2509 * state of each call by calling #pjsua_call_get_info().
Benny Prijonoeebe9af2006-06-13 22:57:13 +00002510 *
2511 * @param ids Array of account IDs to be initialized.
2512 * @param count In input, specifies the maximum number of elements.
2513 * On return, it contains the actual number of elements.
2514 *
2515 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00002516 *
2517 * \par Python:
2518 * This function takes no argument and return list of call Ids.
2519 * \code
2520 [call_ids] = py_pjsua.enum_calls()
2521 * \endcode
Benny Prijonoeebe9af2006-06-13 22:57:13 +00002522 */
2523PJ_DECL(pj_status_t) pjsua_enum_calls(pjsua_call_id ids[],
2524 unsigned *count);
2525
2526
2527/**
2528 * Make outgoing call to the specified URI using the specified account.
2529 *
2530 * @param acc_id The account to be used.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00002531 * @param dst_uri URI to be put in the To header (normally is the same
2532 * as the target URI).
2533 * @param options Options (must be zero at the moment).
2534 * @param user_data Arbitrary user data to be attached to the call, and
2535 * can be retrieved later.
2536 * @param msg_data Optional headers etc to be added to outgoing INVITE
2537 * request, or NULL if no custom header is desired.
2538 * @param p_call_id Pointer to receive call identification.
2539 *
2540 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00002541 *
2542 * \par Python:
2543 * The Python function returns (status, call_id) tuple:
2544 * \code
2545 status, call_id = py_pjsua.call_make_call(acc_id, dst_uri, options,
2546 user_data, msg_data)
2547 * \endcode
2548 * Note: the \a user_data in Python function is an integer, and the
2549 * \a msg_data can be set to None if not required.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00002550 */
2551PJ_DECL(pj_status_t) pjsua_call_make_call(pjsua_acc_id acc_id,
2552 const pj_str_t *dst_uri,
2553 unsigned options,
2554 void *user_data,
2555 const pjsua_msg_data *msg_data,
2556 pjsua_call_id *p_call_id);
2557
2558
2559/**
Benny Prijono9fc735d2006-05-28 14:58:12 +00002560 * Check if the specified call has active INVITE session and the INVITE
2561 * session has not been disconnected.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00002562 *
2563 * @param call_id Call identification.
2564 *
2565 * @return Non-zero if call is active.
Benny Prijonoe6ead542007-01-31 20:53:31 +00002566 *
2567 * \par Python:
2568 * \code
2569 bool = py_pjsua.call_is_active(call_id)
2570 * \endcode
Benny Prijono9fc735d2006-05-28 14:58:12 +00002571 */
Benny Prijonoeebe9af2006-06-13 22:57:13 +00002572PJ_DECL(pj_bool_t) pjsua_call_is_active(pjsua_call_id call_id);
Benny Prijono9fc735d2006-05-28 14:58:12 +00002573
2574
2575/**
Benny Prijonoeebe9af2006-06-13 22:57:13 +00002576 * Check if call has an active media session.
2577 *
2578 * @param call_id Call identification.
2579 *
2580 * @return Non-zero if yes.
Benny Prijonoe6ead542007-01-31 20:53:31 +00002581 *
2582 * \par Python:
2583 * \code
2584 bool = py_pjsua.call_has_media(call_id)
2585 * \endcode
Benny Prijono9fc735d2006-05-28 14:58:12 +00002586 */
Benny Prijonoeebe9af2006-06-13 22:57:13 +00002587PJ_DECL(pj_bool_t) pjsua_call_has_media(pjsua_call_id call_id);
Benny Prijono9fc735d2006-05-28 14:58:12 +00002588
2589
2590/**
Benny Prijonoeebe9af2006-06-13 22:57:13 +00002591 * Get the conference port identification associated with the call.
2592 *
2593 * @param call_id Call identification.
2594 *
2595 * @return Conference port ID, or PJSUA_INVALID_ID when the
2596 * media has not been established or is not active.
Benny Prijonoe6ead542007-01-31 20:53:31 +00002597 *
2598 * \par Python:
2599 * \code
2600 slot = py_pjsua.call_get_conf_port(call_id)
2601 * \endcode
Benny Prijono9fc735d2006-05-28 14:58:12 +00002602 */
Benny Prijonoeebe9af2006-06-13 22:57:13 +00002603PJ_DECL(pjsua_conf_port_id) pjsua_call_get_conf_port(pjsua_call_id call_id);
2604
2605/**
2606 * Obtain detail information about the specified call.
2607 *
2608 * @param call_id Call identification.
2609 * @param info Call info to be initialized.
2610 *
2611 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00002612 *
2613 * \par Python:
2614 * \code
2615 call_info = py_pjsua.call_get_info(call_id)
2616 * \endcode
2617 * \a call_info return value will be set to None if call_id is not valid.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00002618 */
2619PJ_DECL(pj_status_t) pjsua_call_get_info(pjsua_call_id call_id,
Benny Prijono9fc735d2006-05-28 14:58:12 +00002620 pjsua_call_info *info);
2621
2622
2623/**
Benny Prijonob5388cf2007-01-04 22:45:08 +00002624 * Attach application specific data to the call. Application can then
2625 * inspect this data by calling #pjsua_call_get_user_data().
Benny Prijonoeebe9af2006-06-13 22:57:13 +00002626 *
2627 * @param call_id Call identification.
2628 * @param user_data Arbitrary data to be attached to the call.
2629 *
2630 * @return The user data.
Benny Prijonoe6ead542007-01-31 20:53:31 +00002631 *
2632 * \par Python:
2633 * \code
2634 status = py_pjsua.call_set_user_data(call_id, user_data)
2635 * \endcode
2636 * The \a user_data is an integer in the Python function.
Benny Prijono9fc735d2006-05-28 14:58:12 +00002637 */
Benny Prijonoeebe9af2006-06-13 22:57:13 +00002638PJ_DECL(pj_status_t) pjsua_call_set_user_data(pjsua_call_id call_id,
2639 void *user_data);
Benny Prijono9fc735d2006-05-28 14:58:12 +00002640
2641
2642/**
Benny Prijonob5388cf2007-01-04 22:45:08 +00002643 * Get user data attached to the call, which has been previously set with
2644 * #pjsua_call_set_user_data().
Benny Prijonoeebe9af2006-06-13 22:57:13 +00002645 *
2646 * @param call_id Call identification.
2647 *
2648 * @return The user data.
Benny Prijonoe6ead542007-01-31 20:53:31 +00002649 *
2650 * \par Python:
2651 * \code
2652 user_data = py_pjsua.call_get_user_data(call_id)
2653 * \endcode
2654 * The \a user_data is an integer.
Benny Prijono268ca612006-02-07 12:34:11 +00002655 */
Benny Prijonoeebe9af2006-06-13 22:57:13 +00002656PJ_DECL(void*) pjsua_call_get_user_data(pjsua_call_id call_id);
Benny Prijono84126ab2006-02-09 09:30:09 +00002657
2658
2659/**
Benny Prijonob5388cf2007-01-04 22:45:08 +00002660 * Send response to incoming INVITE request. Depending on the status
2661 * code specified as parameter, this function may send provisional
2662 * response, establish the call, or terminate the call.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00002663 *
2664 * @param call_id Incoming call identification.
2665 * @param code Status code, (100-699).
2666 * @param reason Optional reason phrase. If NULL, default text
2667 * will be used.
2668 * @param msg_data Optional list of headers etc to be added to outgoing
2669 * response message.
2670 *
2671 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00002672 *
2673 * \par Python:
2674 * \code
2675 status = py_pjsua.call_answer(call_id, code, reason, msg_data)
2676 * \endcode
2677 * Arguments \a reason and \a msg_data may be set to None if not required.
Benny Prijonoa91a0032006-02-26 21:23:45 +00002678 */
Benny Prijonoeebe9af2006-06-13 22:57:13 +00002679PJ_DECL(pj_status_t) pjsua_call_answer(pjsua_call_id call_id,
2680 unsigned code,
2681 const pj_str_t *reason,
2682 const pjsua_msg_data *msg_data);
Benny Prijonoa91a0032006-02-26 21:23:45 +00002683
2684/**
Benny Prijonoeebe9af2006-06-13 22:57:13 +00002685 * Hangup call by using method that is appropriate according to the
Benny Prijonob5388cf2007-01-04 22:45:08 +00002686 * call state. This function is different than answering the call with
2687 * 3xx-6xx response (with #pjsua_call_answer()), in that this function
2688 * will hangup the call regardless of the state and role of the call,
2689 * while #pjsua_call_answer() only works with incoming calls on EARLY
2690 * state.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00002691 *
2692 * @param call_id Call identification.
2693 * @param code Optional status code to be sent when we're rejecting
2694 * incoming call. If the value is zero, "603/Decline"
2695 * will be sent.
2696 * @param reason Optional reason phrase to be sent when we're rejecting
2697 * incoming call. If NULL, default text will be used.
2698 * @param msg_data Optional list of headers etc to be added to outgoing
2699 * request/response message.
2700 *
2701 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00002702 *
2703 * \par Python:
2704 * \code
2705 status = py_pjsua.call_hangup(call_id, code, reason, msg_data)
2706 * \endcode
2707 * Arguments \a reason and \a msg_data may be set to None if not required.
Benny Prijono26ff9062006-02-21 23:47:00 +00002708 */
Benny Prijonoeebe9af2006-06-13 22:57:13 +00002709PJ_DECL(pj_status_t) pjsua_call_hangup(pjsua_call_id call_id,
2710 unsigned code,
2711 const pj_str_t *reason,
2712 const pjsua_msg_data *msg_data);
Benny Prijono26ff9062006-02-21 23:47:00 +00002713
2714
2715/**
Benny Prijonob5388cf2007-01-04 22:45:08 +00002716 * Put the specified call on hold. This will send re-INVITE with the
2717 * appropriate SDP to inform remote that the call is being put on hold.
2718 * The final status of the request itself will be reported on the
2719 * \a on_call_media_state() callback, which inform the application that
2720 * the media state of the call has changed.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00002721 *
2722 * @param call_id Call identification.
2723 * @param msg_data Optional message components to be sent with
2724 * the request.
2725 *
2726 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00002727 *
2728 * \par Python:
2729 * \code
2730 status = py_pjsua.call_set_hold(call_id, msg_data)
2731 * \endcode
2732 * Argument \a msg_data may be set to None if not required.
Benny Prijono26ff9062006-02-21 23:47:00 +00002733 */
Benny Prijonoeebe9af2006-06-13 22:57:13 +00002734PJ_DECL(pj_status_t) pjsua_call_set_hold(pjsua_call_id call_id,
2735 const pjsua_msg_data *msg_data);
Benny Prijono26ff9062006-02-21 23:47:00 +00002736
2737
2738/**
Benny Prijonob5388cf2007-01-04 22:45:08 +00002739 * Send re-INVITE to release hold.
2740 * The final status of the request itself will be reported on the
2741 * \a on_call_media_state() callback, which inform the application that
2742 * the media state of the call has changed.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00002743 *
2744 * @param call_id Call identification.
2745 * @param unhold If this argument is non-zero and the call is locally
2746 * held, this will release the local hold.
2747 * @param msg_data Optional message components to be sent with
2748 * the request.
2749 *
2750 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00002751 *
2752 * \par Python:
2753 * \code
2754 status = py_pjsua.call_reinvite(call_id, unhold, msg_data)
2755 * \endcode
2756 * Argument \a msg_data may be set to None if not required.
Benny Prijono26ff9062006-02-21 23:47:00 +00002757 */
Benny Prijonoeebe9af2006-06-13 22:57:13 +00002758PJ_DECL(pj_status_t) pjsua_call_reinvite(pjsua_call_id call_id,
2759 pj_bool_t unhold,
2760 const pjsua_msg_data *msg_data);
Benny Prijono26ff9062006-02-21 23:47:00 +00002761
2762
2763/**
Benny Prijono053f5222006-11-11 16:16:04 +00002764 * Initiate call transfer to the specified address. This function will send
2765 * REFER request to instruct remote call party to initiate a new INVITE
2766 * session to the specified destination/target.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00002767 *
Benny Prijonob5388cf2007-01-04 22:45:08 +00002768 * If application is interested to monitor the successfulness and
2769 * the progress of the transfer request, it can implement
2770 * \a on_call_transfer_status() callback which will report the progress
2771 * of the call transfer request.
2772 *
Benny Prijono053f5222006-11-11 16:16:04 +00002773 * @param call_id The call id to be transfered.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00002774 * @param dest Address of new target to be contacted.
2775 * @param msg_data Optional message components to be sent with
2776 * the request.
2777 *
2778 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00002779 *
2780 * \par Python:
2781 * \code
2782 status = py_pjsua.call_xfer(call_id, dest, msg_data)
2783 * \endcode
2784 * Argument \a msg_data may be set to None if not required.
Benny Prijono26ff9062006-02-21 23:47:00 +00002785 */
Benny Prijonoeebe9af2006-06-13 22:57:13 +00002786PJ_DECL(pj_status_t) pjsua_call_xfer(pjsua_call_id call_id,
2787 const pj_str_t *dest,
2788 const pjsua_msg_data *msg_data);
Benny Prijono9fc735d2006-05-28 14:58:12 +00002789
2790/**
Benny Prijono053f5222006-11-11 16:16:04 +00002791 * Flag to indicate that "Require: replaces" should not be put in the
2792 * outgoing INVITE request caused by REFER request created by
2793 * #pjsua_call_xfer_replaces().
2794 */
2795#define PJSUA_XFER_NO_REQUIRE_REPLACES 1
2796
2797/**
2798 * Initiate attended call transfer. This function will send REFER request
2799 * to instruct remote call party to initiate new INVITE session to the URL
2800 * of \a dest_call_id. The party at \a dest_call_id then should "replace"
2801 * the call with us with the new call from the REFER recipient.
2802 *
2803 * @param call_id The call id to be transfered.
2804 * @param dest_call_id The call id to be replaced.
2805 * @param options Application may specify PJSUA_XFER_NO_REQUIRE_REPLACES
2806 * to suppress the inclusion of "Require: replaces" in
2807 * the outgoing INVITE request created by the REFER
2808 * request.
2809 * @param msg_data Optional message components to be sent with
2810 * the request.
2811 *
2812 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00002813 *
2814 * \par Python:
2815 * \code
2816 status = py_pjsua.call_xfer_replaces(call_id, dest_call_id, options, msg_data)
2817 * \endcode
2818 * Argument \a msg_data may be set to None if not required.
Benny Prijono053f5222006-11-11 16:16:04 +00002819 */
2820PJ_DECL(pj_status_t) pjsua_call_xfer_replaces(pjsua_call_id call_id,
2821 pjsua_call_id dest_call_id,
2822 unsigned options,
2823 const pjsua_msg_data *msg_data);
2824
2825/**
Benny Prijonoeebe9af2006-06-13 22:57:13 +00002826 * Send DTMF digits to remote using RFC 2833 payload formats.
2827 *
2828 * @param call_id Call identification.
Benny Prijonoe6ead542007-01-31 20:53:31 +00002829 * @param digits DTMF string digits to be sent.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00002830 *
2831 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00002832 *
2833 * \par Python:
2834 * \code
2835 status = py_pjsua.call_dial_dtmf(call_id, digits)
2836 * \endcode
Benny Prijono9fc735d2006-05-28 14:58:12 +00002837 */
Benny Prijonoeebe9af2006-06-13 22:57:13 +00002838PJ_DECL(pj_status_t) pjsua_call_dial_dtmf(pjsua_call_id call_id,
Benny Prijono9fc735d2006-05-28 14:58:12 +00002839 const pj_str_t *digits);
Benny Prijono26ff9062006-02-21 23:47:00 +00002840
Benny Prijono26ff9062006-02-21 23:47:00 +00002841/**
Benny Prijonob0808372006-03-02 21:18:58 +00002842 * Send instant messaging inside INVITE session.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00002843 *
2844 * @param call_id Call identification.
2845 * @param mime_type Optional MIME type. If NULL, then "text/plain" is
2846 * assumed.
2847 * @param content The message content.
2848 * @param msg_data Optional list of headers etc to be included in outgoing
2849 * request. The body descriptor in the msg_data is
2850 * ignored.
2851 * @param user_data Optional user data, which will be given back when
2852 * the IM callback is called.
2853 *
2854 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00002855 *
2856 * \par Python:
2857 * \code
2858 status = py_pjsua.call_send_im(call_id, mime_type, content, msg_data, user_data)
2859 * \endcode
2860 * Note that the \a user_data argument is an integer in Python.
Benny Prijonob0808372006-03-02 21:18:58 +00002861 */
Benny Prijonoeebe9af2006-06-13 22:57:13 +00002862PJ_DECL(pj_status_t) pjsua_call_send_im( pjsua_call_id call_id,
2863 const pj_str_t *mime_type,
2864 const pj_str_t *content,
2865 const pjsua_msg_data *msg_data,
2866 void *user_data);
Benny Prijonob0808372006-03-02 21:18:58 +00002867
2868
2869/**
2870 * Send IM typing indication inside INVITE session.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00002871 *
2872 * @param call_id Call identification.
2873 * @param is_typing Non-zero to indicate to remote that local person is
2874 * currently typing an IM.
2875 * @param msg_data Optional list of headers etc to be included in outgoing
2876 * request.
2877 *
2878 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00002879 *
2880 * \par Python:
2881 * \code
2882 status = py_pjsua.call_send_typing_ind(call_id, is_typing, msg_data)
2883 * \endcode
2884 * Argument \a msg_data may be set to None if not required.
Benny Prijonob0808372006-03-02 21:18:58 +00002885 */
Benny Prijonoeebe9af2006-06-13 22:57:13 +00002886PJ_DECL(pj_status_t) pjsua_call_send_typing_ind(pjsua_call_id call_id,
2887 pj_bool_t is_typing,
2888 const pjsua_msg_data*msg_data);
Benny Prijonob0808372006-03-02 21:18:58 +00002889
2890/**
Benny Prijonob5388cf2007-01-04 22:45:08 +00002891 * Terminate all calls. This will initiate #pjsua_call_hangup() for all
2892 * currently active calls.
Benny Prijonoe6ead542007-01-31 20:53:31 +00002893 *
2894 * \par Python:
2895 * \code
2896 py_pjsua.call_hangup_all()
2897 * \endcode
Benny Prijono834aee32006-02-19 01:38:06 +00002898 */
Benny Prijonodc39fe82006-05-26 12:17:46 +00002899PJ_DECL(void) pjsua_call_hangup_all(void);
Benny Prijono834aee32006-02-19 01:38:06 +00002900
2901
Benny Prijonob9b32ab2006-06-01 12:28:44 +00002902/**
2903 * Dump call and media statistics to string.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00002904 *
2905 * @param call_id Call identification.
2906 * @param with_media Non-zero to include media information too.
2907 * @param buffer Buffer where the statistics are to be written to.
2908 * @param maxlen Maximum length of buffer.
2909 * @param indent Spaces for left indentation.
2910 *
2911 * @return PJ_SUCCESS on success.
Benny Prijonoe6ead542007-01-31 20:53:31 +00002912 *
2913 * \par Python:
2914 * \code
2915 string = py_pjsua.call_dump(call_id, with_media, max_len, indent)
2916 * \endcode
2917 * The \a max_len argument is the desired maximum length to be allocated.
Benny Prijonob9b32ab2006-06-01 12:28:44 +00002918 */
Benny Prijonoeebe9af2006-06-13 22:57:13 +00002919PJ_DECL(pj_status_t) pjsua_call_dump(pjsua_call_id call_id,
2920 pj_bool_t with_media,
2921 char *buffer,
2922 unsigned maxlen,
2923 const char *indent);
Benny Prijonob9b32ab2006-06-01 12:28:44 +00002924
Benny Prijono9fc735d2006-05-28 14:58:12 +00002925/**
Benny Prijono312aff92006-06-17 04:08:30 +00002926 * @}
Benny Prijono9fc735d2006-05-28 14:58:12 +00002927 */
Benny Prijono834aee32006-02-19 01:38:06 +00002928
2929
2930/*****************************************************************************
Benny Prijono312aff92006-06-17 04:08:30 +00002931 * BUDDY API
Benny Prijono834aee32006-02-19 01:38:06 +00002932 */
2933
Benny Prijono312aff92006-06-17 04:08:30 +00002934
2935/**
Benny Prijonoe6ead542007-01-31 20:53:31 +00002936 * @defgroup PJSUA_LIB_BUDDY PJSUA-API Buddy, Presence, and Instant Messaging
Benny Prijono312aff92006-06-17 04:08:30 +00002937 * @ingroup PJSUA_LIB
2938 * @brief Buddy management, buddy's presence, and instant messaging.
2939 * @{
Benny Prijonoe6ead542007-01-31 20:53:31 +00002940 *
2941 * This section describes PJSUA-APIs related to buddies management,
2942 * presence management, and instant messaging.
Benny Prijono312aff92006-06-17 04:08:30 +00002943 */
2944
2945/**
2946 * Max buddies in buddy list.
2947 */
2948#ifndef PJSUA_MAX_BUDDIES
2949# define PJSUA_MAX_BUDDIES 256
2950#endif
2951
2952
2953/**
Benny Prijonob5388cf2007-01-04 22:45:08 +00002954 * This structure describes buddy configuration when adding a buddy to
2955 * the buddy list with #pjsua_buddy_add(). Application MUST initialize
2956 * the structure with #pjsua_buddy_config_default() to initialize this
2957 * structure with default configuration.
Benny Prijonoe6ead542007-01-31 20:53:31 +00002958 *
2959 * \par Python:
2960 * In Python this structure is <tt>py_pjsua.Buddy_Config</tt>. However
2961 * it is recommended that application instantiates the buddy config
2962 * by calling:
2963 * \code
2964 buddy_cfg = py_pjsua.buddy_config_default()
2965 * \endcode
Benny Prijono312aff92006-06-17 04:08:30 +00002966 */
2967typedef struct pjsua_buddy_config
2968{
2969 /**
2970 * Buddy URL or name address.
2971 */
2972 pj_str_t uri;
2973
2974 /**
2975 * Specify whether presence subscription should start immediately.
2976 */
2977 pj_bool_t subscribe;
2978
2979} pjsua_buddy_config;
2980
2981
2982/**
Benny Prijonob5388cf2007-01-04 22:45:08 +00002983 * This enumeration describes basic buddy's online status.
Benny Prijono312aff92006-06-17 04:08:30 +00002984 */
2985typedef enum pjsua_buddy_status
2986{
2987 /**
2988 * Online status is unknown (possibly because no presence subscription
2989 * has been established).
2990 */
2991 PJSUA_BUDDY_STATUS_UNKNOWN,
2992
2993 /**
Benny Prijonofc24e692007-01-27 18:31:51 +00002994 * Buddy is known to be online.
Benny Prijono312aff92006-06-17 04:08:30 +00002995 */
2996 PJSUA_BUDDY_STATUS_ONLINE,
2997
2998 /**
2999 * Buddy is offline.
3000 */
3001 PJSUA_BUDDY_STATUS_OFFLINE,
3002
3003} pjsua_buddy_status;
3004
3005
3006
3007/**
Benny Prijonob5388cf2007-01-04 22:45:08 +00003008 * This structure describes buddy info, which can be retrieved by calling
3009 * #pjsua_buddy_get_info().
Benny Prijonoe6ead542007-01-31 20:53:31 +00003010 *
3011 * \par Python:
3012 * This structure in Python is <tt>py_pjsua.Buddy_Info</tt>.
Benny Prijono312aff92006-06-17 04:08:30 +00003013 */
3014typedef struct pjsua_buddy_info
3015{
3016 /**
3017 * The buddy ID.
3018 */
3019 pjsua_buddy_id id;
3020
3021 /**
3022 * The full URI of the buddy, as specified in the configuration.
3023 */
3024 pj_str_t uri;
3025
3026 /**
3027 * Buddy's Contact, only available when presence subscription has
3028 * been established to the buddy.
3029 */
3030 pj_str_t contact;
3031
3032 /**
3033 * Buddy's online status.
3034 */
3035 pjsua_buddy_status status;
3036
3037 /**
3038 * Text to describe buddy's online status.
3039 */
3040 pj_str_t status_text;
3041
3042 /**
3043 * Flag to indicate that we should monitor the presence information for
3044 * this buddy (normally yes, unless explicitly disabled).
3045 */
3046 pj_bool_t monitor_pres;
3047
3048 /**
3049 * Internal buffer.
3050 */
3051 char buf_[256];
3052
3053} pjsua_buddy_info;
3054
3055
Benny Prijono834aee32006-02-19 01:38:06 +00003056/**
Benny Prijonob5388cf2007-01-04 22:45:08 +00003057 * Set default values to the buddy config.
Benny Prijonoe6ead542007-01-31 20:53:31 +00003058 *
3059 * \par Python:
3060 * \code
3061 buddy_cfg = py_pjsua.buddy_config_default()
3062 * \endcode
Benny Prijonob5388cf2007-01-04 22:45:08 +00003063 */
3064PJ_INLINE(void) pjsua_buddy_config_default(pjsua_buddy_config *cfg)
3065{
3066 pj_bzero(cfg, sizeof(*cfg));
3067}
3068
3069
3070/**
Benny Prijonoeebe9af2006-06-13 22:57:13 +00003071 * Get total number of buddies.
3072 *
3073 * @return Number of buddies.
Benny Prijonoe6ead542007-01-31 20:53:31 +00003074 *
3075 * \par Python:
3076 * \code
3077 buddy_count = py_pjsua.get_buddy_count()
3078 * \endcode
Benny Prijono9fc735d2006-05-28 14:58:12 +00003079 */
3080PJ_DECL(unsigned) pjsua_get_buddy_count(void);
3081
3082
3083/**
Benny Prijonoeebe9af2006-06-13 22:57:13 +00003084 * Check if buddy ID is valid.
3085 *
3086 * @param buddy_id Buddy ID to check.
3087 *
3088 * @return Non-zero if buddy ID is valid.
Benny Prijonoe6ead542007-01-31 20:53:31 +00003089 *
3090 * \par Python:
3091 * \code
3092 is_valid = py_pjsua.buddy_is_valid(buddy_id)
3093 * \endcode
Benny Prijono9fc735d2006-05-28 14:58:12 +00003094 */
Benny Prijonoeebe9af2006-06-13 22:57:13 +00003095PJ_DECL(pj_bool_t) pjsua_buddy_is_valid(pjsua_buddy_id buddy_id);
3096
3097
3098/**
Benny Prijonob5388cf2007-01-04 22:45:08 +00003099 * Enumerate all buddy IDs in the buddy list. Application then can use
3100 * #pjsua_buddy_get_info() to get the detail information for each buddy
3101 * id.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00003102 *
3103 * @param ids Array of ids to be initialized.
3104 * @param count On input, specifies max elements in the array.
3105 * On return, it contains actual number of elements
3106 * that have been initialized.
3107 *
3108 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00003109 *
3110 * \par Python:
3111 * The Python function takes no argument and returns list of buddy IDs:
3112 * \code
3113 [buddy_ids] = py_pjsua.enum_buddies()
3114 * \endcode
Benny Prijonoeebe9af2006-06-13 22:57:13 +00003115 */
3116PJ_DECL(pj_status_t) pjsua_enum_buddies(pjsua_buddy_id ids[],
3117 unsigned *count);
3118
3119/**
3120 * Get detailed buddy info.
3121 *
3122 * @param buddy_id The buddy identification.
3123 * @param info Pointer to receive information about buddy.
3124 *
3125 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00003126 *
3127 * \par Python:
3128 * \code
3129 buddy_info = py_pjsua.buddy_get_info(buddy_id)
3130 * \endcode
3131 * The function returns None if buddy_id is not valid.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00003132 */
3133PJ_DECL(pj_status_t) pjsua_buddy_get_info(pjsua_buddy_id buddy_id,
Benny Prijono9fc735d2006-05-28 14:58:12 +00003134 pjsua_buddy_info *info);
3135
3136/**
Benny Prijonob5388cf2007-01-04 22:45:08 +00003137 * Add new buddy to the buddy list. If presence subscription is enabled
3138 * for this buddy, this function will also start the presence subscription
3139 * session immediately.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00003140 *
Benny Prijonoe6ead542007-01-31 20:53:31 +00003141 * @param buddy)cfg Buddy configuration.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00003142 * @param p_buddy_id Pointer to receive buddy ID.
3143 *
3144 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00003145 *
3146 * \par Python:
3147 * The function returns (status, buddy_id) tuple:
3148 * \code
3149 status, buddy_id = py_pjsua.buddy_add(buddy_cfg)
3150 * \endcode
Benny Prijono9fc735d2006-05-28 14:58:12 +00003151 */
Benny Prijonoe6ead542007-01-31 20:53:31 +00003152PJ_DECL(pj_status_t) pjsua_buddy_add(const pjsua_buddy_config *buddy_cfg,
Benny Prijonoeebe9af2006-06-13 22:57:13 +00003153 pjsua_buddy_id *p_buddy_id);
Benny Prijono8b1889b2006-06-06 18:40:40 +00003154
3155
3156/**
Benny Prijonob5388cf2007-01-04 22:45:08 +00003157 * Delete the specified buddy from the buddy list. Any presence subscription
3158 * to this buddy will be terminated.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00003159 *
3160 * @param buddy_id Buddy identification.
3161 *
3162 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00003163 *
3164 * \par Python:
3165 * \code
3166 status = py_pjsua.buddy_del(buddy_id)
3167 * \endcode
Benny Prijono8b1889b2006-06-06 18:40:40 +00003168 */
Benny Prijonoeebe9af2006-06-13 22:57:13 +00003169PJ_DECL(pj_status_t) pjsua_buddy_del(pjsua_buddy_id buddy_id);
Benny Prijono9fc735d2006-05-28 14:58:12 +00003170
3171
3172/**
Benny Prijonob5388cf2007-01-04 22:45:08 +00003173 * Enable/disable buddy's presence monitoring. Once buddy's presence is
3174 * subscribed, application will be informed about buddy's presence status
3175 * changed via \a on_buddy_state() callback.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00003176 *
3177 * @param buddy_id Buddy identification.
3178 * @param subscribe Specify non-zero to activate presence subscription to
3179 * the specified buddy.
3180 *
3181 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00003182 *
3183 * \par Python:
3184 * \code
3185 status = py_pjsua.buddy_subscribe_pres(buddy_id, subscribe)
3186 * \endcode
Benny Prijono9fc735d2006-05-28 14:58:12 +00003187 */
Benny Prijonoeebe9af2006-06-13 22:57:13 +00003188PJ_DECL(pj_status_t) pjsua_buddy_subscribe_pres(pjsua_buddy_id buddy_id,
3189 pj_bool_t subscribe);
Benny Prijono9fc735d2006-05-28 14:58:12 +00003190
3191
3192/**
Benny Prijonob5388cf2007-01-04 22:45:08 +00003193 * Dump presence subscriptions to log.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00003194 *
3195 * @param verbose Yes or no.
Benny Prijonoe6ead542007-01-31 20:53:31 +00003196 *
3197 * \par Python:
3198 * \code
3199 py_pjsua.pres_dump()
3200 * \endcode
Benny Prijono834aee32006-02-19 01:38:06 +00003201 */
Benny Prijonoeebe9af2006-06-13 22:57:13 +00003202PJ_DECL(void) pjsua_pres_dump(pj_bool_t verbose);
Benny Prijono834aee32006-02-19 01:38:06 +00003203
3204
Benny Prijonob0808372006-03-02 21:18:58 +00003205/**
3206 * The MESSAGE method (defined in pjsua_im.c)
3207 */
3208extern const pjsip_method pjsip_message_method;
3209
3210
Benny Prijonob0808372006-03-02 21:18:58 +00003211
3212/**
Benny Prijonoeebe9af2006-06-13 22:57:13 +00003213 * Send instant messaging outside dialog, using the specified account for
3214 * route set and authentication.
3215 *
3216 * @param acc_id Account ID to be used to send the request.
3217 * @param to Remote URI.
3218 * @param mime_type Optional MIME type. If NULL, then "text/plain" is
3219 * assumed.
3220 * @param content The message content.
3221 * @param msg_data Optional list of headers etc to be included in outgoing
3222 * request. The body descriptor in the msg_data is
3223 * ignored.
3224 * @param user_data Optional user data, which will be given back when
3225 * the IM callback is called.
3226 *
3227 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00003228 *
3229 * \par Python:
3230 * \code
3231 status = py_pjsua.im_send(acc_id, to, mime_type, content, msg_data, user_data)
3232 * \endcode
3233 * Arguments \a mime_type and \a msg_data may be set to None if not required.
Benny Prijonob0808372006-03-02 21:18:58 +00003234 */
Benny Prijonoeebe9af2006-06-13 22:57:13 +00003235PJ_DECL(pj_status_t) pjsua_im_send(pjsua_acc_id acc_id,
3236 const pj_str_t *to,
3237 const pj_str_t *mime_type,
3238 const pj_str_t *content,
3239 const pjsua_msg_data *msg_data,
3240 void *user_data);
Benny Prijonob0808372006-03-02 21:18:58 +00003241
3242
3243/**
3244 * Send typing indication outside dialog.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00003245 *
3246 * @param acc_id Account ID to be used to send the request.
3247 * @param to Remote URI.
3248 * @param is_typing If non-zero, it tells remote person that local person
3249 * is currently composing an IM.
3250 * @param msg_data Optional list of headers etc to be added to outgoing
3251 * request.
3252 *
3253 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00003254 *
3255 * \par Python:
3256 * \code
3257 status = py_pjsua.im_typing(acc_id, to, is_typing, msg_data)
3258 * \endcode
3259 * Argument \a msg_data may be set to None if not requried.
Benny Prijonob0808372006-03-02 21:18:58 +00003260 */
Benny Prijonoeebe9af2006-06-13 22:57:13 +00003261PJ_DECL(pj_status_t) pjsua_im_typing(pjsua_acc_id acc_id,
3262 const pj_str_t *to,
3263 pj_bool_t is_typing,
3264 const pjsua_msg_data *msg_data);
Benny Prijonob0808372006-03-02 21:18:58 +00003265
3266
Benny Prijonof3195072006-02-14 21:15:30 +00003267
Benny Prijono312aff92006-06-17 04:08:30 +00003268/**
3269 * @}
Benny Prijono9fc735d2006-05-28 14:58:12 +00003270 */
3271
Benny Prijono312aff92006-06-17 04:08:30 +00003272
3273/*****************************************************************************
3274 * MEDIA API
3275 */
3276
3277
3278/**
Benny Prijonoe6ead542007-01-31 20:53:31 +00003279 * @defgroup PJSUA_LIB_MEDIA PJSUA-API Media Manipulation
Benny Prijono312aff92006-06-17 04:08:30 +00003280 * @ingroup PJSUA_LIB
3281 * @brief Media manipulation.
3282 * @{
3283 *
3284 * PJSUA has rather powerful media features, which are built around the
Benny Prijonoe6ead542007-01-31 20:53:31 +00003285 * PJMEDIA conference bridge. Basically, all media "ports" (such as calls, WAV
3286 * players, WAV playlist, file recorders, sound device, tone generators, etc)
Benny Prijono312aff92006-06-17 04:08:30 +00003287 * are terminated in the conference bridge, and application can manipulate
Benny Prijonoe6ead542007-01-31 20:53:31 +00003288 * the interconnection between these terminations freely.
3289 *
3290 * The conference bridge provides powerful switching and mixing functionality
3291 * for application. With the conference bridge, each conference slot (e.g.
3292 * a call) can transmit to multiple destinations, and one destination can
3293 * receive from multiple sources. If more than one media terminations are
3294 * terminated in the same slot, the conference bridge will mix the signal
3295 * automatically.
Benny Prijono312aff92006-06-17 04:08:30 +00003296 *
3297 * Application connects one media termination/slot to another by calling
3298 * #pjsua_conf_connect() function. This will establish <b>unidirectional</b>
Benny Prijonoe6ead542007-01-31 20:53:31 +00003299 * media flow from the source termination to the sink termination. To
3300 * establish bidirectional media flow, application wound need to make another
3301 * call to #pjsua_conf_connect(), this time inverting the source and
3302 * destination slots in the parameter.
3303 *
3304 * For example, to stream a WAV file to remote call, application may use
Benny Prijono312aff92006-06-17 04:08:30 +00003305 * the following steps:
3306 *
3307 \code
3308
3309 pj_status_t stream_to_call( pjsua_call_id call_id )
3310 {
3311 pjsua_player_id player_id;
3312
3313 status = pjsua_player_create("mysong.wav", 0, NULL, &player_id);
3314 if (status != PJ_SUCCESS)
3315 return status;
3316
3317 status = pjsua_conf_connect( pjsua_player_get_conf_port(),
3318 pjsua_call_get_conf_port() );
3319 }
3320 \endcode
3321 *
3322 *
3323 * Other features of PJSUA media:
3324 * - efficient N to M interconnections between media terminations.
3325 * - media termination can be connected to itself to create loopback
3326 * media.
3327 * - the media termination may have different clock rates, and resampling
3328 * will be done automatically by conference bridge.
3329 * - media terminations may also have different frame time; the
3330 * conference bridge will perform the necessary bufferring to adjust
3331 * the difference between terminations.
3332 * - interconnections are removed automatically when media termination
3333 * is removed from the bridge.
3334 * - sound device may be changed even when there are active media
3335 * interconnections.
3336 * - correctly report call's media quality (in #pjsua_call_dump()) from
3337 * RTCP packet exchange.
3338 */
3339
3340/**
3341 * Max ports in the conference bridge.
3342 */
3343#ifndef PJSUA_MAX_CONF_PORTS
Benny Prijono12a669c2006-11-23 07:32:13 +00003344# define PJSUA_MAX_CONF_PORTS 254
Benny Prijono312aff92006-06-17 04:08:30 +00003345#endif
3346
Benny Prijonob5388cf2007-01-04 22:45:08 +00003347/**
3348 * The default clock rate to be used by the conference bridge.
3349 */
Benny Prijono12a669c2006-11-23 07:32:13 +00003350#ifndef PJSUA_DEFAULT_CLOCK_RATE
3351# define PJSUA_DEFAULT_CLOCK_RATE 16000
3352#endif
3353
Benny Prijonob5388cf2007-01-04 22:45:08 +00003354/**
3355 * Default codec quality settings.
3356 */
Benny Prijono12a669c2006-11-23 07:32:13 +00003357#ifndef PJSUA_DEFAULT_CODEC_QUALITY
3358# define PJSUA_DEFAULT_CODEC_QUALITY 5
3359#endif
3360
Benny Prijonob5388cf2007-01-04 22:45:08 +00003361/**
3362 * Default iLBC mode.
3363 */
Benny Prijono12a669c2006-11-23 07:32:13 +00003364#ifndef PJSUA_DEFAULT_ILBC_MODE
3365# define PJSUA_DEFAULT_ILBC_MODE 20
3366#endif
3367
Benny Prijonob5388cf2007-01-04 22:45:08 +00003368/**
3369 * The default echo canceller tail length.
3370 */
Benny Prijono12a669c2006-11-23 07:32:13 +00003371#ifndef PJSUA_DEFAULT_EC_TAIL_LEN
Benny Prijonod2990b92006-11-23 10:19:46 +00003372# define PJSUA_DEFAULT_EC_TAIL_LEN 800
Benny Prijono12a669c2006-11-23 07:32:13 +00003373#endif
Benny Prijono312aff92006-06-17 04:08:30 +00003374
3375
3376/**
Benny Prijonob5388cf2007-01-04 22:45:08 +00003377 * This structure describes media configuration, which will be specified
3378 * when calling #pjsua_init(). Application MUST initialize this structure
3379 * by calling #pjsua_media_config_default().
Benny Prijonoe6ead542007-01-31 20:53:31 +00003380 *
3381 * \par Python:
3382 * This data type in Python is <tt>py_pjsua.Media_Config</tt>. To create
3383 * an object of this type, it is recommended to call
3384 * <tt>py_pjsua.media_config_default()</tt> function instead:
3385 * \code
3386 media_cfg = py_pjsua.media_config_default()
3387 * \endcode
Benny Prijono312aff92006-06-17 04:08:30 +00003388 */
3389struct pjsua_media_config
3390{
3391 /**
3392 * Clock rate to be applied to the conference bridge.
Benny Prijonob5388cf2007-01-04 22:45:08 +00003393 * If value is zero, default clock rate will be used
3394 * (PJSUA_DEFAULT_CLOCK_RATE, which by default is 16KHz).
Benny Prijono312aff92006-06-17 04:08:30 +00003395 */
3396 unsigned clock_rate;
3397
3398 /**
3399 * Specify maximum number of media ports to be created in the
3400 * conference bridge. Since all media terminate in the bridge
3401 * (calls, file player, file recorder, etc), the value must be
3402 * large enough to support all of them. However, the larger
3403 * the value, the more computations are performed.
3404 */
3405 unsigned max_media_ports;
3406
3407 /**
3408 * Specify whether the media manager should manage its own
3409 * ioqueue for the RTP/RTCP sockets. If yes, ioqueue will be created
3410 * and at least one worker thread will be created too. If no,
3411 * the RTP/RTCP sockets will share the same ioqueue as SIP sockets,
3412 * and no worker thread is needed.
3413 *
3414 * Normally application would say yes here, unless it wants to
3415 * run everything from a single thread.
3416 */
3417 pj_bool_t has_ioqueue;
3418
3419 /**
3420 * Specify the number of worker threads to handle incoming RTP
3421 * packets. A value of one is recommended for most applications.
3422 */
3423 unsigned thread_cnt;
3424
Benny Prijono0498d902006-06-19 14:49:14 +00003425 /**
3426 * Media quality, 0-10, according to this table:
Benny Prijono7ca96da2006-08-07 12:11:40 +00003427 * 5-10: resampling use large filter,
3428 * 3-4: resampling use small filter,
Benny Prijono0498d902006-06-19 14:49:14 +00003429 * 1-2: resampling use linear.
3430 * The media quality also sets speex codec quality/complexity to the
3431 * number.
3432 *
Benny Prijono70972992006-08-05 11:13:58 +00003433 * Default: 5 (PJSUA_DEFAULT_CODEC_QUALITY).
Benny Prijono0498d902006-06-19 14:49:14 +00003434 */
3435 unsigned quality;
Benny Prijono0a12f002006-07-26 17:05:39 +00003436
3437 /**
3438 * Specify default ptime.
3439 *
3440 * Default: 0 (codec specific)
3441 */
3442 unsigned ptime;
3443
3444 /**
3445 * Disable VAD?
3446 *
3447 * Default: 0 (no (meaning VAD is enabled))
3448 */
3449 pj_bool_t no_vad;
Benny Prijono00cae612006-07-31 15:19:36 +00003450
3451 /**
3452 * iLBC mode (20 or 30).
3453 *
Benny Prijono70972992006-08-05 11:13:58 +00003454 * Default: 20 (PJSUA_DEFAULT_ILBC_MODE)
Benny Prijono00cae612006-07-31 15:19:36 +00003455 */
3456 unsigned ilbc_mode;
3457
3458 /**
3459 * Percentage of RTP packet to drop in TX direction
3460 * (to simulate packet lost).
3461 *
3462 * Default: 0
3463 */
3464 unsigned tx_drop_pct;
3465
3466 /**
3467 * Percentage of RTP packet to drop in RX direction
3468 * (to simulate packet lost).
3469 *
3470 * Default: 0
3471 */
3472 unsigned rx_drop_pct;
3473
Benny Prijonoc8e24a12006-08-02 18:22:22 +00003474 /**
Benny Prijono5da50432006-08-07 10:24:52 +00003475 * Echo canceller options (see #pjmedia_echo_create())
3476 *
3477 * Default: 0.
3478 */
3479 unsigned ec_options;
3480
3481 /**
Benny Prijonoc8e24a12006-08-02 18:22:22 +00003482 * Echo canceller tail length, in miliseconds.
3483 *
Benny Prijono669643c2006-09-20 20:02:18 +00003484 * Default: PJSUA_DEFAULT_EC_TAIL_LEN
Benny Prijonoc8e24a12006-08-02 18:22:22 +00003485 */
3486 unsigned ec_tail_len;
Benny Prijono1d0ca0c2006-11-21 09:06:47 +00003487
3488 /**
3489 * Jitter buffer initial prefetch delay in msec. The value must be
3490 * between jb_min_pre and jb_max_pre below.
3491 *
3492 * Default: -1 (to use default stream settings, currently 150 msec)
3493 */
3494 int jb_init;
3495
3496 /**
3497 * Jitter buffer minimum prefetch delay in msec.
3498 *
3499 * Default: -1 (to use default stream settings, currently 60 msec)
3500 */
3501 int jb_min_pre;
3502
3503 /**
3504 * Jitter buffer maximum prefetch delay in msec.
3505 *
3506 * Default: -1 (to use default stream settings, currently 240 msec)
3507 */
3508 int jb_max_pre;
3509
3510 /**
3511 * Set maximum delay that can be accomodated by the jitter buffer msec.
3512 *
3513 * Default: -1 (to use default stream settings, currently 360 msec)
3514 */
3515 int jb_max;
3516
Benny Prijono312aff92006-06-17 04:08:30 +00003517};
3518
3519
3520/**
3521 * Use this function to initialize media config.
3522 *
3523 * @param cfg The media config to be initialized.
Benny Prijonoe6ead542007-01-31 20:53:31 +00003524 *
3525 * \par Python:
3526 * \code
3527 media_cfg = py_pjsua.media_config_default()
3528 * \endcode
Benny Prijono312aff92006-06-17 04:08:30 +00003529 */
3530PJ_INLINE(void) pjsua_media_config_default(pjsua_media_config *cfg)
3531{
Benny Prijonoac623b32006-07-03 15:19:31 +00003532 pj_bzero(cfg, sizeof(*cfg));
Benny Prijono312aff92006-06-17 04:08:30 +00003533
Benny Prijono70972992006-08-05 11:13:58 +00003534 cfg->clock_rate = PJSUA_DEFAULT_CLOCK_RATE;
Benny Prijono312aff92006-06-17 04:08:30 +00003535 cfg->max_media_ports = 32;
3536 cfg->has_ioqueue = PJ_TRUE;
3537 cfg->thread_cnt = 1;
Benny Prijono70972992006-08-05 11:13:58 +00003538 cfg->quality = PJSUA_DEFAULT_CODEC_QUALITY;
3539 cfg->ilbc_mode = PJSUA_DEFAULT_ILBC_MODE;
3540 cfg->ec_tail_len = PJSUA_DEFAULT_EC_TAIL_LEN;
Benny Prijono1d0ca0c2006-11-21 09:06:47 +00003541 cfg->jb_init = cfg->jb_min_pre = cfg->jb_max_pre = cfg->jb_max = -1;
Benny Prijono312aff92006-06-17 04:08:30 +00003542}
3543
3544
3545
3546/**
Benny Prijonob5388cf2007-01-04 22:45:08 +00003547 * This structure describes codec information, which can be retrieved by
3548 * calling #pjsua_enum_codecs().
Benny Prijono312aff92006-06-17 04:08:30 +00003549 */
3550typedef struct pjsua_codec_info
3551{
3552 /**
3553 * Codec unique identification.
3554 */
3555 pj_str_t codec_id;
3556
3557 /**
3558 * Codec priority (integer 0-255).
3559 */
3560 pj_uint8_t priority;
3561
3562 /**
3563 * Internal buffer.
3564 */
3565 char buf_[32];
3566
3567} pjsua_codec_info;
3568
3569
3570/**
Benny Prijonob5388cf2007-01-04 22:45:08 +00003571 * This structure descibes information about a particular media port that
3572 * has been registered into the conference bridge. Application can query
3573 * this info by calling #pjsua_conf_get_port_info().
Benny Prijonoe6ead542007-01-31 20:53:31 +00003574 *
3575 * \par Python:
3576 * In Python, this type is <tt>py_pjsua.Conf_Port_Info</tt>.
Benny Prijono312aff92006-06-17 04:08:30 +00003577 */
3578typedef struct pjsua_conf_port_info
3579{
3580 /** Conference port number. */
3581 pjsua_conf_port_id slot_id;
3582
3583 /** Port name. */
3584 pj_str_t name;
3585
3586 /** Clock rate. */
3587 unsigned clock_rate;
3588
3589 /** Number of channels. */
3590 unsigned channel_count;
3591
3592 /** Samples per frame */
3593 unsigned samples_per_frame;
3594
3595 /** Bits per sample */
3596 unsigned bits_per_sample;
3597
3598 /** Number of listeners in the array. */
3599 unsigned listener_cnt;
3600
3601 /** Array of listeners (in other words, ports where this port is
3602 * transmitting to.
3603 */
3604 pjsua_conf_port_id listeners[PJSUA_MAX_CONF_PORTS];
3605
3606} pjsua_conf_port_info;
3607
3608
3609/**
3610 * This structure holds information about custom media transport to
3611 * be registered to pjsua.
Benny Prijonoe6ead542007-01-31 20:53:31 +00003612 *
3613 * \par Python:
3614 * Not applicable.
Benny Prijono312aff92006-06-17 04:08:30 +00003615 */
3616typedef struct pjsua_media_transport
3617{
3618 /**
3619 * Media socket information containing the address information
3620 * of the RTP and RTCP socket.
3621 */
3622 pjmedia_sock_info skinfo;
3623
3624 /**
3625 * The media transport instance.
3626 */
3627 pjmedia_transport *transport;
3628
3629} pjsua_media_transport;
3630
3631
3632
3633
Benny Prijono9fc735d2006-05-28 14:58:12 +00003634/**
3635 * Get maxinum number of conference ports.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00003636 *
3637 * @return Maximum number of ports in the conference bridge.
Benny Prijonoe6ead542007-01-31 20:53:31 +00003638 *
3639 * \par Python:
3640 * \code
3641 port_count = py_pjsua.conf_get_max_ports()
3642 * \endcode
Benny Prijono9fc735d2006-05-28 14:58:12 +00003643 */
Benny Prijonoeebe9af2006-06-13 22:57:13 +00003644PJ_DECL(unsigned) pjsua_conf_get_max_ports(void);
Benny Prijono9fc735d2006-05-28 14:58:12 +00003645
3646
3647/**
Benny Prijonoeebe9af2006-06-13 22:57:13 +00003648 * Get current number of active ports in the bridge.
3649 *
3650 * @return The number.
Benny Prijonoe6ead542007-01-31 20:53:31 +00003651 *
3652 * \par Python:
3653 * \code
3654 count = py_pjsua.conf_get_active_ports()
3655 * \endcode
Benny Prijono9fc735d2006-05-28 14:58:12 +00003656 */
Benny Prijonoeebe9af2006-06-13 22:57:13 +00003657PJ_DECL(unsigned) pjsua_conf_get_active_ports(void);
3658
3659
3660/**
3661 * Enumerate all conference ports.
3662 *
3663 * @param id Array of conference port ID to be initialized.
3664 * @param count On input, specifies max elements in the array.
3665 * On return, it contains actual number of elements
3666 * that have been initialized.
3667 *
3668 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00003669 *
3670 * \par Python:
3671 * The Python functions returns list of conference port Ids:
3672 * \code
3673 [port_ids] = py_pjsua.enum_conf_ports()
3674 * \endcode
Benny Prijonoeebe9af2006-06-13 22:57:13 +00003675 */
3676PJ_DECL(pj_status_t) pjsua_enum_conf_ports(pjsua_conf_port_id id[],
3677 unsigned *count);
Benny Prijono8b1889b2006-06-06 18:40:40 +00003678
3679
3680/**
3681 * Get information about the specified conference port
Benny Prijonoeebe9af2006-06-13 22:57:13 +00003682 *
Benny Prijonoe6ead542007-01-31 20:53:31 +00003683 * @param port_id Port identification.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00003684 * @param info Pointer to store the port info.
3685 *
3686 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00003687 *
3688 * \par Python:
3689 * \code
3690 port_info = py_pjsua.conf_get_port_info(port_id)
3691 * \endcode
3692 * The function will return None if \a port_id is not valid.
Benny Prijono8b1889b2006-06-06 18:40:40 +00003693 */
Benny Prijonoe6ead542007-01-31 20:53:31 +00003694PJ_DECL(pj_status_t) pjsua_conf_get_port_info( pjsua_conf_port_id port_id,
Benny Prijono8b1889b2006-06-06 18:40:40 +00003695 pjsua_conf_port_info *info);
Benny Prijono9fc735d2006-05-28 14:58:12 +00003696
3697
3698/**
Benny Prijonoe909eac2006-07-27 22:04:56 +00003699 * Add arbitrary media port to PJSUA's conference bridge. Application
3700 * can use this function to add the media port that it creates. For
3701 * media ports that are created by PJSUA-LIB (such as calls, file player,
3702 * or file recorder), PJSUA-LIB will automatically add the port to
3703 * the bridge.
3704 *
3705 * @param pool Pool to use.
3706 * @param port Media port to be added to the bridge.
3707 * @param p_id Optional pointer to receive the conference
3708 * slot id.
3709 *
3710 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00003711 *
3712 * \par Python:
3713 * Not applicable (for now)
Benny Prijonoe909eac2006-07-27 22:04:56 +00003714 */
3715PJ_DECL(pj_status_t) pjsua_conf_add_port(pj_pool_t *pool,
3716 pjmedia_port *port,
3717 pjsua_conf_port_id *p_id);
3718
3719
3720/**
3721 * Remove arbitrary slot from the conference bridge. Application should only
Benny Prijonob5388cf2007-01-04 22:45:08 +00003722 * call this function if it registered the port manually with previous call
3723 * to #pjsua_conf_add_port().
Benny Prijonoe909eac2006-07-27 22:04:56 +00003724 *
Benny Prijonoe6ead542007-01-31 20:53:31 +00003725 * @param port_id The slot id of the port to be removed.
Benny Prijonoe909eac2006-07-27 22:04:56 +00003726 *
3727 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00003728 *
3729 * \par Python:
3730 * \code
3731 status = py_pjsua.conf_remove_port(port_id)
3732 * \endcode
Benny Prijonoe909eac2006-07-27 22:04:56 +00003733 */
Benny Prijonoe6ead542007-01-31 20:53:31 +00003734PJ_DECL(pj_status_t) pjsua_conf_remove_port(pjsua_conf_port_id port_id);
Benny Prijonoe909eac2006-07-27 22:04:56 +00003735
3736
3737/**
Benny Prijonoeebe9af2006-06-13 22:57:13 +00003738 * Establish unidirectional media flow from souce to sink. One source
3739 * may transmit to multiple destinations/sink. And if multiple
3740 * sources are transmitting to the same sink, the media will be mixed
3741 * together. Source and sink may refer to the same ID, effectively
3742 * looping the media.
3743 *
3744 * If bidirectional media flow is desired, application needs to call
3745 * this function twice, with the second one having the arguments
3746 * reversed.
3747 *
3748 * @param source Port ID of the source media/transmitter.
3749 * @param sink Port ID of the destination media/received.
3750 *
3751 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00003752 *
3753 * \par Python:
3754 * \code
3755 status = py_pjsua.conf_connect(source, sink)
3756 * \endcode
Benny Prijono9fc735d2006-05-28 14:58:12 +00003757 */
Benny Prijonoeebe9af2006-06-13 22:57:13 +00003758PJ_DECL(pj_status_t) pjsua_conf_connect(pjsua_conf_port_id source,
3759 pjsua_conf_port_id sink);
Benny Prijono9fc735d2006-05-28 14:58:12 +00003760
3761
3762/**
Benny Prijonoeebe9af2006-06-13 22:57:13 +00003763 * Disconnect media flow from the source to destination port.
3764 *
3765 * @param source Port ID of the source media/transmitter.
3766 * @param sink Port ID of the destination media/received.
3767 *
3768 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00003769 *
3770 * \par Python:
3771 * \code
3772 status = py_pjsua.conf_disconnect(source, sink)
3773 * \endcode
Benny Prijono9fc735d2006-05-28 14:58:12 +00003774 */
Benny Prijonoeebe9af2006-06-13 22:57:13 +00003775PJ_DECL(pj_status_t) pjsua_conf_disconnect(pjsua_conf_port_id source,
3776 pjsua_conf_port_id sink);
Benny Prijono9fc735d2006-05-28 14:58:12 +00003777
3778
Benny Prijono6dd967c2006-12-26 02:27:14 +00003779/**
3780 * Adjust the signal level to be transmitted from the bridge to the
3781 * specified port by making it louder or quieter.
3782 *
3783 * @param slot The conference bridge slot number.
3784 * @param level Signal level adjustment. Value 1.0 means no level
3785 * adjustment, while value 0 means to mute the port.
3786 *
3787 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00003788 *
3789 * \par Python:
3790 * Not implemented (yet)
Benny Prijono6dd967c2006-12-26 02:27:14 +00003791 */
3792PJ_DECL(pj_status_t) pjsua_conf_adjust_tx_level(pjsua_conf_port_id slot,
3793 float level);
3794
3795/**
3796 * Adjust the signal level to be received from the specified port (to
3797 * the bridge) by making it louder or quieter.
3798 *
3799 * @param slot The conference bridge slot number.
3800 * @param level Signal level adjustment. Value 1.0 means no level
3801 * adjustment, while value 0 means to mute the port.
3802 *
3803 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00003804 *
3805 * \par Python:
3806 * Not implemented (yet)
Benny Prijono6dd967c2006-12-26 02:27:14 +00003807 */
3808PJ_DECL(pj_status_t) pjsua_conf_adjust_rx_level(pjsua_conf_port_id slot,
3809 float level);
3810
3811/**
3812 * Get last signal level transmitted to or received from the specified port.
3813 * The signal level is an integer value in zero to 255, with zero indicates
3814 * no signal, and 255 indicates the loudest signal level.
3815 *
3816 * @param slot The conference bridge slot number.
3817 * @param tx_level Optional argument to receive the level of signal
3818 * transmitted to the specified port (i.e. the direction
3819 * is from the bridge to the port).
3820 * @param rx_level Optional argument to receive the level of signal
3821 * received from the port (i.e. the direction is from the
3822 * port to the bridge).
3823 *
3824 * @return PJ_SUCCESS on success.
Benny Prijonoe6ead542007-01-31 20:53:31 +00003825 *
3826 * \par Python:
3827 * Not implemented (yet)
Benny Prijono6dd967c2006-12-26 02:27:14 +00003828 */
3829PJ_DECL(pj_status_t) pjsua_conf_get_signal_level(pjsua_conf_port_id slot,
3830 unsigned *tx_level,
3831 unsigned *rx_level);
3832
Benny Prijono6dd967c2006-12-26 02:27:14 +00003833
Benny Prijonoeebe9af2006-06-13 22:57:13 +00003834/*****************************************************************************
Benny Prijonoa66c3312007-01-21 23:12:40 +00003835 * File player and playlist.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00003836 */
3837
Benny Prijono9fc735d2006-05-28 14:58:12 +00003838/**
Benny Prijonoa66c3312007-01-21 23:12:40 +00003839 * Create a file player, and automatically add this player to
Benny Prijonoeebe9af2006-06-13 22:57:13 +00003840 * the conference bridge.
3841 *
3842 * @param filename The filename to be played. Currently only
Benny Prijono312aff92006-06-17 04:08:30 +00003843 * WAV files are supported, and the WAV file MUST be
3844 * formatted as 16bit PCM mono/single channel (any
3845 * clock rate is supported).
Benny Prijonoeebe9af2006-06-13 22:57:13 +00003846 * @param options Options (currently zero).
Benny Prijonoeebe9af2006-06-13 22:57:13 +00003847 * @param p_id Pointer to receive player ID.
3848 *
3849 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00003850 *
3851 * \par Python:
3852 * The function returns (status, id) tuple:
3853 * \code
3854 status, id = py_pjsua.player_create(filename, options)
3855 * \endcode
Benny Prijono9fc735d2006-05-28 14:58:12 +00003856 */
3857PJ_DECL(pj_status_t) pjsua_player_create(const pj_str_t *filename,
Benny Prijonoeebe9af2006-06-13 22:57:13 +00003858 unsigned options,
Benny Prijonoeebe9af2006-06-13 22:57:13 +00003859 pjsua_player_id *p_id);
Benny Prijono9fc735d2006-05-28 14:58:12 +00003860
3861
3862/**
Benny Prijonoa66c3312007-01-21 23:12:40 +00003863 * Create a file playlist media port, and automatically add the port
3864 * to the conference bridge.
3865 *
3866 * @param file_names Array of file names to be added to the play list.
3867 * Note that the files must have the same clock rate,
3868 * number of channels, and number of bits per sample.
3869 * @param file_count Number of files in the array.
3870 * @param label Optional label to be set for the media port.
3871 * @param options Optional option flag. Application may specify
3872 * PJMEDIA_FILE_NO_LOOP to prevent looping.
3873 * @param p_id Optional pointer to receive player ID.
3874 *
3875 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00003876 *
3877 * \par Python:
3878 * Not implemented yet.
Benny Prijonoa66c3312007-01-21 23:12:40 +00003879 */
3880PJ_DECL(pj_status_t) pjsua_playlist_create(const pj_str_t file_names[],
3881 unsigned file_count,
3882 const pj_str_t *label,
3883 unsigned options,
3884 pjsua_player_id *p_id);
3885
3886/**
3887 * Get conference port ID associated with player or playlist.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00003888 *
3889 * @param id The file player ID.
3890 *
3891 * @return Conference port ID associated with this player.
Benny Prijonoe6ead542007-01-31 20:53:31 +00003892 *
3893 * \par Python:
3894 * \code
3895 port_id = py_pjsua.player_get_conf_port(id)
3896 * \endcode
Benny Prijono9fc735d2006-05-28 14:58:12 +00003897 */
Benny Prijono8b1889b2006-06-06 18:40:40 +00003898PJ_DECL(pjsua_conf_port_id) pjsua_player_get_conf_port(pjsua_player_id id);
Benny Prijono9fc735d2006-05-28 14:58:12 +00003899
3900
3901/**
Benny Prijonoa66c3312007-01-21 23:12:40 +00003902 * Get the media port for the player or playlist.
Benny Prijono469b1522006-12-26 03:05:17 +00003903 *
3904 * @param id The player ID.
3905 * @param p_port The media port associated with the player.
3906 *
3907 * @return PJ_SUCCESS on success.
Benny Prijonoe6ead542007-01-31 20:53:31 +00003908 *
3909 * \par Python:
3910 * Not applicable.
Benny Prijono469b1522006-12-26 03:05:17 +00003911 */
3912PJ_DECL(pj_status_t) pjsua_player_get_port(pjsua_recorder_id id,
3913 pjmedia_port **p_port);
3914
3915/**
Benny Prijonoa66c3312007-01-21 23:12:40 +00003916 * Set playback position. This operation is not valid for playlist.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00003917 *
3918 * @param id The file player ID.
3919 * @param samples The playback position, in samples. Application can
3920 * specify zero to re-start the playback.
3921 *
3922 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00003923 *
3924 * \par Python:
3925 * \code
3926 status = py_pjsua.player_set_pos(id, samples)
3927 * \endcode
Benny Prijono9fc735d2006-05-28 14:58:12 +00003928 */
3929PJ_DECL(pj_status_t) pjsua_player_set_pos(pjsua_player_id id,
3930 pj_uint32_t samples);
3931
3932
3933/**
Benny Prijonoa66c3312007-01-21 23:12:40 +00003934 * Close the file of playlist, remove the player from the bridge, and free
3935 * resources associated with the file player or playlist.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00003936 *
3937 * @param id The file player ID.
3938 *
3939 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00003940 *
3941 * \par Python:
3942 * \code
3943 status = py_pjsua.player_destroy(id)
3944 * \endcode
Benny Prijono9fc735d2006-05-28 14:58:12 +00003945 */
3946PJ_DECL(pj_status_t) pjsua_player_destroy(pjsua_player_id id);
3947
3948
Benny Prijonoeebe9af2006-06-13 22:57:13 +00003949/*****************************************************************************
3950 * File recorder.
3951 */
Benny Prijono9fc735d2006-05-28 14:58:12 +00003952
3953/**
Benny Prijonoeebe9af2006-06-13 22:57:13 +00003954 * Create a file recorder, and automatically connect this recorder to
Benny Prijono8f310522006-10-20 11:08:49 +00003955 * the conference bridge. The recorder currently supports recording WAV file,
3956 * and on Windows, MP3 file. The type of the recorder to use is determined
3957 * by the extension of the file (e.g. ".wav" or ".mp3").
Benny Prijonoeebe9af2006-06-13 22:57:13 +00003958 *
Benny Prijonob3cdb2b2006-10-19 15:49:47 +00003959 * @param filename Output file name. The function will determine the
3960 * default format to be used based on the file extension.
3961 * Currently ".wav" is supported on all platforms, and
3962 * also ".mp3" is support on Windows.
Benny Prijono8f310522006-10-20 11:08:49 +00003963 * @param enc_type Optionally specify the type of encoder to be used to
3964 * compress the media, if the file can support different
3965 * encodings. This value must be zero for now.
3966 * @param enc_param Optionally specify codec specific parameter to be
3967 * passed to the file writer. For .MP3 recorder, this
3968 * can point to pjmedia_mp3_encoder_option structure to
3969 * specify additional settings for the .mp3 recorder.
3970 * For .WAV recorder, this value must be NULL.
3971 * @param max_size Maximum file size. Specify zero or -1 to remove size
3972 * limitation. This value must be zero or -1 for now.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00003973 * @param options Optional options.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00003974 * @param p_id Pointer to receive the recorder instance.
3975 *
3976 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00003977 *
3978 * \par Python:
3979 * \code
3980 status, id = py_pjsua.recorder_create(filename, enc_type, enc_param, max_size, options)
3981 * \endcode
3982 * The \a enc_param is a string in Python.
Benny Prijono9fc735d2006-05-28 14:58:12 +00003983 */
3984PJ_DECL(pj_status_t) pjsua_recorder_create(const pj_str_t *filename,
Benny Prijono8f310522006-10-20 11:08:49 +00003985 unsigned enc_type,
3986 void *enc_param,
Benny Prijonoeebe9af2006-06-13 22:57:13 +00003987 pj_ssize_t max_size,
3988 unsigned options,
Benny Prijonoeebe9af2006-06-13 22:57:13 +00003989 pjsua_recorder_id *p_id);
Benny Prijono9fc735d2006-05-28 14:58:12 +00003990
3991
3992/**
3993 * Get conference port associated with recorder.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00003994 *
3995 * @param id The recorder ID.
3996 *
3997 * @return Conference port ID associated with this recorder.
Benny Prijonoe6ead542007-01-31 20:53:31 +00003998 *
3999 * \par Python:
4000 * \code
4001 port_id = py_pjsua.recorder_get_conf_port(id)
4002 * \endcode
Benny Prijono9fc735d2006-05-28 14:58:12 +00004003 */
Benny Prijono8b1889b2006-06-06 18:40:40 +00004004PJ_DECL(pjsua_conf_port_id) pjsua_recorder_get_conf_port(pjsua_recorder_id id);
Benny Prijono9fc735d2006-05-28 14:58:12 +00004005
4006
4007/**
Benny Prijono469b1522006-12-26 03:05:17 +00004008 * Get the media port for the recorder.
4009 *
4010 * @param id The recorder ID.
4011 * @param p_port The media port associated with the recorder.
4012 *
4013 * @return PJ_SUCCESS on success.
Benny Prijonoe6ead542007-01-31 20:53:31 +00004014 *
4015 * \par Python:
4016 * Not applicable.
Benny Prijono469b1522006-12-26 03:05:17 +00004017 */
4018PJ_DECL(pj_status_t) pjsua_recorder_get_port(pjsua_recorder_id id,
4019 pjmedia_port **p_port);
4020
4021
4022/**
Benny Prijonoeebe9af2006-06-13 22:57:13 +00004023 * Destroy recorder (this will complete recording).
4024 *
4025 * @param id The recorder ID.
4026 *
4027 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00004028 *
4029 * \par Python:
4030 * \code
4031 status = py_pjsua.recorder_destroy(id)
4032 * \endcode
Benny Prijono9fc735d2006-05-28 14:58:12 +00004033 */
4034PJ_DECL(pj_status_t) pjsua_recorder_destroy(pjsua_recorder_id id);
4035
4036
Benny Prijonoeebe9af2006-06-13 22:57:13 +00004037/*****************************************************************************
4038 * Sound devices.
4039 */
4040
Benny Prijono9fc735d2006-05-28 14:58:12 +00004041/**
Benny Prijonob5388cf2007-01-04 22:45:08 +00004042 * Enum all sound devices installed in the system.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00004043 *
4044 * @param info Array of info to be initialized.
4045 * @param count On input, specifies max elements in the array.
4046 * On return, it contains actual number of elements
4047 * that have been initialized.
4048 *
4049 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00004050 *
4051 *
4052 * \par Python:
4053 * The function returns list of sound device info:
4054 * \code
4055 [dev_infos] = py_pjsua.enum_snd_devs()
4056 * \endcode
4057 *
Benny Prijono9fc735d2006-05-28 14:58:12 +00004058 */
Benny Prijonoeebe9af2006-06-13 22:57:13 +00004059PJ_DECL(pj_status_t) pjsua_enum_snd_devs(pjmedia_snd_dev_info info[],
4060 unsigned *count);
Benny Prijono9fc735d2006-05-28 14:58:12 +00004061
4062
Benny Prijonoa3cbb1c2006-08-25 12:41:05 +00004063
4064/**
4065 * Get currently active sound devices. If sound devices has not been created
4066 * (for example when pjsua_start() is not called), it is possible that
4067 * the function returns PJ_SUCCESS with -1 as device IDs.
4068 *
4069 * @param capture_dev On return it will be filled with device ID of the
4070 * capture device.
4071 * @param playback_dev On return it will be filled with device ID of the
4072 * device ID of the playback device.
4073 *
4074 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00004075 *
4076 * \par Python:
Benny Prijonoebdf8772007-02-01 19:25:50 +00004077 * The function takes no argument and return an (integer,integer) tuple:
Benny Prijonoe6ead542007-01-31 20:53:31 +00004078 * \code
4079 capture_dev, playback_dev = py_pjsua.get_snd_dev()
4080 * \endcode
Benny Prijonoa3cbb1c2006-08-25 12:41:05 +00004081 */
4082PJ_DECL(pj_status_t) pjsua_get_snd_dev(int *capture_dev,
4083 int *playback_dev);
4084
4085
Benny Prijono9fc735d2006-05-28 14:58:12 +00004086/**
Benny Prijonoeebe9af2006-06-13 22:57:13 +00004087 * Select or change sound device. Application may call this function at
4088 * any time to replace current sound device.
4089 *
4090 * @param capture_dev Device ID of the capture device.
4091 * @param playback_dev Device ID of the playback device.
4092 *
4093 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00004094 *
4095 * \par Python:
4096 * \code
4097 status = py_pjsua.set_snd_dev(capture_dev, playback_dev)
4098 * \endcode
Benny Prijono9fc735d2006-05-28 14:58:12 +00004099 */
Benny Prijonoeebe9af2006-06-13 22:57:13 +00004100PJ_DECL(pj_status_t) pjsua_set_snd_dev(int capture_dev,
4101 int playback_dev);
4102
4103
4104/**
4105 * Set pjsua to use null sound device. The null sound device only provides
4106 * the timing needed by the conference bridge, and will not interract with
4107 * any hardware.
4108 *
4109 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00004110 *
4111 * \par Python:
4112 * \code
4113 status = py_pjsua.set_null_snd_dev()
4114 * \endcode
Benny Prijonoeebe9af2006-06-13 22:57:13 +00004115 */
4116PJ_DECL(pj_status_t) pjsua_set_null_snd_dev(void);
4117
4118
Benny Prijonoe909eac2006-07-27 22:04:56 +00004119/**
4120 * Disconnect the main conference bridge from any sound devices, and let
4121 * application connect the bridge to it's own sound device/master port.
4122 *
4123 * @return The port interface of the conference bridge,
4124 * so that application can connect this to it's own
4125 * sound device or master port.
Benny Prijonoe6ead542007-01-31 20:53:31 +00004126 *
4127 * \par Python:
4128 * Not applicable (for now).
Benny Prijonoe909eac2006-07-27 22:04:56 +00004129 */
4130PJ_DECL(pjmedia_port*) pjsua_set_no_snd_dev(void);
4131
4132
Benny Prijonof20687a2006-08-04 18:27:19 +00004133/**
Benny Prijono22dfe592006-08-06 12:07:13 +00004134 * Configure the echo canceller tail length of the sound port.
Benny Prijonof20687a2006-08-04 18:27:19 +00004135 *
4136 * @param tail_ms The tail length, in miliseconds. Set to zero to
4137 * disable AEC.
Benny Prijono5da50432006-08-07 10:24:52 +00004138 * @param options Options to be passed to #pjmedia_echo_create().
4139 * Normally the value should be zero.
Benny Prijonof20687a2006-08-04 18:27:19 +00004140 *
4141 * @return PJ_SUCCESS on success.
Benny Prijonoe6ead542007-01-31 20:53:31 +00004142 *
4143 * \par Python:
4144 * \code
4145 status = py_pjsua.set_ec(tail_ms, options)
4146 * \endcode
Benny Prijonof20687a2006-08-04 18:27:19 +00004147 */
Benny Prijono5da50432006-08-07 10:24:52 +00004148PJ_DECL(pj_status_t) pjsua_set_ec(unsigned tail_ms, unsigned options);
Benny Prijonof20687a2006-08-04 18:27:19 +00004149
4150
4151/**
Benny Prijono22dfe592006-08-06 12:07:13 +00004152 * Get current echo canceller tail length.
Benny Prijonof20687a2006-08-04 18:27:19 +00004153 *
4154 * @param p_tail_ms Pointer to receive the tail length, in miliseconds.
4155 * If AEC is disabled, the value will be zero.
4156 *
4157 * @return PJ_SUCCESS on success.
Benny Prijonoe6ead542007-01-31 20:53:31 +00004158 *
4159 * \par Python:
4160 * \code
4161 tail_ms = py_pjsua.get_ec_tail()
4162 * \endcode
Benny Prijonof20687a2006-08-04 18:27:19 +00004163 */
Benny Prijono22dfe592006-08-06 12:07:13 +00004164PJ_DECL(pj_status_t) pjsua_get_ec_tail(unsigned *p_tail_ms);
Benny Prijonof20687a2006-08-04 18:27:19 +00004165
4166
4167
Benny Prijonoeebe9af2006-06-13 22:57:13 +00004168/*****************************************************************************
4169 * Codecs.
4170 */
4171
4172/**
4173 * Enum all supported codecs in the system.
4174 *
4175 * @param id Array of ID to be initialized.
4176 * @param count On input, specifies max elements in the array.
4177 * On return, it contains actual number of elements
4178 * that have been initialized.
4179 *
4180 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00004181 *
4182 * \par Python:
4183 * This function takes no argument and returns list of codec infos:
4184 * \code
4185 [codec_info] = py_pjsua.enum_codecs()
4186 * \endcode
Benny Prijonoeebe9af2006-06-13 22:57:13 +00004187 */
4188PJ_DECL(pj_status_t) pjsua_enum_codecs( pjsua_codec_info id[],
4189 unsigned *count );
4190
4191
4192/**
4193 * Change codec priority.
4194 *
Benny Prijonoe6ead542007-01-31 20:53:31 +00004195 * @param codec_id Codec ID, which is a string that uniquely identify
4196 * the codec (such as "speex/8000"). Please see pjsua
4197 * manual or pjmedia codec reference for details.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00004198 * @param priority Codec priority, 0-255, where zero means to disable
4199 * the codec.
4200 *
4201 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00004202 *
4203 * \par Python:
4204 * \code
4205 status = py_pjsua.codec_set_priority(codec_id, priority)
4206 * \endcode
Benny Prijonoeebe9af2006-06-13 22:57:13 +00004207 */
Benny Prijonoe6ead542007-01-31 20:53:31 +00004208PJ_DECL(pj_status_t) pjsua_codec_set_priority( const pj_str_t *codec_id,
Benny Prijonoeebe9af2006-06-13 22:57:13 +00004209 pj_uint8_t priority );
4210
4211
4212/**
4213 * Get codec parameters.
4214 *
Benny Prijonoe6ead542007-01-31 20:53:31 +00004215 * @param codec_id Codec ID.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00004216 * @param param Structure to receive codec parameters.
4217 *
4218 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00004219 *
4220 * \par Python:
4221 * The Python function is experimental:
4222 * \code
4223 codec_param = py_pjsua.codec_get_param(codec_id)
4224 * \endcode
Benny Prijonoeebe9af2006-06-13 22:57:13 +00004225 */
Benny Prijonoe6ead542007-01-31 20:53:31 +00004226PJ_DECL(pj_status_t) pjsua_codec_get_param( const pj_str_t *codec_id,
Benny Prijonoeebe9af2006-06-13 22:57:13 +00004227 pjmedia_codec_param *param );
4228
4229
4230/**
4231 * Set codec parameters.
4232 *
Benny Prijonoe6ead542007-01-31 20:53:31 +00004233 * @param codec_id Codec ID.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00004234 * @param param Codec parameter to set.
4235 *
4236 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00004237 *
4238 * \par Python:
4239 * The Python function is experimental:
4240 * \code
4241 status = py_pjsua.codec_set_param(codec_id, param)
4242 * \endcode
4243
Benny Prijonoeebe9af2006-06-13 22:57:13 +00004244 */
Benny Prijonoe6ead542007-01-31 20:53:31 +00004245PJ_DECL(pj_status_t) pjsua_codec_set_param( const pj_str_t *codec_id,
Benny Prijonoeebe9af2006-06-13 22:57:13 +00004246 const pjmedia_codec_param *param);
4247
4248
4249
Benny Prijono9fc735d2006-05-28 14:58:12 +00004250
Benny Prijono312aff92006-06-17 04:08:30 +00004251/**
4252 * Create UDP media transports for all the calls. This function creates
4253 * one UDP media transport for each call.
Benny Prijonof3195072006-02-14 21:15:30 +00004254 *
Benny Prijono312aff92006-06-17 04:08:30 +00004255 * @param cfg Media transport configuration. The "port" field in the
4256 * configuration is used as the start port to bind the
4257 * sockets.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00004258 *
4259 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00004260 *
4261 * \par Python:
4262 * Not implemented yet.
Benny Prijonof3195072006-02-14 21:15:30 +00004263 */
Benny Prijono312aff92006-06-17 04:08:30 +00004264PJ_DECL(pj_status_t)
4265pjsua_media_transports_create(const pjsua_transport_config *cfg);
Benny Prijonof3195072006-02-14 21:15:30 +00004266
Benny Prijonodc39fe82006-05-26 12:17:46 +00004267
4268/**
Benny Prijono312aff92006-06-17 04:08:30 +00004269 * Register custom media transports to be used by calls. There must
4270 * enough media transports for all calls.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00004271 *
Benny Prijono312aff92006-06-17 04:08:30 +00004272 * @param tp The media transport array.
4273 * @param count Number of elements in the array. This number MUST
4274 * match the number of maximum calls configured when
4275 * pjsua is created.
4276 * @param auto_delete Flag to indicate whether the transports should be
4277 * destroyed when pjsua is shutdown.
4278 *
4279 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00004280 *
4281 * \par Python:
4282 * Note applicable.
Benny Prijonodc39fe82006-05-26 12:17:46 +00004283 */
Benny Prijono312aff92006-06-17 04:08:30 +00004284PJ_DECL(pj_status_t)
4285pjsua_media_transports_attach( pjsua_media_transport tp[],
4286 unsigned count,
4287 pj_bool_t auto_delete);
Benny Prijonodc39fe82006-05-26 12:17:46 +00004288
4289
Benny Prijono312aff92006-06-17 04:08:30 +00004290/**
4291 * @}
4292 */
4293
Benny Prijonof3195072006-02-14 21:15:30 +00004294
Benny Prijono268ca612006-02-07 12:34:11 +00004295
Benny Prijono312aff92006-06-17 04:08:30 +00004296/**
4297 * @}
4298 */
4299
Benny Prijonoe6ead542007-01-31 20:53:31 +00004300PJ_END_DECL
4301
Benny Prijono312aff92006-06-17 04:08:30 +00004302
Benny Prijono268ca612006-02-07 12:34:11 +00004303#endif /* __PJSUA_H__ */