1
/* $Id: sip_ua_layer.h 3553 2011-05-05 06:14:19Z nanang $ */
3
* Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
4
* Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2 of the License, or
9
* (at your option) any later version.
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20
#ifndef __PJSIP_SIP_UA_LAYER_H__
21
#define __PJSIP_SIP_UA_LAYER_H__
24
* @file sip_ua_layer.h
25
* @brief SIP User Agent Layer Module
27
#include <pjsip/sip_types.h>
33
* @defgroup PJSIP_UA Base User Agent Layer/Common Dialog Layer
34
* @brief Dialog management.
36
* This module provides basic dialog management, which is used by higher
37
* layer dialog usages such as INVITE sessions and SIP Event Subscription
38
* framework (RFC 3265). Application should link with <b>pjsip-core</b>
39
* library to use this base UA layer. The base UA layer module is initialized
40
* with #pjsip_ua_init_module().
44
* @defgroup PJSUA_UA SIP User Agent Module
46
* @brief Provides dialog management.
49
* Application MUST initialize the user agent layer module by calling
50
* #pjsip_ua_init_module() before using any of the dialog API, and link
51
* the application with with <b>pjsip-core</b> library.
54
/** User agent initialization parameter. */
55
typedef struct pjsip_ua_init_param
57
/** Callback to be called when the UA layer detects that outgoing
60
pjsip_dialog* (*on_dlg_forked)(pjsip_dialog *first_set, pjsip_rx_data *res);
61
} pjsip_ua_init_param;
64
* Initialize user agent layer and register it to the specified endpoint.
66
* @param endpt The endpoint where the user agent will be
68
* @param prm UA initialization parameter.
70
* @return PJ_SUCCESS on success.
72
PJ_DECL(pj_status_t) pjsip_ua_init_module(pjsip_endpoint *endpt,
73
const pjsip_ua_init_param *prm);
76
* Get the instance of the user agent.
78
* @return The user agent module instance.
80
PJ_DECL(pjsip_user_agent*) pjsip_ua_instance(void);
84
* Retrieve the current number of dialog-set currently registered
85
* in the hash table. Note that dialog-set is different than dialog
86
* when the request forks. In this case, all dialogs created from
87
* the original request will belong to the same dialog set. When
88
* no forking occurs, the number of dialog sets will be equal to
89
* the number of dialogs.
91
* @return Number of dialog sets.
93
PJ_DECL(pj_uint32_t) pjsip_ua_get_dlg_set_count(void);
97
* Find a dialog with the specified Call-ID and tags properties. This
98
* function may optionally lock the matching dialog instance before
99
* returning it back to the caller.
101
* @param call_id The call ID to be matched.
102
* @param local_tag The local tag to be matched.
103
* @param remote_tag The remote tag to be matched.
104
* @param lock_dialog If non-zero, instruct the function to lock the
105
* matching dialog with #pjsip_dlg_inc_lock().
106
* Application is responsible to release the dialog's
107
* lock after it has finished manipulating the dialog,
108
* by calling #pjsip_dlg_dec_lock().
110
* @return The matching dialog instance, or NULL if no matching
113
PJ_DECL(pjsip_dialog*) pjsip_ua_find_dialog(const pj_str_t *call_id,
114
const pj_str_t *local_tag,
115
const pj_str_t *remote_tag,
116
pj_bool_t lock_dialog);
119
* Destroy the user agent layer.
121
* @return PJ_SUCCESS on success.
123
PJ_DECL(pj_status_t) pjsip_ua_destroy(void);
126
* Dump user agent contents (e.g. all dialogs).
128
* @param detail If non-zero, list of dialogs will be printed.
130
PJ_DECL(void) pjsip_ua_dump(pj_bool_t detail);
133
* Get the endpoint instance of a user agent module.
135
* @param ua The user agent instance.
137
* @return The endpoint instance where the user agent is
140
PJ_DECL(pjsip_endpoint*) pjsip_ua_get_endpt(pjsip_user_agent *ua);
149
* Internal (called by sip_dialog.c).
152
PJ_DECL(pj_status_t) pjsip_ua_register_dlg( pjsip_user_agent *ua,
154
PJ_DECL(pj_status_t) pjsip_ua_unregister_dlg(pjsip_user_agent *ua,
161
#endif /* __PJSIP_SIP_UA_LAYER_H__ */