blob: 3a144f80045fe8236197bff8b847b8c3ddf43a75 [file] [log] [blame]
Benny Prijono268ca612006-02-07 12:34:11 +00001/* $Id$ */
2/*
Benny Prijonoa771a512007-02-19 01:13:53 +00003 * Copyright (C) 2003-2007 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 __SIP_INVITE_SESSION_H__
20#define __SIP_INVITE_SESSION_H__
21
Benny Prijono312aff92006-06-17 04:08:30 +000022/**
23 * @file sip_inv.h
24 * @brief INVITE sessions
25 */
26
27
Benny Prijono268ca612006-02-07 12:34:11 +000028#include <pjsip/sip_dialog.h>
29#include <pjmedia/sdp_neg.h>
30
Benny Prijonof3195072006-02-14 21:15:30 +000031
Benny Prijono312aff92006-06-17 04:08:30 +000032/**
33 * @defgroup PJSIP_HIGH_UA User Agent Library
34 * @ingroup PJSIP
35 * @brief Mid-level User Agent Library.
36 *
37 * This is the high level user agent library, which consists of:
38 * - @ref PJSIP_INV, to encapsulate INVITE sessions and SDP
39 * negotiation in the session,
40 * - @ref PJSUA_REGC, high level client registration API, and
41 * - @ref PJSUA_XFER.
42 *
43 * More detailed information is explained in
44 * <A HREF="/docs.htm">PJSIP Developer's Guide</A>
45 * PDF document, and readers are encouraged to read the document to
46 * get the concept behind dialog, dialog usages, and INVITE sessions.
47 *
48 * The User Agent Library is implemented in <b>pjsip-ua</b> static
49 * library.
50 */
51
52/**
53 * @defgroup PJSIP_INV INVITE Session
54 * @ingroup PJSIP_HIGH_UA
55 * @brief Provides INVITE session management.
56 * @{
57 *
58 * The INVITE session uses the @ref PJSIP_DIALOG framework to manage
59 * the underlying dialog, and is one type of usages that can use
60 * a particular dialog instance (other usages are event subscription,
61 * discussed in @ref PJSIP_EVENT_NOT). The INVITE session manages
62 * the life-time of the session, and also manages the SDP negotiation.
63 *
64 * Application must link with <b>pjsip-ua</b> static library to use this API.
65 *
66 * More detailed information is explained in
67 * <A HREF="/docs.htm">PJSIP Developer's Guide</A>
68 * PDF document, and readers are encouraged to read the document to
69 * get the concept behind dialog, dialog usages, and INVITE sessions.
70 *
71 * The INVITE session does NOT manage media. If application wants to
72 * use API that encapsulates both signaling and media in a very easy
73 * to use API, it can use @ref PJSUA_LIB for this purpose.
74 */
75
Benny Prijonof3195072006-02-14 21:15:30 +000076PJ_BEGIN_DECL
77
78
Benny Prijono312aff92006-06-17 04:08:30 +000079/**
80 * @see pjsip_inv_session
81 */
Benny Prijono268ca612006-02-07 12:34:11 +000082typedef struct pjsip_inv_session pjsip_inv_session;
Benny Prijono312aff92006-06-17 04:08:30 +000083
Benny Prijono268ca612006-02-07 12:34:11 +000084
85/**
86 * This enumeration describes invite session state.
87 */
Benny Prijono312aff92006-06-17 04:08:30 +000088typedef enum pjsip_inv_state
Benny Prijono268ca612006-02-07 12:34:11 +000089{
90 PJSIP_INV_STATE_NULL, /**< Before INVITE is sent or received */
91 PJSIP_INV_STATE_CALLING, /**< After INVITE is sent */
92 PJSIP_INV_STATE_INCOMING, /**< After INVITE is received. */
93 PJSIP_INV_STATE_EARLY, /**< After response with To tag. */
94 PJSIP_INV_STATE_CONNECTING, /**< After 2xx is sent/received. */
95 PJSIP_INV_STATE_CONFIRMED, /**< After ACK is sent/received. */
96 PJSIP_INV_STATE_DISCONNECTED, /**< Session is terminated. */
Benny Prijono312aff92006-06-17 04:08:30 +000097} pjsip_inv_state;
Benny Prijono268ca612006-02-07 12:34:11 +000098
99/**
100 * This structure contains callbacks to be registered by application to
101 * receieve notifications from the framework about various events in
102 * the invite session.
103 */
Benny Prijono312aff92006-06-17 04:08:30 +0000104typedef struct pjsip_inv_callback
Benny Prijono268ca612006-02-07 12:34:11 +0000105{
106 /**
107 * This callback is called when the invite sesion state has changed.
108 * Application should inspect the session state (inv_sess->state) to get
109 * the current state of the session.
110 *
111 * This callback is mandatory.
112 *
113 * @param inv The invite session.
114 * @param e The event which has caused the invite session's
115 * state to change.
116 */
117 void (*on_state_changed)(pjsip_inv_session *inv, pjsip_event *e);
118
119
120 /**
121 * This callback is called when the invite usage module has created
122 * a new dialog and invite because of forked outgoing request.
123 *
124 * This callback is mandatory.
125 *
126 * @param inv The new invite session.
127 * @param e The event which has caused the dialog to fork.
128 * The type of this event can be either
129 * PJSIP_EVENT_RX_MSG or PJSIP_EVENT_RX_200_MSG.
130 */
131 void (*on_new_session)(pjsip_inv_session *inv, pjsip_event *e);
132
133 /**
134 * This callback is called whenever any transactions within the session
135 * has changed their state. Application MAY implement this callback,
136 * e.g. to monitor the progress of an outgoing request.
137 *
138 * This callback is optional.
139 *
140 * @param inv The invite session.
141 * @param tsx The transaction, which state has changed.
142 * @param e The event which has caused the transation state's
143 * to change.
144 */
145 void (*on_tsx_state_changed)(pjsip_inv_session *inv,
146 pjsip_transaction *tsx,
147 pjsip_event *e);
148
149 /**
150 * This callback is called when the invite session has received
151 * new offer from peer. Application can inspect the remote offer
Benny Prijono26ff9062006-02-21 23:47:00 +0000152 * in "offer".
Benny Prijono268ca612006-02-07 12:34:11 +0000153 *
154 * @param inv The invite session.
Benny Prijono26ff9062006-02-21 23:47:00 +0000155 * @param offer Remote offer.
Benny Prijono268ca612006-02-07 12:34:11 +0000156 */
Benny Prijono26ff9062006-02-21 23:47:00 +0000157 void (*on_rx_offer)(pjsip_inv_session *inv,
158 const pjmedia_sdp_session *offer);
Benny Prijono268ca612006-02-07 12:34:11 +0000159
160 /**
161 * This callback is called after SDP offer/answer session has completed.
162 * The status argument specifies the status of the offer/answer,
163 * as returned by pjmedia_sdp_neg_negotiate().
164 *
165 * This callback is optional (from the point of view of the framework),
166 * but all useful applications normally need to implement this callback.
167 *
168 * @param inv The invite session.
169 * @param status The negotiation status.
170 */
171 void (*on_media_update)(pjsip_inv_session *inv_ses,
172 pj_status_t status);
Benny Prijono312aff92006-06-17 04:08:30 +0000173
174} pjsip_inv_callback;
175
Benny Prijono268ca612006-02-07 12:34:11 +0000176
177
178/**
179 * This enumeration shows various options that can be applied to a session.
180 * The bitmask combination of these options need to be specified when
181 * creating a session. After the dialog is established (including early),
182 * the options member of #pjsip_inv_session shows which capabilities are
183 * common in both endpoints.
184 */
185enum pjsip_inv_option
186{
187 /**
188 * Indicate support for reliable provisional response extension
189 */
190 PJSIP_INV_SUPPORT_100REL = 1,
191
192 /**
193 * Indicate support for session timer extension.
194 */
195 PJSIP_INV_SUPPORT_TIMER = 2,
196
197 /**
198 * Indicate support for UPDATE method. This is automatically implied
199 * when creating outgoing dialog. After the dialog is established,
200 * the options member of #pjsip_inv_session shows whether peer supports
201 * this method as well.
202 */
203 PJSIP_INV_SUPPORT_UPDATE = 4,
204
205 /**
206 * Require reliable provisional response extension.
207 */
208 PJSIP_INV_REQUIRE_100REL = 32,
209
210 /**
211 * Require session timer extension.
212 */
213 PJSIP_INV_REQUIRE_TIMER = 64,
214
215};
216
217
218/**
219 * This structure describes the invite session.
220 */
221struct pjsip_inv_session
222{
Benny Prijono0b6340c2006-06-13 22:21:23 +0000223 char obj_name[PJ_MAX_OBJ_NAME]; /**< Log identification */
Benny Prijonoe4f2abb2006-02-10 14:04:05 +0000224 pj_pool_t *pool; /**< Dialog's pool. */
225 pjsip_inv_state state; /**< Invite sess state. */
Benny Prijono1dc8be02007-05-30 04:26:40 +0000226 pj_bool_t cancelling; /**< CANCEL requested */
227 pj_bool_t pending_cancel; /**< Wait to send CANCEL*/
Benny Prijonod4e0abd2006-03-05 11:53:36 +0000228 pjsip_status_code cause; /**< Disconnect cause. */
Benny Prijono0b6340c2006-06-13 22:21:23 +0000229 pj_str_t cause_text; /**< Cause text. */
Benny Prijonod4e0abd2006-03-05 11:53:36 +0000230 pj_bool_t notify; /**< Internal. */
Benny Prijonoe4f2abb2006-02-10 14:04:05 +0000231 pjsip_dialog *dlg; /**< Underlying dialog. */
232 pjsip_role_e role; /**< Invite role. */
233 unsigned options; /**< Options in use. */
234 pjmedia_sdp_neg *neg; /**< Negotiator. */
235 pjsip_transaction *invite_tsx; /**< 1st invite tsx. */
236 void *mod_data[PJSIP_MAX_MODULE];/**< Modules data. */
Benny Prijono268ca612006-02-07 12:34:11 +0000237};
238
239
240/**
241 * Initialize the invite usage module and register it to the endpoint.
242 * The callback argument contains pointer to functions to be called on
243 * occurences of events in invite sessions.
244 *
245 * @param endpt The endpoint instance.
Benny Prijono312aff92006-06-17 04:08:30 +0000246 * @param cb Callback structure.
Benny Prijono268ca612006-02-07 12:34:11 +0000247 *
248 * @return PJ_SUCCESS on success, or the appropriate error code.
249 */
250PJ_DECL(pj_status_t) pjsip_inv_usage_init(pjsip_endpoint *endpt,
Benny Prijono268ca612006-02-07 12:34:11 +0000251 const pjsip_inv_callback *cb);
252
253/**
254 * Get the INVITE usage module instance.
255 *
256 * @return PJ_SUCCESS on success, or the appropriate error code.
257 */
258PJ_DECL(pjsip_module*) pjsip_inv_usage_instance(void);
259
260
Benny Prijono632ce712006-02-09 14:01:40 +0000261/**
262 * Dump user agent contents (e.g. all dialogs).
263 */
264PJ_DECL(void) pjsip_inv_usage_dump(void);
265
Benny Prijono268ca612006-02-07 12:34:11 +0000266
267/**
268 * Create UAC invite session for the specified dialog in dlg.
269 *
270 * @param dlg The dialog which will be used by this invite session.
271 * @param local_sdp If application has determined its media capability,
272 * it can specify the SDP here. Otherwise it can leave
273 * this to NULL, to let remote UAS specifies an offer.
274 * @param options The options argument is bitmask combination of SIP
275 * features in pjsip_inv_options enumeration.
276 * @param p_inv On successful return, the invite session will be put
277 * in this argument.
278 *
279 * @return The function will return PJ_SUCCESS if it can create
280 * the session. Otherwise the appropriate error status
281 * will be returned on failure.
282 */
283PJ_DECL(pj_status_t) pjsip_inv_create_uac(pjsip_dialog *dlg,
284 const pjmedia_sdp_session *local_sdp,
285 unsigned options,
286 pjsip_inv_session **p_inv);
287
288
289/**
290 * Application SHOULD call this function upon receiving the initial INVITE
291 * request in rdata before creating the invite session (or even dialog),
292 * to verify that the invite session can handle the INVITE request.
293 * This function verifies that local endpoint is capable to handle required
294 * SIP extensions in the request (i.e. Require header) and also the media,
295 * if media description is present in the request.
296 *
297 * @param rdata The incoming INVITE request.
298 *
299 * @param options Upon calling this function, the options argument
300 * MUST contain the desired SIP extensions to be
301 * applied to the session. Upon return, this argument
302 * will contain the SIP extension that will be applied
303 * to the session, after considering the Supported,
304 * Require, and Allow headers in the request.
305 *
306 * @param sdp If local media capability has been determined,
307 * and if application wishes to verify that it can
308 * handle the media offer in the incoming INVITE
309 * request, it SHOULD specify its local media capability
310 * in this argument.
311 * If it is not specified, media verification will not
312 * be performed by this function.
313 *
314 * @param dlg If tdata is not NULL, application needs to specify
315 * how to create the response. Either dlg or endpt
316 * argument MUST be specified, with dlg argument takes
317 * precedence when both are specified.
318 *
319 * If a dialog has been created prior to calling this
320 * function, then it MUST be specified in dlg argument.
321 * Otherwise application MUST specify the endpt argument
322 * (this is useful e.g. when application wants to send
323 * the response statelessly).
324 *
325 * @param endpt If tdata is not NULL, application needs to specify
326 * how to create the response. Either dlg or endpt
327 * argument MUST be specified, with dlg argument takes
328 * precedence when both are specified.
329 *
330 * @param tdata If this argument is not NULL, this function will
331 * create the appropriate non-2xx final response message
332 * when the verification fails.
333 *
334 * @return If everything has been negotiated successfully,
335 * the function will return PJ_SUCCESS. Otherwise it
336 * will return the reason of the failure as the return
337 * code.
338 *
339 * This function is capable to create the appropriate
340 * response message when the verification has failed.
341 * If tdata is specified, then a non-2xx final response
342 * will be created and put in this argument upon return,
343 * when the verification has failed.
344 *
345 * If a dialog has been created prior to calling this
346 * function, then it MUST be specified in dlg argument.
347 * Otherwise application MUST specify the endpt argument
348 * (this is useful e.g. when application wants to send
349 * the response statelessly).
350 */
351PJ_DECL(pj_status_t) pjsip_inv_verify_request( pjsip_rx_data *rdata,
352 unsigned *options,
353 const pjmedia_sdp_session *sdp,
354 pjsip_dialog *dlg,
355 pjsip_endpoint *endpt,
356 pjsip_tx_data **tdata);
357
358
359/**
360 * Create UAS invite session for the specified dialog in dlg. Application
361 * SHOULD call the verification function before calling this function,
362 * to ensure that it can create the session successfully.
363 *
364 * @param dlg The dialog to be used.
365 * @param rdata Application MUST specify the received INVITE request
366 * in rdata. The invite session needs to inspect the
367 * received request to see if the request contains
368 * features that it supports.
Benny Prijono312aff92006-06-17 04:08:30 +0000369 * @param local_sdp If application has determined its media capability,
Benny Prijono268ca612006-02-07 12:34:11 +0000370 * it can specify this capability in this argument.
371 * If SDP is received in the initial INVITE, the UAS
372 * capability specified in this argument doesn't have to
373 * match the received offer; the SDP negotiator is able
374 * to rearrange the media lines in the answer so that it
375 * matches the offer.
376 * @param options The options argument is bitmask combination of SIP
377 * features in pjsip_inv_options enumeration.
378 * @param p_inv Pointer to receive the newly created invite session.
379 *
380 * @return On successful, the invite session will be put in
381 * p_inv argument and the function will return PJ_SUCCESS.
382 * Otherwise the appropriate error status will be returned
383 * on failure.
384 */
385PJ_DECL(pj_status_t) pjsip_inv_create_uas(pjsip_dialog *dlg,
386 pjsip_rx_data *rdata,
387 const pjmedia_sdp_session *local_sdp,
388 unsigned options,
389 pjsip_inv_session **p_inv);
390
391
392/**
Benny Prijonod4e0abd2006-03-05 11:53:36 +0000393 * Forcefully terminate and destroy INVITE session, regardless of
394 * the state of the session. Note that this function should only be used
395 * when there is failure in the INVITE session creation. After the
396 * invite session has been created and initialized, normally application
397 * SHOULD use #pjsip_inv_end_session() to end the INVITE session instead.
398 *
399 * Note also that this function may terminate the underlying dialog, if
400 * there are no other sessions in the dialog.
401 *
402 * @param inv The invite session.
403 * @param st_code Status code for the reason of the termination.
404 * @param notify If set to non-zero, then on_state_changed()
405 * callback will be called.
406 *
407 * @return PJ_SUCCESS if the INVITE session has been
408 * terminated.
409 */
410PJ_DECL(pj_status_t) pjsip_inv_terminate( pjsip_inv_session *inv,
411 int st_code,
412 pj_bool_t notify );
413
414
415/**
Benny Prijono268ca612006-02-07 12:34:11 +0000416 * Create the initial INVITE request for this session. This function can only
417 * be called for UAC session. If local media capability is specified when
418 * the invite session was created, then this function will put an SDP offer
419 * in the outgoing INVITE request. Otherwise the outgoing request will not
420 * contain SDP body.
421 *
422 * @param inv The UAC invite session.
423 * @param p_tdata The initial INVITE request will be put in this
424 * argument if it can be created successfully.
425 *
426 * @return PJ_SUCCESS if the INVITE request can be created.
427 */
428PJ_DECL(pj_status_t) pjsip_inv_invite( pjsip_inv_session *inv,
429 pjsip_tx_data **p_tdata );
430
431
432/**
Benny Prijono64f851e2006-02-23 13:49:28 +0000433 * Create the initial response message for the incoming INVITE request in
434 * rdata with status code st_code and optional status text st_text. Use
435 * #pjsip_answer() to create subsequent response message.
436 */
437PJ_DECL(pj_status_t) pjsip_inv_initial_answer( pjsip_inv_session *inv,
438 pjsip_rx_data *rdata,
439 int st_code,
440 const pj_str_t *st_text,
441 const pjmedia_sdp_session *sdp,
442 pjsip_tx_data **p_tdata);
443
444/**
Benny Prijono268ca612006-02-07 12:34:11 +0000445 * Create a response message to the initial INVITE request. This function
446 * can only be called for the initial INVITE request, as subsequent
447 * re-INVITE request will be answered automatically.
448 *
449 * @param inv The UAS invite session.
450 * @param st_code The st_code contains the status code to be sent,
451 * which may be a provisional or final response.
452 * @param st_text If custom status text is desired, application can
453 * specify the text in st_text; otherwise if this
454 * argument is NULL, default status text will be used.
455 * @param local_sdp If application has specified its media capability
456 * during creation of UAS invite session, the local_sdp
457 * argument MUST be NULL. This is because application
458 * can not perform more than one SDP offer/answer session
459 * in a single INVITE transaction.
460 * If application has not specified its media capability
461 * during creation of UAS invite session, it MAY or MUST
462 * specify its capability in local_sdp argument,
463 * depending whether st_code indicates a 2xx final
464 * response.
465 * @param p_tdata Pointer to receive the response message created by
466 * this function.
467 *
468 * @return PJ_SUCCESS if response message was created
469 * successfully.
470 */
471PJ_DECL(pj_status_t) pjsip_inv_answer( pjsip_inv_session *inv,
472 int st_code,
473 const pj_str_t *st_text,
474 const pjmedia_sdp_session *local_sdp,
475 pjsip_tx_data **p_tdata );
476
477
Benny Prijonoa66c7152006-02-09 01:26:14 +0000478/**
Benny Prijono26ff9062006-02-21 23:47:00 +0000479 * Set local answer to respond to remote SDP offer, to be carried by
480 * subsequent response (or request).
Benny Prijonoa66c7152006-02-09 01:26:14 +0000481 *
482 * @param inv The invite session.
483 * @param sdp The SDP description which will be set as answer
484 * to remote.
Benny Prijono26ff9062006-02-21 23:47:00 +0000485 *
486 * @return PJ_SUCCESS if local answer can be accepted by
487 * SDP negotiator.
Benny Prijonoa66c7152006-02-09 01:26:14 +0000488 */
Benny Prijono26ff9062006-02-21 23:47:00 +0000489PJ_DECL(pj_status_t) pjsip_inv_set_sdp_answer(pjsip_inv_session *inv,
490 const pjmedia_sdp_session *sdp );
491
Benny Prijonoa66c7152006-02-09 01:26:14 +0000492
Benny Prijono268ca612006-02-07 12:34:11 +0000493/**
494 * Create a SIP message to initiate invite session termination. Depending on
495 * the state of the session, this function may return CANCEL request,
496 * a non-2xx final response, or a BYE request. If the session has not answered
497 * the incoming INVITE, this function creates the non-2xx final response with
498 * the specified status code in st_code and optional status text in st_text.
499 *
500 * @param inv The invite session.
501 * @param st_code Status code to be used for terminating the session.
502 * @param st_text Optional status text.
503 * @param p_tdata Pointer to receive the message to be created.
504 *
505 * @return PJ_SUCCESS if termination message can be created.
506 */
507PJ_DECL(pj_status_t) pjsip_inv_end_session( pjsip_inv_session *inv,
508 int st_code,
509 const pj_str_t *st_text,
510 pjsip_tx_data **p_tdata );
511
512
513
514/**
515 * Create a re-INVITE request.
516 *
517 * @param inv The invite session.
518 * @param new_contact If application wants to update its local contact and
519 * inform peer to perform target refresh with a new
520 * contact, it can specify the new contact in this
521 * argument; otherwise this argument must be NULL.
522 * @param new_offer Application MAY initiate a new SDP offer/answer
523 * session in the request when there is no pending
524 * answer to be sent or received. It can detect this
525 * condition by observing the state of the SDP
526 * negotiator of the invite session. If new offer
527 * should be sent to remote, the offer must be specified
528 * in this argument, otherwise it must be NULL.
529 * @param p_tdata Pointer to receive the re-INVITE request message to
530 * be created.
531 *
532 * @return PJ_SUCCESS if a re-INVITE request with the specified
533 * characteristics (e.g. to contain new offer) can be
534 * created.
535 */
536PJ_DECL(pj_status_t) pjsip_inv_reinvite(pjsip_inv_session *inv,
537 const pj_str_t *new_contact,
538 const pjmedia_sdp_session *new_offer,
539 pjsip_tx_data **p_tdata );
540
541
542
543/**
544 * Create an UPDATE request.
545 *
546 * @param inv The invite session.
547 * @param new_contact If application wants to update its local contact
548 * and inform peer to perform target refresh with a new
549 * contact, it can specify the new contact in this
550 * argument; otherwise this argument must be NULL.
551 * @param new_offer Application MAY initiate a new SDP offer/answer
552 * session in the request when there is no pending answer
553 * to be sent or received. It can detect this condition
554 * by observing the state of the SDP negotiator of the
555 * invite session. If new offer should be sent to remote,
556 * the offer must be specified in this argument; otherwise
557 * this argument must be NULL.
558 * @param p_tdata Pointer to receive the UPDATE request message to
559 * be created.
560 *
561 * @return PJ_SUCCESS if a UPDATE request with the specified
562 * characteristics (e.g. to contain new offer) can be
563 * created.
564 */
565PJ_DECL(pj_status_t) pjsip_inv_update ( pjsip_inv_session *inv,
566 const pj_str_t *new_contact,
567 const pjmedia_sdp_session *new_offer,
568 pjsip_tx_data **p_tdata );
569
570
571/**
572 * Send request or response message in tdata.
573 *
574 * @param inv The invite session.
575 * @param tdata The message to be sent.
Benny Prijono268ca612006-02-07 12:34:11 +0000576 *
577 * @return PJ_SUCCESS if transaction can be initiated
578 * successfully to send this message. Note that the
579 * actual final state of the transaction itself will
580 * be reported later, in on_tsx_state_changed()
581 * callback.
582 */
583PJ_DECL(pj_status_t) pjsip_inv_send_msg(pjsip_inv_session *inv,
Benny Prijonoe8b0d3b2006-03-17 17:57:52 +0000584 pjsip_tx_data *tdata);
Benny Prijono268ca612006-02-07 12:34:11 +0000585
586
587
588/**
589 * Get the invite session for the dialog, if any.
590 *
591 * @param dlg The dialog which invite session is being queried.
592 *
593 * @return The invite session instance which has been
594 * associated with this dialog, or NULL.
595 */
596PJ_DECL(pjsip_inv_session*) pjsip_dlg_get_inv_session(pjsip_dialog *dlg);
597
598/**
599 * Get the invite session instance associated with transaction tsx, if any.
600 *
601 * @param tsx The transaction, which invite session is being
602 * queried.
603 *
604 * @return The invite session instance which has been
605 * associated with this transaction, or NULL.
606 */
607PJ_DECL(pjsip_inv_session*) pjsip_tsx_get_inv_session(pjsip_transaction *tsx);
608
609
Benny Prijonoe8b0d3b2006-03-17 17:57:52 +0000610/**
611 * Get state names for INVITE session state.
612 *
613 * @param state The invite state.
614 *
615 * @return String describing the state.
616 */
617PJ_DECL(const char *) pjsip_inv_state_name(pjsip_inv_state state);
618
Benny Prijono268ca612006-02-07 12:34:11 +0000619
Benny Prijono56315612006-07-18 14:39:40 +0000620/**
621 * This is a utility function to create SIP body for SDP content.
622 *
623 * @param pool Pool to allocate memory.
624 * @param sdp SDP session to be put in the SIP message body.
625 * @param p_body Pointer to receive SIP message body containing
626 * the SDP session.
627 *
628 * @return PJ_SUCCESS on success.
629 */
630PJ_DECL(pj_status_t) pjsip_create_sdp_body(pj_pool_t *pool,
631 pjmedia_sdp_session *sdp,
632 pjsip_msg_body **p_body);
633
634
Benny Prijonof3195072006-02-14 21:15:30 +0000635PJ_END_DECL
636
Benny Prijono312aff92006-06-17 04:08:30 +0000637/**
638 * @}
639 */
Benny Prijono268ca612006-02-07 12:34:11 +0000640
641
642#endif /* __SIP_INVITE_SESSION_H__ */