blob: cbda0587cb963d4f6acf1d306c2a1a4d60d566b6 [file] [log] [blame]
Benny Prijono268ca612006-02-07 12:34:11 +00001/* $Id$ */
2/*
Benny Prijono32177c02008-06-20 22:44:47 +00003 * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
Benny Prijono268ca612006-02-07 12:34:11 +00004 *
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 Prijono4ab9fbb2007-10-12 12:14:27 +000043/* Include all PJNATH headers */
44#include <pjnath.h>
45
Benny Prijono268ca612006-02-07 12:34:11 +000046/* Include all PJLIB-UTIL headers. */
47#include <pjlib-util.h>
48
49/* Include all PJLIB headers. */
50#include <pjlib.h>
51
52
Benny Prijonoe6ead542007-01-31 20:53:31 +000053PJ_BEGIN_DECL
54
55
Benny Prijono312aff92006-06-17 04:08:30 +000056/**
Benny Prijonoe6ead542007-01-31 20:53:31 +000057 * @defgroup PJSUA_LIB PJSUA API - High Level Softphone API for C/C++ and Python
Benny Prijono312aff92006-06-17 04:08:30 +000058 * @brief Very high level API for constructing SIP UA applications.
59 * @{
60 *
Benny Prijonoe6ead542007-01-31 20:53:31 +000061 * @section pjsua_api_intro A SIP User Agent API for C/C++ and Python
62 *
63 * PJSUA API is very high level API, available for C/C++ and Python language,
64 * for constructing SIP multimedia user agent
Benny Prijono312aff92006-06-17 04:08:30 +000065 * applications. It wraps together the signaling and media functionalities
66 * into an easy to use call API, provides account management, buddy
67 * management, presence, instant messaging, along with multimedia
68 * features such as conferencing, file streaming, local playback,
69 * voice recording, and so on.
70 *
Benny Prijonoe6ead542007-01-31 20:53:31 +000071 * @subsection pjsua_for_c_cpp C/C++ Binding
Benny Prijono312aff92006-06-17 04:08:30 +000072 * Application must link with <b>pjsua-lib</b> to use this API. In addition,
73 * this library depends on the following libraries:
74 * - <b>pjsip-ua</b>,
75 * - <b>pjsip-simple</b>,
76 * - <b>pjsip-core</b>,
77 * - <b>pjmedia</b>,
78 * - <b>pjmedia-codec</b>,
79 * - <b>pjlib-util</b>, and
80 * - <b>pjlib</b>,
81 *
Benny Prijonoe6ead542007-01-31 20:53:31 +000082 * so application must also link with these libraries as well. For more
83 * information, please refer to
84 * <A HREF="http://www.pjsip.org/using.htm">Getting Started with PJSIP</A>
85 * page.
Benny Prijono312aff92006-06-17 04:08:30 +000086 *
Benny Prijonoe6ead542007-01-31 20:53:31 +000087 * @subsection pjsua_for_python Python Binding
88 *
89 * The Python binding for PJSUA-API is implemented by <b>py_pjsua</b>
90 * module, in <tt>pjsip-apps/py_pjsua</tt> directory. This module is
91 * built by building <tt>py_pjsua</tt> project in <tt>pjsip_apps</tt>
92 * Visual Studio workspace, or by invoking the usual <tt>setup.py</tt>
93 * Python installer script.
94 *
95 * The Python script then can import the PJSUA-API Python module by
96 * using <b>import py_pjsua</b> construct as usual.
97 *
98 *
99 * @section pjsua_samples
100 *
101 * Few samples are provided both in C and Python.
102 *
103 - @ref page_pjsip_sample_simple_pjsuaua_c\n
104 Very simple SIP User Agent with registration, call, and media, using
105 PJSUA-API, all in under 200 lines of code.
106
107 - @ref page_pjsip_samples_pjsua\n
108 This is the reference implementation for PJSIP and PJMEDIA.
109 PJSUA is a console based application, designed to be simple enough
110 to be readble, but powerful enough to demonstrate all features
111 available in PJSIP and PJMEDIA.\n
112
113 - Python sample\n
114 For a real simple Python sample application, have a look at
115 <A HREF="http://www.pjsip.org/trac/browser/pjproject/trunk/pjsip-apps/src/py_pjsua/pjsua_app.py">
116 <tt>pjsip-apps/src/py_pjsua/pjsua_app.py</tt></A> file.
117
Benny Prijono312aff92006-06-17 04:08:30 +0000118 * @section root_using_pjsua_lib Using PJSUA API
119 *
Benny Prijonoe6ead542007-01-31 20:53:31 +0000120 * Please refer to @ref PJSUA_LIB_BASE on how to create and initialize the API.
121 * And then see the Modules on the bottom of this page for more information
122 * about specific subject.
Benny Prijono312aff92006-06-17 04:08:30 +0000123 */
124
Benny Prijonoa91a0032006-02-26 21:23:45 +0000125
Benny Prijonof3195072006-02-14 21:15:30 +0000126
Benny Prijono312aff92006-06-17 04:08:30 +0000127/*****************************************************************************
128 * BASE API
129 */
130
Benny Prijonof04ffdd2006-02-21 00:11:18 +0000131/**
Benny Prijonoe6ead542007-01-31 20:53:31 +0000132 * @defgroup PJSUA_LIB_BASE PJSUA-API Basic API
Benny Prijono312aff92006-06-17 04:08:30 +0000133 * @ingroup PJSUA_LIB
134 * @brief Basic application creation/initialization, logging configuration, etc.
135 * @{
136 *
137 * The base PJSUA API controls PJSUA creation, initialization, and startup, and
138 * also provides various auxiliary functions.
139 *
140 * @section using_pjsua_lib Using PJSUA Library
141 *
142 * @subsection creating_pjsua_lib Creating PJSUA
143 *
Benny Prijonoe6ead542007-01-31 20:53:31 +0000144 * Before anything else, application must create PJSUA by calling #pjsua_create()
145 * (or <tt>py_pjsua.create()</tt> from Python).
Benny Prijono312aff92006-06-17 04:08:30 +0000146 * This, among other things, will initialize PJLIB, which is crucial before
Benny Prijonoe6ead542007-01-31 20:53:31 +0000147 * any PJLIB functions can be called, PJLIB-UTIL, and create a SIP endpoint.
148 *
149 * After this function is called, application can create a memory pool (with
150 * #pjsua_pool_create()) and read configurations from command line or file to
151 * build the settings to initialize PJSUA below.
Benny Prijono312aff92006-06-17 04:08:30 +0000152 *
153 * @subsection init_pjsua_lib Initializing PJSUA
154 *
155 * After PJSUA is created, application can initialize PJSUA by calling
Benny Prijonoe6ead542007-01-31 20:53:31 +0000156 * #pjsua_init(). This function takes several optional configuration settings
157 * in the argument, if application wants to set them.
Benny Prijono312aff92006-06-17 04:08:30 +0000158 *
Benny Prijonoe6ead542007-01-31 20:53:31 +0000159 * @subsubsection init_pjsua_lib_c_cpp PJSUA-LIB Initialization (in C)
160 * Sample code to initialize PJSUA in C code:
Benny Prijono312aff92006-06-17 04:08:30 +0000161 \code
162
Benny Prijonob5388cf2007-01-04 22:45:08 +0000163 #include <pjsua-lib/pjsua.h>
164
165 #define THIS_FILE __FILE__
166
167 static pj_status_t app_init(void)
168 {
Benny Prijono312aff92006-06-17 04:08:30 +0000169 pjsua_config ua_cfg;
170 pjsua_logging_config log_cfg;
171 pjsua_media_config media_cfg;
Benny Prijonob5388cf2007-01-04 22:45:08 +0000172 pj_status_t status;
173
174 // Must create pjsua before anything else!
175 status = pjsua_create();
176 if (status != PJ_SUCCESS) {
177 pjsua_perror(THIS_FILE, "Error initializing pjsua", status);
178 return status;
179 }
Benny Prijono312aff92006-06-17 04:08:30 +0000180
181 // Initialize configs with default settings.
182 pjsua_config_default(&ua_cfg);
183 pjsua_logging_config_default(&log_cfg);
184 pjsua_media_config_default(&media_cfg);
185
186 // At the very least, application would want to override
187 // the call callbacks in pjsua_config:
188 ua_cfg.cb.on_incoming_call = ...
189 ua_cfg.cb.on_call_state = ..
190 ...
191
192 // Customize other settings (or initialize them from application specific
193 // configuration file):
194 ...
195
196 // Initialize pjsua
197 status = pjsua_init(&ua_cfg, &log_cfg, &media_cfg);
198 if (status != PJ_SUCCESS) {
199 pjsua_perror(THIS_FILE, "Error initializing pjsua", status);
200 return status;
201 }
Benny Prijonob5388cf2007-01-04 22:45:08 +0000202 .
203 ...
204 }
Benny Prijono312aff92006-06-17 04:08:30 +0000205 \endcode
206 *
Benny Prijonoe6ead542007-01-31 20:53:31 +0000207 *
208 * @subsubsection init_pjsua_lib_python PJSUA-LIB Initialization (in Python)
209 * Sample code to initialize PJSUA in Python code:
210
211 \code
212
213import py_pjsua
214
215#
216# Initialize pjsua.
217#
218def app_init():
219 # Create pjsua before anything else
220 status = py_pjsua.create()
221 if status != 0:
222 err_exit("pjsua create() error", status)
223
224 # We use default logging config for this sample
225 log_cfg = py_pjsua.logging_config_default()
226
227 # Create and initialize pjsua config
228 # Note: for this Python module, thread_cnt must be 0 since Python
229 # doesn't like to be called from alien thread (pjsua's thread
230 # in this case)
231 ua_cfg = py_pjsua.config_default()
232 ua_cfg.thread_cnt = 0
233 ua_cfg.user_agent = "PJSUA/Python 0.1"
234
235 # Override callbacks. At the very least application would want to
236 # override the call callbacks in pjsua_config
237 ua_cfg.cb.on_incoming_call = ...
238 ua_cfg.cb.on_call_state = ...
239
240 # Use default media config for this cample
241 med_cfg = py_pjsua.media_config_default()
242
243 #
244 # Initialize pjsua!!
245 #
246 status = py_pjsua.init(ua_cfg, log_cfg, med_cfg)
247 if status != 0:
248 err_exit("pjsua init() error", status)
249
250
251
252# Utility: display PJ error and exit
253#
254def err_exit(title, rc):
255 py_pjsua.perror(THIS_FILE, title, rc)
256 exit(1)
257
258 \endcode
259
260
Benny Prijono312aff92006-06-17 04:08:30 +0000261 * @subsection other_init_pjsua_lib Other Initialization
262 *
263 * After PJSUA is initialized with #pjsua_init(), application will normally
264 * need/want to perform the following tasks:
265 *
Benny Prijonoe6ead542007-01-31 20:53:31 +0000266 * - create SIP transport with #pjsua_transport_create(). Application would
267 * to call #pjsua_transport_create() for each transport types that it
268 * wants to support (for example, UDP, TCP, and TLS). Please see
Benny Prijono312aff92006-06-17 04:08:30 +0000269 * @ref PJSUA_LIB_TRANSPORT section for more info.
270 * - create one or more SIP accounts with #pjsua_acc_add() or
Benny Prijonoe6ead542007-01-31 20:53:31 +0000271 * #pjsua_acc_add_local(). The SIP account is used for registering with
272 * the SIP server, if any. Please see @ref PJSUA_LIB_ACC for more info.
Benny Prijono312aff92006-06-17 04:08:30 +0000273 * - add one or more buddies with #pjsua_buddy_add(). Please see
274 * @ref PJSUA_LIB_BUDDY section for more info.
275 * - optionally configure the sound device, codec settings, and other
276 * media settings. Please see @ref PJSUA_LIB_MEDIA for more info.
277 *
278 *
279 * @subsection starting_pjsua_lib Starting PJSUA
280 *
281 * After all initializations have been done, application must call
282 * #pjsua_start() to start PJSUA. This function will check that all settings
Benny Prijonoe6ead542007-01-31 20:53:31 +0000283 * have been properly configured, and apply default settings when they haven't,
284 * or report error status when it is unable to recover from missing settings.
Benny Prijono312aff92006-06-17 04:08:30 +0000285 *
286 * Most settings can be changed during run-time. For example, application
287 * may add, modify, or delete accounts, buddies, or change media settings
288 * during run-time.
Benny Prijonob5388cf2007-01-04 22:45:08 +0000289 *
Benny Prijonoe6ead542007-01-31 20:53:31 +0000290 * @subsubsection starting_pjsua_lib_c C Example for Starting PJSUA
Benny Prijonob5388cf2007-01-04 22:45:08 +0000291 * Sample code:
292 \code
293 static pj_status_t app_run(void)
294 {
295 pj_status_t status;
296
297 // Start pjsua
298 status = pjsua_start();
299 if (status != PJ_SUCCESS) {
300 pjsua_destroy();
301 pjsua_perror(THIS_FILE, "Error starting pjsua", status);
302 return status;
303 }
304
305 // Run application loop
306 while (1) {
307 char choice[10];
308
309 printf("Select menu: ");
310 fgets(choice, sizeof(choice), stdin);
311 ...
312 }
313 }
314 \endcode
Benny Prijonoe6ead542007-01-31 20:53:31 +0000315
316 * @subsubsection starting_pjsua_lib_python Python Example for starting PJSUA
317 * For Python, starting PJSUA-LIB takes one more step, that is to initialize
318 * Python worker thread to poll PJSUA-LIB. This step is necessary because
319 * Python doesn't like it when it is called by an "alien" thread (that is,
320 * thread that is not created using Python API).
321 *
322 * Because of this, we cannot use a worker thread in PJSUA-LIB, because then
323 * the Python callback will be called by an "alien" thread and this would
324 * crash Python (or raise assert() probably).
325 *
326 * So because worker thread is disabled, we need to create a worker thread
327 * in Python. Note that this may not be necessary if we're creating a
328 * GUI application, because then we can attach, for example, a GUI timer
329 * object to poll the PJSUA-LIB. But because we're creating a console
330 * application which will block at <tt>sys.stdin.readline()</tt>, we need
331 * to have a worker thread to poll PJSUA-LIB.
332
333 \code
334
335import thread
336
337C_QUIT = 0
338
339
340def app_start():
341 # Done with initialization, start pjsua!!
342 #
343 status = py_pjsua.start()
344 if status != 0:
345 py_pjsua.destroy()
346 err_exit("Error starting pjsua!", status)
347
348 # Start worker thread
349 thr = thread.start_new(worker_thread_main, (0,))
350
351 print "PJSUA Started!!"
352
353#
354# Worker thread function.
355# Python doesn't like it when it's called from an alien thread
356# (pjsua's worker thread, in this case), so for Python we must
357# disable worker thread in pjsua and poll pjsua from Python instead.
358#
359def worker_thread_main(arg):
360 global C_QUIT
361 thread_desc = 0
362 status = py_pjsua.thread_register("python worker", thread_desc)
363 if status != 0:
364 py_pjsua.perror(THIS_FILE, "Error registering thread", status)
365 else:
366 while C_QUIT == 0:
367 py_pjsua.handle_events(50)
368 print "Worker thread quitting.."
369 C_QUIT = 2
370
371
372 \endcode
Benny Prijonof04ffdd2006-02-21 00:11:18 +0000373 */
Benny Prijonoeebe9af2006-06-13 22:57:13 +0000374
Benny Prijono312aff92006-06-17 04:08:30 +0000375/** Constant to identify invalid ID for all sorts of IDs. */
376#define PJSUA_INVALID_ID (-1)
Benny Prijonoeebe9af2006-06-13 22:57:13 +0000377
378/** Call identification */
379typedef int pjsua_call_id;
380
Benny Prijono312aff92006-06-17 04:08:30 +0000381/** Account identification */
382typedef int pjsua_acc_id;
Benny Prijonoeebe9af2006-06-13 22:57:13 +0000383
384/** Buddy identification */
Benny Prijono8b1889b2006-06-06 18:40:40 +0000385typedef int pjsua_buddy_id;
Benny Prijonoeebe9af2006-06-13 22:57:13 +0000386
387/** File player identification */
Benny Prijono8b1889b2006-06-06 18:40:40 +0000388typedef int pjsua_player_id;
Benny Prijonoeebe9af2006-06-13 22:57:13 +0000389
390/** File recorder identification */
Benny Prijono8b1889b2006-06-06 18:40:40 +0000391typedef int pjsua_recorder_id;
Benny Prijonoeebe9af2006-06-13 22:57:13 +0000392
393/** Conference port identification */
Benny Prijono8b1889b2006-06-06 18:40:40 +0000394typedef int pjsua_conf_port_id;
395
396
Benny Prijonoeebe9af2006-06-13 22:57:13 +0000397
Benny Prijonoa91a0032006-02-26 21:23:45 +0000398/**
Benny Prijono312aff92006-06-17 04:08:30 +0000399 * Maximum proxies in account.
Benny Prijonodc39fe82006-05-26 12:17:46 +0000400 */
Benny Prijono312aff92006-06-17 04:08:30 +0000401#ifndef PJSUA_ACC_MAX_PROXIES
402# define PJSUA_ACC_MAX_PROXIES 8
403#endif
Benny Prijonoeebe9af2006-06-13 22:57:13 +0000404
Benny Prijonod8179652008-01-23 20:39:07 +0000405#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0)
Benny Prijonoeebe9af2006-06-13 22:57:13 +0000406
Benny Prijonod8179652008-01-23 20:39:07 +0000407/**
408 * Default value of SRTP mode usage. Valid values are PJMEDIA_SRTP_DISABLED,
409 * PJMEDIA_SRTP_OPTIONAL, and PJMEDIA_SRTP_MANDATORY.
410 */
411#ifndef PJSUA_DEFAULT_USE_SRTP
412 #define PJSUA_DEFAULT_USE_SRTP PJMEDIA_SRTP_DISABLED
413#endif
414
415/**
416 * Default value of secure signaling requirement for SRTP.
417 * Valid values are:
418 * 0: SRTP does not require secure signaling
419 * 1: SRTP requires secure transport such as TLS
420 * 2: SRTP requires secure end-to-end transport (SIPS)
421 */
422#ifndef PJSUA_DEFAULT_SRTP_SECURE_SIGNALING
423 #define PJSUA_DEFAULT_SRTP_SECURE_SIGNALING 1
424#endif
425
426#endif
Benny Prijonoeebe9af2006-06-13 22:57:13 +0000427
428/**
Benny Prijonob5388cf2007-01-04 22:45:08 +0000429 * Logging configuration, which can be (optionally) specified when calling
430 * #pjsua_init(). Application must call #pjsua_logging_config_default() to
431 * initialize this structure with the default values.
Benny Prijonoe6ead542007-01-31 20:53:31 +0000432 *
433 * \par Sample Python Syntax:
434 * \code
435 # Python type: py_pjsua.Logging_Config
436
437 log_cfg = py_pjsua.logging_config_default()
438 log_cfg.level = 4
439 * \endcode
Benny Prijonoeebe9af2006-06-13 22:57:13 +0000440 */
441typedef struct pjsua_logging_config
442{
443 /**
444 * Log incoming and outgoing SIP message? Yes!
445 */
446 pj_bool_t msg_logging;
447
448 /**
449 * Input verbosity level. Value 5 is reasonable.
450 */
451 unsigned level;
452
453 /**
454 * Verbosity level for console. Value 4 is reasonable.
455 */
456 unsigned console_level;
457
458 /**
459 * Log decoration.
460 */
461 unsigned decor;
462
463 /**
464 * Optional log filename.
465 */
466 pj_str_t log_filename;
467
468 /**
469 * Optional callback function to be called to write log to
470 * application specific device. This function will be called for
471 * log messages on input verbosity level.
Benny Prijonoe6ead542007-01-31 20:53:31 +0000472 *
473 * \par Sample Python Syntax:
474 * \code
475 # level: integer
476 # data: string
477 # len: integer
478
479 def cb(level, data, len):
480 print data,
481 * \endcode
Benny Prijonoeebe9af2006-06-13 22:57:13 +0000482 */
Benny Prijonofe7d87b2007-11-29 11:35:44 +0000483 void (*cb)(int level, const char *data, int len);
Benny Prijonoeebe9af2006-06-13 22:57:13 +0000484
485
486} pjsua_logging_config;
487
488
489/**
490 * Use this function to initialize logging config.
491 *
492 * @param cfg The logging config to be initialized.
Benny Prijonoe6ead542007-01-31 20:53:31 +0000493 *
494 * \par Python Syntax:
495 * The Python function instantiates and initialize the logging config:
496 * \code
497 logging_cfg = py_pjsua.logging_config_default()
498 * \endcode
Benny Prijonoeebe9af2006-06-13 22:57:13 +0000499 */
Benny Prijono1f61a8f2007-08-16 10:11:44 +0000500PJ_DECL(void) pjsua_logging_config_default(pjsua_logging_config *cfg);
Benny Prijonoeebe9af2006-06-13 22:57:13 +0000501
Benny Prijonoeebe9af2006-06-13 22:57:13 +0000502
503/**
504 * Use this function to duplicate logging config.
505 *
506 * @param pool Pool to use.
507 * @param dst Destination config.
508 * @param src Source config.
Benny Prijonoe6ead542007-01-31 20:53:31 +0000509 *
510 * \par Python Syntax:
511 * Not available (for now). Ideally we should be able to just assign
512 * one config to another, but this has not been tested.
Benny Prijonoeebe9af2006-06-13 22:57:13 +0000513 */
Benny Prijono1f61a8f2007-08-16 10:11:44 +0000514PJ_DECL(void) pjsua_logging_config_dup(pj_pool_t *pool,
515 pjsua_logging_config *dst,
516 const pjsua_logging_config *src);
Benny Prijonoeebe9af2006-06-13 22:57:13 +0000517
Benny Prijonodc39fe82006-05-26 12:17:46 +0000518
519/**
Benny Prijonob5388cf2007-01-04 22:45:08 +0000520 * This structure describes application callback to receive various event
521 * notification from PJSUA-API. All of these callbacks are OPTIONAL,
522 * although definitely application would want to implement some of
523 * the important callbacks (such as \a on_incoming_call).
Benny Prijonoe6ead542007-01-31 20:53:31 +0000524 *
525 * \par Python Syntax:
526 * This callback structure is embedded on pjsua_config structure.
Benny Prijonodc39fe82006-05-26 12:17:46 +0000527 */
Benny Prijonoeebe9af2006-06-13 22:57:13 +0000528typedef struct pjsua_callback
Benny Prijonodc39fe82006-05-26 12:17:46 +0000529{
530 /**
Benny Prijono9fc735d2006-05-28 14:58:12 +0000531 * Notify application when invite state has changed.
532 * Application may then query the call info to get the
Benny Prijonoe6ead542007-01-31 20:53:31 +0000533 * detail call states by calling pjsua_call_get_info() function.
Benny Prijono0875ae82006-12-26 00:11:48 +0000534 *
535 * @param call_id The call index.
536 * @param e Event which causes the call state to change.
Benny Prijonoe6ead542007-01-31 20:53:31 +0000537 *
538 * \par Python Syntax:
539 * \code
540 # call_id: integer
541 # e: an opaque object
542
543 def on_call_state(call_id, e):
544 return
545 * \endcode
Benny Prijonodc39fe82006-05-26 12:17:46 +0000546 */
Benny Prijonoeebe9af2006-06-13 22:57:13 +0000547 void (*on_call_state)(pjsua_call_id call_id, pjsip_event *e);
Benny Prijonodc39fe82006-05-26 12:17:46 +0000548
549 /**
Benny Prijono8b1889b2006-06-06 18:40:40 +0000550 * Notify application on incoming call.
Benny Prijono0875ae82006-12-26 00:11:48 +0000551 *
552 * @param acc_id The account which match the incoming call.
553 * @param call_id The call id that has just been created for
554 * the call.
555 * @param rdata The incoming INVITE request.
Benny Prijonoe6ead542007-01-31 20:53:31 +0000556 *
557 * \par Python Syntax:
558 * \code
559 # acc_id: integer
560 # call_id: integer
561 # rdata: an opaque object
562
563 def on_incoming_call(acc_id, call_id, rdata):
564 return
565 * \endcode
Benny Prijono8b1889b2006-06-06 18:40:40 +0000566 */
Benny Prijonoeebe9af2006-06-13 22:57:13 +0000567 void (*on_incoming_call)(pjsua_acc_id acc_id, pjsua_call_id call_id,
Benny Prijono8b1889b2006-06-06 18:40:40 +0000568 pjsip_rx_data *rdata);
569
570 /**
Benny Prijonofeb69f42007-10-05 09:12:26 +0000571 * This is a general notification callback which is called whenever
572 * a transaction within the call has changed state. Application can
573 * implement this callback for example to monitor the state of
574 * outgoing requests, or to answer unhandled incoming requests
575 * (such as INFO) with a final response.
576 *
577 * @param call_id Call identification.
578 * @param tsx The transaction which has changed state.
579 * @param e Transaction event that caused the state change.
580 */
581 void (*on_call_tsx_state)(pjsua_call_id call_id,
582 pjsip_transaction *tsx,
583 pjsip_event *e);
584
585 /**
Benny Prijonoeebe9af2006-06-13 22:57:13 +0000586 * Notify application when media state in the call has changed.
587 * Normal application would need to implement this callback, e.g.
Benny Prijono6ba8c542007-10-16 01:34:14 +0000588 * to connect the call's media to sound device. When ICE is used,
589 * this callback will also be called to report ICE negotiation
590 * failure.
Benny Prijono0875ae82006-12-26 00:11:48 +0000591 *
592 * @param call_id The call index.
Benny Prijonoe6ead542007-01-31 20:53:31 +0000593 *
594 * \par Python Syntax:
595 * \code
596 # call_id: integer
597
598 def on_call_media_state(call_id):
599 return
600 * \endcode
Benny Prijonoeebe9af2006-06-13 22:57:13 +0000601 */
602 void (*on_call_media_state)(pjsua_call_id call_id);
603
Benny Prijonofc13bf62008-02-20 08:56:15 +0000604
605 /**
606 * Notify application when media session is created and before it is
607 * registered to the conference bridge. Application may return different
608 * media port if it has added media processing port to the stream. This
609 * media port then will be added to the conference bridge instead.
610 *
611 * @param call_id Call identification.
612 * @param sess Media session for the call.
613 * @param stream_idx Stream index in the media session.
614 * @param p_port On input, it specifies the media port of the
615 * stream. Application may modify this pointer to
616 * point to different media port to be registered
617 * to the conference bridge.
618 *
619 * \par Python:
620 * Not applicable.
621 */
622 void (*on_stream_created)(pjsua_call_id call_id,
623 pjmedia_session *sess,
624 unsigned stream_idx,
625 pjmedia_port **p_port);
626
627 /**
628 * Notify application when media session has been unregistered from the
629 * conference bridge and about to be destroyed.
630 *
631 * @param call_id Call identification.
632 * @param sess Media session for the call.
633 * @param stream_idx Stream index in the media session.
634 *
635 * \par Python:
636 * Not applicable.
637 */
638 void (*on_stream_destroyed)(pjsua_call_id call_id,
639 pjmedia_session *sess,
640 unsigned stream_idx);
641
Benny Prijonoeebe9af2006-06-13 22:57:13 +0000642 /**
Benny Prijono0875ae82006-12-26 00:11:48 +0000643 * Notify application upon incoming DTMF digits.
644 *
645 * @param call_id The call index.
646 * @param digit DTMF ASCII digit.
Benny Prijonoe6ead542007-01-31 20:53:31 +0000647 *
648 * \par Python Syntax:
649 * \code
650 # call_id: integer
Benny Prijono1f63cc42007-09-10 16:54:22 +0000651 # digit: digit string
Benny Prijonoe6ead542007-01-31 20:53:31 +0000652
653 def on_dtmf_digit(call_id, digit):
654 return
655 * \endcode
Benny Prijono0875ae82006-12-26 00:11:48 +0000656 */
657 void (*on_dtmf_digit)(pjsua_call_id call_id, int digit);
658
659 /**
Benny Prijonob5388cf2007-01-04 22:45:08 +0000660 * Notify application on call being transfered (i.e. REFER is received).
Benny Prijono9fc735d2006-05-28 14:58:12 +0000661 * Application can decide to accept/reject transfer request
Benny Prijonoc54dcb32008-04-08 23:33:15 +0000662 * by setting the code (default is 202). When this callback
Benny Prijono9fc735d2006-05-28 14:58:12 +0000663 * is not defined, the default behavior is to accept the
664 * transfer.
Benny Prijono0875ae82006-12-26 00:11:48 +0000665 *
666 * @param call_id The call index.
667 * @param dst The destination where the call will be
668 * transfered to.
669 * @param code Status code to be returned for the call transfer
670 * request. On input, it contains status code 200.
Benny Prijonoe6ead542007-01-31 20:53:31 +0000671 *
672 * \par Python Syntax:
673 * \code
674 # call_id: integer
675 # dst: string
676 # code: integer
677
678 def on_call_transfer_request(call_id, dst, code):
679 return code
680
681 * \endcode
Benny Prijono9fc735d2006-05-28 14:58:12 +0000682 */
Benny Prijono4ddad2c2006-10-18 17:16:34 +0000683 void (*on_call_transfer_request)(pjsua_call_id call_id,
684 const pj_str_t *dst,
685 pjsip_status_code *code);
686
687 /**
688 * Notify application of the status of previously sent call
689 * transfer request. Application can monitor the status of the
690 * call transfer request, for example to decide whether to
691 * terminate existing call.
692 *
693 * @param call_id Call ID.
Benny Prijonoe6ead542007-01-31 20:53:31 +0000694 * @param st_code Status progress of the transfer request.
695 * @param st_text Status progress text.
Benny Prijono4ddad2c2006-10-18 17:16:34 +0000696 * @param final If non-zero, no further notification will
Benny Prijonoe6ead542007-01-31 20:53:31 +0000697 * be reported. The st_code specified in
Benny Prijono4ddad2c2006-10-18 17:16:34 +0000698 * this callback is the final status.
699 * @param p_cont Initially will be set to non-zero, application
700 * can set this to FALSE if it no longer wants
701 * to receie further notification (for example,
702 * after it hangs up the call).
Benny Prijonoe6ead542007-01-31 20:53:31 +0000703 *
704 * \par Python Syntax:
705 * \code
706 # call_id: integer
707 # st_code: integer
708 # st_text: string
709 # final: integer
710 # cont: integer
711
712 # return: cont
713
714 def on_call_transfer_status(call_id, st_code, st_text, final, cont):
715 return cont
716 * \endcode
Benny Prijono4ddad2c2006-10-18 17:16:34 +0000717 */
718 void (*on_call_transfer_status)(pjsua_call_id call_id,
Benny Prijonoe6ead542007-01-31 20:53:31 +0000719 int st_code,
720 const pj_str_t *st_text,
Benny Prijono4ddad2c2006-10-18 17:16:34 +0000721 pj_bool_t final,
722 pj_bool_t *p_cont);
Benny Prijono9fc735d2006-05-28 14:58:12 +0000723
724 /**
Benny Prijono053f5222006-11-11 16:16:04 +0000725 * Notify application about incoming INVITE with Replaces header.
726 * Application may reject the request by setting non-2xx code.
727 *
728 * @param call_id The call ID to be replaced.
729 * @param rdata The incoming INVITE request to replace the call.
730 * @param st_code Status code to be set by application. Application
731 * should only return a final status (200-699).
732 * @param st_text Optional status text to be set by application.
Benny Prijonoe6ead542007-01-31 20:53:31 +0000733 *
734 * \par Python Syntax:
735 * \code
736 # call_id: integer
737 # rdata: an opaque object
738 # st_code: integer
739 # st_text: string
740
741 # return: (st_code, st_text) tuple
742
743 def on_call_replace_request(call_id, rdata, st_code, st_text):
744 return st_code, st_text
745 * \endcode
Benny Prijono053f5222006-11-11 16:16:04 +0000746 */
747 void (*on_call_replace_request)(pjsua_call_id call_id,
748 pjsip_rx_data *rdata,
749 int *st_code,
750 pj_str_t *st_text);
751
752 /**
753 * Notify application that an existing call has been replaced with
754 * a new call. This happens when PJSUA-API receives incoming INVITE
755 * request with Replaces header.
756 *
757 * After this callback is called, normally PJSUA-API will disconnect
758 * \a old_call_id and establish \a new_call_id.
759 *
760 * @param old_call_id Existing call which to be replaced with the
761 * new call.
762 * @param new_call_id The new call.
763 * @param rdata The incoming INVITE with Replaces request.
Benny Prijonoe6ead542007-01-31 20:53:31 +0000764 *
765 * \par Python Syntax:
766 * \code
767 # old_call_id: integer
768 # new_call_id: integer
769
770 def on_call_replaced(old_call_id, new_call_id):
771 return
772 * \endcode
Benny Prijono053f5222006-11-11 16:16:04 +0000773 */
774 void (*on_call_replaced)(pjsua_call_id old_call_id,
775 pjsua_call_id new_call_id);
776
777
778 /**
Benny Prijono9fc735d2006-05-28 14:58:12 +0000779 * Notify application when registration status has changed.
780 * Application may then query the account info to get the
781 * registration details.
Benny Prijono0875ae82006-12-26 00:11:48 +0000782 *
783 * @param acc_id Account ID.
Benny Prijonoe6ead542007-01-31 20:53:31 +0000784 *
785 * \par Python Syntax:
786 * \code
787 # acc_id: account ID (integer)
788
789 def on_reg_state(acc_id):
790 return
791 * \endcode
Benny Prijonodc39fe82006-05-26 12:17:46 +0000792 */
Benny Prijono8b1889b2006-06-06 18:40:40 +0000793 void (*on_reg_state)(pjsua_acc_id acc_id);
Benny Prijonodc39fe82006-05-26 12:17:46 +0000794
795 /**
Benny Prijono9fc735d2006-05-28 14:58:12 +0000796 * Notify application when the buddy state has changed.
797 * Application may then query the buddy into to get the details.
Benny Prijono0875ae82006-12-26 00:11:48 +0000798 *
799 * @param buddy_id The buddy id.
Benny Prijonoe6ead542007-01-31 20:53:31 +0000800 *
801 * \par Python Syntax:
802 * \code
803 # buddy_id: integer
804
805 def on_buddy_state(buddy_id):
806 return
807 * \endcode
Benny Prijono9fc735d2006-05-28 14:58:12 +0000808 */
Benny Prijono8b1889b2006-06-06 18:40:40 +0000809 void (*on_buddy_state)(pjsua_buddy_id buddy_id);
Benny Prijono9fc735d2006-05-28 14:58:12 +0000810
811 /**
812 * Notify application on incoming pager (i.e. MESSAGE request).
Benny Prijonoeebe9af2006-06-13 22:57:13 +0000813 * Argument call_id will be -1 if MESSAGE request is not related to an
Benny Prijonodc39fe82006-05-26 12:17:46 +0000814 * existing call.
Benny Prijono0875ae82006-12-26 00:11:48 +0000815 *
Benny Prijonobbeb3992007-05-21 13:48:35 +0000816 * See also \a on_pager2() callback for the version with \a pjsip_rx_data
817 * passed as one of the argument.
818 *
Benny Prijono0875ae82006-12-26 00:11:48 +0000819 * @param call_id Containts the ID of the call where the IM was
820 * sent, or PJSUA_INVALID_ID if the IM was sent
821 * outside call context.
822 * @param from URI of the sender.
823 * @param to URI of the destination message.
824 * @param contact The Contact URI of the sender, if present.
825 * @param mime_type MIME type of the message.
826 * @param body The message content.
Benny Prijonoe6ead542007-01-31 20:53:31 +0000827 *
828 * \par Python Syntax:
829 * \code
830 # call_id: integer
831 # from: string
832 # to: string
833 # contact: string
834 # mime_type: string
835 # body: string
Benny Prijonoba736c42008-07-10 20:45:03 +0000836 # acc_id: integer
Benny Prijonoe6ead542007-01-31 20:53:31 +0000837
838 def on_pager(call_id, from, to, contact, mime_type, body):
839 return
840 * \endcode
Benny Prijonodc39fe82006-05-26 12:17:46 +0000841 */
Benny Prijonoeebe9af2006-06-13 22:57:13 +0000842 void (*on_pager)(pjsua_call_id call_id, const pj_str_t *from,
843 const pj_str_t *to, const pj_str_t *contact,
844 const pj_str_t *mime_type, const pj_str_t *body);
845
846 /**
Benny Prijonobbeb3992007-05-21 13:48:35 +0000847 * This is the alternative version of the \a on_pager() callback with
848 * \a pjsip_rx_data argument.
849 *
850 * @param call_id Containts the ID of the call where the IM was
851 * sent, or PJSUA_INVALID_ID if the IM was sent
852 * outside call context.
853 * @param from URI of the sender.
854 * @param to URI of the destination message.
855 * @param contact The Contact URI of the sender, if present.
856 * @param mime_type MIME type of the message.
857 * @param body The message content.
858 * @param rdata The incoming MESSAGE request.
Benny Prijonoba736c42008-07-10 20:45:03 +0000859 * @param acc_id Account ID most suitable for this message.
Benny Prijonobbeb3992007-05-21 13:48:35 +0000860 */
861 void (*on_pager2)(pjsua_call_id call_id, const pj_str_t *from,
862 const pj_str_t *to, const pj_str_t *contact,
863 const pj_str_t *mime_type, const pj_str_t *body,
Benny Prijonoba736c42008-07-10 20:45:03 +0000864 pjsip_rx_data *rdata, pjsua_acc_id acc_id);
Benny Prijonobbeb3992007-05-21 13:48:35 +0000865
866 /**
Benny Prijonoeebe9af2006-06-13 22:57:13 +0000867 * Notify application about the delivery status of outgoing pager
Benny Prijono4da0b1d2007-06-11 18:22:54 +0000868 * request. See also on_pager_status2() callback for the version with
869 * \a pjsip_rx_data in the argument list.
Benny Prijonoeebe9af2006-06-13 22:57:13 +0000870 *
871 * @param call_id Containts the ID of the call where the IM was
872 * sent, or PJSUA_INVALID_ID if the IM was sent
873 * outside call context.
874 * @param to Destination URI.
875 * @param body Message body.
876 * @param user_data Arbitrary data that was specified when sending
877 * IM message.
878 * @param status Delivery status.
879 * @param reason Delivery status reason.
Benny Prijonoe6ead542007-01-31 20:53:31 +0000880 *
881 * \par Python Syntax
882 * \code
883 # call_id: integer
884 # to: string
885 # body: string
886 # user_data: string
887 # status: integer
888 # reason: string
Benny Prijonoba736c42008-07-10 20:45:03 +0000889 # acc_id: integer
Benny Prijonoe6ead542007-01-31 20:53:31 +0000890
891 def on_pager_status(call_id, to, body, user_data, status, reason):
892 return
893 * \endcode
Benny Prijonoeebe9af2006-06-13 22:57:13 +0000894 */
895 void (*on_pager_status)(pjsua_call_id call_id,
896 const pj_str_t *to,
897 const pj_str_t *body,
898 void *user_data,
899 pjsip_status_code status,
900 const pj_str_t *reason);
Benny Prijonodc39fe82006-05-26 12:17:46 +0000901
902 /**
Benny Prijono4da0b1d2007-06-11 18:22:54 +0000903 * Notify application about the delivery status of outgoing pager
904 * request.
905 *
906 * @param call_id Containts the ID of the call where the IM was
907 * sent, or PJSUA_INVALID_ID if the IM was sent
908 * outside call context.
909 * @param to Destination URI.
910 * @param body Message body.
911 * @param user_data Arbitrary data that was specified when sending
912 * IM message.
913 * @param status Delivery status.
914 * @param reason Delivery status reason.
Benny Prijono0a982002007-06-12 16:22:09 +0000915 * @param tdata The original MESSAGE request.
Benny Prijono4da0b1d2007-06-11 18:22:54 +0000916 * @param rdata The incoming MESSAGE response, or NULL if the
917 * message transaction fails because of time out
918 * or transport error.
Benny Prijonoba736c42008-07-10 20:45:03 +0000919 * @param acc_id Account ID from this the instant message was
920 * send.
Benny Prijono4da0b1d2007-06-11 18:22:54 +0000921 */
922 void (*on_pager_status2)(pjsua_call_id call_id,
923 const pj_str_t *to,
924 const pj_str_t *body,
925 void *user_data,
926 pjsip_status_code status,
927 const pj_str_t *reason,
Benny Prijono0a982002007-06-12 16:22:09 +0000928 pjsip_tx_data *tdata,
Benny Prijonoba736c42008-07-10 20:45:03 +0000929 pjsip_rx_data *rdata,
930 pjsua_acc_id acc_id);
Benny Prijono4da0b1d2007-06-11 18:22:54 +0000931
932 /**
Benny Prijono9fc735d2006-05-28 14:58:12 +0000933 * Notify application about typing indication.
Benny Prijono0875ae82006-12-26 00:11:48 +0000934 *
935 * @param call_id Containts the ID of the call where the IM was
936 * sent, or PJSUA_INVALID_ID if the IM was sent
937 * outside call context.
938 * @param from URI of the sender.
939 * @param to URI of the destination message.
940 * @param contact The Contact URI of the sender, if present.
941 * @param is_typing Non-zero if peer is typing, or zero if peer
942 * has stopped typing a message.
Benny Prijonoe6ead542007-01-31 20:53:31 +0000943 *
944 * \par Python Syntax
945 * \code
946 # call_id: string
947 # from: string
948 # to: string
949 # contact: string
950 # is_typing: integer
951
952 def on_typing(call_id, from, to, contact, is_typing):
953 return
954 * \endcode
Benny Prijonodc39fe82006-05-26 12:17:46 +0000955 */
Benny Prijonoeebe9af2006-06-13 22:57:13 +0000956 void (*on_typing)(pjsua_call_id call_id, const pj_str_t *from,
957 const pj_str_t *to, const pj_str_t *contact,
958 pj_bool_t is_typing);
Benny Prijonodc39fe82006-05-26 12:17:46 +0000959
Benny Prijono6ba8c542007-10-16 01:34:14 +0000960 /**
Benny Prijonoba736c42008-07-10 20:45:03 +0000961 * Notify application about typing indication.
962 *
963 * @param call_id Containts the ID of the call where the IM was
964 * sent, or PJSUA_INVALID_ID if the IM was sent
965 * outside call context.
966 * @param from URI of the sender.
967 * @param to URI of the destination message.
968 * @param contact The Contact URI of the sender, if present.
969 * @param is_typing Non-zero if peer is typing, or zero if peer
970 * has stopped typing a message.
971 * @param rdata The received request.
972 * @param acc_id Account ID most suitable for this message.
973 */
974 void (*on_typing2)(pjsua_call_id call_id, const pj_str_t *from,
975 const pj_str_t *to, const pj_str_t *contact,
976 pj_bool_t is_typing, pjsip_rx_data *rdata,
977 pjsua_acc_id acc_id);
978
979 /**
Benny Prijono6ba8c542007-10-16 01:34:14 +0000980 * Callback when the library has finished performing NAT type
981 * detection.
982 *
983 * @param res NAT detection result.
984 */
985 void (*on_nat_detect)(const pj_stun_nat_detect_result *res);
986
Benny Prijonoeebe9af2006-06-13 22:57:13 +0000987} pjsua_callback;
988
989
990
Benny Prijonodc39fe82006-05-26 12:17:46 +0000991
992/**
Benny Prijonob5388cf2007-01-04 22:45:08 +0000993 * This structure describes the settings to control the API and
994 * user agent behavior, and can be specified when calling #pjsua_init().
995 * Before setting the values, application must call #pjsua_config_default()
996 * to initialize this structure with the default values.
Benny Prijonoe6ead542007-01-31 20:53:31 +0000997 *
998 * \par Python Sample Syntax:
999 * The pjsua_config type in Python is <tt>py_pjsua.Config</tt>. Application
1000 * creates the instance by calling <tt>py_pjsua.config_default()</tt>:
1001 * \code
1002 cfg = py_pjsua.config_default()
1003 * \endcode
Benny Prijonodc39fe82006-05-26 12:17:46 +00001004 */
Benny Prijonoeebe9af2006-06-13 22:57:13 +00001005typedef struct pjsua_config
1006{
1007
1008 /**
Benny Prijonob5388cf2007-01-04 22:45:08 +00001009 * Maximum calls to support (default: 4). The value specified here
1010 * must be smaller than the compile time maximum settings
1011 * PJSUA_MAX_CALLS, which by default is 32. To increase this
1012 * limit, the library must be recompiled with new PJSUA_MAX_CALLS
1013 * value.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00001014 */
1015 unsigned max_calls;
1016
1017 /**
1018 * Number of worker threads. Normally application will want to have at
1019 * least one worker thread, unless when it wants to poll the library
1020 * periodically, which in this case the worker thread can be set to
1021 * zero.
1022 */
1023 unsigned thread_cnt;
1024
1025 /**
Benny Prijonofa9e5b12006-10-08 12:39:34 +00001026 * Number of nameservers. If no name server is configured, the SIP SRV
1027 * resolution would be disabled, and domain will be resolved with
1028 * standard pj_gethostbyname() function.
1029 */
1030 unsigned nameserver_count;
1031
1032 /**
1033 * Array of nameservers to be used by the SIP resolver subsystem.
1034 * The order of the name server specifies the priority (first name
1035 * server will be used first, unless it is not reachable).
1036 */
1037 pj_str_t nameserver[4];
1038
1039 /**
Benny Prijonob5388cf2007-01-04 22:45:08 +00001040 * Number of outbound proxies in the \a outbound_proxy array.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00001041 */
1042 unsigned outbound_proxy_cnt;
1043
1044 /**
1045 * Specify the URL of outbound proxies to visit for all outgoing requests.
1046 * The outbound proxies will be used for all accounts, and it will
1047 * be used to build the route set for outgoing requests. The final
1048 * route set for outgoing requests will consists of the outbound proxies
1049 * and the proxy configured in the account.
1050 */
1051 pj_str_t outbound_proxy[4];
1052
Benny Prijonoc97608e2007-03-23 16:34:20 +00001053 /**
Benny Prijonoebbf6892007-03-24 17:37:25 +00001054 * Specify domain name to be resolved with DNS SRV resolution to get the
Benny Prijonof76e1392008-06-06 14:51:48 +00001055 * address of the STUN server. Alternatively application may specify
1056 * \a stun_host instead.
Benny Prijonoebbf6892007-03-24 17:37:25 +00001057 *
1058 * If DNS SRV resolution failed for this domain, then DNS A resolution
1059 * will be performed only if \a stun_host is specified.
Benny Prijonoc97608e2007-03-23 16:34:20 +00001060 */
Benny Prijonoebbf6892007-03-24 17:37:25 +00001061 pj_str_t stun_domain;
1062
1063 /**
Benny Prijonoaf09dc32007-04-22 12:48:30 +00001064 * Specify STUN server to be used, in "HOST[:PORT]" format. If port is
1065 * not specified, default port 3478 will be used.
Benny Prijonoebbf6892007-03-24 17:37:25 +00001066 */
1067 pj_str_t stun_host;
1068
1069 /**
Benny Prijono91a6a172007-10-31 08:59:29 +00001070 * Support for adding and parsing NAT type in the SDP to assist
1071 * troubleshooting. The valid values are:
1072 * - 0: no information will be added in SDP, and parsing is disabled.
Benny Prijono6ba8c542007-10-16 01:34:14 +00001073 * - 1: only the NAT type number is added.
1074 * - 2: add both NAT type number and name.
1075 *
Benny Prijono91a6a172007-10-31 08:59:29 +00001076 * Default: 1
Benny Prijono6ba8c542007-10-16 01:34:14 +00001077 */
1078 int nat_type_in_sdp;
1079
1080 /**
Benny Prijonodcfc0ba2007-09-30 16:50:27 +00001081 * Specify whether support for reliable provisional response (100rel and
1082 * PRACK) should be required by default. Note that this setting can be
1083 * further customized in account configuration (#pjsua_acc_config).
1084 *
1085 * Default: PJ_FALSE
1086 */
1087 pj_bool_t require_100rel;
1088
Benny Prijonoeebe9af2006-06-13 22:57:13 +00001089 /**
1090 * Number of credentials in the credential array.
1091 */
1092 unsigned cred_count;
1093
1094 /**
1095 * Array of credentials. These credentials will be used by all accounts,
Benny Prijonob5388cf2007-01-04 22:45:08 +00001096 * and can be used to authenticate against outbound proxies. If the
1097 * credential is specific to the account, then application should set
1098 * the credential in the pjsua_acc_config rather than the credential
1099 * here.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00001100 */
1101 pjsip_cred_info cred_info[PJSUA_ACC_MAX_PROXIES];
1102
1103 /**
Benny Prijonob5388cf2007-01-04 22:45:08 +00001104 * Application callback to receive various event notifications from
1105 * the library.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00001106 */
1107 pjsua_callback cb;
1108
Benny Prijono56315612006-07-18 14:39:40 +00001109 /**
Benny Prijonob5388cf2007-01-04 22:45:08 +00001110 * Optional user agent string (default empty). If it's empty, no
1111 * User-Agent header will be sent with outgoing requests.
Benny Prijono56315612006-07-18 14:39:40 +00001112 */
1113 pj_str_t user_agent;
1114
Benny Prijonod8179652008-01-23 20:39:07 +00001115#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0)
1116 /**
1117 * Specify default value of secure media transport usage.
1118 * Valid values are PJMEDIA_SRTP_DISABLED, PJMEDIA_SRTP_OPTIONAL, and
1119 * PJMEDIA_SRTP_MANDATORY.
1120 *
1121 * Note that this setting can be further customized in account
1122 * configuration (#pjsua_acc_config).
1123 *
1124 * Default: #PJSUA_DEFAULT_USE_SRTP
1125 */
1126 pjmedia_srtp_use use_srtp;
1127
1128 /**
1129 * Specify whether SRTP requires secure signaling to be used. This option
1130 * is only used when \a use_srtp option above is non-zero.
1131 *
1132 * Valid values are:
1133 * 0: SRTP does not require secure signaling
1134 * 1: SRTP requires secure transport such as TLS
1135 * 2: SRTP requires secure end-to-end transport (SIPS)
1136 *
1137 * Note that this setting can be further customized in account
1138 * configuration (#pjsua_acc_config).
1139 *
1140 * Default: #PJSUA_DEFAULT_SRTP_SECURE_SIGNALING
1141 */
1142 int srtp_secure_signaling;
1143#endif
1144
Benny Prijonoeebe9af2006-06-13 22:57:13 +00001145} pjsua_config;
1146
1147
1148/**
1149 * Use this function to initialize pjsua config.
1150 *
1151 * @param cfg pjsua config to be initialized.
Benny Prijonoe6ead542007-01-31 20:53:31 +00001152 *
1153 * \par Python Sample Syntax:
1154 * The corresponding Python function creates an instance of the config and
1155 * initializes it to the default settings:
1156 * \code
1157 cfg = py_pjsua.config_default()
1158 * \endcode
1159
Benny Prijonoeebe9af2006-06-13 22:57:13 +00001160 */
Benny Prijono1f61a8f2007-08-16 10:11:44 +00001161PJ_DECL(void) pjsua_config_default(pjsua_config *cfg);
Benny Prijonoeebe9af2006-06-13 22:57:13 +00001162
1163
Benny Prijonoa7b376b2008-01-25 16:06:33 +00001164/** The implementation has been moved to sip_auth.h */
Benny Prijono7977f9f2007-10-10 11:37:56 +00001165#define pjsip_cred_dup pjsip_cred_info_dup
Benny Prijonoeebe9af2006-06-13 22:57:13 +00001166
1167
1168/**
1169 * Duplicate pjsua_config.
Benny Prijonoe6ead542007-01-31 20:53:31 +00001170 *
1171 * @param pool The pool to get memory from.
1172 * @param dst Destination config.
1173 * @param src Source config.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00001174 */
Benny Prijono1f61a8f2007-08-16 10:11:44 +00001175PJ_DECL(void) pjsua_config_dup(pj_pool_t *pool,
1176 pjsua_config *dst,
1177 const pjsua_config *src);
Benny Prijonoeebe9af2006-06-13 22:57:13 +00001178
Benny Prijonoeebe9af2006-06-13 22:57:13 +00001179
1180/**
1181 * This structure describes additional information to be sent with
Benny Prijonob5388cf2007-01-04 22:45:08 +00001182 * outgoing SIP message. It can (optionally) be specified for example
1183 * with #pjsua_call_make_call(), #pjsua_call_answer(), #pjsua_call_hangup(),
1184 * #pjsua_call_set_hold(), #pjsua_call_send_im(), and many more.
1185 *
1186 * Application MUST call #pjsua_msg_data_init() to initialize this
1187 * structure before setting its values.
Benny Prijonoe6ead542007-01-31 20:53:31 +00001188 *
1189 * \par Python Syntax
1190 * The data type in Python is <tt>py_pjsua.Msg_Data</tt>. Application is
1191 * recommended to instantiate the structure by using this construct:
1192 * \code
1193 msg_data = py_pjsua.msg_data_init()
1194 * \endcode
Benny Prijonoeebe9af2006-06-13 22:57:13 +00001195 */
1196typedef struct pjsua_msg_data
1197{
1198 /**
Benny Prijonoc92ca5c2007-06-11 17:03:41 +00001199 * Additional message headers as linked list. Application can add
1200 * headers to the list by creating the header, either from the heap/pool
1201 * or from temporary local variable, and add the header using
1202 * linked list operation. See pjsip_apps.c for some sample codes.
Benny Prijonoe6ead542007-01-31 20:53:31 +00001203 *
1204 * \par Python:
1205 * This field is implemented as string linked-list in Python, where each
1206 * string describes the header. For example:
1207 \code
1208 msg_data = py_pjsua.Msg_Data()
1209 msg_data.hdr_list = ["Subject: Hello py_pjsua!", "Priority: very low"]
1210 \endcode
Benny Prijonoeebe9af2006-06-13 22:57:13 +00001211 */
1212 pjsip_hdr hdr_list;
1213
1214 /**
1215 * MIME type of optional message body.
1216 */
1217 pj_str_t content_type;
1218
1219 /**
1220 * Optional message body.
1221 */
1222 pj_str_t msg_body;
1223
1224} pjsua_msg_data;
1225
1226
1227/**
1228 * Initialize message data.
1229 *
1230 * @param msg_data Message data to be initialized.
Benny Prijonoe6ead542007-01-31 20:53:31 +00001231 *
1232 * \par Python
1233 * The corresponding Python function creates and initializes the structure:
1234 * \code
1235 msg_data = py_pjsua.msg_data_init()
1236 * \endcode
Benny Prijonoeebe9af2006-06-13 22:57:13 +00001237 */
Benny Prijono1f61a8f2007-08-16 10:11:44 +00001238PJ_DECL(void) pjsua_msg_data_init(pjsua_msg_data *msg_data);
Benny Prijono268ca612006-02-07 12:34:11 +00001239
Benny Prijono268ca612006-02-07 12:34:11 +00001240
1241/**
Benny Prijonoeebe9af2006-06-13 22:57:13 +00001242 * Instantiate pjsua application. Application must call this function before
1243 * calling any other functions, to make sure that the underlying libraries
1244 * are properly initialized. Once this function has returned success,
1245 * application must call pjsua_destroy() before quitting.
1246 *
1247 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00001248 *
1249 * \par Python:
1250 * \code
1251 status = py_pjsua.create()
1252 * \endcode
Benny Prijonodc39fe82006-05-26 12:17:46 +00001253 */
1254PJ_DECL(pj_status_t) pjsua_create(void);
1255
1256
Benny Prijonoa7b376b2008-01-25 16:06:33 +00001257/** Forward declaration */
Benny Prijonoe6ead542007-01-31 20:53:31 +00001258typedef struct pjsua_media_config pjsua_media_config;
1259
1260
Benny Prijonodc39fe82006-05-26 12:17:46 +00001261/**
Benny Prijonoeebe9af2006-06-13 22:57:13 +00001262 * Initialize pjsua with the specified settings. All the settings are
1263 * optional, and the default values will be used when the config is not
1264 * specified.
Benny Prijonoccf95622006-02-07 18:48:01 +00001265 *
Benny Prijonob5388cf2007-01-04 22:45:08 +00001266 * Note that #pjsua_create() MUST be called before calling this function.
1267 *
Benny Prijonoeebe9af2006-06-13 22:57:13 +00001268 * @param ua_cfg User agent configuration.
1269 * @param log_cfg Optional logging configuration.
1270 * @param media_cfg Optional media configuration.
Benny Prijonoccf95622006-02-07 18:48:01 +00001271 *
Benny Prijonoeebe9af2006-06-13 22:57:13 +00001272 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00001273 *
1274 * \par Python:
1275 * The function is similar in Python:
1276 * \code
1277 status = py_pjsua.init(ua_cfg, log_cfg, media_cfg)
1278 * \endcode
1279 * Note that \a ua_cfg, \a log_cfg, and \a media_cfg are optional, and
1280 * the Python script may pass None if it doesn't want to configure the
1281 * setting.
Benny Prijono268ca612006-02-07 12:34:11 +00001282 */
Benny Prijonoeebe9af2006-06-13 22:57:13 +00001283PJ_DECL(pj_status_t) pjsua_init(const pjsua_config *ua_cfg,
1284 const pjsua_logging_config *log_cfg,
1285 const pjsua_media_config *media_cfg);
Benny Prijono268ca612006-02-07 12:34:11 +00001286
1287
1288/**
Benny Prijonoeebe9af2006-06-13 22:57:13 +00001289 * Application is recommended to call this function after all initialization
1290 * is done, so that the library can do additional checking set up
1291 * additional
Benny Prijonoccf95622006-02-07 18:48:01 +00001292 *
Benny Prijonob5388cf2007-01-04 22:45:08 +00001293 * Application may call this function anytime after #pjsua_init().
1294 *
Benny Prijonoeebe9af2006-06-13 22:57:13 +00001295 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00001296 *
1297 * \par Python:
1298 * The function is similar in Python:
1299 * \code
1300 status = py_pjsua.start()
1301 * \endcode
Benny Prijonoccf95622006-02-07 18:48:01 +00001302 */
Benny Prijonodc39fe82006-05-26 12:17:46 +00001303PJ_DECL(pj_status_t) pjsua_start(void);
Benny Prijonoccf95622006-02-07 18:48:01 +00001304
Benny Prijonoeebe9af2006-06-13 22:57:13 +00001305
Benny Prijonoccf95622006-02-07 18:48:01 +00001306/**
Benny Prijonob5388cf2007-01-04 22:45:08 +00001307 * Destroy pjsua. Application is recommended to perform graceful shutdown
1308 * before calling this function (such as unregister the account from the SIP
1309 * server, terminate presense subscription, and hangup active calls), however,
1310 * this function will do all of these if it finds there are active sessions
1311 * that need to be terminated. This function will approximately block for
1312 * one second to wait for replies from remote.
1313 *
1314 * Application.may safely call this function more than once if it doesn't
1315 * keep track of it's state.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00001316 *
1317 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00001318 *
1319 * \par Python:
1320 * The function is similar in Python:
1321 * \code
1322 status = py_pjsua.destroy()
1323 * \endcode
Benny Prijono268ca612006-02-07 12:34:11 +00001324 */
Benny Prijonodc39fe82006-05-26 12:17:46 +00001325PJ_DECL(pj_status_t) pjsua_destroy(void);
Benny Prijonoa91a0032006-02-26 21:23:45 +00001326
Benny Prijonoeebe9af2006-06-13 22:57:13 +00001327
Benny Prijono9fc735d2006-05-28 14:58:12 +00001328/**
Benny Prijonoeebe9af2006-06-13 22:57:13 +00001329 * Poll pjsua for events, and if necessary block the caller thread for
1330 * the specified maximum interval (in miliseconds).
1331 *
Benny Prijonob5388cf2007-01-04 22:45:08 +00001332 * Application doesn't normally need to call this function if it has
1333 * configured worker thread (\a thread_cnt field) in pjsua_config structure,
1334 * because polling then will be done by these worker threads instead.
1335 *
Benny Prijonoeebe9af2006-06-13 22:57:13 +00001336 * @param msec_timeout Maximum time to wait, in miliseconds.
1337 *
1338 * @return The number of events that have been handled during the
1339 * poll. Negative value indicates error, and application
Benny Prijonoe6ead542007-01-31 20:53:31 +00001340 * can retrieve the error as (status = -return_value).
1341 *
1342 * \par Python:
1343 * The function is similar in Python:
1344 * \code
1345 n = py_pjsua.handle_events(msec_timeout)
1346 * \endcode
Benny Prijonob9b32ab2006-06-01 12:28:44 +00001347 */
1348PJ_DECL(int) pjsua_handle_events(unsigned msec_timeout);
1349
1350
1351/**
Benny Prijonob5388cf2007-01-04 22:45:08 +00001352 * Create memory pool to be used by the application. Once application
1353 * finished using the pool, it must be released with pj_pool_release().
Benny Prijonoeebe9af2006-06-13 22:57:13 +00001354 *
1355 * @param name Optional pool name.
Benny Prijono312aff92006-06-17 04:08:30 +00001356 * @param init_size Initial size of the pool.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00001357 * @param increment Increment size.
1358 *
1359 * @return The pool, or NULL when there's no memory.
Benny Prijonoe6ead542007-01-31 20:53:31 +00001360 *
1361 * \par Python:
1362 * Python script may also create a pool object from the script:
1363 * \code
1364 pool = py_pjsua.pool_create(name, init_size, increment)
1365 * \endcode
Benny Prijonoeebe9af2006-06-13 22:57:13 +00001366 */
1367PJ_DECL(pj_pool_t*) pjsua_pool_create(const char *name, pj_size_t init_size,
1368 pj_size_t increment);
1369
1370
1371/**
1372 * Application can call this function at any time (after pjsua_create(), of
1373 * course) to change logging settings.
1374 *
1375 * @param c Logging configuration.
1376 *
1377 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00001378 *
1379 * \par Python:
1380 * The function is similar in Python:
1381 * \code
1382 status = py_pjsua.reconfigure_logging(log_cfg)
1383 * \endcode
Benny Prijonoeebe9af2006-06-13 22:57:13 +00001384 */
1385PJ_DECL(pj_status_t) pjsua_reconfigure_logging(const pjsua_logging_config *c);
1386
1387
1388/**
1389 * Internal function to get SIP endpoint instance of pjsua, which is
1390 * needed for example to register module, create transports, etc.
Benny Prijonob5388cf2007-01-04 22:45:08 +00001391 * Only valid after #pjsua_init() is called.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00001392 *
1393 * @return SIP endpoint instance.
Benny Prijonoe6ead542007-01-31 20:53:31 +00001394 *
1395 * \par Python:
1396 * Application may retrieve the SIP endpoint instance:
1397 * \code
1398 endpt = py_pjsua.get_pjsip_endpt()
1399 * \endcode
1400 * However currently the object is just an opaque object and does not have
1401 * any use for Python scripts.
Benny Prijono9fc735d2006-05-28 14:58:12 +00001402 */
1403PJ_DECL(pjsip_endpoint*) pjsua_get_pjsip_endpt(void);
1404
1405/**
Benny Prijonoeebe9af2006-06-13 22:57:13 +00001406 * Internal function to get media endpoint instance.
1407 * Only valid after #pjsua_init() is called.
1408 *
1409 * @return Media endpoint instance.
Benny Prijonoe6ead542007-01-31 20:53:31 +00001410 *
1411 * \par Python:
1412 * Application may retrieve the media endpoint instance:
1413 * \code
1414 endpt = py_pjsua.get_pjmedia_endpt()
1415 * \endcode
1416 * However currently the object is just an opaque object and does not have
1417 * any use for Python scripts.
Benny Prijono9fc735d2006-05-28 14:58:12 +00001418 */
1419PJ_DECL(pjmedia_endpt*) pjsua_get_pjmedia_endpt(void);
1420
Benny Prijono97b87172006-08-24 14:25:14 +00001421/**
1422 * Internal function to get PJSUA pool factory.
Benny Prijonob5388cf2007-01-04 22:45:08 +00001423 * Only valid after #pjsua_create() is called.
Benny Prijono97b87172006-08-24 14:25:14 +00001424 *
1425 * @return Pool factory currently used by PJSUA.
Benny Prijonoe6ead542007-01-31 20:53:31 +00001426 *
1427 * \par Python:
1428 * Application may retrieve the pool factory instance:
1429 * \code
1430 endpt = py_pjsua.get_pool_factory()
1431 * \endcode
1432 * However currently the object is just an opaque object and does not have
1433 * any use for Python scripts.
Benny Prijono97b87172006-08-24 14:25:14 +00001434 */
1435PJ_DECL(pj_pool_factory*) pjsua_get_pool_factory(void);
1436
1437
Benny Prijonoeebe9af2006-06-13 22:57:13 +00001438
1439/*****************************************************************************
Benny Prijono312aff92006-06-17 04:08:30 +00001440 * Utilities.
1441 *
Benny Prijono9fc735d2006-05-28 14:58:12 +00001442 */
Benny Prijonoeebe9af2006-06-13 22:57:13 +00001443
1444/**
Benny Prijono4ab9fbb2007-10-12 12:14:27 +00001445 * This is a utility function to detect NAT type in front of this
1446 * endpoint. Once invoked successfully, this function will complete
Benny Prijono6ba8c542007-10-16 01:34:14 +00001447 * asynchronously and report the result in \a on_nat_detect() callback
1448 * of pjsua_callback.
Benny Prijono4ab9fbb2007-10-12 12:14:27 +00001449 *
Benny Prijono6ba8c542007-10-16 01:34:14 +00001450 * After NAT has been detected and the callback is called, application can
1451 * get the detected NAT type by calling #pjsua_get_nat_type(). Application
1452 * can also perform NAT detection by calling #pjsua_detect_nat_type()
1453 * again at later time.
Benny Prijono4ab9fbb2007-10-12 12:14:27 +00001454 *
Benny Prijono6ba8c542007-10-16 01:34:14 +00001455 * Note that STUN must be enabled to run this function successfully.
1456 *
1457 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijono4ab9fbb2007-10-12 12:14:27 +00001458 */
Benny Prijono6ba8c542007-10-16 01:34:14 +00001459PJ_DECL(pj_status_t) pjsua_detect_nat_type(void);
1460
1461
1462/**
1463 * Get the NAT type as detected by #pjsua_detect_nat_type() function.
1464 * This function will only return useful NAT type after #pjsua_detect_nat_type()
1465 * has completed successfully and \a on_nat_detect() callback has been called.
1466 *
1467 * @param type NAT type.
1468 *
1469 * @return When detection is in progress, this function will
1470 * return PJ_EPENDING and \a type will be set to
1471 * PJ_STUN_NAT_TYPE_UNKNOWN. After NAT type has been
1472 * detected successfully, this function will return
1473 * PJ_SUCCESS and \a type will be set to the correct
1474 * value. Other return values indicate error and
1475 * \a type will be set to PJ_STUN_NAT_TYPE_ERR_UNKNOWN.
Benny Prijono91a6a172007-10-31 08:59:29 +00001476 *
1477 * @see pjsua_call_get_rem_nat_type()
Benny Prijono6ba8c542007-10-16 01:34:14 +00001478 */
1479PJ_DECL(pj_status_t) pjsua_get_nat_type(pj_stun_nat_type *type);
Benny Prijono4ab9fbb2007-10-12 12:14:27 +00001480
1481
1482/**
Benny Prijonob5388cf2007-01-04 22:45:08 +00001483 * This is a utility function to verify that valid SIP url is given. If the
1484 * URL is valid, PJ_SUCCESS will be returned.
Benny Prijono312aff92006-06-17 04:08:30 +00001485 *
Benny Prijonoe6ead542007-01-31 20:53:31 +00001486 * @param url The URL, as NULL terminated string.
Benny Prijono312aff92006-06-17 04:08:30 +00001487 *
1488 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00001489 *
1490 * \par Python:
1491 * \code
1492 status = py_pjsua.verify_sip_url(url)
1493 * \endcode
Benny Prijono312aff92006-06-17 04:08:30 +00001494 */
Benny Prijonoe6ead542007-01-31 20:53:31 +00001495PJ_DECL(pj_status_t) pjsua_verify_sip_url(const char *url);
Benny Prijono312aff92006-06-17 04:08:30 +00001496
1497
1498/**
Benny Prijonob5388cf2007-01-04 22:45:08 +00001499 * This is a utility function to display error message for the specified
1500 * error code. The error message will be sent to the log.
Benny Prijono312aff92006-06-17 04:08:30 +00001501 *
1502 * @param sender The log sender field.
1503 * @param title Message title for the error.
1504 * @param status Status code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00001505 *
1506 * \par Python:
1507 * \code
1508 py_pjsua.perror(sender, title, status)
1509 * \endcode
Benny Prijono312aff92006-06-17 04:08:30 +00001510 */
1511PJ_DECL(void) pjsua_perror(const char *sender, const char *title,
1512 pj_status_t status);
1513
1514
Benny Prijonoda9785b2007-04-02 20:43:06 +00001515/**
1516 * This is a utility function to dump the stack states to log, using
1517 * verbosity level 3.
1518 *
1519 * @param detail Will print detailed output (such as list of
1520 * SIP transactions) when non-zero.
1521 */
1522PJ_DECL(void) pjsua_dump(pj_bool_t detail);
Benny Prijono312aff92006-06-17 04:08:30 +00001523
1524/**
1525 * @}
1526 */
1527
1528
1529
1530/*****************************************************************************
1531 * TRANSPORT API
1532 */
1533
1534/**
Benny Prijonoe6ead542007-01-31 20:53:31 +00001535 * @defgroup PJSUA_LIB_TRANSPORT PJSUA-API Signaling Transport
Benny Prijono312aff92006-06-17 04:08:30 +00001536 * @ingroup PJSUA_LIB
1537 * @brief API for managing SIP transports
1538 * @{
Benny Prijonoe6ead542007-01-31 20:53:31 +00001539 *
1540 * PJSUA-API supports creating multiple transport instances, for example UDP,
1541 * TCP, and TLS transport. SIP transport must be created before adding an
1542 * account.
Benny Prijono312aff92006-06-17 04:08:30 +00001543 */
1544
1545
Benny Prijonoe6ead542007-01-31 20:53:31 +00001546/** SIP transport identification.
1547 */
Benny Prijono312aff92006-06-17 04:08:30 +00001548typedef int pjsua_transport_id;
1549
1550
1551/**
Benny Prijono0a5cad82006-09-26 13:21:02 +00001552 * Transport configuration for creating transports for both SIP
Benny Prijonob5388cf2007-01-04 22:45:08 +00001553 * and media. Before setting some values to this structure, application
1554 * MUST call #pjsua_transport_config_default() to initialize its
1555 * values with default settings.
Benny Prijonoe6ead542007-01-31 20:53:31 +00001556 *
1557 * \par Python:
1558 * The data type in Python is <tt>py_pjsua.Transport_Config</tt>,
1559 * although application can just do this to create the instance:
1560 * \code
1561 transport_cfg = py_pjsua.transport_config_default()
1562 * \endcode
Benny Prijono312aff92006-06-17 04:08:30 +00001563 */
1564typedef struct pjsua_transport_config
1565{
1566 /**
1567 * UDP port number to bind locally. This setting MUST be specified
1568 * even when default port is desired. If the value is zero, the
1569 * transport will be bound to any available port, and application
1570 * can query the port by querying the transport info.
1571 */
1572 unsigned port;
1573
1574 /**
Benny Prijono0a5cad82006-09-26 13:21:02 +00001575 * Optional address to advertise as the address of this transport.
1576 * Application can specify any address or hostname for this field,
1577 * for example it can point to one of the interface address in the
1578 * system, or it can point to the public address of a NAT router
1579 * where port mappings have been configured for the application.
1580 *
1581 * Note: this option can be used for both UDP and TCP as well!
Benny Prijono312aff92006-06-17 04:08:30 +00001582 */
Benny Prijono0a5cad82006-09-26 13:21:02 +00001583 pj_str_t public_addr;
1584
1585 /**
1586 * Optional address where the socket should be bound to. This option
1587 * SHOULD only be used to selectively bind the socket to particular
1588 * interface (instead of 0.0.0.0), and SHOULD NOT be used to set the
1589 * published address of a transport (the public_addr field should be
1590 * used for that purpose).
1591 *
1592 * Note that unlike public_addr field, the address (or hostname) here
1593 * MUST correspond to the actual interface address in the host, since
1594 * this address will be specified as bind() argument.
1595 */
1596 pj_str_t bound_addr;
Benny Prijono312aff92006-06-17 04:08:30 +00001597
1598 /**
Benny Prijonob5388cf2007-01-04 22:45:08 +00001599 * This specifies TLS settings for TLS transport. It is only be used
1600 * when this transport config is being used to create a SIP TLS
1601 * transport.
Benny Prijono6e0e54b2006-12-08 21:58:31 +00001602 */
Benny Prijonof3bbc132006-12-25 06:43:59 +00001603 pjsip_tls_setting tls_setting;
Benny Prijono6e0e54b2006-12-08 21:58:31 +00001604
Benny Prijono312aff92006-06-17 04:08:30 +00001605} pjsua_transport_config;
1606
1607
1608/**
1609 * Call this function to initialize UDP config with default values.
1610 *
1611 * @param cfg The UDP config to be initialized.
Benny Prijonoe6ead542007-01-31 20:53:31 +00001612 *
1613 * \par Python:
1614 * The corresponding Python function is rather different:
1615 * \code
1616 transport_cfg = py_pjsua.transport_config_default()
1617 * \endcode
Benny Prijono312aff92006-06-17 04:08:30 +00001618 */
Benny Prijono1f61a8f2007-08-16 10:11:44 +00001619PJ_DECL(void) pjsua_transport_config_default(pjsua_transport_config *cfg);
Benny Prijono312aff92006-06-17 04:08:30 +00001620
1621
1622/**
Benny Prijono312aff92006-06-17 04:08:30 +00001623 * Duplicate transport config.
Benny Prijonoe6ead542007-01-31 20:53:31 +00001624 *
1625 * @param pool The pool.
1626 * @param dst The destination config.
1627 * @param src The source config.
1628 *
1629 * \par Python:
1630 * Not applicable. One should be able to just copy one variable instance
1631 * to another in Python.
Benny Prijono312aff92006-06-17 04:08:30 +00001632 */
Benny Prijono1f61a8f2007-08-16 10:11:44 +00001633PJ_DECL(void) pjsua_transport_config_dup(pj_pool_t *pool,
1634 pjsua_transport_config *dst,
1635 const pjsua_transport_config *src);
Benny Prijono312aff92006-06-17 04:08:30 +00001636
1637
1638/**
Benny Prijonob5388cf2007-01-04 22:45:08 +00001639 * This structure describes transport information returned by
1640 * #pjsua_transport_get_info() function.
Benny Prijonoe6ead542007-01-31 20:53:31 +00001641 *
1642 * \par Python:
1643 * The corresponding data type in Python is <tt>py_pjsua.Transport_Info</tt>.
Benny Prijono312aff92006-06-17 04:08:30 +00001644 */
1645typedef struct pjsua_transport_info
1646{
1647 /**
1648 * PJSUA transport identification.
1649 */
1650 pjsua_transport_id id;
1651
1652 /**
1653 * Transport type.
1654 */
1655 pjsip_transport_type_e type;
1656
1657 /**
1658 * Transport type name.
1659 */
1660 pj_str_t type_name;
1661
1662 /**
1663 * Transport string info/description.
1664 */
1665 pj_str_t info;
1666
1667 /**
1668 * Transport flag (see ##pjsip_transport_flags_e).
1669 */
1670 unsigned flag;
1671
1672 /**
1673 * Local address length.
1674 */
1675 unsigned addr_len;
1676
1677 /**
1678 * Local/bound address.
1679 */
1680 pj_sockaddr local_addr;
1681
1682 /**
1683 * Published address (or transport address name).
1684 */
1685 pjsip_host_port local_name;
1686
1687 /**
1688 * Current number of objects currently referencing this transport.
1689 */
1690 unsigned usage_count;
1691
1692
1693} pjsua_transport_info;
1694
1695
1696/**
Benny Prijonob5388cf2007-01-04 22:45:08 +00001697 * Create and start a new SIP transport according to the specified
1698 * settings.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00001699 *
1700 * @param type Transport type.
1701 * @param cfg Transport configuration.
1702 * @param p_id Optional pointer to receive transport ID.
1703 *
1704 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00001705 *
1706 * \par Python:
1707 * The corresponding Python function returns (status,id) tuple:
1708 * \code
1709 status, transport_id = py_pjsua.transport_create(type, cfg)
1710 * \endcode
Benny Prijonoeebe9af2006-06-13 22:57:13 +00001711 */
1712PJ_DECL(pj_status_t) pjsua_transport_create(pjsip_transport_type_e type,
1713 const pjsua_transport_config *cfg,
1714 pjsua_transport_id *p_id);
1715
1716/**
Benny Prijonoe6ead542007-01-31 20:53:31 +00001717 * Register transport that has been created by application. This function
1718 * is useful if application wants to implement custom SIP transport and use
1719 * it with pjsua.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00001720 *
1721 * @param tp Transport instance.
1722 * @param p_id Optional pointer to receive transport ID.
1723 *
1724 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00001725 *
1726 * \par Python:
1727 * Not applicable (for now), because one cannot create a custom transport
1728 * from Python script.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00001729 */
1730PJ_DECL(pj_status_t) pjsua_transport_register(pjsip_transport *tp,
1731 pjsua_transport_id *p_id);
1732
1733
1734/**
Benny Prijonoe6ead542007-01-31 20:53:31 +00001735 * Enumerate all transports currently created in the system. This function
1736 * will return all transport IDs, and application may then call
1737 * #pjsua_transport_get_info() function to retrieve detailed information
1738 * about the transport.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00001739 *
1740 * @param id Array to receive transport ids.
1741 * @param count In input, specifies the maximum number of elements.
1742 * On return, it contains the actual number of elements.
1743 *
1744 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00001745 *
1746 * \par Python:
1747 * The function returns list of integers representing transport ids:
1748 * \code
1749 [int] = py_pjsua.enum_transports()
1750 * \endcode
Benny Prijonoeebe9af2006-06-13 22:57:13 +00001751 */
1752PJ_DECL(pj_status_t) pjsua_enum_transports( pjsua_transport_id id[],
1753 unsigned *count );
1754
1755
1756/**
1757 * Get information about transports.
1758 *
1759 * @param id Transport ID.
1760 * @param info Pointer to receive transport info.
1761 *
1762 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00001763 *
1764 * \par Python:
1765 * \code
1766 transport_info = py_pjsua.transport_get_info(id)
1767 * \endcode
1768 * The Python function returns None on error.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00001769 */
1770PJ_DECL(pj_status_t) pjsua_transport_get_info(pjsua_transport_id id,
1771 pjsua_transport_info *info);
1772
1773
1774/**
1775 * Disable a transport or re-enable it. By default transport is always
1776 * enabled after it is created. Disabling a transport does not necessarily
1777 * close the socket, it will only discard incoming messages and prevent
1778 * the transport from being used to send outgoing messages.
1779 *
1780 * @param id Transport ID.
1781 * @param enabled Non-zero to enable, zero to disable.
1782 *
1783 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00001784 *
1785 * \par Python:
1786 * \code
1787 status = py_pjsua.transport_set_enable(id, enabled)
1788 * \endcode
Benny Prijonoeebe9af2006-06-13 22:57:13 +00001789 */
1790PJ_DECL(pj_status_t) pjsua_transport_set_enable(pjsua_transport_id id,
1791 pj_bool_t enabled);
1792
1793
1794/**
1795 * Close the transport. If transport is forcefully closed, it will be
1796 * immediately closed, and any pending transactions that are using the
Benny Prijonob5388cf2007-01-04 22:45:08 +00001797 * transport may not terminate properly (it may even crash). Otherwise,
1798 * the system will wait until all transactions are closed while preventing
1799 * new users from using the transport, and will close the transport when
1800 * it is safe to do so.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00001801 *
1802 * @param id Transport ID.
1803 * @param force Non-zero to immediately close the transport. This
1804 * is not recommended!
1805 *
1806 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00001807 *
1808 * \par Python:
1809 * \code
1810 status = py_pjsua.transport_close(id, force)
1811 * \endcode
Benny Prijonoeebe9af2006-06-13 22:57:13 +00001812 */
1813PJ_DECL(pj_status_t) pjsua_transport_close( pjsua_transport_id id,
1814 pj_bool_t force );
Benny Prijono9fc735d2006-05-28 14:58:12 +00001815
Benny Prijonoeebe9af2006-06-13 22:57:13 +00001816/**
Benny Prijono312aff92006-06-17 04:08:30 +00001817 * @}
Benny Prijonoeebe9af2006-06-13 22:57:13 +00001818 */
Benny Prijonoeebe9af2006-06-13 22:57:13 +00001819
1820
Benny Prijonoeebe9af2006-06-13 22:57:13 +00001821
1822
1823/*****************************************************************************
Benny Prijono312aff92006-06-17 04:08:30 +00001824 * ACCOUNT API
Benny Prijonoa91a0032006-02-26 21:23:45 +00001825 */
1826
Benny Prijono312aff92006-06-17 04:08:30 +00001827
1828/**
Benny Prijonoe6ead542007-01-31 20:53:31 +00001829 * @defgroup PJSUA_LIB_ACC PJSUA-API Accounts Management
Benny Prijono312aff92006-06-17 04:08:30 +00001830 * @ingroup PJSUA_LIB
Benny Prijonoe6ead542007-01-31 20:53:31 +00001831 * @brief PJSUA Accounts management
Benny Prijono312aff92006-06-17 04:08:30 +00001832 * @{
Benny Prijonoe6ead542007-01-31 20:53:31 +00001833 *
Benny Prijono312aff92006-06-17 04:08:30 +00001834 * PJSUA accounts provide identity (or identities) of the user who is currently
Benny Prijonoe6ead542007-01-31 20:53:31 +00001835 * using the application. In SIP terms, the identity is used as the <b>From</b>
1836 * header in outgoing requests.
1837 *
1838 * PJSUA-API supports creating and managing multiple accounts. The maximum
1839 * number of accounts is limited by a compile time constant
1840 * <tt>PJSUA_MAX_ACC</tt>.
Benny Prijono312aff92006-06-17 04:08:30 +00001841 *
1842 * Account may or may not have client registration associated with it.
1843 * An account is also associated with <b>route set</b> and some <b>authentication
1844 * credentials</b>, which are used when sending SIP request messages using the
1845 * account. An account also has presence's <b>online status</b>, which
Benny Prijonoe6ead542007-01-31 20:53:31 +00001846 * will be reported to remote peer when they subscribe to the account's
1847 * presence, or which is published to a presence server if presence
1848 * publication is enabled for the account.
Benny Prijono312aff92006-06-17 04:08:30 +00001849 *
1850 * At least one account MUST be created in the application. If no user
1851 * association is required, application can create a userless account by
1852 * calling #pjsua_acc_add_local(). A userless account identifies local endpoint
Benny Prijonoe6ead542007-01-31 20:53:31 +00001853 * instead of a particular user, and it correspond with a particular
1854 * transport instance.
Benny Prijono312aff92006-06-17 04:08:30 +00001855 *
1856 * Also one account must be set as the <b>default account</b>, which is used as
1857 * the account to use when PJSUA fails to match a request with any other
1858 * accounts.
1859 *
1860 * When sending outgoing SIP requests (such as making calls or sending
1861 * instant messages), normally PJSUA requires the application to specify
1862 * which account to use for the request. If no account is specified,
1863 * PJSUA may be able to select the account by matching the destination
1864 * domain name, and fall back to default account when no match is found.
1865 */
1866
1867/**
1868 * Maximum accounts.
1869 */
1870#ifndef PJSUA_MAX_ACC
1871# define PJSUA_MAX_ACC 8
1872#endif
1873
1874
1875/**
1876 * Default registration interval.
1877 */
1878#ifndef PJSUA_REG_INTERVAL
Benny Prijonobddef2c2007-10-31 13:28:08 +00001879# define PJSUA_REG_INTERVAL 300
Benny Prijono312aff92006-06-17 04:08:30 +00001880#endif
1881
1882
1883/**
Benny Prijono3a5e1ab2006-08-15 20:26:34 +00001884 * Default PUBLISH expiration
1885 */
1886#ifndef PJSUA_PUBLISH_EXPIRATION
1887# define PJSUA_PUBLISH_EXPIRATION 600
1888#endif
1889
1890
1891/**
Benny Prijono093d3022006-09-24 00:07:11 +00001892 * Default account priority.
1893 */
1894#ifndef PJSUA_DEFAULT_ACC_PRIORITY
1895# define PJSUA_DEFAULT_ACC_PRIORITY 0
1896#endif
1897
1898
1899/**
Benny Prijono8058a622007-06-08 04:37:05 +00001900 * This macro specifies the URI scheme to use in Contact header
1901 * when secure transport such as TLS is used. Application can specify
1902 * either "sip" or "sips".
1903 */
1904#ifndef PJSUA_SECURE_SCHEME
Benny Prijonocf0b4b22007-10-06 17:31:09 +00001905# define PJSUA_SECURE_SCHEME "sips"
Benny Prijono8058a622007-06-08 04:37:05 +00001906#endif
1907
1908
1909/**
Benny Prijonob5388cf2007-01-04 22:45:08 +00001910 * This structure describes account configuration to be specified when
1911 * adding a new account with #pjsua_acc_add(). Application MUST initialize
1912 * this structure first by calling #pjsua_acc_config_default().
Benny Prijonoe6ead542007-01-31 20:53:31 +00001913 *
1914 * \par Python:
1915 * The data type in Python is <tt>py_pjsua.Acc_Config</tt>, but normally
1916 * application can just use the snippet below to create and initialize
1917 * the account config:
1918 * \code
1919 acc_cfg = py_pjsua.acc_config_default()
1920 * \endcode
Benny Prijono312aff92006-06-17 04:08:30 +00001921 */
1922typedef struct pjsua_acc_config
1923{
Benny Prijono093d3022006-09-24 00:07:11 +00001924 /**
1925 * Account priority, which is used to control the order of matching
1926 * incoming/outgoing requests. The higher the number means the higher
1927 * the priority is, and the account will be matched first.
1928 */
1929 int priority;
1930
Benny Prijono312aff92006-06-17 04:08:30 +00001931 /**
1932 * The full SIP URL for the account. The value can take name address or
1933 * URL format, and will look something like "sip:account@serviceprovider".
1934 *
1935 * This field is mandatory.
1936 */
1937 pj_str_t id;
1938
1939 /**
1940 * This is the URL to be put in the request URI for the registration,
1941 * and will look something like "sip:serviceprovider".
1942 *
1943 * This field should be specified if registration is desired. If the
1944 * value is empty, no account registration will be performed.
1945 */
1946 pj_str_t reg_uri;
1947
Benny Prijono3a5e1ab2006-08-15 20:26:34 +00001948 /**
Benny Prijonob5388cf2007-01-04 22:45:08 +00001949 * If this flag is set, the presence information of this account will
1950 * be PUBLISH-ed to the server where the account belongs.
Benny Prijono48ab2b72007-11-08 09:24:30 +00001951 *
1952 * Default: PJ_FALSE
Benny Prijono3a5e1ab2006-08-15 20:26:34 +00001953 */
1954 pj_bool_t publish_enabled;
1955
Benny Prijonofe04fb52007-08-24 08:28:52 +00001956 /**
Benny Prijono48ab2b72007-11-08 09:24:30 +00001957 * Authentication preference.
1958 */
1959 pjsip_auth_clt_pref auth_pref;
1960
1961 /**
Benny Prijonofe04fb52007-08-24 08:28:52 +00001962 * Optional PIDF tuple ID for outgoing PUBLISH and NOTIFY. If this value
1963 * is not specified, a random string will be used.
1964 */
1965 pj_str_t pidf_tuple_id;
1966
Benny Prijono312aff92006-06-17 04:08:30 +00001967 /**
1968 * Optional URI to be put as Contact for this account. It is recommended
1969 * that this field is left empty, so that the value will be calculated
1970 * automatically based on the transport address.
1971 */
Benny Prijonob4a17c92006-07-10 14:40:21 +00001972 pj_str_t force_contact;
Benny Prijono312aff92006-06-17 04:08:30 +00001973
1974 /**
Benny Prijonodcfc0ba2007-09-30 16:50:27 +00001975 * Specify whether support for reliable provisional response (100rel and
1976 * PRACK) should be required for all sessions of this account.
1977 *
1978 * Default: PJ_FALSE
1979 */
1980 pj_bool_t require_100rel;
1981
1982 /**
Benny Prijono312aff92006-06-17 04:08:30 +00001983 * Number of proxies in the proxy array below.
Benny Prijonoe6ead542007-01-31 20:53:31 +00001984 *
1985 * \par Python:
1986 * Not applicable, as \a proxy is implemented as list of strings.
Benny Prijono312aff92006-06-17 04:08:30 +00001987 */
1988 unsigned proxy_cnt;
1989
1990 /**
1991 * Optional URI of the proxies to be visited for all outgoing requests
1992 * that are using this account (REGISTER, INVITE, etc). Application need
1993 * to specify these proxies if the service provider requires that requests
1994 * destined towards its network should go through certain proxies first
1995 * (for example, border controllers).
1996 *
1997 * These proxies will be put in the route set for this account, with
1998 * maintaining the orders (the first proxy in the array will be visited
Benny Prijonob5388cf2007-01-04 22:45:08 +00001999 * first). If global outbound proxies are configured in pjsua_config,
2000 * then these account proxies will be placed after the global outbound
2001 * proxies in the routeset.
Benny Prijonoe6ead542007-01-31 20:53:31 +00002002 *
2003 * \par Python:
2004 * This will be list of strings.
Benny Prijono312aff92006-06-17 04:08:30 +00002005 */
2006 pj_str_t proxy[PJSUA_ACC_MAX_PROXIES];
2007
2008 /**
2009 * Optional interval for registration, in seconds. If the value is zero,
Benny Prijonobddef2c2007-10-31 13:28:08 +00002010 * default interval will be used (PJSUA_REG_INTERVAL, 300 seconds).
Benny Prijono312aff92006-06-17 04:08:30 +00002011 */
2012 unsigned reg_timeout;
2013
2014 /**
2015 * Number of credentials in the credential array.
Benny Prijonoe6ead542007-01-31 20:53:31 +00002016 *
2017 * \par Python:
2018 * Not applicable, since \a cred_info is a list of credentials.
Benny Prijono312aff92006-06-17 04:08:30 +00002019 */
2020 unsigned cred_count;
2021
2022 /**
2023 * Array of credentials. If registration is desired, normally there should
2024 * be at least one credential specified, to successfully authenticate
2025 * against the service provider. More credentials can be specified, for
2026 * example when the requests are expected to be challenged by the
2027 * proxies in the route set.
Benny Prijonoe6ead542007-01-31 20:53:31 +00002028 *
2029 * \par Python:
2030 * This field is a list of credentials.
Benny Prijono312aff92006-06-17 04:08:30 +00002031 */
2032 pjsip_cred_info cred_info[PJSUA_ACC_MAX_PROXIES];
2033
Benny Prijono62c5c5b2007-01-13 23:22:40 +00002034 /**
2035 * Optionally bind this account to specific transport. This normally is
2036 * not a good idea, as account should be able to send requests using
2037 * any available transports according to the destination. But some
2038 * application may want to have explicit control over the transport to
2039 * use, so in that case it can set this field.
2040 *
2041 * Default: -1 (PJSUA_INVALID_ID)
2042 *
2043 * @see pjsua_acc_set_transport()
2044 */
2045 pjsua_transport_id transport_id;
2046
Benny Prijono15b02302007-09-27 14:07:07 +00002047 /**
Benny Prijonoe8554ef2008-03-22 09:33:52 +00002048 * This option is used to update the UDP transport address and the Contact
2049 * header of REGISTER request. When this option is enabled, the library
2050 * will keep track of the public IP address from the response of REGISTER
2051 * request. Once it detects that the address has changed, it will
2052 * unregister current Contact, update the Contact with transport address
2053 * learned from Via header, and register a new Contact to the registrar.
2054 * This will also update the public name of UDP transport if STUN is
2055 * configured.
Benny Prijono15b02302007-09-27 14:07:07 +00002056 *
2057 * Default: 1 (yes)
2058 */
Benny Prijonoe8554ef2008-03-22 09:33:52 +00002059 pj_bool_t allow_contact_rewrite;
Benny Prijono15b02302007-09-27 14:07:07 +00002060
Benny Prijonobddef2c2007-10-31 13:28:08 +00002061 /**
2062 * Set the interval for periodic keep-alive transmission for this account.
2063 * If this value is zero, keep-alive will be disabled for this account.
2064 * The keep-alive transmission will be sent to the registrar's address,
2065 * after successful registration.
2066 *
Benny Prijonobddef2c2007-10-31 13:28:08 +00002067 * Default: 15 (seconds)
2068 */
2069 unsigned ka_interval;
2070
2071 /**
2072 * Specify the data to be transmitted as keep-alive packets.
2073 *
2074 * Default: CR-LF
2075 */
2076 pj_str_t ka_data;
2077
Benny Prijonod8179652008-01-23 20:39:07 +00002078#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0)
2079 /**
2080 * Specify whether secure media transport should be used for this account.
2081 * Valid values are PJMEDIA_SRTP_DISABLED, PJMEDIA_SRTP_OPTIONAL, and
2082 * PJMEDIA_SRTP_MANDATORY.
2083 *
2084 * Default: #PJSUA_DEFAULT_USE_SRTP
2085 */
2086 pjmedia_srtp_use use_srtp;
2087
2088 /**
2089 * Specify whether SRTP requires secure signaling to be used. This option
2090 * is only used when \a use_srtp option above is non-zero.
2091 *
2092 * Valid values are:
2093 * 0: SRTP does not require secure signaling
2094 * 1: SRTP requires secure transport such as TLS
2095 * 2: SRTP requires secure end-to-end transport (SIPS)
2096 *
2097 * Default: #PJSUA_DEFAULT_SRTP_SECURE_SIGNALING
2098 */
2099 int srtp_secure_signaling;
2100#endif
2101
Benny Prijono312aff92006-06-17 04:08:30 +00002102} pjsua_acc_config;
2103
2104
2105/**
2106 * Call this function to initialize account config with default values.
2107 *
2108 * @param cfg The account config to be initialized.
Benny Prijonoe6ead542007-01-31 20:53:31 +00002109 *
2110 * \par Python:
2111 * In Python, this function both creates and initializes the account
2112 * config:
2113 * \code
2114 acc_cfg = py_pjsua.acc_config_default()
2115 * \endcode
Benny Prijono312aff92006-06-17 04:08:30 +00002116 */
Benny Prijono1f61a8f2007-08-16 10:11:44 +00002117PJ_DECL(void) pjsua_acc_config_default(pjsua_acc_config *cfg);
Benny Prijono312aff92006-06-17 04:08:30 +00002118
2119
2120/**
Benny Prijonobddef2c2007-10-31 13:28:08 +00002121 * Duplicate account config.
2122 *
2123 * @param pool Pool to be used for duplicating the config.
2124 * @param dst Destination configuration.
2125 * @param src Source configuration.
2126 */
2127PJ_DECL(void) pjsua_acc_config_dup(pj_pool_t *pool,
2128 pjsua_acc_config *dst,
2129 const pjsua_acc_config *src);
2130
2131
2132/**
Benny Prijono312aff92006-06-17 04:08:30 +00002133 * Account info. Application can query account info by calling
2134 * #pjsua_acc_get_info().
Benny Prijonoe6ead542007-01-31 20:53:31 +00002135 *
2136 * \par Python:
2137 * The data type in Python is <tt>py_pjsua.Acc_Info</tt>.
Benny Prijono312aff92006-06-17 04:08:30 +00002138 */
2139typedef struct pjsua_acc_info
2140{
2141 /**
2142 * The account ID.
2143 */
2144 pjsua_acc_id id;
2145
2146 /**
2147 * Flag to indicate whether this is the default account.
2148 */
2149 pj_bool_t is_default;
2150
2151 /**
2152 * Account URI
2153 */
2154 pj_str_t acc_uri;
2155
2156 /**
2157 * Flag to tell whether this account has registration setting
2158 * (reg_uri is not empty).
2159 */
2160 pj_bool_t has_registration;
2161
2162 /**
2163 * An up to date expiration interval for account registration session.
2164 */
2165 int expires;
2166
2167 /**
2168 * Last registration status code. If status code is zero, the account
2169 * is currently not registered. Any other value indicates the SIP
2170 * status code of the registration.
2171 */
2172 pjsip_status_code status;
2173
2174 /**
2175 * String describing the registration status.
2176 */
2177 pj_str_t status_text;
2178
2179 /**
2180 * Presence online status for this account.
2181 */
2182 pj_bool_t online_status;
2183
2184 /**
Benny Prijono4461c7d2007-08-25 13:36:15 +00002185 * Presence online status text.
2186 */
2187 pj_str_t online_status_text;
2188
2189 /**
2190 * Extended RPID online status information.
2191 */
2192 pjrpid_element rpid;
2193
2194 /**
Benny Prijono312aff92006-06-17 04:08:30 +00002195 * Buffer that is used internally to store the status text.
2196 */
2197 char buf_[PJ_ERR_MSG_SIZE];
2198
2199} pjsua_acc_info;
2200
2201
2202
2203/**
2204 * Get number of current accounts.
2205 *
2206 * @return Current number of accounts.
Benny Prijonoe6ead542007-01-31 20:53:31 +00002207 *
2208 * \par Python:
2209 * \code
2210 count = py_pjsua.acc_get_count()
2211 * \endcode
Benny Prijono312aff92006-06-17 04:08:30 +00002212 */
2213PJ_DECL(unsigned) pjsua_acc_get_count(void);
2214
2215
2216/**
2217 * Check if the specified account ID is valid.
2218 *
2219 * @param acc_id Account ID to check.
2220 *
2221 * @return Non-zero if account ID is valid.
Benny Prijonoe6ead542007-01-31 20:53:31 +00002222 *
2223 * \par Python:
2224 * \code
2225 is_valid = py_pjsua.acc_is_valid(acc_id)
2226 * \endcode
Benny Prijono312aff92006-06-17 04:08:30 +00002227 */
2228PJ_DECL(pj_bool_t) pjsua_acc_is_valid(pjsua_acc_id acc_id);
2229
2230
2231/**
Benny Prijono21b9ad92006-08-15 13:11:22 +00002232 * Set default account to be used when incoming and outgoing
2233 * requests doesn't match any accounts.
2234 *
2235 * @param acc_id The account ID to be used as default.
2236 *
2237 * @return PJ_SUCCESS on success.
Benny Prijonoe6ead542007-01-31 20:53:31 +00002238 *
2239 * \par Python:
2240 * \code
2241 status = py_pjsua.acc_set_default(acc_id)
2242 * \endcode
Benny Prijono21b9ad92006-08-15 13:11:22 +00002243 */
2244PJ_DECL(pj_status_t) pjsua_acc_set_default(pjsua_acc_id acc_id);
2245
2246
2247/**
Benny Prijonob5388cf2007-01-04 22:45:08 +00002248 * Get default account to be used when receiving incoming requests (calls),
2249 * when the destination of the incoming call doesn't match any other
2250 * accounts.
Benny Prijono21b9ad92006-08-15 13:11:22 +00002251 *
2252 * @return The default account ID, or PJSUA_INVALID_ID if no
2253 * default account is configured.
Benny Prijonoe6ead542007-01-31 20:53:31 +00002254 *
2255 * \par Python:
2256 * \code
2257 acc_id = py_pjsua.acc_get_default()
2258 * \endcode
Benny Prijono21b9ad92006-08-15 13:11:22 +00002259 */
2260PJ_DECL(pjsua_acc_id) pjsua_acc_get_default(void);
2261
2262
2263/**
Benny Prijono312aff92006-06-17 04:08:30 +00002264 * Add a new account to pjsua. PJSUA must have been initialized (with
Benny Prijonob5388cf2007-01-04 22:45:08 +00002265 * #pjsua_init()) before calling this function. If registration is configured
2266 * for this account, this function would also start the SIP registration
2267 * session with the SIP registrar server. This SIP registration session
2268 * will be maintained internally by the library, and application doesn't
2269 * need to do anything to maintain the registration session.
2270 *
Benny Prijono312aff92006-06-17 04:08:30 +00002271 *
Benny Prijonoe6ead542007-01-31 20:53:31 +00002272 * @param acc_cfg Account configuration.
Benny Prijono312aff92006-06-17 04:08:30 +00002273 * @param is_default If non-zero, this account will be set as the default
2274 * account. The default account will be used when sending
2275 * outgoing requests (e.g. making call) when no account is
2276 * specified, and when receiving incoming requests when the
2277 * request does not match any accounts. It is recommended
2278 * that default account is set to local/LAN account.
2279 * @param p_acc_id Pointer to receive account ID of the new account.
2280 *
2281 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00002282 *
2283 * \par Python:
2284 * The function returns (status, account_id) tuple:
2285 * \code
2286 status, account_id = py_pjsua.acc_add(acc_cfg, is_default)
2287 * \endcode
Benny Prijono312aff92006-06-17 04:08:30 +00002288 */
Benny Prijonoe6ead542007-01-31 20:53:31 +00002289PJ_DECL(pj_status_t) pjsua_acc_add(const pjsua_acc_config *acc_cfg,
Benny Prijono312aff92006-06-17 04:08:30 +00002290 pj_bool_t is_default,
2291 pjsua_acc_id *p_acc_id);
2292
2293
2294/**
2295 * Add a local account. A local account is used to identify local endpoint
2296 * instead of a specific user, and for this reason, a transport ID is needed
2297 * to obtain the local address information.
2298 *
2299 * @param tid Transport ID to generate account address.
2300 * @param is_default If non-zero, this account will be set as the default
2301 * account. The default account will be used when sending
2302 * outgoing requests (e.g. making call) when no account is
2303 * specified, and when receiving incoming requests when the
2304 * request does not match any accounts. It is recommended
2305 * that default account is set to local/LAN account.
2306 * @param p_acc_id Pointer to receive account ID of the new account.
2307 *
2308 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00002309 *
2310 * \par Python:
2311 * The function returns (status, account_id) tuple:
2312 * \code
2313 status, account_id = py_pjsua.acc_add_local(tid, is_default)
2314 * \endcode
Benny Prijono312aff92006-06-17 04:08:30 +00002315 */
2316PJ_DECL(pj_status_t) pjsua_acc_add_local(pjsua_transport_id tid,
2317 pj_bool_t is_default,
2318 pjsua_acc_id *p_acc_id);
2319
2320/**
Benny Prijonob5388cf2007-01-04 22:45:08 +00002321 * Delete an account. This will unregister the account from the SIP server,
2322 * if necessary, and terminate server side presence subscriptions associated
2323 * with this account.
Benny Prijono312aff92006-06-17 04:08:30 +00002324 *
2325 * @param acc_id Id of the account to be deleted.
2326 *
2327 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00002328 *
2329 * \par Python:
2330 * \code
2331 status = py_pjsua.acc_del(acc_id)
2332 * \endcode
Benny Prijono312aff92006-06-17 04:08:30 +00002333 */
2334PJ_DECL(pj_status_t) pjsua_acc_del(pjsua_acc_id acc_id);
2335
2336
2337/**
2338 * Modify account information.
2339 *
2340 * @param acc_id Id of the account to be modified.
Benny Prijonoe6ead542007-01-31 20:53:31 +00002341 * @param acc_cfg New account configuration.
Benny Prijono312aff92006-06-17 04:08:30 +00002342 *
2343 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00002344 *
2345 * \par Python:
2346 * \code
2347 status = py_pjsua.acc_modify(acc_id, acc_cfg)
2348 * \endcode
Benny Prijono312aff92006-06-17 04:08:30 +00002349 */
2350PJ_DECL(pj_status_t) pjsua_acc_modify(pjsua_acc_id acc_id,
Benny Prijonoe6ead542007-01-31 20:53:31 +00002351 const pjsua_acc_config *acc_cfg);
Benny Prijono312aff92006-06-17 04:08:30 +00002352
2353
2354/**
2355 * Modify account's presence status to be advertised to remote/presence
Benny Prijonob5388cf2007-01-04 22:45:08 +00002356 * subscribers. This would trigger the sending of outgoing NOTIFY request
Benny Prijono4461c7d2007-08-25 13:36:15 +00002357 * if there are server side presence subscription for this account, and/or
2358 * outgoing PUBLISH if presence publication is enabled for this account.
2359 *
2360 * @see pjsua_acc_set_online_status2()
Benny Prijono312aff92006-06-17 04:08:30 +00002361 *
2362 * @param acc_id The account ID.
2363 * @param is_online True of false.
2364 *
2365 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00002366 *
2367 * \par Python:
2368 * \code
2369 status = py_pjsua.acc_set_online_status(acc_id, is_online)
2370 * \endcode
Benny Prijono312aff92006-06-17 04:08:30 +00002371 */
2372PJ_DECL(pj_status_t) pjsua_acc_set_online_status(pjsua_acc_id acc_id,
2373 pj_bool_t is_online);
2374
Benny Prijono4461c7d2007-08-25 13:36:15 +00002375/**
2376 * Modify account's presence status to be advertised to remote/presence
2377 * subscribers. This would trigger the sending of outgoing NOTIFY request
2378 * if there are server side presence subscription for this account, and/or
2379 * outgoing PUBLISH if presence publication is enabled for this account.
2380 *
2381 * @see pjsua_acc_set_online_status()
2382 *
2383 * @param acc_id The account ID.
2384 * @param is_online True of false.
2385 * @param pr Extended information in subset of RPID format
2386 * which allows setting custom presence text.
2387 *
2388 * @return PJ_SUCCESS on success, or the appropriate error code.
2389 */
2390PJ_DECL(pj_status_t) pjsua_acc_set_online_status2(pjsua_acc_id acc_id,
2391 pj_bool_t is_online,
2392 const pjrpid_element *pr);
Benny Prijono312aff92006-06-17 04:08:30 +00002393
2394/**
Benny Prijonob5388cf2007-01-04 22:45:08 +00002395 * Update registration or perform unregistration. If registration is
2396 * configured for this account, then initial SIP REGISTER will be sent
2397 * when the account is added with #pjsua_acc_add(). Application normally
2398 * only need to call this function if it wants to manually update the
2399 * registration or to unregister from the server.
Benny Prijono312aff92006-06-17 04:08:30 +00002400 *
2401 * @param acc_id The account ID.
2402 * @param renew If renew argument is zero, this will start
2403 * unregistration process.
2404 *
2405 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00002406 *
2407 * \par Python:
2408 * \code
2409 status = py_pjsua.acc_set_registration(acc_id, renew)
2410 * \endcode
Benny Prijono312aff92006-06-17 04:08:30 +00002411 */
2412PJ_DECL(pj_status_t) pjsua_acc_set_registration(pjsua_acc_id acc_id,
2413 pj_bool_t renew);
2414
2415
2416/**
Benny Prijonob5388cf2007-01-04 22:45:08 +00002417 * Get information about the specified account.
Benny Prijono312aff92006-06-17 04:08:30 +00002418 *
2419 * @param acc_id Account identification.
2420 * @param info Pointer to receive account information.
2421 *
2422 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00002423 *
2424 * \par Python:
2425 * \code
2426 acc_info = py_pjsua.acc_get_info(acc_id)
2427 * \endcode
2428 * The function returns None if account ID is not valid.
Benny Prijono312aff92006-06-17 04:08:30 +00002429 */
2430PJ_DECL(pj_status_t) pjsua_acc_get_info(pjsua_acc_id acc_id,
2431 pjsua_acc_info *info);
2432
2433
2434/**
Benny Prijonob5388cf2007-01-04 22:45:08 +00002435 * Enumerate all account currently active in the library. This will fill
2436 * the array with the account Ids, and application can then query the
2437 * account information for each id with #pjsua_acc_get_info().
2438 *
2439 * @see pjsua_acc_enum_info().
Benny Prijono312aff92006-06-17 04:08:30 +00002440 *
2441 * @param ids Array of account IDs to be initialized.
2442 * @param count In input, specifies the maximum number of elements.
2443 * On return, it contains the actual number of elements.
2444 *
2445 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00002446 *
2447 * \par Python:
2448 * The function takes no argument and returns list of account Ids:
2449 * \code
2450 [acc_ids] = py_pjsua.enum_accs()
2451 * \endcode
Benny Prijono312aff92006-06-17 04:08:30 +00002452 */
2453PJ_DECL(pj_status_t) pjsua_enum_accs(pjsua_acc_id ids[],
2454 unsigned *count );
2455
2456
2457/**
Benny Prijonob5388cf2007-01-04 22:45:08 +00002458 * Enumerate account informations.
Benny Prijono312aff92006-06-17 04:08:30 +00002459 *
2460 * @param info Array of account infos to be initialized.
2461 * @param count In input, specifies the maximum number of elements.
2462 * On return, it contains the actual number of elements.
2463 *
2464 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00002465 *
2466 * \par Python:
2467 * The function takes no argument and returns list of account infos:
2468 * \code
2469 [acc_info] = py_pjsua.acc_enum_info()
2470 * \endcode
Benny Prijono312aff92006-06-17 04:08:30 +00002471 */
2472PJ_DECL(pj_status_t) pjsua_acc_enum_info( pjsua_acc_info info[],
2473 unsigned *count );
2474
2475
2476/**
2477 * This is an internal function to find the most appropriate account to
2478 * used to reach to the specified URL.
2479 *
2480 * @param url The remote URL to reach.
2481 *
2482 * @return Account id.
Benny Prijonoe6ead542007-01-31 20:53:31 +00002483 *
2484 * \par Python:
2485 * \code
2486 acc_id = py_pjsua.acc_find_for_outgoing(url)
2487 * \endcode
Benny Prijono312aff92006-06-17 04:08:30 +00002488 */
2489PJ_DECL(pjsua_acc_id) pjsua_acc_find_for_outgoing(const pj_str_t *url);
2490
2491
2492/**
2493 * This is an internal function to find the most appropriate account to be
2494 * used to handle incoming calls.
2495 *
2496 * @param rdata The incoming request message.
2497 *
2498 * @return Account id.
Benny Prijonoe6ead542007-01-31 20:53:31 +00002499 *
2500 * \par Python:
2501 * \code
2502 acc_id = py_pjsua.acc_find_for_outgoing(url)
2503 * \endcode
Benny Prijono312aff92006-06-17 04:08:30 +00002504 */
2505PJ_DECL(pjsua_acc_id) pjsua_acc_find_for_incoming(pjsip_rx_data *rdata);
2506
2507
Benny Prijonoc570f2d2006-07-18 00:33:02 +00002508/**
Benny Prijonofff245c2007-04-02 11:44:47 +00002509 * Create arbitrary requests using the account. Application should only use
2510 * this function to create auxiliary requests outside dialog, such as
2511 * OPTIONS, and use the call or presence API to create dialog related
2512 * requests.
2513 *
2514 * @param acc_id The account ID.
2515 * @param method The SIP method of the request.
2516 * @param target Target URI.
2517 * @param p_tdata Pointer to receive the request.
2518 *
2519 * @return PJ_SUCCESS or the error code.
2520 */
2521PJ_DECL(pj_status_t) pjsua_acc_create_request(pjsua_acc_id acc_id,
2522 const pjsip_method *method,
2523 const pj_str_t *target,
2524 pjsip_tx_data **p_tdata);
2525
2526
2527/**
Benny Prijonoc570f2d2006-07-18 00:33:02 +00002528 * Create a suitable URI to be put as Contact based on the specified
2529 * target URI for the specified account.
2530 *
2531 * @param pool Pool to allocate memory for the string.
2532 * @param contact The string where the Contact URI will be stored.
2533 * @param acc_id Account ID.
2534 * @param uri Destination URI of the request.
2535 *
2536 * @return PJ_SUCCESS on success, other on error.
Benny Prijonoe6ead542007-01-31 20:53:31 +00002537 *
2538 * \par Python:
2539 * This function is still experimental in Python:
2540 * \code
2541 uri = py_pjsua.acc_create_uac_contact(pool, acc_id, uri)
2542 * \endcode
Benny Prijonoc570f2d2006-07-18 00:33:02 +00002543 */
2544PJ_DECL(pj_status_t) pjsua_acc_create_uac_contact( pj_pool_t *pool,
2545 pj_str_t *contact,
2546 pjsua_acc_id acc_id,
2547 const pj_str_t *uri);
2548
2549
2550
2551/**
2552 * Create a suitable URI to be put as Contact based on the information
2553 * in the incoming request.
2554 *
2555 * @param pool Pool to allocate memory for the string.
2556 * @param contact The string where the Contact URI will be stored.
2557 * @param acc_id Account ID.
2558 * @param rdata Incoming request.
2559 *
2560 * @return PJ_SUCCESS on success, other on error.
Benny Prijonoe6ead542007-01-31 20:53:31 +00002561 *
2562 * \par Python:
2563 * This function is still experimental in Python:
2564 * \code
2565 uri = py_pjsua.acc_create_uas_contact(pool, acc_id, rdata)
2566 * \endcode
Benny Prijonoc570f2d2006-07-18 00:33:02 +00002567 */
2568PJ_DECL(pj_status_t) pjsua_acc_create_uas_contact( pj_pool_t *pool,
2569 pj_str_t *contact,
2570 pjsua_acc_id acc_id,
2571 pjsip_rx_data *rdata );
2572
2573
Benny Prijono62c5c5b2007-01-13 23:22:40 +00002574/**
2575 * Lock/bind this account to a specific transport/listener. Normally
2576 * application shouldn't need to do this, as transports will be selected
2577 * automatically by the stack according to the destination.
2578 *
2579 * When account is locked/bound to a specific transport, all outgoing
2580 * requests from this account will use the specified transport (this
2581 * includes SIP registration, dialog (call and event subscription), and
2582 * out-of-dialog requests such as MESSAGE).
2583 *
2584 * Note that transport_id may be specified in pjsua_acc_config too.
2585 *
2586 * @param acc_id The account ID.
2587 * @param tp_id The transport ID.
2588 *
2589 * @return PJ_SUCCESS on success.
Benny Prijonoe6ead542007-01-31 20:53:31 +00002590 *
2591 * \par Python:
2592 * Not yet implemented.
Benny Prijono62c5c5b2007-01-13 23:22:40 +00002593 */
2594PJ_DECL(pj_status_t) pjsua_acc_set_transport(pjsua_acc_id acc_id,
2595 pjsua_transport_id tp_id);
2596
Benny Prijono312aff92006-06-17 04:08:30 +00002597
2598/**
2599 * @}
2600 */
2601
2602
2603/*****************************************************************************
2604 * CALLS API
2605 */
2606
2607
2608/**
Benny Prijonoe6ead542007-01-31 20:53:31 +00002609 * @defgroup PJSUA_LIB_CALL PJSUA-API Calls Management
Benny Prijono312aff92006-06-17 04:08:30 +00002610 * @ingroup PJSUA_LIB
2611 * @brief Call manipulation.
2612 * @{
2613 */
2614
2615/**
Benny Prijonob5388cf2007-01-04 22:45:08 +00002616 * Maximum simultaneous calls.
Benny Prijono312aff92006-06-17 04:08:30 +00002617 */
2618#ifndef PJSUA_MAX_CALLS
2619# define PJSUA_MAX_CALLS 32
2620#endif
2621
2622
2623
2624/**
Benny Prijonob5388cf2007-01-04 22:45:08 +00002625 * This enumeration specifies the media status of a call, and it's part
2626 * of pjsua_call_info structure.
Benny Prijono312aff92006-06-17 04:08:30 +00002627 */
2628typedef enum pjsua_call_media_status
2629{
Benny Prijonob5388cf2007-01-04 22:45:08 +00002630 /** Call currently has no media */
Benny Prijono312aff92006-06-17 04:08:30 +00002631 PJSUA_CALL_MEDIA_NONE,
Benny Prijonob5388cf2007-01-04 22:45:08 +00002632
2633 /** The media is active */
Benny Prijono312aff92006-06-17 04:08:30 +00002634 PJSUA_CALL_MEDIA_ACTIVE,
Benny Prijonob5388cf2007-01-04 22:45:08 +00002635
2636 /** The media is currently put on hold by local endpoint */
Benny Prijono312aff92006-06-17 04:08:30 +00002637 PJSUA_CALL_MEDIA_LOCAL_HOLD,
Benny Prijonob5388cf2007-01-04 22:45:08 +00002638
2639 /** The media is currently put on hold by remote endpoint */
Benny Prijono312aff92006-06-17 04:08:30 +00002640 PJSUA_CALL_MEDIA_REMOTE_HOLD,
Benny Prijonob5388cf2007-01-04 22:45:08 +00002641
Benny Prijono096c56c2007-09-15 08:30:16 +00002642 /** The media has reported error (e.g. ICE negotiation) */
2643 PJSUA_CALL_MEDIA_ERROR
2644
Benny Prijono312aff92006-06-17 04:08:30 +00002645} pjsua_call_media_status;
2646
2647
2648/**
Benny Prijonob5388cf2007-01-04 22:45:08 +00002649 * This structure describes the information and current status of a call.
Benny Prijonoe6ead542007-01-31 20:53:31 +00002650 *
2651 * \par Python:
2652 * The type name is <tt>py_pjsua.Call_Info</tt>.
Benny Prijono312aff92006-06-17 04:08:30 +00002653 */
2654typedef struct pjsua_call_info
2655{
2656 /** Call identification. */
2657 pjsua_call_id id;
2658
2659 /** Initial call role (UAC == caller) */
2660 pjsip_role_e role;
2661
Benny Prijono90315512006-09-14 16:05:16 +00002662 /** The account ID where this call belongs. */
2663 pjsua_acc_id acc_id;
2664
Benny Prijono312aff92006-06-17 04:08:30 +00002665 /** Local URI */
2666 pj_str_t local_info;
2667
2668 /** Local Contact */
2669 pj_str_t local_contact;
2670
2671 /** Remote URI */
2672 pj_str_t remote_info;
2673
2674 /** Remote contact */
2675 pj_str_t remote_contact;
2676
2677 /** Dialog Call-ID string. */
2678 pj_str_t call_id;
2679
2680 /** Call state */
2681 pjsip_inv_state state;
2682
2683 /** Text describing the state */
2684 pj_str_t state_text;
2685
2686 /** Last status code heard, which can be used as cause code */
2687 pjsip_status_code last_status;
2688
2689 /** The reason phrase describing the status. */
2690 pj_str_t last_status_text;
2691
2692 /** Call media status. */
2693 pjsua_call_media_status media_status;
2694
2695 /** Media direction */
2696 pjmedia_dir media_dir;
2697
2698 /** The conference port number for the call */
2699 pjsua_conf_port_id conf_slot;
2700
2701 /** Up-to-date call connected duration (zero when call is not
2702 * established)
2703 */
2704 pj_time_val connect_duration;
2705
2706 /** Total call duration, including set-up time */
2707 pj_time_val total_duration;
2708
2709 /** Internal */
2710 struct {
2711 char local_info[128];
2712 char local_contact[128];
2713 char remote_info[128];
2714 char remote_contact[128];
2715 char call_id[128];
2716 char last_status_text[128];
2717 } buf_;
2718
2719} pjsua_call_info;
2720
2721
2722
Benny Prijonoa91a0032006-02-26 21:23:45 +00002723/**
Benny Prijono9fc735d2006-05-28 14:58:12 +00002724 * Get maximum number of calls configured in pjsua.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00002725 *
2726 * @return Maximum number of calls configured.
Benny Prijonoe6ead542007-01-31 20:53:31 +00002727 *
2728 * \par Python:
2729 * \code
2730 count = py_pjsua.call_get_max_count()
2731 * \endcode
Benny Prijono9fc735d2006-05-28 14:58:12 +00002732 */
Benny Prijono8b1889b2006-06-06 18:40:40 +00002733PJ_DECL(unsigned) pjsua_call_get_max_count(void);
Benny Prijono9fc735d2006-05-28 14:58:12 +00002734
2735/**
Benny Prijonoeebe9af2006-06-13 22:57:13 +00002736 * Get number of currently active calls.
2737 *
2738 * @return Number of currently active calls.
Benny Prijonoe6ead542007-01-31 20:53:31 +00002739 *
2740 * \par Python:
2741 * \code
2742 count = py_pjsua.call_get_count()
2743 * \endcode
Benny Prijono9fc735d2006-05-28 14:58:12 +00002744 */
Benny Prijono8b1889b2006-06-06 18:40:40 +00002745PJ_DECL(unsigned) pjsua_call_get_count(void);
Benny Prijono9fc735d2006-05-28 14:58:12 +00002746
2747/**
Benny Prijonob5388cf2007-01-04 22:45:08 +00002748 * Enumerate all active calls. Application may then query the information and
2749 * state of each call by calling #pjsua_call_get_info().
Benny Prijonoeebe9af2006-06-13 22:57:13 +00002750 *
2751 * @param ids Array of account IDs to be initialized.
2752 * @param count In input, specifies the maximum number of elements.
2753 * On return, it contains the actual number of elements.
2754 *
2755 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00002756 *
2757 * \par Python:
2758 * This function takes no argument and return list of call Ids.
2759 * \code
2760 [call_ids] = py_pjsua.enum_calls()
2761 * \endcode
Benny Prijonoeebe9af2006-06-13 22:57:13 +00002762 */
2763PJ_DECL(pj_status_t) pjsua_enum_calls(pjsua_call_id ids[],
2764 unsigned *count);
2765
2766
2767/**
2768 * Make outgoing call to the specified URI using the specified account.
2769 *
2770 * @param acc_id The account to be used.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00002771 * @param dst_uri URI to be put in the To header (normally is the same
2772 * as the target URI).
2773 * @param options Options (must be zero at the moment).
2774 * @param user_data Arbitrary user data to be attached to the call, and
2775 * can be retrieved later.
2776 * @param msg_data Optional headers etc to be added to outgoing INVITE
2777 * request, or NULL if no custom header is desired.
2778 * @param p_call_id Pointer to receive call identification.
2779 *
2780 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00002781 *
2782 * \par Python:
2783 * The Python function returns (status, call_id) tuple:
2784 * \code
2785 status, call_id = py_pjsua.call_make_call(acc_id, dst_uri, options,
2786 user_data, msg_data)
2787 * \endcode
2788 * Note: the \a user_data in Python function is an integer, and the
2789 * \a msg_data can be set to None if not required.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00002790 */
2791PJ_DECL(pj_status_t) pjsua_call_make_call(pjsua_acc_id acc_id,
2792 const pj_str_t *dst_uri,
2793 unsigned options,
2794 void *user_data,
2795 const pjsua_msg_data *msg_data,
2796 pjsua_call_id *p_call_id);
2797
2798
2799/**
Benny Prijono9fc735d2006-05-28 14:58:12 +00002800 * Check if the specified call has active INVITE session and the INVITE
2801 * session has not been disconnected.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00002802 *
2803 * @param call_id Call identification.
2804 *
2805 * @return Non-zero if call is active.
Benny Prijonoe6ead542007-01-31 20:53:31 +00002806 *
2807 * \par Python:
2808 * \code
2809 bool = py_pjsua.call_is_active(call_id)
2810 * \endcode
Benny Prijono9fc735d2006-05-28 14:58:12 +00002811 */
Benny Prijonoeebe9af2006-06-13 22:57:13 +00002812PJ_DECL(pj_bool_t) pjsua_call_is_active(pjsua_call_id call_id);
Benny Prijono9fc735d2006-05-28 14:58:12 +00002813
2814
2815/**
Benny Prijonoeebe9af2006-06-13 22:57:13 +00002816 * Check if call has an active media session.
2817 *
2818 * @param call_id Call identification.
2819 *
2820 * @return Non-zero if yes.
Benny Prijonoe6ead542007-01-31 20:53:31 +00002821 *
2822 * \par Python:
2823 * \code
2824 bool = py_pjsua.call_has_media(call_id)
2825 * \endcode
Benny Prijono9fc735d2006-05-28 14:58:12 +00002826 */
Benny Prijonoeebe9af2006-06-13 22:57:13 +00002827PJ_DECL(pj_bool_t) pjsua_call_has_media(pjsua_call_id call_id);
Benny Prijono9fc735d2006-05-28 14:58:12 +00002828
2829
2830/**
Benny Prijonoeebe9af2006-06-13 22:57:13 +00002831 * Get the conference port identification associated with the call.
2832 *
2833 * @param call_id Call identification.
2834 *
2835 * @return Conference port ID, or PJSUA_INVALID_ID when the
2836 * media has not been established or is not active.
Benny Prijonoe6ead542007-01-31 20:53:31 +00002837 *
2838 * \par Python:
2839 * \code
2840 slot = py_pjsua.call_get_conf_port(call_id)
2841 * \endcode
Benny Prijono9fc735d2006-05-28 14:58:12 +00002842 */
Benny Prijonoeebe9af2006-06-13 22:57:13 +00002843PJ_DECL(pjsua_conf_port_id) pjsua_call_get_conf_port(pjsua_call_id call_id);
2844
2845/**
2846 * Obtain detail information about the specified call.
2847 *
2848 * @param call_id Call identification.
2849 * @param info Call info to be initialized.
2850 *
2851 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00002852 *
2853 * \par Python:
2854 * \code
2855 call_info = py_pjsua.call_get_info(call_id)
2856 * \endcode
2857 * \a call_info return value will be set to None if call_id is not valid.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00002858 */
2859PJ_DECL(pj_status_t) pjsua_call_get_info(pjsua_call_id call_id,
Benny Prijono9fc735d2006-05-28 14:58:12 +00002860 pjsua_call_info *info);
2861
2862
2863/**
Benny Prijonob5388cf2007-01-04 22:45:08 +00002864 * Attach application specific data to the call. Application can then
2865 * inspect this data by calling #pjsua_call_get_user_data().
Benny Prijonoeebe9af2006-06-13 22:57:13 +00002866 *
2867 * @param call_id Call identification.
2868 * @param user_data Arbitrary data to be attached to the call.
2869 *
2870 * @return The user data.
Benny Prijonoe6ead542007-01-31 20:53:31 +00002871 *
2872 * \par Python:
2873 * \code
2874 status = py_pjsua.call_set_user_data(call_id, user_data)
2875 * \endcode
2876 * The \a user_data is an integer in the Python function.
Benny Prijono9fc735d2006-05-28 14:58:12 +00002877 */
Benny Prijonoeebe9af2006-06-13 22:57:13 +00002878PJ_DECL(pj_status_t) pjsua_call_set_user_data(pjsua_call_id call_id,
2879 void *user_data);
Benny Prijono9fc735d2006-05-28 14:58:12 +00002880
2881
2882/**
Benny Prijonob5388cf2007-01-04 22:45:08 +00002883 * Get user data attached to the call, which has been previously set with
2884 * #pjsua_call_set_user_data().
Benny Prijonoeebe9af2006-06-13 22:57:13 +00002885 *
2886 * @param call_id Call identification.
2887 *
2888 * @return The user data.
Benny Prijonoe6ead542007-01-31 20:53:31 +00002889 *
2890 * \par Python:
2891 * \code
2892 user_data = py_pjsua.call_get_user_data(call_id)
2893 * \endcode
2894 * The \a user_data is an integer.
Benny Prijono268ca612006-02-07 12:34:11 +00002895 */
Benny Prijonoeebe9af2006-06-13 22:57:13 +00002896PJ_DECL(void*) pjsua_call_get_user_data(pjsua_call_id call_id);
Benny Prijono84126ab2006-02-09 09:30:09 +00002897
2898
2899/**
Benny Prijono91a6a172007-10-31 08:59:29 +00002900 * Get the NAT type of remote's endpoint. This is a proprietary feature
2901 * of PJSUA-LIB which sends its NAT type in the SDP when \a nat_type_in_sdp
2902 * is set in #pjsua_config.
2903 *
2904 * This function can only be called after SDP has been received from remote,
2905 * which means for incoming call, this function can be called as soon as
2906 * call is received as long as incoming call contains SDP, and for outgoing
2907 * call, this function can be called only after SDP is received (normally in
2908 * 200/OK response to INVITE). As a general case, application should call
2909 * this function after or in \a on_call_media_state() callback.
2910 *
2911 * @param call_id Call identification.
2912 * @param p_type Pointer to store the NAT type. Application can then
2913 * retrieve the string description of the NAT type
2914 * by calling pj_stun_get_nat_name().
2915 *
2916 * @return PJ_SUCCESS on success.
2917 *
2918 * @see pjsua_get_nat_type(), nat_type_in_sdp
2919 */
2920PJ_DECL(pj_status_t) pjsua_call_get_rem_nat_type(pjsua_call_id call_id,
2921 pj_stun_nat_type *p_type);
2922
2923/**
Benny Prijonob5388cf2007-01-04 22:45:08 +00002924 * Send response to incoming INVITE request. Depending on the status
2925 * code specified as parameter, this function may send provisional
2926 * response, establish the call, or terminate the call.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00002927 *
2928 * @param call_id Incoming call identification.
2929 * @param code Status code, (100-699).
2930 * @param reason Optional reason phrase. If NULL, default text
2931 * will be used.
2932 * @param msg_data Optional list of headers etc to be added to outgoing
2933 * response message.
2934 *
2935 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00002936 *
2937 * \par Python:
2938 * \code
2939 status = py_pjsua.call_answer(call_id, code, reason, msg_data)
2940 * \endcode
2941 * Arguments \a reason and \a msg_data may be set to None if not required.
Benny Prijonoa91a0032006-02-26 21:23:45 +00002942 */
Benny Prijonoeebe9af2006-06-13 22:57:13 +00002943PJ_DECL(pj_status_t) pjsua_call_answer(pjsua_call_id call_id,
2944 unsigned code,
2945 const pj_str_t *reason,
2946 const pjsua_msg_data *msg_data);
Benny Prijonoa91a0032006-02-26 21:23:45 +00002947
2948/**
Benny Prijonoeebe9af2006-06-13 22:57:13 +00002949 * Hangup call by using method that is appropriate according to the
Benny Prijonob5388cf2007-01-04 22:45:08 +00002950 * call state. This function is different than answering the call with
2951 * 3xx-6xx response (with #pjsua_call_answer()), in that this function
2952 * will hangup the call regardless of the state and role of the call,
2953 * while #pjsua_call_answer() only works with incoming calls on EARLY
2954 * state.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00002955 *
2956 * @param call_id Call identification.
2957 * @param code Optional status code to be sent when we're rejecting
2958 * incoming call. If the value is zero, "603/Decline"
2959 * will be sent.
2960 * @param reason Optional reason phrase to be sent when we're rejecting
2961 * incoming call. If NULL, default text will be used.
2962 * @param msg_data Optional list of headers etc to be added to outgoing
2963 * request/response message.
2964 *
2965 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00002966 *
2967 * \par Python:
2968 * \code
2969 status = py_pjsua.call_hangup(call_id, code, reason, msg_data)
2970 * \endcode
2971 * Arguments \a reason and \a msg_data may be set to None if not required.
Benny Prijono26ff9062006-02-21 23:47:00 +00002972 */
Benny Prijonoeebe9af2006-06-13 22:57:13 +00002973PJ_DECL(pj_status_t) pjsua_call_hangup(pjsua_call_id call_id,
2974 unsigned code,
2975 const pj_str_t *reason,
2976 const pjsua_msg_data *msg_data);
Benny Prijono26ff9062006-02-21 23:47:00 +00002977
2978
2979/**
Benny Prijonob5388cf2007-01-04 22:45:08 +00002980 * Put the specified call on hold. This will send re-INVITE with the
2981 * appropriate SDP to inform remote that the call is being put on hold.
2982 * The final status of the request itself will be reported on the
2983 * \a on_call_media_state() callback, which inform the application that
2984 * the media state of the call has changed.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00002985 *
2986 * @param call_id Call identification.
2987 * @param msg_data Optional message components to be sent with
2988 * the request.
2989 *
2990 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00002991 *
2992 * \par Python:
2993 * \code
2994 status = py_pjsua.call_set_hold(call_id, msg_data)
2995 * \endcode
2996 * Argument \a msg_data may be set to None if not required.
Benny Prijono26ff9062006-02-21 23:47:00 +00002997 */
Benny Prijonoeebe9af2006-06-13 22:57:13 +00002998PJ_DECL(pj_status_t) pjsua_call_set_hold(pjsua_call_id call_id,
2999 const pjsua_msg_data *msg_data);
Benny Prijono26ff9062006-02-21 23:47:00 +00003000
3001
3002/**
Benny Prijonob5388cf2007-01-04 22:45:08 +00003003 * Send re-INVITE to release hold.
3004 * The final status of the request itself will be reported on the
3005 * \a on_call_media_state() callback, which inform the application that
3006 * the media state of the call has changed.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00003007 *
3008 * @param call_id Call identification.
3009 * @param unhold If this argument is non-zero and the call is locally
3010 * held, this will release the local hold.
3011 * @param msg_data Optional message components to be sent with
3012 * the request.
3013 *
3014 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00003015 *
3016 * \par Python:
3017 * \code
3018 status = py_pjsua.call_reinvite(call_id, unhold, msg_data)
3019 * \endcode
3020 * Argument \a msg_data may be set to None if not required.
Benny Prijono26ff9062006-02-21 23:47:00 +00003021 */
Benny Prijonoeebe9af2006-06-13 22:57:13 +00003022PJ_DECL(pj_status_t) pjsua_call_reinvite(pjsua_call_id call_id,
3023 pj_bool_t unhold,
3024 const pjsua_msg_data *msg_data);
Benny Prijono26ff9062006-02-21 23:47:00 +00003025
Benny Prijonoc08682e2007-10-04 06:17:58 +00003026/**
3027 * Send UPDATE request.
3028 *
3029 * @param call_id Call identification.
3030 * @param options Must be zero for now.
3031 * @param msg_data Optional message components to be sent with
3032 * the request.
3033 *
3034 * @return PJ_SUCCESS on success, or the appropriate error code.
3035 */
3036PJ_DECL(pj_status_t) pjsua_call_update(pjsua_call_id call_id,
3037 unsigned options,
3038 const pjsua_msg_data *msg_data);
Benny Prijono26ff9062006-02-21 23:47:00 +00003039
3040/**
Benny Prijono053f5222006-11-11 16:16:04 +00003041 * Initiate call transfer to the specified address. This function will send
3042 * REFER request to instruct remote call party to initiate a new INVITE
3043 * session to the specified destination/target.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00003044 *
Benny Prijonob5388cf2007-01-04 22:45:08 +00003045 * If application is interested to monitor the successfulness and
3046 * the progress of the transfer request, it can implement
3047 * \a on_call_transfer_status() callback which will report the progress
3048 * of the call transfer request.
3049 *
Benny Prijono053f5222006-11-11 16:16:04 +00003050 * @param call_id The call id to be transfered.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00003051 * @param dest Address of new target to be contacted.
3052 * @param msg_data Optional message components to be sent with
3053 * the request.
3054 *
3055 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00003056 *
3057 * \par Python:
3058 * \code
3059 status = py_pjsua.call_xfer(call_id, dest, msg_data)
3060 * \endcode
3061 * Argument \a msg_data may be set to None if not required.
Benny Prijono26ff9062006-02-21 23:47:00 +00003062 */
Benny Prijonoeebe9af2006-06-13 22:57:13 +00003063PJ_DECL(pj_status_t) pjsua_call_xfer(pjsua_call_id call_id,
3064 const pj_str_t *dest,
3065 const pjsua_msg_data *msg_data);
Benny Prijono9fc735d2006-05-28 14:58:12 +00003066
3067/**
Benny Prijono053f5222006-11-11 16:16:04 +00003068 * Flag to indicate that "Require: replaces" should not be put in the
3069 * outgoing INVITE request caused by REFER request created by
3070 * #pjsua_call_xfer_replaces().
3071 */
3072#define PJSUA_XFER_NO_REQUIRE_REPLACES 1
3073
3074/**
3075 * Initiate attended call transfer. This function will send REFER request
3076 * to instruct remote call party to initiate new INVITE session to the URL
3077 * of \a dest_call_id. The party at \a dest_call_id then should "replace"
3078 * the call with us with the new call from the REFER recipient.
3079 *
3080 * @param call_id The call id to be transfered.
3081 * @param dest_call_id The call id to be replaced.
3082 * @param options Application may specify PJSUA_XFER_NO_REQUIRE_REPLACES
3083 * to suppress the inclusion of "Require: replaces" in
3084 * the outgoing INVITE request created by the REFER
3085 * request.
3086 * @param msg_data Optional message components to be sent with
3087 * the request.
3088 *
3089 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00003090 *
3091 * \par Python:
3092 * \code
3093 status = py_pjsua.call_xfer_replaces(call_id, dest_call_id, options, msg_data)
3094 * \endcode
3095 * Argument \a msg_data may be set to None if not required.
Benny Prijono053f5222006-11-11 16:16:04 +00003096 */
3097PJ_DECL(pj_status_t) pjsua_call_xfer_replaces(pjsua_call_id call_id,
3098 pjsua_call_id dest_call_id,
3099 unsigned options,
3100 const pjsua_msg_data *msg_data);
3101
3102/**
Benny Prijonoeebe9af2006-06-13 22:57:13 +00003103 * Send DTMF digits to remote using RFC 2833 payload formats.
3104 *
3105 * @param call_id Call identification.
Benny Prijonoe6ead542007-01-31 20:53:31 +00003106 * @param digits DTMF string digits to be sent.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00003107 *
3108 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00003109 *
3110 * \par Python:
3111 * \code
3112 status = py_pjsua.call_dial_dtmf(call_id, digits)
3113 * \endcode
Benny Prijono9fc735d2006-05-28 14:58:12 +00003114 */
Benny Prijonoeebe9af2006-06-13 22:57:13 +00003115PJ_DECL(pj_status_t) pjsua_call_dial_dtmf(pjsua_call_id call_id,
Benny Prijono9fc735d2006-05-28 14:58:12 +00003116 const pj_str_t *digits);
Benny Prijono26ff9062006-02-21 23:47:00 +00003117
Benny Prijono26ff9062006-02-21 23:47:00 +00003118/**
Benny Prijonob0808372006-03-02 21:18:58 +00003119 * Send instant messaging inside INVITE session.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00003120 *
3121 * @param call_id Call identification.
3122 * @param mime_type Optional MIME type. If NULL, then "text/plain" is
3123 * assumed.
3124 * @param content The message content.
3125 * @param msg_data Optional list of headers etc to be included in outgoing
3126 * request. The body descriptor in the msg_data is
3127 * ignored.
3128 * @param user_data Optional user data, which will be given back when
3129 * the IM callback is called.
3130 *
3131 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00003132 *
3133 * \par Python:
3134 * \code
3135 status = py_pjsua.call_send_im(call_id, mime_type, content, msg_data, user_data)
3136 * \endcode
3137 * Note that the \a user_data argument is an integer in Python.
Benny Prijonob0808372006-03-02 21:18:58 +00003138 */
Benny Prijonoeebe9af2006-06-13 22:57:13 +00003139PJ_DECL(pj_status_t) pjsua_call_send_im( pjsua_call_id call_id,
3140 const pj_str_t *mime_type,
3141 const pj_str_t *content,
3142 const pjsua_msg_data *msg_data,
3143 void *user_data);
Benny Prijonob0808372006-03-02 21:18:58 +00003144
3145
3146/**
3147 * Send IM typing indication inside INVITE session.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00003148 *
3149 * @param call_id Call identification.
3150 * @param is_typing Non-zero to indicate to remote that local person is
3151 * currently typing an IM.
3152 * @param msg_data Optional list of headers etc to be included in outgoing
3153 * request.
3154 *
3155 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00003156 *
3157 * \par Python:
3158 * \code
3159 status = py_pjsua.call_send_typing_ind(call_id, is_typing, msg_data)
3160 * \endcode
3161 * Argument \a msg_data may be set to None if not required.
Benny Prijonob0808372006-03-02 21:18:58 +00003162 */
Benny Prijonoeebe9af2006-06-13 22:57:13 +00003163PJ_DECL(pj_status_t) pjsua_call_send_typing_ind(pjsua_call_id call_id,
3164 pj_bool_t is_typing,
3165 const pjsua_msg_data*msg_data);
Benny Prijonob0808372006-03-02 21:18:58 +00003166
3167/**
Benny Prijonofeb69f42007-10-05 09:12:26 +00003168 * Send arbitrary request with the call. This is useful for example to send
3169 * INFO request. Note that application should not use this function to send
3170 * requests which would change the invite session's state, such as re-INVITE,
3171 * UPDATE, PRACK, and BYE.
3172 *
3173 * @param call_id Call identification.
3174 * @param method SIP method of the request.
3175 * @param msg_data Optional message body and/or list of headers to be
3176 * included in outgoing request.
3177 *
3178 * @return PJ_SUCCESS on success, or the appropriate error code.
3179 */
3180PJ_DECL(pj_status_t) pjsua_call_send_request(pjsua_call_id call_id,
3181 const pj_str_t *method,
3182 const pjsua_msg_data *msg_data);
3183
3184
3185/**
Benny Prijonob5388cf2007-01-04 22:45:08 +00003186 * Terminate all calls. This will initiate #pjsua_call_hangup() for all
3187 * currently active calls.
Benny Prijonoe6ead542007-01-31 20:53:31 +00003188 *
3189 * \par Python:
3190 * \code
3191 py_pjsua.call_hangup_all()
3192 * \endcode
Benny Prijono834aee32006-02-19 01:38:06 +00003193 */
Benny Prijonodc39fe82006-05-26 12:17:46 +00003194PJ_DECL(void) pjsua_call_hangup_all(void);
Benny Prijono834aee32006-02-19 01:38:06 +00003195
3196
Benny Prijonob9b32ab2006-06-01 12:28:44 +00003197/**
3198 * Dump call and media statistics to string.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00003199 *
3200 * @param call_id Call identification.
3201 * @param with_media Non-zero to include media information too.
3202 * @param buffer Buffer where the statistics are to be written to.
3203 * @param maxlen Maximum length of buffer.
3204 * @param indent Spaces for left indentation.
3205 *
3206 * @return PJ_SUCCESS on success.
Benny Prijonoe6ead542007-01-31 20:53:31 +00003207 *
3208 * \par Python:
3209 * \code
3210 string = py_pjsua.call_dump(call_id, with_media, max_len, indent)
3211 * \endcode
3212 * The \a max_len argument is the desired maximum length to be allocated.
Benny Prijonob9b32ab2006-06-01 12:28:44 +00003213 */
Benny Prijonoeebe9af2006-06-13 22:57:13 +00003214PJ_DECL(pj_status_t) pjsua_call_dump(pjsua_call_id call_id,
3215 pj_bool_t with_media,
3216 char *buffer,
3217 unsigned maxlen,
3218 const char *indent);
Benny Prijonob9b32ab2006-06-01 12:28:44 +00003219
Benny Prijono9fc735d2006-05-28 14:58:12 +00003220/**
Benny Prijono312aff92006-06-17 04:08:30 +00003221 * @}
Benny Prijono9fc735d2006-05-28 14:58:12 +00003222 */
Benny Prijono834aee32006-02-19 01:38:06 +00003223
3224
3225/*****************************************************************************
Benny Prijono312aff92006-06-17 04:08:30 +00003226 * BUDDY API
Benny Prijono834aee32006-02-19 01:38:06 +00003227 */
3228
Benny Prijono312aff92006-06-17 04:08:30 +00003229
3230/**
Benny Prijonoe6ead542007-01-31 20:53:31 +00003231 * @defgroup PJSUA_LIB_BUDDY PJSUA-API Buddy, Presence, and Instant Messaging
Benny Prijono312aff92006-06-17 04:08:30 +00003232 * @ingroup PJSUA_LIB
3233 * @brief Buddy management, buddy's presence, and instant messaging.
3234 * @{
Benny Prijonoe6ead542007-01-31 20:53:31 +00003235 *
3236 * This section describes PJSUA-APIs related to buddies management,
3237 * presence management, and instant messaging.
Benny Prijono312aff92006-06-17 04:08:30 +00003238 */
3239
3240/**
3241 * Max buddies in buddy list.
3242 */
3243#ifndef PJSUA_MAX_BUDDIES
3244# define PJSUA_MAX_BUDDIES 256
3245#endif
3246
3247
3248/**
Benny Prijonoa17496a2007-10-31 10:20:31 +00003249 * This specifies how long the library should retry resending SUBSCRIBE
3250 * if the previous SUBSCRIBE failed.
3251 *
3252 * Default: 300 seconds
3253 */
3254#ifndef PJSUA_PRES_TIMER
3255# define PJSUA_PRES_TIMER 300
3256#endif
3257
3258
3259/**
Benny Prijonob5388cf2007-01-04 22:45:08 +00003260 * This structure describes buddy configuration when adding a buddy to
3261 * the buddy list with #pjsua_buddy_add(). Application MUST initialize
3262 * the structure with #pjsua_buddy_config_default() to initialize this
3263 * structure with default configuration.
Benny Prijonoe6ead542007-01-31 20:53:31 +00003264 *
3265 * \par Python:
3266 * In Python this structure is <tt>py_pjsua.Buddy_Config</tt>. However
3267 * it is recommended that application instantiates the buddy config
3268 * by calling:
3269 * \code
3270 buddy_cfg = py_pjsua.buddy_config_default()
3271 * \endcode
Benny Prijono312aff92006-06-17 04:08:30 +00003272 */
3273typedef struct pjsua_buddy_config
3274{
3275 /**
3276 * Buddy URL or name address.
3277 */
3278 pj_str_t uri;
3279
3280 /**
3281 * Specify whether presence subscription should start immediately.
3282 */
3283 pj_bool_t subscribe;
3284
3285} pjsua_buddy_config;
3286
3287
3288/**
Benny Prijonob5388cf2007-01-04 22:45:08 +00003289 * This enumeration describes basic buddy's online status.
Benny Prijono312aff92006-06-17 04:08:30 +00003290 */
3291typedef enum pjsua_buddy_status
3292{
3293 /**
3294 * Online status is unknown (possibly because no presence subscription
3295 * has been established).
3296 */
3297 PJSUA_BUDDY_STATUS_UNKNOWN,
3298
3299 /**
Benny Prijonofc24e692007-01-27 18:31:51 +00003300 * Buddy is known to be online.
Benny Prijono312aff92006-06-17 04:08:30 +00003301 */
3302 PJSUA_BUDDY_STATUS_ONLINE,
3303
3304 /**
3305 * Buddy is offline.
3306 */
3307 PJSUA_BUDDY_STATUS_OFFLINE,
3308
3309} pjsua_buddy_status;
3310
3311
3312
3313/**
Benny Prijonob5388cf2007-01-04 22:45:08 +00003314 * This structure describes buddy info, which can be retrieved by calling
3315 * #pjsua_buddy_get_info().
Benny Prijonoe6ead542007-01-31 20:53:31 +00003316 *
3317 * \par Python:
3318 * This structure in Python is <tt>py_pjsua.Buddy_Info</tt>.
Benny Prijono312aff92006-06-17 04:08:30 +00003319 */
3320typedef struct pjsua_buddy_info
3321{
3322 /**
3323 * The buddy ID.
3324 */
3325 pjsua_buddy_id id;
3326
3327 /**
3328 * The full URI of the buddy, as specified in the configuration.
3329 */
3330 pj_str_t uri;
3331
3332 /**
3333 * Buddy's Contact, only available when presence subscription has
3334 * been established to the buddy.
3335 */
3336 pj_str_t contact;
3337
3338 /**
3339 * Buddy's online status.
3340 */
3341 pjsua_buddy_status status;
3342
3343 /**
3344 * Text to describe buddy's online status.
3345 */
3346 pj_str_t status_text;
3347
3348 /**
3349 * Flag to indicate that we should monitor the presence information for
3350 * this buddy (normally yes, unless explicitly disabled).
3351 */
3352 pj_bool_t monitor_pres;
3353
3354 /**
Benny Prijono4461c7d2007-08-25 13:36:15 +00003355 * Extended RPID information about the person.
3356 */
3357 pjrpid_element rpid;
3358
3359 /**
Benny Prijono312aff92006-06-17 04:08:30 +00003360 * Internal buffer.
3361 */
Benny Prijono4461c7d2007-08-25 13:36:15 +00003362 char buf_[512];
Benny Prijono312aff92006-06-17 04:08:30 +00003363
3364} pjsua_buddy_info;
3365
3366
Benny Prijono834aee32006-02-19 01:38:06 +00003367/**
Benny Prijonob5388cf2007-01-04 22:45:08 +00003368 * Set default values to the buddy config.
Benny Prijonoe6ead542007-01-31 20:53:31 +00003369 *
3370 * \par Python:
3371 * \code
3372 buddy_cfg = py_pjsua.buddy_config_default()
3373 * \endcode
Benny Prijonob5388cf2007-01-04 22:45:08 +00003374 */
Benny Prijono1f61a8f2007-08-16 10:11:44 +00003375PJ_DECL(void) pjsua_buddy_config_default(pjsua_buddy_config *cfg);
Benny Prijonob5388cf2007-01-04 22:45:08 +00003376
3377
3378/**
Benny Prijonoeebe9af2006-06-13 22:57:13 +00003379 * Get total number of buddies.
3380 *
3381 * @return Number of buddies.
Benny Prijonoe6ead542007-01-31 20:53:31 +00003382 *
3383 * \par Python:
3384 * \code
3385 buddy_count = py_pjsua.get_buddy_count()
3386 * \endcode
Benny Prijono9fc735d2006-05-28 14:58:12 +00003387 */
3388PJ_DECL(unsigned) pjsua_get_buddy_count(void);
3389
3390
3391/**
Benny Prijonoeebe9af2006-06-13 22:57:13 +00003392 * Check if buddy ID is valid.
3393 *
3394 * @param buddy_id Buddy ID to check.
3395 *
3396 * @return Non-zero if buddy ID is valid.
Benny Prijonoe6ead542007-01-31 20:53:31 +00003397 *
3398 * \par Python:
3399 * \code
3400 is_valid = py_pjsua.buddy_is_valid(buddy_id)
3401 * \endcode
Benny Prijono9fc735d2006-05-28 14:58:12 +00003402 */
Benny Prijonoeebe9af2006-06-13 22:57:13 +00003403PJ_DECL(pj_bool_t) pjsua_buddy_is_valid(pjsua_buddy_id buddy_id);
3404
3405
3406/**
Benny Prijonob5388cf2007-01-04 22:45:08 +00003407 * Enumerate all buddy IDs in the buddy list. Application then can use
3408 * #pjsua_buddy_get_info() to get the detail information for each buddy
3409 * id.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00003410 *
3411 * @param ids Array of ids to be initialized.
3412 * @param count On input, specifies max elements in the array.
3413 * On return, it contains actual number of elements
3414 * that have been initialized.
3415 *
3416 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00003417 *
3418 * \par Python:
3419 * The Python function takes no argument and returns list of buddy IDs:
3420 * \code
3421 [buddy_ids] = py_pjsua.enum_buddies()
3422 * \endcode
Benny Prijonoeebe9af2006-06-13 22:57:13 +00003423 */
3424PJ_DECL(pj_status_t) pjsua_enum_buddies(pjsua_buddy_id ids[],
3425 unsigned *count);
3426
3427/**
3428 * Get detailed buddy info.
3429 *
3430 * @param buddy_id The buddy identification.
3431 * @param info Pointer to receive information about buddy.
3432 *
3433 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00003434 *
3435 * \par Python:
3436 * \code
3437 buddy_info = py_pjsua.buddy_get_info(buddy_id)
3438 * \endcode
3439 * The function returns None if buddy_id is not valid.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00003440 */
3441PJ_DECL(pj_status_t) pjsua_buddy_get_info(pjsua_buddy_id buddy_id,
Benny Prijono9fc735d2006-05-28 14:58:12 +00003442 pjsua_buddy_info *info);
3443
3444/**
Benny Prijonob5388cf2007-01-04 22:45:08 +00003445 * Add new buddy to the buddy list. If presence subscription is enabled
3446 * for this buddy, this function will also start the presence subscription
3447 * session immediately.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00003448 *
Benny Prijonoa7b376b2008-01-25 16:06:33 +00003449 * @param buddy_cfg Buddy configuration.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00003450 * @param p_buddy_id Pointer to receive buddy ID.
3451 *
3452 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00003453 *
3454 * \par Python:
3455 * The function returns (status, buddy_id) tuple:
3456 * \code
3457 status, buddy_id = py_pjsua.buddy_add(buddy_cfg)
3458 * \endcode
Benny Prijono9fc735d2006-05-28 14:58:12 +00003459 */
Benny Prijonoe6ead542007-01-31 20:53:31 +00003460PJ_DECL(pj_status_t) pjsua_buddy_add(const pjsua_buddy_config *buddy_cfg,
Benny Prijonoeebe9af2006-06-13 22:57:13 +00003461 pjsua_buddy_id *p_buddy_id);
Benny Prijono8b1889b2006-06-06 18:40:40 +00003462
3463
3464/**
Benny Prijonob5388cf2007-01-04 22:45:08 +00003465 * Delete the specified buddy from the buddy list. Any presence subscription
3466 * to this buddy will be terminated.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00003467 *
3468 * @param buddy_id Buddy identification.
3469 *
3470 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00003471 *
3472 * \par Python:
3473 * \code
3474 status = py_pjsua.buddy_del(buddy_id)
3475 * \endcode
Benny Prijono8b1889b2006-06-06 18:40:40 +00003476 */
Benny Prijonoeebe9af2006-06-13 22:57:13 +00003477PJ_DECL(pj_status_t) pjsua_buddy_del(pjsua_buddy_id buddy_id);
Benny Prijono9fc735d2006-05-28 14:58:12 +00003478
3479
3480/**
Benny Prijonob5388cf2007-01-04 22:45:08 +00003481 * Enable/disable buddy's presence monitoring. Once buddy's presence is
3482 * subscribed, application will be informed about buddy's presence status
3483 * changed via \a on_buddy_state() callback.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00003484 *
3485 * @param buddy_id Buddy identification.
3486 * @param subscribe Specify non-zero to activate presence subscription to
3487 * the specified buddy.
3488 *
3489 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00003490 *
3491 * \par Python:
3492 * \code
3493 status = py_pjsua.buddy_subscribe_pres(buddy_id, subscribe)
3494 * \endcode
Benny Prijono9fc735d2006-05-28 14:58:12 +00003495 */
Benny Prijonoeebe9af2006-06-13 22:57:13 +00003496PJ_DECL(pj_status_t) pjsua_buddy_subscribe_pres(pjsua_buddy_id buddy_id,
3497 pj_bool_t subscribe);
Benny Prijono9fc735d2006-05-28 14:58:12 +00003498
3499
3500/**
Benny Prijono10861432007-10-31 10:54:53 +00003501 * Update the presence information for the buddy. Although the library
3502 * periodically refreshes the presence subscription for all buddies, some
3503 * application may want to refresh the buddy's presence subscription
3504 * immediately, and in this case it can use this function to accomplish
3505 * this.
3506 *
3507 * Note that the buddy's presence subscription will only be initiated
3508 * if presence monitoring is enabled for the buddy. See
3509 * #pjsua_buddy_subscribe_pres() for more info. Also if presence subscription
3510 * for the buddy is already active, this function will not do anything.
3511 *
3512 * Once the presence subscription is activated successfully for the buddy,
3513 * application will be notified about the buddy's presence status in the
3514 * on_buddy_state() callback.
3515 *
3516 * @param buddy_id Buddy identification.
3517 *
3518 * @return PJ_SUCCESS on success, or the appropriate error code.
3519 */
3520PJ_DECL(pj_status_t) pjsua_buddy_update_pres(pjsua_buddy_id buddy_id);
3521
3522
3523/**
Benny Prijonob5388cf2007-01-04 22:45:08 +00003524 * Dump presence subscriptions to log.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00003525 *
3526 * @param verbose Yes or no.
Benny Prijonoe6ead542007-01-31 20:53:31 +00003527 *
3528 * \par Python:
3529 * \code
3530 py_pjsua.pres_dump()
3531 * \endcode
Benny Prijono834aee32006-02-19 01:38:06 +00003532 */
Benny Prijonoeebe9af2006-06-13 22:57:13 +00003533PJ_DECL(void) pjsua_pres_dump(pj_bool_t verbose);
Benny Prijono834aee32006-02-19 01:38:06 +00003534
3535
Benny Prijonob0808372006-03-02 21:18:58 +00003536/**
3537 * The MESSAGE method (defined in pjsua_im.c)
3538 */
3539extern const pjsip_method pjsip_message_method;
3540
3541
Benny Prijonob0808372006-03-02 21:18:58 +00003542
3543/**
Benny Prijonoeebe9af2006-06-13 22:57:13 +00003544 * Send instant messaging outside dialog, using the specified account for
3545 * route set and authentication.
3546 *
3547 * @param acc_id Account ID to be used to send the request.
3548 * @param to Remote URI.
3549 * @param mime_type Optional MIME type. If NULL, then "text/plain" is
3550 * assumed.
3551 * @param content The message content.
3552 * @param msg_data Optional list of headers etc to be included in outgoing
3553 * request. The body descriptor in the msg_data is
3554 * ignored.
3555 * @param user_data Optional user data, which will be given back when
3556 * the IM callback is called.
3557 *
3558 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00003559 *
3560 * \par Python:
3561 * \code
3562 status = py_pjsua.im_send(acc_id, to, mime_type, content, msg_data, user_data)
3563 * \endcode
3564 * Arguments \a mime_type and \a msg_data may be set to None if not required.
Benny Prijonob0808372006-03-02 21:18:58 +00003565 */
Benny Prijonoeebe9af2006-06-13 22:57:13 +00003566PJ_DECL(pj_status_t) pjsua_im_send(pjsua_acc_id acc_id,
3567 const pj_str_t *to,
3568 const pj_str_t *mime_type,
3569 const pj_str_t *content,
3570 const pjsua_msg_data *msg_data,
3571 void *user_data);
Benny Prijonob0808372006-03-02 21:18:58 +00003572
3573
3574/**
3575 * Send typing indication outside dialog.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00003576 *
3577 * @param acc_id Account ID to be used to send the request.
3578 * @param to Remote URI.
3579 * @param is_typing If non-zero, it tells remote person that local person
3580 * is currently composing an IM.
3581 * @param msg_data Optional list of headers etc to be added to outgoing
3582 * request.
3583 *
3584 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00003585 *
3586 * \par Python:
3587 * \code
3588 status = py_pjsua.im_typing(acc_id, to, is_typing, msg_data)
3589 * \endcode
3590 * Argument \a msg_data may be set to None if not requried.
Benny Prijonob0808372006-03-02 21:18:58 +00003591 */
Benny Prijonoeebe9af2006-06-13 22:57:13 +00003592PJ_DECL(pj_status_t) pjsua_im_typing(pjsua_acc_id acc_id,
3593 const pj_str_t *to,
3594 pj_bool_t is_typing,
3595 const pjsua_msg_data *msg_data);
Benny Prijonob0808372006-03-02 21:18:58 +00003596
3597
Benny Prijonof3195072006-02-14 21:15:30 +00003598
Benny Prijono312aff92006-06-17 04:08:30 +00003599/**
3600 * @}
Benny Prijono9fc735d2006-05-28 14:58:12 +00003601 */
3602
Benny Prijono312aff92006-06-17 04:08:30 +00003603
3604/*****************************************************************************
3605 * MEDIA API
3606 */
3607
3608
3609/**
Benny Prijonoe6ead542007-01-31 20:53:31 +00003610 * @defgroup PJSUA_LIB_MEDIA PJSUA-API Media Manipulation
Benny Prijono312aff92006-06-17 04:08:30 +00003611 * @ingroup PJSUA_LIB
3612 * @brief Media manipulation.
3613 * @{
3614 *
3615 * PJSUA has rather powerful media features, which are built around the
Benny Prijonoe6ead542007-01-31 20:53:31 +00003616 * PJMEDIA conference bridge. Basically, all media "ports" (such as calls, WAV
3617 * players, WAV playlist, file recorders, sound device, tone generators, etc)
Benny Prijono312aff92006-06-17 04:08:30 +00003618 * are terminated in the conference bridge, and application can manipulate
Benny Prijonoe6ead542007-01-31 20:53:31 +00003619 * the interconnection between these terminations freely.
3620 *
3621 * The conference bridge provides powerful switching and mixing functionality
3622 * for application. With the conference bridge, each conference slot (e.g.
3623 * a call) can transmit to multiple destinations, and one destination can
3624 * receive from multiple sources. If more than one media terminations are
3625 * terminated in the same slot, the conference bridge will mix the signal
3626 * automatically.
Benny Prijono312aff92006-06-17 04:08:30 +00003627 *
3628 * Application connects one media termination/slot to another by calling
3629 * #pjsua_conf_connect() function. This will establish <b>unidirectional</b>
Benny Prijonoe6ead542007-01-31 20:53:31 +00003630 * media flow from the source termination to the sink termination. To
3631 * establish bidirectional media flow, application wound need to make another
3632 * call to #pjsua_conf_connect(), this time inverting the source and
3633 * destination slots in the parameter.
3634 *
3635 * For example, to stream a WAV file to remote call, application may use
Benny Prijono312aff92006-06-17 04:08:30 +00003636 * the following steps:
3637 *
3638 \code
3639
3640 pj_status_t stream_to_call( pjsua_call_id call_id )
3641 {
3642 pjsua_player_id player_id;
3643
3644 status = pjsua_player_create("mysong.wav", 0, NULL, &player_id);
3645 if (status != PJ_SUCCESS)
3646 return status;
3647
3648 status = pjsua_conf_connect( pjsua_player_get_conf_port(),
3649 pjsua_call_get_conf_port() );
3650 }
3651 \endcode
3652 *
3653 *
3654 * Other features of PJSUA media:
3655 * - efficient N to M interconnections between media terminations.
3656 * - media termination can be connected to itself to create loopback
3657 * media.
3658 * - the media termination may have different clock rates, and resampling
3659 * will be done automatically by conference bridge.
3660 * - media terminations may also have different frame time; the
3661 * conference bridge will perform the necessary bufferring to adjust
3662 * the difference between terminations.
3663 * - interconnections are removed automatically when media termination
3664 * is removed from the bridge.
3665 * - sound device may be changed even when there are active media
3666 * interconnections.
3667 * - correctly report call's media quality (in #pjsua_call_dump()) from
3668 * RTCP packet exchange.
3669 */
3670
3671/**
Benny Prijono37c710b2008-01-10 12:09:26 +00003672 * Max ports in the conference bridge. This setting is the default value
3673 * for pjsua_media_config.max_media_ports.
Benny Prijono312aff92006-06-17 04:08:30 +00003674 */
3675#ifndef PJSUA_MAX_CONF_PORTS
Benny Prijono12a669c2006-11-23 07:32:13 +00003676# define PJSUA_MAX_CONF_PORTS 254
Benny Prijono312aff92006-06-17 04:08:30 +00003677#endif
3678
Benny Prijonob5388cf2007-01-04 22:45:08 +00003679/**
Benny Prijono37c710b2008-01-10 12:09:26 +00003680 * The default clock rate to be used by the conference bridge. This setting
3681 * is the default value for pjsua_media_config.clock_rate.
Benny Prijonob5388cf2007-01-04 22:45:08 +00003682 */
Benny Prijono12a669c2006-11-23 07:32:13 +00003683#ifndef PJSUA_DEFAULT_CLOCK_RATE
3684# define PJSUA_DEFAULT_CLOCK_RATE 16000
3685#endif
3686
Benny Prijonob5388cf2007-01-04 22:45:08 +00003687/**
Benny Prijono37c710b2008-01-10 12:09:26 +00003688 * Default frame length in the conference bridge. This setting
3689 * is the default value for pjsua_media_config.audio_frame_ptime.
3690 */
3691#ifndef PJSUA_DEFAULT_AUDIO_FRAME_PTIME
Nanang Izzuddinaf974842008-05-08 09:51:16 +00003692# define PJSUA_DEFAULT_AUDIO_FRAME_PTIME 20
Benny Prijono37c710b2008-01-10 12:09:26 +00003693#endif
3694
3695
3696/**
3697 * Default codec quality settings. This setting is the default value
3698 * for pjsua_media_config.quality.
Benny Prijonob5388cf2007-01-04 22:45:08 +00003699 */
Benny Prijono12a669c2006-11-23 07:32:13 +00003700#ifndef PJSUA_DEFAULT_CODEC_QUALITY
Nanang Izzuddin9dbad152008-06-10 18:56:10 +00003701# define PJSUA_DEFAULT_CODEC_QUALITY 8
Benny Prijono12a669c2006-11-23 07:32:13 +00003702#endif
3703
Benny Prijonob5388cf2007-01-04 22:45:08 +00003704/**
Benny Prijono37c710b2008-01-10 12:09:26 +00003705 * Default iLBC mode. This setting is the default value for
3706 * pjsua_media_config.ilbc_mode.
Benny Prijonob5388cf2007-01-04 22:45:08 +00003707 */
Benny Prijono12a669c2006-11-23 07:32:13 +00003708#ifndef PJSUA_DEFAULT_ILBC_MODE
Benny Prijono37c710b2008-01-10 12:09:26 +00003709# define PJSUA_DEFAULT_ILBC_MODE 30
Benny Prijono12a669c2006-11-23 07:32:13 +00003710#endif
3711
Benny Prijonob5388cf2007-01-04 22:45:08 +00003712/**
Benny Prijono37c710b2008-01-10 12:09:26 +00003713 * The default echo canceller tail length. This setting
3714 * is the default value for pjsua_media_config.ec_tail_len.
Benny Prijonob5388cf2007-01-04 22:45:08 +00003715 */
Benny Prijono12a669c2006-11-23 07:32:13 +00003716#ifndef PJSUA_DEFAULT_EC_TAIL_LEN
Benny Prijono427439c2007-10-21 09:41:24 +00003717# define PJSUA_DEFAULT_EC_TAIL_LEN 200
Benny Prijono12a669c2006-11-23 07:32:13 +00003718#endif
Benny Prijono312aff92006-06-17 04:08:30 +00003719
3720
3721/**
Benny Prijonocba59d92007-02-16 09:22:56 +00003722 * The maximum file player.
3723 */
3724#ifndef PJSUA_MAX_PLAYERS
3725# define PJSUA_MAX_PLAYERS 32
3726#endif
3727
3728
3729/**
3730 * The maximum file player.
3731 */
3732#ifndef PJSUA_MAX_RECORDERS
3733# define PJSUA_MAX_RECORDERS 32
3734#endif
3735
3736
3737/**
Benny Prijonob5388cf2007-01-04 22:45:08 +00003738 * This structure describes media configuration, which will be specified
3739 * when calling #pjsua_init(). Application MUST initialize this structure
3740 * by calling #pjsua_media_config_default().
Benny Prijonoe6ead542007-01-31 20:53:31 +00003741 *
3742 * \par Python:
3743 * This data type in Python is <tt>py_pjsua.Media_Config</tt>. To create
3744 * an object of this type, it is recommended to call
3745 * <tt>py_pjsua.media_config_default()</tt> function instead:
3746 * \code
3747 media_cfg = py_pjsua.media_config_default()
3748 * \endcode
Benny Prijono312aff92006-06-17 04:08:30 +00003749 */
3750struct pjsua_media_config
3751{
3752 /**
3753 * Clock rate to be applied to the conference bridge.
Benny Prijonob5388cf2007-01-04 22:45:08 +00003754 * If value is zero, default clock rate will be used
3755 * (PJSUA_DEFAULT_CLOCK_RATE, which by default is 16KHz).
Benny Prijono312aff92006-06-17 04:08:30 +00003756 */
3757 unsigned clock_rate;
3758
3759 /**
Benny Prijonof3758ee2008-02-26 15:32:16 +00003760 * Clock rate to be applied when opening the sound device.
3761 * If value is zero, conference bridge clock rate will be used.
3762 */
3763 unsigned snd_clock_rate;
3764
3765 /**
Benny Prijono7d60d052008-03-29 12:24:20 +00003766 * Channel count be applied when opening the sound device and
3767 * conference bridge.
3768 */
3769 unsigned channel_count;
3770
3771 /**
Benny Prijonocf0b4b22007-10-06 17:31:09 +00003772 * Specify audio frame ptime. The value here will affect the
3773 * samples per frame of both the sound device and the conference
3774 * bridge. Specifying lower ptime will normally reduce the
3775 * latency.
3776 *
Benny Prijono37c710b2008-01-10 12:09:26 +00003777 * Default value: PJSUA_DEFAULT_AUDIO_FRAME_PTIME
Benny Prijonocf0b4b22007-10-06 17:31:09 +00003778 */
3779 unsigned audio_frame_ptime;
3780
3781 /**
Benny Prijono312aff92006-06-17 04:08:30 +00003782 * Specify maximum number of media ports to be created in the
3783 * conference bridge. Since all media terminate in the bridge
3784 * (calls, file player, file recorder, etc), the value must be
3785 * large enough to support all of them. However, the larger
3786 * the value, the more computations are performed.
Benny Prijono37c710b2008-01-10 12:09:26 +00003787 *
3788 * Default value: PJSUA_MAX_CONF_PORTS
Benny Prijono312aff92006-06-17 04:08:30 +00003789 */
3790 unsigned max_media_ports;
3791
3792 /**
3793 * Specify whether the media manager should manage its own
3794 * ioqueue for the RTP/RTCP sockets. If yes, ioqueue will be created
3795 * and at least one worker thread will be created too. If no,
3796 * the RTP/RTCP sockets will share the same ioqueue as SIP sockets,
3797 * and no worker thread is needed.
3798 *
3799 * Normally application would say yes here, unless it wants to
3800 * run everything from a single thread.
3801 */
3802 pj_bool_t has_ioqueue;
3803
3804 /**
3805 * Specify the number of worker threads to handle incoming RTP
3806 * packets. A value of one is recommended for most applications.
3807 */
3808 unsigned thread_cnt;
3809
Benny Prijono0498d902006-06-19 14:49:14 +00003810 /**
3811 * Media quality, 0-10, according to this table:
Benny Prijono7ca96da2006-08-07 12:11:40 +00003812 * 5-10: resampling use large filter,
3813 * 3-4: resampling use small filter,
Benny Prijono0498d902006-06-19 14:49:14 +00003814 * 1-2: resampling use linear.
3815 * The media quality also sets speex codec quality/complexity to the
3816 * number.
3817 *
Benny Prijono70972992006-08-05 11:13:58 +00003818 * Default: 5 (PJSUA_DEFAULT_CODEC_QUALITY).
Benny Prijono0498d902006-06-19 14:49:14 +00003819 */
3820 unsigned quality;
Benny Prijono0a12f002006-07-26 17:05:39 +00003821
3822 /**
Benny Prijonocf0b4b22007-10-06 17:31:09 +00003823 * Specify default codec ptime.
Benny Prijono0a12f002006-07-26 17:05:39 +00003824 *
3825 * Default: 0 (codec specific)
3826 */
3827 unsigned ptime;
3828
3829 /**
3830 * Disable VAD?
3831 *
3832 * Default: 0 (no (meaning VAD is enabled))
3833 */
3834 pj_bool_t no_vad;
Benny Prijono00cae612006-07-31 15:19:36 +00003835
3836 /**
3837 * iLBC mode (20 or 30).
3838 *
Benny Prijono37c710b2008-01-10 12:09:26 +00003839 * Default: 30 (PJSUA_DEFAULT_ILBC_MODE)
Benny Prijono00cae612006-07-31 15:19:36 +00003840 */
3841 unsigned ilbc_mode;
3842
3843 /**
3844 * Percentage of RTP packet to drop in TX direction
3845 * (to simulate packet lost).
3846 *
3847 * Default: 0
3848 */
3849 unsigned tx_drop_pct;
3850
3851 /**
3852 * Percentage of RTP packet to drop in RX direction
3853 * (to simulate packet lost).
3854 *
3855 * Default: 0
3856 */
3857 unsigned rx_drop_pct;
3858
Benny Prijonoc8e24a12006-08-02 18:22:22 +00003859 /**
Benny Prijono5da50432006-08-07 10:24:52 +00003860 * Echo canceller options (see #pjmedia_echo_create())
3861 *
3862 * Default: 0.
3863 */
3864 unsigned ec_options;
3865
3866 /**
Benny Prijonoc8e24a12006-08-02 18:22:22 +00003867 * Echo canceller tail length, in miliseconds.
3868 *
Benny Prijono669643c2006-09-20 20:02:18 +00003869 * Default: PJSUA_DEFAULT_EC_TAIL_LEN
Benny Prijonoc8e24a12006-08-02 18:22:22 +00003870 */
3871 unsigned ec_tail_len;
Benny Prijono1d0ca0c2006-11-21 09:06:47 +00003872
3873 /**
3874 * Jitter buffer initial prefetch delay in msec. The value must be
3875 * between jb_min_pre and jb_max_pre below.
3876 *
3877 * Default: -1 (to use default stream settings, currently 150 msec)
3878 */
3879 int jb_init;
3880
3881 /**
3882 * Jitter buffer minimum prefetch delay in msec.
3883 *
3884 * Default: -1 (to use default stream settings, currently 60 msec)
3885 */
3886 int jb_min_pre;
3887
3888 /**
3889 * Jitter buffer maximum prefetch delay in msec.
3890 *
3891 * Default: -1 (to use default stream settings, currently 240 msec)
3892 */
3893 int jb_max_pre;
3894
3895 /**
3896 * Set maximum delay that can be accomodated by the jitter buffer msec.
3897 *
3898 * Default: -1 (to use default stream settings, currently 360 msec)
3899 */
3900 int jb_max;
3901
Benny Prijonoc97608e2007-03-23 16:34:20 +00003902 /**
3903 * Enable ICE
3904 */
3905 pj_bool_t enable_ice;
3906
3907 /**
Benny Prijonof76e1392008-06-06 14:51:48 +00003908 * Disable ICE host candidates.
Benny Prijonoc97608e2007-03-23 16:34:20 +00003909 */
Benny Prijonof76e1392008-06-06 14:51:48 +00003910 pj_bool_t ice_no_host_cands;
3911
3912 /**
3913 * Enable TURN relay candidate in ICE.
3914 */
3915 pj_bool_t enable_turn;
3916
3917 /**
3918 * Specify TURN domain name or host name, in in "DOMAIN:PORT" or
3919 * "HOST:PORT" format.
3920 */
3921 pj_str_t turn_server;
3922
3923 /**
3924 * Specify the connection type to be used to the TURN server. Valid
3925 * values are PJ_TURN_TP_UDP or PJ_TURN_TP_TCP.
3926 *
3927 * Default: PJ_TURN_TP_UDP
3928 */
3929 pj_turn_tp_type turn_conn_type;
3930
3931 /**
3932 * Specify the credential to authenticate with the TURN server.
3933 */
3934 pj_stun_auth_cred turn_auth_cred;
Nanang Izzuddin68559c32008-06-13 17:01:46 +00003935
3936 /**
3937 * Specify idle time of sound device before it is automatically closed,
3938 * in seconds.
3939 *
3940 * Default : -1 (Disable the auto-close feature of sound device)
3941 */
3942 int snd_auto_close_time;
Benny Prijono312aff92006-06-17 04:08:30 +00003943};
3944
3945
3946/**
3947 * Use this function to initialize media config.
3948 *
3949 * @param cfg The media config to be initialized.
Benny Prijonoe6ead542007-01-31 20:53:31 +00003950 *
3951 * \par Python:
3952 * \code
3953 media_cfg = py_pjsua.media_config_default()
3954 * \endcode
Benny Prijono312aff92006-06-17 04:08:30 +00003955 */
Benny Prijono1f61a8f2007-08-16 10:11:44 +00003956PJ_DECL(void) pjsua_media_config_default(pjsua_media_config *cfg);
Benny Prijono312aff92006-06-17 04:08:30 +00003957
3958
3959/**
Benny Prijonob5388cf2007-01-04 22:45:08 +00003960 * This structure describes codec information, which can be retrieved by
3961 * calling #pjsua_enum_codecs().
Benny Prijono312aff92006-06-17 04:08:30 +00003962 */
3963typedef struct pjsua_codec_info
3964{
3965 /**
3966 * Codec unique identification.
3967 */
3968 pj_str_t codec_id;
3969
3970 /**
3971 * Codec priority (integer 0-255).
3972 */
3973 pj_uint8_t priority;
3974
3975 /**
3976 * Internal buffer.
3977 */
3978 char buf_[32];
3979
3980} pjsua_codec_info;
3981
3982
3983/**
Benny Prijonob5388cf2007-01-04 22:45:08 +00003984 * This structure descibes information about a particular media port that
3985 * has been registered into the conference bridge. Application can query
3986 * this info by calling #pjsua_conf_get_port_info().
Benny Prijonoe6ead542007-01-31 20:53:31 +00003987 *
3988 * \par Python:
3989 * In Python, this type is <tt>py_pjsua.Conf_Port_Info</tt>.
Benny Prijono312aff92006-06-17 04:08:30 +00003990 */
3991typedef struct pjsua_conf_port_info
3992{
3993 /** Conference port number. */
3994 pjsua_conf_port_id slot_id;
3995
3996 /** Port name. */
3997 pj_str_t name;
3998
3999 /** Clock rate. */
4000 unsigned clock_rate;
4001
4002 /** Number of channels. */
4003 unsigned channel_count;
4004
4005 /** Samples per frame */
4006 unsigned samples_per_frame;
4007
4008 /** Bits per sample */
4009 unsigned bits_per_sample;
4010
4011 /** Number of listeners in the array. */
4012 unsigned listener_cnt;
4013
4014 /** Array of listeners (in other words, ports where this port is
4015 * transmitting to.
4016 */
4017 pjsua_conf_port_id listeners[PJSUA_MAX_CONF_PORTS];
4018
4019} pjsua_conf_port_info;
4020
4021
4022/**
4023 * This structure holds information about custom media transport to
4024 * be registered to pjsua.
Benny Prijonoe6ead542007-01-31 20:53:31 +00004025 *
4026 * \par Python:
4027 * Not applicable.
Benny Prijono312aff92006-06-17 04:08:30 +00004028 */
4029typedef struct pjsua_media_transport
4030{
4031 /**
4032 * Media socket information containing the address information
4033 * of the RTP and RTCP socket.
4034 */
4035 pjmedia_sock_info skinfo;
4036
4037 /**
4038 * The media transport instance.
4039 */
4040 pjmedia_transport *transport;
4041
4042} pjsua_media_transport;
4043
4044
4045
4046
Benny Prijono9fc735d2006-05-28 14:58:12 +00004047/**
4048 * Get maxinum number of conference ports.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00004049 *
4050 * @return Maximum number of ports in the conference bridge.
Benny Prijonoe6ead542007-01-31 20:53:31 +00004051 *
4052 * \par Python:
4053 * \code
4054 port_count = py_pjsua.conf_get_max_ports()
4055 * \endcode
Benny Prijono9fc735d2006-05-28 14:58:12 +00004056 */
Benny Prijonoeebe9af2006-06-13 22:57:13 +00004057PJ_DECL(unsigned) pjsua_conf_get_max_ports(void);
Benny Prijono9fc735d2006-05-28 14:58:12 +00004058
4059
4060/**
Benny Prijonoeebe9af2006-06-13 22:57:13 +00004061 * Get current number of active ports in the bridge.
4062 *
4063 * @return The number.
Benny Prijonoe6ead542007-01-31 20:53:31 +00004064 *
4065 * \par Python:
4066 * \code
4067 count = py_pjsua.conf_get_active_ports()
4068 * \endcode
Benny Prijono9fc735d2006-05-28 14:58:12 +00004069 */
Benny Prijonoeebe9af2006-06-13 22:57:13 +00004070PJ_DECL(unsigned) pjsua_conf_get_active_ports(void);
4071
4072
4073/**
4074 * Enumerate all conference ports.
4075 *
4076 * @param id Array of conference port ID to be initialized.
4077 * @param count On input, specifies max elements in the array.
4078 * On return, it contains actual number of elements
4079 * that have been initialized.
4080 *
4081 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00004082 *
4083 * \par Python:
4084 * The Python functions returns list of conference port Ids:
4085 * \code
4086 [port_ids] = py_pjsua.enum_conf_ports()
4087 * \endcode
Benny Prijonoeebe9af2006-06-13 22:57:13 +00004088 */
4089PJ_DECL(pj_status_t) pjsua_enum_conf_ports(pjsua_conf_port_id id[],
4090 unsigned *count);
Benny Prijono8b1889b2006-06-06 18:40:40 +00004091
4092
4093/**
4094 * Get information about the specified conference port
Benny Prijonoeebe9af2006-06-13 22:57:13 +00004095 *
Benny Prijonoe6ead542007-01-31 20:53:31 +00004096 * @param port_id Port identification.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00004097 * @param info Pointer to store the port info.
4098 *
4099 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00004100 *
4101 * \par Python:
4102 * \code
4103 port_info = py_pjsua.conf_get_port_info(port_id)
4104 * \endcode
4105 * The function will return None if \a port_id is not valid.
Benny Prijono8b1889b2006-06-06 18:40:40 +00004106 */
Benny Prijonoe6ead542007-01-31 20:53:31 +00004107PJ_DECL(pj_status_t) pjsua_conf_get_port_info( pjsua_conf_port_id port_id,
Benny Prijono8b1889b2006-06-06 18:40:40 +00004108 pjsua_conf_port_info *info);
Benny Prijono9fc735d2006-05-28 14:58:12 +00004109
4110
4111/**
Benny Prijonoe909eac2006-07-27 22:04:56 +00004112 * Add arbitrary media port to PJSUA's conference bridge. Application
4113 * can use this function to add the media port that it creates. For
4114 * media ports that are created by PJSUA-LIB (such as calls, file player,
4115 * or file recorder), PJSUA-LIB will automatically add the port to
4116 * the bridge.
4117 *
4118 * @param pool Pool to use.
4119 * @param port Media port to be added to the bridge.
4120 * @param p_id Optional pointer to receive the conference
4121 * slot id.
4122 *
4123 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00004124 *
4125 * \par Python:
4126 * Not applicable (for now)
Benny Prijonoe909eac2006-07-27 22:04:56 +00004127 */
4128PJ_DECL(pj_status_t) pjsua_conf_add_port(pj_pool_t *pool,
4129 pjmedia_port *port,
4130 pjsua_conf_port_id *p_id);
4131
4132
4133/**
4134 * Remove arbitrary slot from the conference bridge. Application should only
Benny Prijonob5388cf2007-01-04 22:45:08 +00004135 * call this function if it registered the port manually with previous call
4136 * to #pjsua_conf_add_port().
Benny Prijonoe909eac2006-07-27 22:04:56 +00004137 *
Benny Prijonoe6ead542007-01-31 20:53:31 +00004138 * @param port_id The slot id of the port to be removed.
Benny Prijonoe909eac2006-07-27 22:04:56 +00004139 *
4140 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00004141 *
4142 * \par Python:
4143 * \code
4144 status = py_pjsua.conf_remove_port(port_id)
4145 * \endcode
Benny Prijonoe909eac2006-07-27 22:04:56 +00004146 */
Benny Prijonoe6ead542007-01-31 20:53:31 +00004147PJ_DECL(pj_status_t) pjsua_conf_remove_port(pjsua_conf_port_id port_id);
Benny Prijonoe909eac2006-07-27 22:04:56 +00004148
4149
4150/**
Benny Prijonoeebe9af2006-06-13 22:57:13 +00004151 * Establish unidirectional media flow from souce to sink. One source
4152 * may transmit to multiple destinations/sink. And if multiple
4153 * sources are transmitting to the same sink, the media will be mixed
4154 * together. Source and sink may refer to the same ID, effectively
4155 * looping the media.
4156 *
4157 * If bidirectional media flow is desired, application needs to call
4158 * this function twice, with the second one having the arguments
4159 * reversed.
4160 *
4161 * @param source Port ID of the source media/transmitter.
4162 * @param sink Port ID of the destination media/received.
4163 *
4164 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00004165 *
4166 * \par Python:
4167 * \code
4168 status = py_pjsua.conf_connect(source, sink)
4169 * \endcode
Benny Prijono9fc735d2006-05-28 14:58:12 +00004170 */
Benny Prijonoeebe9af2006-06-13 22:57:13 +00004171PJ_DECL(pj_status_t) pjsua_conf_connect(pjsua_conf_port_id source,
4172 pjsua_conf_port_id sink);
Benny Prijono9fc735d2006-05-28 14:58:12 +00004173
4174
4175/**
Benny Prijonoeebe9af2006-06-13 22:57:13 +00004176 * Disconnect media flow from the source to destination port.
4177 *
4178 * @param source Port ID of the source media/transmitter.
4179 * @param sink Port ID of the destination media/received.
4180 *
4181 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00004182 *
4183 * \par Python:
4184 * \code
4185 status = py_pjsua.conf_disconnect(source, sink)
4186 * \endcode
Benny Prijono9fc735d2006-05-28 14:58:12 +00004187 */
Benny Prijonoeebe9af2006-06-13 22:57:13 +00004188PJ_DECL(pj_status_t) pjsua_conf_disconnect(pjsua_conf_port_id source,
4189 pjsua_conf_port_id sink);
Benny Prijono9fc735d2006-05-28 14:58:12 +00004190
4191
Benny Prijono6dd967c2006-12-26 02:27:14 +00004192/**
4193 * Adjust the signal level to be transmitted from the bridge to the
4194 * specified port by making it louder or quieter.
4195 *
4196 * @param slot The conference bridge slot number.
4197 * @param level Signal level adjustment. Value 1.0 means no level
4198 * adjustment, while value 0 means to mute the port.
4199 *
4200 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00004201 *
4202 * \par Python:
4203 * Not implemented (yet)
Benny Prijono6dd967c2006-12-26 02:27:14 +00004204 */
4205PJ_DECL(pj_status_t) pjsua_conf_adjust_tx_level(pjsua_conf_port_id slot,
4206 float level);
4207
4208/**
4209 * Adjust the signal level to be received from the specified port (to
4210 * the bridge) by making it louder or quieter.
4211 *
4212 * @param slot The conference bridge slot number.
4213 * @param level Signal level adjustment. Value 1.0 means no level
4214 * adjustment, while value 0 means to mute the port.
4215 *
4216 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00004217 *
4218 * \par Python:
4219 * Not implemented (yet)
Benny Prijono6dd967c2006-12-26 02:27:14 +00004220 */
4221PJ_DECL(pj_status_t) pjsua_conf_adjust_rx_level(pjsua_conf_port_id slot,
4222 float level);
4223
4224/**
4225 * Get last signal level transmitted to or received from the specified port.
4226 * The signal level is an integer value in zero to 255, with zero indicates
4227 * no signal, and 255 indicates the loudest signal level.
4228 *
4229 * @param slot The conference bridge slot number.
4230 * @param tx_level Optional argument to receive the level of signal
4231 * transmitted to the specified port (i.e. the direction
4232 * is from the bridge to the port).
4233 * @param rx_level Optional argument to receive the level of signal
4234 * received from the port (i.e. the direction is from the
4235 * port to the bridge).
4236 *
4237 * @return PJ_SUCCESS on success.
Benny Prijonoe6ead542007-01-31 20:53:31 +00004238 *
4239 * \par Python:
4240 * Not implemented (yet)
Benny Prijono6dd967c2006-12-26 02:27:14 +00004241 */
4242PJ_DECL(pj_status_t) pjsua_conf_get_signal_level(pjsua_conf_port_id slot,
4243 unsigned *tx_level,
4244 unsigned *rx_level);
4245
Benny Prijono6dd967c2006-12-26 02:27:14 +00004246
Benny Prijonoeebe9af2006-06-13 22:57:13 +00004247/*****************************************************************************
Benny Prijonoa66c3312007-01-21 23:12:40 +00004248 * File player and playlist.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00004249 */
4250
Benny Prijono9fc735d2006-05-28 14:58:12 +00004251/**
Benny Prijonoa66c3312007-01-21 23:12:40 +00004252 * Create a file player, and automatically add this player to
Benny Prijonoeebe9af2006-06-13 22:57:13 +00004253 * the conference bridge.
4254 *
4255 * @param filename The filename to be played. Currently only
Benny Prijono312aff92006-06-17 04:08:30 +00004256 * WAV files are supported, and the WAV file MUST be
4257 * formatted as 16bit PCM mono/single channel (any
4258 * clock rate is supported).
Benny Prijono58add7c2008-01-18 13:24:07 +00004259 * @param options Optional option flag. Application may specify
4260 * PJMEDIA_FILE_NO_LOOP to prevent playback loop.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00004261 * @param p_id Pointer to receive player ID.
4262 *
4263 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00004264 *
4265 * \par Python:
4266 * The function returns (status, id) tuple:
4267 * \code
4268 status, id = py_pjsua.player_create(filename, options)
4269 * \endcode
Benny Prijono9fc735d2006-05-28 14:58:12 +00004270 */
4271PJ_DECL(pj_status_t) pjsua_player_create(const pj_str_t *filename,
Benny Prijonoeebe9af2006-06-13 22:57:13 +00004272 unsigned options,
Benny Prijonoeebe9af2006-06-13 22:57:13 +00004273 pjsua_player_id *p_id);
Benny Prijono9fc735d2006-05-28 14:58:12 +00004274
4275
4276/**
Benny Prijonoa66c3312007-01-21 23:12:40 +00004277 * Create a file playlist media port, and automatically add the port
4278 * to the conference bridge.
4279 *
4280 * @param file_names Array of file names to be added to the play list.
4281 * Note that the files must have the same clock rate,
4282 * number of channels, and number of bits per sample.
4283 * @param file_count Number of files in the array.
4284 * @param label Optional label to be set for the media port.
4285 * @param options Optional option flag. Application may specify
4286 * PJMEDIA_FILE_NO_LOOP to prevent looping.
4287 * @param p_id Optional pointer to receive player ID.
4288 *
4289 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00004290 *
4291 * \par Python:
4292 * Not implemented yet.
Benny Prijonoa66c3312007-01-21 23:12:40 +00004293 */
4294PJ_DECL(pj_status_t) pjsua_playlist_create(const pj_str_t file_names[],
4295 unsigned file_count,
4296 const pj_str_t *label,
4297 unsigned options,
4298 pjsua_player_id *p_id);
4299
4300/**
4301 * Get conference port ID associated with player or playlist.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00004302 *
4303 * @param id The file player ID.
4304 *
4305 * @return Conference port ID associated with this player.
Benny Prijonoe6ead542007-01-31 20:53:31 +00004306 *
4307 * \par Python:
4308 * \code
4309 port_id = py_pjsua.player_get_conf_port(id)
4310 * \endcode
Benny Prijono9fc735d2006-05-28 14:58:12 +00004311 */
Benny Prijono8b1889b2006-06-06 18:40:40 +00004312PJ_DECL(pjsua_conf_port_id) pjsua_player_get_conf_port(pjsua_player_id id);
Benny Prijono9fc735d2006-05-28 14:58:12 +00004313
4314
4315/**
Benny Prijonoa66c3312007-01-21 23:12:40 +00004316 * Get the media port for the player or playlist.
Benny Prijono469b1522006-12-26 03:05:17 +00004317 *
4318 * @param id The player ID.
4319 * @param p_port The media port associated with the player.
4320 *
4321 * @return PJ_SUCCESS on success.
Benny Prijonoe6ead542007-01-31 20:53:31 +00004322 *
4323 * \par Python:
4324 * Not applicable.
Benny Prijono469b1522006-12-26 03:05:17 +00004325 */
Benny Prijono58add7c2008-01-18 13:24:07 +00004326PJ_DECL(pj_status_t) pjsua_player_get_port(pjsua_player_id id,
Benny Prijono469b1522006-12-26 03:05:17 +00004327 pjmedia_port **p_port);
4328
4329/**
Benny Prijonoa66c3312007-01-21 23:12:40 +00004330 * Set playback position. This operation is not valid for playlist.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00004331 *
4332 * @param id The file player ID.
4333 * @param samples The playback position, in samples. Application can
4334 * specify zero to re-start the playback.
4335 *
4336 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00004337 *
4338 * \par Python:
4339 * \code
4340 status = py_pjsua.player_set_pos(id, samples)
4341 * \endcode
Benny Prijono9fc735d2006-05-28 14:58:12 +00004342 */
4343PJ_DECL(pj_status_t) pjsua_player_set_pos(pjsua_player_id id,
4344 pj_uint32_t samples);
4345
4346
4347/**
Benny Prijonoa66c3312007-01-21 23:12:40 +00004348 * Close the file of playlist, remove the player from the bridge, and free
4349 * resources associated with the file player or playlist.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00004350 *
4351 * @param id The file player ID.
4352 *
4353 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00004354 *
4355 * \par Python:
4356 * \code
4357 status = py_pjsua.player_destroy(id)
4358 * \endcode
Benny Prijono9fc735d2006-05-28 14:58:12 +00004359 */
4360PJ_DECL(pj_status_t) pjsua_player_destroy(pjsua_player_id id);
4361
4362
Benny Prijonoeebe9af2006-06-13 22:57:13 +00004363/*****************************************************************************
4364 * File recorder.
4365 */
Benny Prijono9fc735d2006-05-28 14:58:12 +00004366
4367/**
Benny Prijonoeebe9af2006-06-13 22:57:13 +00004368 * Create a file recorder, and automatically connect this recorder to
Benny Prijonoc95a0f02007-04-09 07:06:08 +00004369 * the conference bridge. The recorder currently supports recording WAV file.
4370 * The type of the recorder to use is determined by the extension of the file
4371 * (e.g. ".wav").
Benny Prijonoeebe9af2006-06-13 22:57:13 +00004372 *
Benny Prijonob3cdb2b2006-10-19 15:49:47 +00004373 * @param filename Output file name. The function will determine the
4374 * default format to be used based on the file extension.
Benny Prijonoc95a0f02007-04-09 07:06:08 +00004375 * Currently ".wav" is supported on all platforms.
Benny Prijono8f310522006-10-20 11:08:49 +00004376 * @param enc_type Optionally specify the type of encoder to be used to
4377 * compress the media, if the file can support different
4378 * encodings. This value must be zero for now.
4379 * @param enc_param Optionally specify codec specific parameter to be
Benny Prijonoc95a0f02007-04-09 07:06:08 +00004380 * passed to the file writer.
Benny Prijono8f310522006-10-20 11:08:49 +00004381 * For .WAV recorder, this value must be NULL.
4382 * @param max_size Maximum file size. Specify zero or -1 to remove size
4383 * limitation. This value must be zero or -1 for now.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00004384 * @param options Optional options.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00004385 * @param p_id Pointer to receive the recorder instance.
4386 *
4387 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00004388 *
4389 * \par Python:
4390 * \code
4391 status, id = py_pjsua.recorder_create(filename, enc_type, enc_param, max_size, options)
4392 * \endcode
4393 * The \a enc_param is a string in Python.
Benny Prijono9fc735d2006-05-28 14:58:12 +00004394 */
4395PJ_DECL(pj_status_t) pjsua_recorder_create(const pj_str_t *filename,
Benny Prijono8f310522006-10-20 11:08:49 +00004396 unsigned enc_type,
4397 void *enc_param,
Benny Prijonoeebe9af2006-06-13 22:57:13 +00004398 pj_ssize_t max_size,
4399 unsigned options,
Benny Prijonoeebe9af2006-06-13 22:57:13 +00004400 pjsua_recorder_id *p_id);
Benny Prijono9fc735d2006-05-28 14:58:12 +00004401
4402
4403/**
4404 * Get conference port associated with recorder.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00004405 *
4406 * @param id The recorder ID.
4407 *
4408 * @return Conference port ID associated with this recorder.
Benny Prijonoe6ead542007-01-31 20:53:31 +00004409 *
4410 * \par Python:
4411 * \code
4412 port_id = py_pjsua.recorder_get_conf_port(id)
4413 * \endcode
Benny Prijono9fc735d2006-05-28 14:58:12 +00004414 */
Benny Prijono8b1889b2006-06-06 18:40:40 +00004415PJ_DECL(pjsua_conf_port_id) pjsua_recorder_get_conf_port(pjsua_recorder_id id);
Benny Prijono9fc735d2006-05-28 14:58:12 +00004416
4417
4418/**
Benny Prijono469b1522006-12-26 03:05:17 +00004419 * Get the media port for the recorder.
4420 *
4421 * @param id The recorder ID.
4422 * @param p_port The media port associated with the recorder.
4423 *
4424 * @return PJ_SUCCESS on success.
Benny Prijonoe6ead542007-01-31 20:53:31 +00004425 *
4426 * \par Python:
4427 * Not applicable.
Benny Prijono469b1522006-12-26 03:05:17 +00004428 */
4429PJ_DECL(pj_status_t) pjsua_recorder_get_port(pjsua_recorder_id id,
4430 pjmedia_port **p_port);
4431
4432
4433/**
Benny Prijonoeebe9af2006-06-13 22:57:13 +00004434 * Destroy recorder (this will complete recording).
4435 *
4436 * @param id The recorder ID.
4437 *
4438 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00004439 *
4440 * \par Python:
4441 * \code
4442 status = py_pjsua.recorder_destroy(id)
4443 * \endcode
Benny Prijono9fc735d2006-05-28 14:58:12 +00004444 */
4445PJ_DECL(pj_status_t) pjsua_recorder_destroy(pjsua_recorder_id id);
4446
4447
Benny Prijonoeebe9af2006-06-13 22:57:13 +00004448/*****************************************************************************
4449 * Sound devices.
4450 */
4451
Benny Prijono9fc735d2006-05-28 14:58:12 +00004452/**
Benny Prijonob5388cf2007-01-04 22:45:08 +00004453 * Enum all sound devices installed in the system.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00004454 *
4455 * @param info Array of info to be initialized.
4456 * @param count On input, specifies max elements in the array.
4457 * On return, it contains actual number of elements
4458 * that have been initialized.
4459 *
4460 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00004461 *
4462 *
4463 * \par Python:
4464 * The function returns list of sound device info:
4465 * \code
4466 [dev_infos] = py_pjsua.enum_snd_devs()
4467 * \endcode
4468 *
Benny Prijono9fc735d2006-05-28 14:58:12 +00004469 */
Benny Prijonoeebe9af2006-06-13 22:57:13 +00004470PJ_DECL(pj_status_t) pjsua_enum_snd_devs(pjmedia_snd_dev_info info[],
4471 unsigned *count);
Benny Prijono9fc735d2006-05-28 14:58:12 +00004472
4473
Benny Prijonoa3cbb1c2006-08-25 12:41:05 +00004474
4475/**
4476 * Get currently active sound devices. If sound devices has not been created
4477 * (for example when pjsua_start() is not called), it is possible that
4478 * the function returns PJ_SUCCESS with -1 as device IDs.
4479 *
4480 * @param capture_dev On return it will be filled with device ID of the
4481 * capture device.
4482 * @param playback_dev On return it will be filled with device ID of the
4483 * device ID of the playback device.
4484 *
4485 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00004486 *
4487 * \par Python:
Benny Prijonoebdf8772007-02-01 19:25:50 +00004488 * The function takes no argument and return an (integer,integer) tuple:
Benny Prijonoe6ead542007-01-31 20:53:31 +00004489 * \code
4490 capture_dev, playback_dev = py_pjsua.get_snd_dev()
4491 * \endcode
Benny Prijonoa3cbb1c2006-08-25 12:41:05 +00004492 */
4493PJ_DECL(pj_status_t) pjsua_get_snd_dev(int *capture_dev,
4494 int *playback_dev);
4495
4496
Benny Prijono9fc735d2006-05-28 14:58:12 +00004497/**
Benny Prijonoeebe9af2006-06-13 22:57:13 +00004498 * Select or change sound device. Application may call this function at
4499 * any time to replace current sound device.
4500 *
4501 * @param capture_dev Device ID of the capture device.
4502 * @param playback_dev Device ID of the playback device.
4503 *
4504 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00004505 *
4506 * \par Python:
4507 * \code
4508 status = py_pjsua.set_snd_dev(capture_dev, playback_dev)
4509 * \endcode
Benny Prijono9fc735d2006-05-28 14:58:12 +00004510 */
Benny Prijonoeebe9af2006-06-13 22:57:13 +00004511PJ_DECL(pj_status_t) pjsua_set_snd_dev(int capture_dev,
4512 int playback_dev);
4513
4514
4515/**
4516 * Set pjsua to use null sound device. The null sound device only provides
4517 * the timing needed by the conference bridge, and will not interract with
4518 * any hardware.
4519 *
4520 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00004521 *
4522 * \par Python:
4523 * \code
4524 status = py_pjsua.set_null_snd_dev()
4525 * \endcode
Benny Prijonoeebe9af2006-06-13 22:57:13 +00004526 */
4527PJ_DECL(pj_status_t) pjsua_set_null_snd_dev(void);
4528
4529
Benny Prijonoe909eac2006-07-27 22:04:56 +00004530/**
4531 * Disconnect the main conference bridge from any sound devices, and let
4532 * application connect the bridge to it's own sound device/master port.
4533 *
4534 * @return The port interface of the conference bridge,
4535 * so that application can connect this to it's own
4536 * sound device or master port.
Benny Prijonoe6ead542007-01-31 20:53:31 +00004537 *
4538 * \par Python:
4539 * Not applicable (for now).
Benny Prijonoe909eac2006-07-27 22:04:56 +00004540 */
4541PJ_DECL(pjmedia_port*) pjsua_set_no_snd_dev(void);
4542
4543
Benny Prijonof20687a2006-08-04 18:27:19 +00004544/**
Benny Prijono22dfe592006-08-06 12:07:13 +00004545 * Configure the echo canceller tail length of the sound port.
Benny Prijonof20687a2006-08-04 18:27:19 +00004546 *
4547 * @param tail_ms The tail length, in miliseconds. Set to zero to
4548 * disable AEC.
Benny Prijonoa7b376b2008-01-25 16:06:33 +00004549 * @param options Options to be passed to pjmedia_echo_create().
Benny Prijono5da50432006-08-07 10:24:52 +00004550 * Normally the value should be zero.
Benny Prijonof20687a2006-08-04 18:27:19 +00004551 *
4552 * @return PJ_SUCCESS on success.
Benny Prijonoe6ead542007-01-31 20:53:31 +00004553 *
4554 * \par Python:
4555 * \code
4556 status = py_pjsua.set_ec(tail_ms, options)
4557 * \endcode
Benny Prijonof20687a2006-08-04 18:27:19 +00004558 */
Benny Prijono5da50432006-08-07 10:24:52 +00004559PJ_DECL(pj_status_t) pjsua_set_ec(unsigned tail_ms, unsigned options);
Benny Prijonof20687a2006-08-04 18:27:19 +00004560
4561
4562/**
Benny Prijono22dfe592006-08-06 12:07:13 +00004563 * Get current echo canceller tail length.
Benny Prijonof20687a2006-08-04 18:27:19 +00004564 *
4565 * @param p_tail_ms Pointer to receive the tail length, in miliseconds.
4566 * If AEC is disabled, the value will be zero.
4567 *
4568 * @return PJ_SUCCESS on success.
Benny Prijonoe6ead542007-01-31 20:53:31 +00004569 *
4570 * \par Python:
4571 * \code
4572 tail_ms = py_pjsua.get_ec_tail()
4573 * \endcode
Benny Prijonof20687a2006-08-04 18:27:19 +00004574 */
Benny Prijono22dfe592006-08-06 12:07:13 +00004575PJ_DECL(pj_status_t) pjsua_get_ec_tail(unsigned *p_tail_ms);
Benny Prijonof20687a2006-08-04 18:27:19 +00004576
4577
4578
Benny Prijonoeebe9af2006-06-13 22:57:13 +00004579/*****************************************************************************
4580 * Codecs.
4581 */
4582
4583/**
4584 * Enum all supported codecs in the system.
4585 *
4586 * @param id Array of ID to be initialized.
4587 * @param count On input, specifies max elements in the array.
4588 * On return, it contains actual number of elements
4589 * that have been initialized.
4590 *
4591 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00004592 *
4593 * \par Python:
4594 * This function takes no argument and returns list of codec infos:
4595 * \code
4596 [codec_info] = py_pjsua.enum_codecs()
4597 * \endcode
Benny Prijonoeebe9af2006-06-13 22:57:13 +00004598 */
4599PJ_DECL(pj_status_t) pjsua_enum_codecs( pjsua_codec_info id[],
4600 unsigned *count );
4601
4602
4603/**
4604 * Change codec priority.
4605 *
Benny Prijonoe6ead542007-01-31 20:53:31 +00004606 * @param codec_id Codec ID, which is a string that uniquely identify
4607 * the codec (such as "speex/8000"). Please see pjsua
4608 * manual or pjmedia codec reference for details.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00004609 * @param priority Codec priority, 0-255, where zero means to disable
4610 * the codec.
4611 *
4612 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00004613 *
4614 * \par Python:
4615 * \code
4616 status = py_pjsua.codec_set_priority(codec_id, priority)
4617 * \endcode
Benny Prijonoeebe9af2006-06-13 22:57:13 +00004618 */
Benny Prijonoe6ead542007-01-31 20:53:31 +00004619PJ_DECL(pj_status_t) pjsua_codec_set_priority( const pj_str_t *codec_id,
Benny Prijonoeebe9af2006-06-13 22:57:13 +00004620 pj_uint8_t priority );
4621
4622
4623/**
4624 * Get codec parameters.
4625 *
Benny Prijonoe6ead542007-01-31 20:53:31 +00004626 * @param codec_id Codec ID.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00004627 * @param param Structure to receive codec parameters.
4628 *
4629 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00004630 *
4631 * \par Python:
4632 * The Python function is experimental:
4633 * \code
4634 codec_param = py_pjsua.codec_get_param(codec_id)
4635 * \endcode
Benny Prijonoeebe9af2006-06-13 22:57:13 +00004636 */
Benny Prijonoe6ead542007-01-31 20:53:31 +00004637PJ_DECL(pj_status_t) pjsua_codec_get_param( const pj_str_t *codec_id,
Benny Prijonoeebe9af2006-06-13 22:57:13 +00004638 pjmedia_codec_param *param );
4639
4640
4641/**
4642 * Set codec parameters.
4643 *
Benny Prijonoe6ead542007-01-31 20:53:31 +00004644 * @param codec_id Codec ID.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00004645 * @param param Codec parameter to set.
4646 *
4647 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00004648 *
4649 * \par Python:
4650 * The Python function is experimental:
4651 * \code
4652 status = py_pjsua.codec_set_param(codec_id, param)
4653 * \endcode
4654
Benny Prijonoeebe9af2006-06-13 22:57:13 +00004655 */
Benny Prijonoe6ead542007-01-31 20:53:31 +00004656PJ_DECL(pj_status_t) pjsua_codec_set_param( const pj_str_t *codec_id,
Benny Prijonoeebe9af2006-06-13 22:57:13 +00004657 const pjmedia_codec_param *param);
4658
4659
4660
Benny Prijono9fc735d2006-05-28 14:58:12 +00004661
Benny Prijono312aff92006-06-17 04:08:30 +00004662/**
4663 * Create UDP media transports for all the calls. This function creates
4664 * one UDP media transport for each call.
Benny Prijonof3195072006-02-14 21:15:30 +00004665 *
Benny Prijono312aff92006-06-17 04:08:30 +00004666 * @param cfg Media transport configuration. The "port" field in the
4667 * configuration is used as the start port to bind the
4668 * sockets.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00004669 *
4670 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00004671 *
4672 * \par Python:
4673 * Not implemented yet.
Benny Prijonof3195072006-02-14 21:15:30 +00004674 */
Benny Prijono312aff92006-06-17 04:08:30 +00004675PJ_DECL(pj_status_t)
4676pjsua_media_transports_create(const pjsua_transport_config *cfg);
Benny Prijonof3195072006-02-14 21:15:30 +00004677
Benny Prijonodc39fe82006-05-26 12:17:46 +00004678
4679/**
Benny Prijono312aff92006-06-17 04:08:30 +00004680 * Register custom media transports to be used by calls. There must
4681 * enough media transports for all calls.
Benny Prijonoeebe9af2006-06-13 22:57:13 +00004682 *
Benny Prijono312aff92006-06-17 04:08:30 +00004683 * @param tp The media transport array.
4684 * @param count Number of elements in the array. This number MUST
4685 * match the number of maximum calls configured when
4686 * pjsua is created.
4687 * @param auto_delete Flag to indicate whether the transports should be
4688 * destroyed when pjsua is shutdown.
4689 *
4690 * @return PJ_SUCCESS on success, or the appropriate error code.
Benny Prijonoe6ead542007-01-31 20:53:31 +00004691 *
4692 * \par Python:
4693 * Note applicable.
Benny Prijonodc39fe82006-05-26 12:17:46 +00004694 */
Benny Prijono312aff92006-06-17 04:08:30 +00004695PJ_DECL(pj_status_t)
4696pjsua_media_transports_attach( pjsua_media_transport tp[],
4697 unsigned count,
4698 pj_bool_t auto_delete);
Benny Prijonodc39fe82006-05-26 12:17:46 +00004699
4700
Benny Prijono312aff92006-06-17 04:08:30 +00004701/**
4702 * @}
4703 */
4704
Benny Prijonof3195072006-02-14 21:15:30 +00004705
Benny Prijono268ca612006-02-07 12:34:11 +00004706
Benny Prijono312aff92006-06-17 04:08:30 +00004707/**
4708 * @}
4709 */
4710
Benny Prijonoe6ead542007-01-31 20:53:31 +00004711PJ_END_DECL
4712
Benny Prijono312aff92006-06-17 04:08:30 +00004713
Benny Prijono268ca612006-02-07 12:34:11 +00004714#endif /* __PJSUA_H__ */