blob: e74abfac07597c11e8b77ef2bd092ba5316cddce [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 Prijono77998ce2007-06-20 10:03:46 +0000152 * in "offer", and set the SDP answer with #pjsip_inv_set_sdp_answer().
153 * When the application sends a SIP message to send the answer,
154 * this SDP answer will be negotiated with the offer, and the result
155 * will be sent with the SIP message.
Benny Prijono268ca612006-02-07 12:34:11 +0000156 *
157 * @param inv The invite session.
Benny Prijono26ff9062006-02-21 23:47:00 +0000158 * @param offer Remote offer.
Benny Prijono268ca612006-02-07 12:34:11 +0000159 */
Benny Prijono26ff9062006-02-21 23:47:00 +0000160 void (*on_rx_offer)(pjsip_inv_session *inv,
161 const pjmedia_sdp_session *offer);
Benny Prijono268ca612006-02-07 12:34:11 +0000162
163 /**
Benny Prijono77998ce2007-06-20 10:03:46 +0000164 * This callback is optional, and it is used to ask the application
165 * to create a fresh offer, when the invite session has received
166 * re-INVITE without offer. This offer then will be sent in the
167 * 200/OK response to the re-INVITE request.
168 *
169 * If application doesn't implement this callback, the invite session
170 * will send the currently active SDP as the offer.
171 *
172 * @param inv The invite session.
173 * @param p_offer Pointer to receive the SDP offer created by
174 * application.
175 */
176 void (*on_create_offer)(pjsip_inv_session *inv,
177 pjmedia_sdp_session **p_offer);
178
179 /**
Benny Prijono268ca612006-02-07 12:34:11 +0000180 * This callback is called after SDP offer/answer session has completed.
181 * The status argument specifies the status of the offer/answer,
182 * as returned by pjmedia_sdp_neg_negotiate().
183 *
184 * This callback is optional (from the point of view of the framework),
185 * but all useful applications normally need to implement this callback.
186 *
187 * @param inv The invite session.
188 * @param status The negotiation status.
189 */
190 void (*on_media_update)(pjsip_inv_session *inv_ses,
191 pj_status_t status);
Benny Prijono312aff92006-06-17 04:08:30 +0000192
193} pjsip_inv_callback;
194
Benny Prijono268ca612006-02-07 12:34:11 +0000195
196
197/**
198 * This enumeration shows various options that can be applied to a session.
199 * The bitmask combination of these options need to be specified when
200 * creating a session. After the dialog is established (including early),
201 * the options member of #pjsip_inv_session shows which capabilities are
202 * common in both endpoints.
203 */
204enum pjsip_inv_option
205{
206 /**
207 * Indicate support for reliable provisional response extension
208 */
209 PJSIP_INV_SUPPORT_100REL = 1,
210
211 /**
212 * Indicate support for session timer extension.
213 */
214 PJSIP_INV_SUPPORT_TIMER = 2,
215
216 /**
217 * Indicate support for UPDATE method. This is automatically implied
218 * when creating outgoing dialog. After the dialog is established,
219 * the options member of #pjsip_inv_session shows whether peer supports
220 * this method as well.
221 */
222 PJSIP_INV_SUPPORT_UPDATE = 4,
223
224 /**
225 * Require reliable provisional response extension.
226 */
227 PJSIP_INV_REQUIRE_100REL = 32,
228
229 /**
230 * Require session timer extension.
231 */
232 PJSIP_INV_REQUIRE_TIMER = 64,
233
234};
235
236
237/**
238 * This structure describes the invite session.
239 */
240struct pjsip_inv_session
241{
Benny Prijono0b6340c2006-06-13 22:21:23 +0000242 char obj_name[PJ_MAX_OBJ_NAME]; /**< Log identification */
Benny Prijonoe4f2abb2006-02-10 14:04:05 +0000243 pj_pool_t *pool; /**< Dialog's pool. */
244 pjsip_inv_state state; /**< Invite sess state. */
Benny Prijono1dc8be02007-05-30 04:26:40 +0000245 pj_bool_t cancelling; /**< CANCEL requested */
246 pj_bool_t pending_cancel; /**< Wait to send CANCEL*/
Benny Prijonod4e0abd2006-03-05 11:53:36 +0000247 pjsip_status_code cause; /**< Disconnect cause. */
Benny Prijono0b6340c2006-06-13 22:21:23 +0000248 pj_str_t cause_text; /**< Cause text. */
Benny Prijonod4e0abd2006-03-05 11:53:36 +0000249 pj_bool_t notify; /**< Internal. */
Benny Prijonoe4f2abb2006-02-10 14:04:05 +0000250 pjsip_dialog *dlg; /**< Underlying dialog. */
251 pjsip_role_e role; /**< Invite role. */
252 unsigned options; /**< Options in use. */
253 pjmedia_sdp_neg *neg; /**< Negotiator. */
254 pjsip_transaction *invite_tsx; /**< 1st invite tsx. */
255 void *mod_data[PJSIP_MAX_MODULE];/**< Modules data. */
Benny Prijono268ca612006-02-07 12:34:11 +0000256};
257
258
259/**
260 * Initialize the invite usage module and register it to the endpoint.
261 * The callback argument contains pointer to functions to be called on
262 * occurences of events in invite sessions.
263 *
264 * @param endpt The endpoint instance.
Benny Prijono312aff92006-06-17 04:08:30 +0000265 * @param cb Callback structure.
Benny Prijono268ca612006-02-07 12:34:11 +0000266 *
267 * @return PJ_SUCCESS on success, or the appropriate error code.
268 */
269PJ_DECL(pj_status_t) pjsip_inv_usage_init(pjsip_endpoint *endpt,
Benny Prijono268ca612006-02-07 12:34:11 +0000270 const pjsip_inv_callback *cb);
271
272/**
273 * Get the INVITE usage module instance.
274 *
275 * @return PJ_SUCCESS on success, or the appropriate error code.
276 */
277PJ_DECL(pjsip_module*) pjsip_inv_usage_instance(void);
278
279
Benny Prijono632ce712006-02-09 14:01:40 +0000280/**
281 * Dump user agent contents (e.g. all dialogs).
282 */
283PJ_DECL(void) pjsip_inv_usage_dump(void);
284
Benny Prijono268ca612006-02-07 12:34:11 +0000285
286/**
287 * Create UAC invite session for the specified dialog in dlg.
288 *
289 * @param dlg The dialog which will be used by this invite session.
290 * @param local_sdp If application has determined its media capability,
291 * it can specify the SDP here. Otherwise it can leave
292 * this to NULL, to let remote UAS specifies an offer.
293 * @param options The options argument is bitmask combination of SIP
294 * features in pjsip_inv_options enumeration.
295 * @param p_inv On successful return, the invite session will be put
296 * in this argument.
297 *
298 * @return The function will return PJ_SUCCESS if it can create
299 * the session. Otherwise the appropriate error status
300 * will be returned on failure.
301 */
302PJ_DECL(pj_status_t) pjsip_inv_create_uac(pjsip_dialog *dlg,
303 const pjmedia_sdp_session *local_sdp,
304 unsigned options,
305 pjsip_inv_session **p_inv);
306
307
308/**
309 * Application SHOULD call this function upon receiving the initial INVITE
310 * request in rdata before creating the invite session (or even dialog),
311 * to verify that the invite session can handle the INVITE request.
312 * This function verifies that local endpoint is capable to handle required
313 * SIP extensions in the request (i.e. Require header) and also the media,
314 * if media description is present in the request.
315 *
316 * @param rdata The incoming INVITE request.
317 *
318 * @param options Upon calling this function, the options argument
319 * MUST contain the desired SIP extensions to be
320 * applied to the session. Upon return, this argument
321 * will contain the SIP extension that will be applied
322 * to the session, after considering the Supported,
323 * Require, and Allow headers in the request.
324 *
325 * @param sdp If local media capability has been determined,
326 * and if application wishes to verify that it can
327 * handle the media offer in the incoming INVITE
328 * request, it SHOULD specify its local media capability
329 * in this argument.
330 * If it is not specified, media verification will not
331 * be performed by this function.
332 *
333 * @param dlg If tdata is not NULL, application needs to specify
334 * how to create the response. Either dlg or endpt
335 * argument MUST be specified, with dlg argument takes
336 * precedence when both are specified.
337 *
338 * If a dialog has been created prior to calling this
339 * function, then it MUST be specified in dlg argument.
340 * Otherwise application MUST specify the endpt argument
341 * (this is useful e.g. when application wants to send
342 * the response statelessly).
343 *
344 * @param endpt If tdata is not NULL, application needs to specify
345 * how to create the response. Either dlg or endpt
346 * argument MUST be specified, with dlg argument takes
347 * precedence when both are specified.
348 *
349 * @param tdata If this argument is not NULL, this function will
350 * create the appropriate non-2xx final response message
351 * when the verification fails.
352 *
353 * @return If everything has been negotiated successfully,
354 * the function will return PJ_SUCCESS. Otherwise it
355 * will return the reason of the failure as the return
356 * code.
357 *
358 * This function is capable to create the appropriate
359 * response message when the verification has failed.
360 * If tdata is specified, then a non-2xx final response
361 * will be created and put in this argument upon return,
362 * when the verification has failed.
363 *
364 * If a dialog has been created prior to calling this
365 * function, then it MUST be specified in dlg argument.
366 * Otherwise application MUST specify the endpt argument
367 * (this is useful e.g. when application wants to send
368 * the response statelessly).
369 */
370PJ_DECL(pj_status_t) pjsip_inv_verify_request( pjsip_rx_data *rdata,
371 unsigned *options,
372 const pjmedia_sdp_session *sdp,
373 pjsip_dialog *dlg,
374 pjsip_endpoint *endpt,
375 pjsip_tx_data **tdata);
376
377
378/**
379 * Create UAS invite session for the specified dialog in dlg. Application
380 * SHOULD call the verification function before calling this function,
381 * to ensure that it can create the session successfully.
382 *
383 * @param dlg The dialog to be used.
384 * @param rdata Application MUST specify the received INVITE request
385 * in rdata. The invite session needs to inspect the
386 * received request to see if the request contains
387 * features that it supports.
Benny Prijono312aff92006-06-17 04:08:30 +0000388 * @param local_sdp If application has determined its media capability,
Benny Prijono268ca612006-02-07 12:34:11 +0000389 * it can specify this capability in this argument.
390 * If SDP is received in the initial INVITE, the UAS
391 * capability specified in this argument doesn't have to
392 * match the received offer; the SDP negotiator is able
393 * to rearrange the media lines in the answer so that it
394 * matches the offer.
395 * @param options The options argument is bitmask combination of SIP
396 * features in pjsip_inv_options enumeration.
397 * @param p_inv Pointer to receive the newly created invite session.
398 *
399 * @return On successful, the invite session will be put in
400 * p_inv argument and the function will return PJ_SUCCESS.
401 * Otherwise the appropriate error status will be returned
402 * on failure.
403 */
404PJ_DECL(pj_status_t) pjsip_inv_create_uas(pjsip_dialog *dlg,
405 pjsip_rx_data *rdata,
406 const pjmedia_sdp_session *local_sdp,
407 unsigned options,
408 pjsip_inv_session **p_inv);
409
410
411/**
Benny Prijonod4e0abd2006-03-05 11:53:36 +0000412 * Forcefully terminate and destroy INVITE session, regardless of
413 * the state of the session. Note that this function should only be used
414 * when there is failure in the INVITE session creation. After the
415 * invite session has been created and initialized, normally application
416 * SHOULD use #pjsip_inv_end_session() to end the INVITE session instead.
417 *
418 * Note also that this function may terminate the underlying dialog, if
419 * there are no other sessions in the dialog.
420 *
421 * @param inv The invite session.
422 * @param st_code Status code for the reason of the termination.
423 * @param notify If set to non-zero, then on_state_changed()
424 * callback will be called.
425 *
426 * @return PJ_SUCCESS if the INVITE session has been
427 * terminated.
428 */
429PJ_DECL(pj_status_t) pjsip_inv_terminate( pjsip_inv_session *inv,
430 int st_code,
431 pj_bool_t notify );
432
433
434/**
Benny Prijono268ca612006-02-07 12:34:11 +0000435 * Create the initial INVITE request for this session. This function can only
436 * be called for UAC session. If local media capability is specified when
437 * the invite session was created, then this function will put an SDP offer
438 * in the outgoing INVITE request. Otherwise the outgoing request will not
439 * contain SDP body.
440 *
441 * @param inv The UAC invite session.
442 * @param p_tdata The initial INVITE request will be put in this
443 * argument if it can be created successfully.
444 *
445 * @return PJ_SUCCESS if the INVITE request can be created.
446 */
447PJ_DECL(pj_status_t) pjsip_inv_invite( pjsip_inv_session *inv,
448 pjsip_tx_data **p_tdata );
449
450
451/**
Benny Prijono64f851e2006-02-23 13:49:28 +0000452 * Create the initial response message for the incoming INVITE request in
453 * rdata with status code st_code and optional status text st_text. Use
454 * #pjsip_answer() to create subsequent response message.
455 */
456PJ_DECL(pj_status_t) pjsip_inv_initial_answer( pjsip_inv_session *inv,
457 pjsip_rx_data *rdata,
458 int st_code,
459 const pj_str_t *st_text,
460 const pjmedia_sdp_session *sdp,
461 pjsip_tx_data **p_tdata);
462
463/**
Benny Prijono268ca612006-02-07 12:34:11 +0000464 * Create a response message to the initial INVITE request. This function
465 * can only be called for the initial INVITE request, as subsequent
466 * re-INVITE request will be answered automatically.
467 *
468 * @param inv The UAS invite session.
469 * @param st_code The st_code contains the status code to be sent,
470 * which may be a provisional or final response.
471 * @param st_text If custom status text is desired, application can
472 * specify the text in st_text; otherwise if this
473 * argument is NULL, default status text will be used.
474 * @param local_sdp If application has specified its media capability
475 * during creation of UAS invite session, the local_sdp
476 * argument MUST be NULL. This is because application
477 * can not perform more than one SDP offer/answer session
478 * in a single INVITE transaction.
479 * If application has not specified its media capability
480 * during creation of UAS invite session, it MAY or MUST
481 * specify its capability in local_sdp argument,
482 * depending whether st_code indicates a 2xx final
483 * response.
484 * @param p_tdata Pointer to receive the response message created by
485 * this function.
486 *
487 * @return PJ_SUCCESS if response message was created
488 * successfully.
489 */
490PJ_DECL(pj_status_t) pjsip_inv_answer( pjsip_inv_session *inv,
491 int st_code,
492 const pj_str_t *st_text,
493 const pjmedia_sdp_session *local_sdp,
494 pjsip_tx_data **p_tdata );
495
496
Benny Prijonoa66c7152006-02-09 01:26:14 +0000497/**
Benny Prijono26ff9062006-02-21 23:47:00 +0000498 * Set local answer to respond to remote SDP offer, to be carried by
499 * subsequent response (or request).
Benny Prijonoa66c7152006-02-09 01:26:14 +0000500 *
501 * @param inv The invite session.
502 * @param sdp The SDP description which will be set as answer
503 * to remote.
Benny Prijono26ff9062006-02-21 23:47:00 +0000504 *
505 * @return PJ_SUCCESS if local answer can be accepted by
506 * SDP negotiator.
Benny Prijonoa66c7152006-02-09 01:26:14 +0000507 */
Benny Prijono26ff9062006-02-21 23:47:00 +0000508PJ_DECL(pj_status_t) pjsip_inv_set_sdp_answer(pjsip_inv_session *inv,
509 const pjmedia_sdp_session *sdp );
510
Benny Prijonoa66c7152006-02-09 01:26:14 +0000511
Benny Prijono268ca612006-02-07 12:34:11 +0000512/**
513 * Create a SIP message to initiate invite session termination. Depending on
514 * the state of the session, this function may return CANCEL request,
515 * a non-2xx final response, or a BYE request. If the session has not answered
516 * the incoming INVITE, this function creates the non-2xx final response with
517 * the specified status code in st_code and optional status text in st_text.
518 *
519 * @param inv The invite session.
520 * @param st_code Status code to be used for terminating the session.
521 * @param st_text Optional status text.
522 * @param p_tdata Pointer to receive the message to be created.
523 *
524 * @return PJ_SUCCESS if termination message can be created.
525 */
526PJ_DECL(pj_status_t) pjsip_inv_end_session( pjsip_inv_session *inv,
527 int st_code,
528 const pj_str_t *st_text,
529 pjsip_tx_data **p_tdata );
530
531
532
533/**
534 * Create a re-INVITE request.
535 *
536 * @param inv The invite session.
537 * @param new_contact If application wants to update its local contact and
538 * inform peer to perform target refresh with a new
539 * contact, it can specify the new contact in this
540 * argument; otherwise this argument must be NULL.
541 * @param new_offer Application MAY initiate a new SDP offer/answer
542 * session in the request when there is no pending
543 * answer to be sent or received. It can detect this
544 * condition by observing the state of the SDP
545 * negotiator of the invite session. If new offer
546 * should be sent to remote, the offer must be specified
547 * in this argument, otherwise it must be NULL.
548 * @param p_tdata Pointer to receive the re-INVITE request message to
549 * be created.
550 *
551 * @return PJ_SUCCESS if a re-INVITE request with the specified
552 * characteristics (e.g. to contain new offer) can be
553 * created.
554 */
555PJ_DECL(pj_status_t) pjsip_inv_reinvite(pjsip_inv_session *inv,
556 const pj_str_t *new_contact,
557 const pjmedia_sdp_session *new_offer,
558 pjsip_tx_data **p_tdata );
559
560
561
562/**
563 * Create an UPDATE request.
564 *
565 * @param inv The invite session.
566 * @param new_contact If application wants to update its local contact
567 * and inform peer to perform target refresh with a new
568 * contact, it can specify the new contact in this
569 * argument; otherwise this argument must be NULL.
570 * @param new_offer Application MAY initiate a new SDP offer/answer
571 * session in the request when there is no pending answer
572 * to be sent or received. It can detect this condition
573 * by observing the state of the SDP negotiator of the
574 * invite session. If new offer should be sent to remote,
575 * the offer must be specified in this argument; otherwise
576 * this argument must be NULL.
577 * @param p_tdata Pointer to receive the UPDATE request message to
578 * be created.
579 *
580 * @return PJ_SUCCESS if a UPDATE request with the specified
581 * characteristics (e.g. to contain new offer) can be
582 * created.
583 */
584PJ_DECL(pj_status_t) pjsip_inv_update ( pjsip_inv_session *inv,
585 const pj_str_t *new_contact,
586 const pjmedia_sdp_session *new_offer,
587 pjsip_tx_data **p_tdata );
588
589
590/**
591 * Send request or response message in tdata.
592 *
593 * @param inv The invite session.
594 * @param tdata The message to be sent.
Benny Prijono268ca612006-02-07 12:34:11 +0000595 *
596 * @return PJ_SUCCESS if transaction can be initiated
597 * successfully to send this message. Note that the
598 * actual final state of the transaction itself will
599 * be reported later, in on_tsx_state_changed()
600 * callback.
601 */
602PJ_DECL(pj_status_t) pjsip_inv_send_msg(pjsip_inv_session *inv,
Benny Prijonoe8b0d3b2006-03-17 17:57:52 +0000603 pjsip_tx_data *tdata);
Benny Prijono268ca612006-02-07 12:34:11 +0000604
605
606
607/**
608 * Get the invite session for the dialog, if any.
609 *
610 * @param dlg The dialog which invite session is being queried.
611 *
612 * @return The invite session instance which has been
613 * associated with this dialog, or NULL.
614 */
615PJ_DECL(pjsip_inv_session*) pjsip_dlg_get_inv_session(pjsip_dialog *dlg);
616
617/**
618 * Get the invite session instance associated with transaction tsx, if any.
619 *
620 * @param tsx The transaction, which invite session is being
621 * queried.
622 *
623 * @return The invite session instance which has been
624 * associated with this transaction, or NULL.
625 */
626PJ_DECL(pjsip_inv_session*) pjsip_tsx_get_inv_session(pjsip_transaction *tsx);
627
628
Benny Prijonoe8b0d3b2006-03-17 17:57:52 +0000629/**
630 * Get state names for INVITE session state.
631 *
632 * @param state The invite state.
633 *
634 * @return String describing the state.
635 */
636PJ_DECL(const char *) pjsip_inv_state_name(pjsip_inv_state state);
637
Benny Prijono268ca612006-02-07 12:34:11 +0000638
Benny Prijono56315612006-07-18 14:39:40 +0000639/**
640 * This is a utility function to create SIP body for SDP content.
641 *
642 * @param pool Pool to allocate memory.
643 * @param sdp SDP session to be put in the SIP message body.
644 * @param p_body Pointer to receive SIP message body containing
645 * the SDP session.
646 *
647 * @return PJ_SUCCESS on success.
648 */
649PJ_DECL(pj_status_t) pjsip_create_sdp_body(pj_pool_t *pool,
650 pjmedia_sdp_session *sdp,
651 pjsip_msg_body **p_body);
652
653
Benny Prijonof3195072006-02-14 21:15:30 +0000654PJ_END_DECL
655
Benny Prijono312aff92006-06-17 04:08:30 +0000656/**
657 * @}
658 */
Benny Prijono268ca612006-02-07 12:34:11 +0000659
660
661#endif /* __SIP_INVITE_SESSION_H__ */