~ubuntu-branches/ubuntu/vivid/sflphone/vivid

« back to all changes in this revision

Viewing changes to daemon/libs/pjproject-2.0.1/pjsip/include/pjsip-simple/mwi.h

  • Committer: Package Import Robot
  • Author(s): Mark Purcell
  • Date: 2013-06-30 11:40:56 UTC
  • mfrom: (4.1.18 saucy-proposed)
  • Revision ID: package-import@ubuntu.com-20130630114056-0np50jkyqo6vnmii
Tags: 1.2.3-2
* changeset_r92d62cfc54732bbbcfff2b1d36c096b120b981a5.diff 
  - fixes automatic endian detection 
* Update Vcs: fixes vcs-field-not-canonical

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* $Id: mwi.h 3553 2011-05-05 06:14:19Z nanang $ */
 
2
/*
 
3
 * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
 
4
 *
 
5
 * This program is free software; you can redistribute it and/or modify
 
6
 * it under the terms of the GNU General Public License as published by
 
7
 * the Free Software Foundation; either version 2 of the License, or
 
8
 * (at your option) any later version.
 
9
 *
 
10
 * This program is distributed in the hope that it will be useful,
 
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
 * GNU General Public License for more details.
 
14
 *
 
15
 * You should have received a copy of the GNU General Public License
 
16
 * along with this program; if not, write to the Free Software
 
17
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
18
 */
 
19
#ifndef __PJSIP_SIMPLE_MWI_H__
 
20
#define __PJSIP_SIMPLE_MWI_H__
 
21
 
 
22
/**
 
23
 * @file mwi.h
 
24
 * @brief SIP Extension for MWI (RFC 3842)
 
25
 */
 
26
#include <pjsip-simple/evsub.h>
 
27
#include <pjsip/sip_msg.h>
 
28
 
 
29
 
 
30
PJ_BEGIN_DECL
 
31
 
 
32
 
 
33
/**
 
34
 * @defgroup mwi SIP Message Summary and Message Waiting Indication (RFC 3842)
 
35
 * @ingroup PJSIP_SIMPLE
 
36
 * @brief Support for SIP MWI Extension (RFC 3842)
 
37
 * @{
 
38
 *
 
39
 * This module implements RFC 3842: A Message Summary and Message Waiting
 
40
 * Indication Event Package for the Session Initiation Protocol (SIP).
 
41
 * It uses the SIP Event Notification framework (evsub.h) and extends the
 
42
 * framework by implementing "message-summary" event package.
 
43
 */
 
44
 
 
45
 
 
46
/**
 
47
 * Initialize the MWI module and register it as endpoint module and
 
48
 * package to the event subscription module.
 
49
 *
 
50
 * @param endpt         The endpoint instance.
 
51
 * @param mod_evsub     The event subscription module instance.
 
52
 *
 
53
 * @return              PJ_SUCCESS if the module is successfully
 
54
 *                      initialized and registered to both endpoint
 
55
 *                      and the event subscription module.
 
56
 */
 
57
PJ_DECL(pj_status_t) pjsip_mwi_init_module(pjsip_endpoint *endpt,
 
58
                                           pjsip_module *mod_evsub);
 
59
 
 
60
/**
 
61
 * Get the MWI module instance.
 
62
 *
 
63
 * @return              The MWI module instance.
 
64
 */
 
65
PJ_DECL(pjsip_module*) pjsip_mwi_instance(void);
 
66
 
 
67
/**
 
68
 * Create MWI client subscription session.
 
69
 *
 
70
 * @param dlg           The underlying dialog to use.
 
71
 * @param user_cb       Pointer to callbacks to receive MWI subscription
 
72
 *                      events.
 
73
 * @param options       Option flags. Currently only PJSIP_EVSUB_NO_EVENT_ID
 
74
 *                      is recognized.
 
75
 * @param p_evsub       Pointer to receive the MWI subscription
 
76
 *                      session.
 
77
 *
 
78
 * @return              PJ_SUCCESS on success.
 
79
 */
 
80
PJ_DECL(pj_status_t) pjsip_mwi_create_uac( pjsip_dialog *dlg,
 
81
                                           const pjsip_evsub_user *user_cb,
 
82
                                           unsigned options,
 
83
                                           pjsip_evsub **p_evsub );
 
84
 
 
85
/**
 
86
 * Create MWI server subscription session.
 
87
 *
 
88
 * @param dlg           The underlying dialog to use.
 
89
 * @param user_cb       Pointer to callbacks to receive MWI subscription
 
90
 *                      events.
 
91
 * @param rdata         The incoming SUBSCRIBE request that creates the event
 
92
 *                      subscription.
 
93
 * @param p_evsub       Pointer to receive the MWI subscription
 
94
 *                      session.
 
95
 *
 
96
 * @return              PJ_SUCCESS on success.
 
97
 */
 
98
PJ_DECL(pj_status_t) pjsip_mwi_create_uas( pjsip_dialog *dlg,
 
99
                                           const pjsip_evsub_user *user_cb,
 
100
                                           pjsip_rx_data *rdata,
 
101
                                           pjsip_evsub **p_evsub );
 
102
 
 
103
/**
 
104
 * Forcefully destroy the MWI subscription. This function should only
 
105
 * be called on special condition, such as when the subscription
 
106
 * initialization has failed. For other conditions, application MUST terminate
 
107
 * the subscription by sending the appropriate un(SUBSCRIBE) or NOTIFY.
 
108
 *
 
109
 * @param sub           The MWI subscription.
 
110
 * @param notify        Specify whether the state notification callback
 
111
 *                      should be called.
 
112
 *
 
113
 * @return              PJ_SUCCESS if subscription session has been destroyed.
 
114
 */
 
115
PJ_DECL(pj_status_t) pjsip_mwi_terminate( pjsip_evsub *sub,
 
116
                                          pj_bool_t notify );
 
117
 
 
118
/**
 
119
 * Call this function to create request to initiate MWI subscription, to
 
120
 * refresh subcription, or to request subscription termination.
 
121
 *
 
122
 * @param sub           Client subscription instance.
 
123
 * @param expires       Subscription expiration. If the value is set to zero,
 
124
 *                      this will request unsubscription.
 
125
 * @param p_tdata       Pointer to receive the request.
 
126
 *
 
127
 * @return              PJ_SUCCESS on success.
 
128
 */
 
129
PJ_DECL(pj_status_t) pjsip_mwi_initiate( pjsip_evsub *sub,
 
130
                                         pj_int32_t expires,
 
131
                                         pjsip_tx_data **p_tdata);
 
132
 
 
133
/**
 
134
 * Accept the incoming subscription request by sending 2xx response to
 
135
 * incoming SUBSCRIBE request.
 
136
 *
 
137
 * @param sub           Server subscription instance.
 
138
 * @param rdata         The incoming subscription request message.
 
139
 * @param st_code       Status code, which MUST be final response.
 
140
 * @param hdr_list      Optional list of headers to be added in the response.
 
141
 *
 
142
 * @return              PJ_SUCCESS on success.
 
143
 */
 
144
PJ_DECL(pj_status_t) pjsip_mwi_accept( pjsip_evsub *sub,
 
145
                                       pjsip_rx_data *rdata,
 
146
                                       int st_code,
 
147
                                       const pjsip_hdr *hdr_list );
 
148
 
 
149
/**
 
150
 * For notifier, create NOTIFY request to subscriber, and set the state
 
151
 * of the subscription.
 
152
 *
 
153
 * @param sub           The server subscription (notifier) instance.
 
154
 * @param state         New state to set.
 
155
 * @param state_str     The state string name, if state contains value other
 
156
 *                      than active, pending, or terminated. Otherwise this
 
157
 *                      argument is ignored.
 
158
 * @param reason        Specify reason if new state is terminated, otherwise
 
159
 *                      put NULL.
 
160
 * @param mime_type     MIME type/content type of the message body.
 
161
 * @param body          Message body to be included in the NOTIFY request.
 
162
 * @param p_tdata       Pointer to receive the request.
 
163
 *
 
164
 * @return              PJ_SUCCESS on success.
 
165
 */
 
166
PJ_DECL(pj_status_t) pjsip_mwi_notify( pjsip_evsub *sub,
 
167
                                       pjsip_evsub_state state,
 
168
                                       const pj_str_t *state_str,
 
169
                                       const pj_str_t *reason,
 
170
                                       const pjsip_media_type *mime_type,
 
171
                                       const pj_str_t *body,
 
172
                                       pjsip_tx_data **p_tdata);
 
173
 
 
174
/**
 
175
 * Create NOTIFY request containing message body from the last NOITFY
 
176
 * message created.
 
177
 *
 
178
 * @param sub           Server subscription object.
 
179
 * @param p_tdata       Pointer to receive request.
 
180
 *
 
181
 * @return              PJ_SUCCESS on success.
 
182
 */
 
183
PJ_DECL(pj_status_t) pjsip_mwi_current_notify( pjsip_evsub *sub,
 
184
                                               pjsip_tx_data **p_tdata );
 
185
 
 
186
 
 
187
/**
 
188
 * Send request message that was previously created with initiate(), notify(),
 
189
 * or current_notify(). Application may also send request created with other
 
190
 * functions, e.g. authentication. But the request MUST be either request
 
191
 * that creates/refresh subscription or NOTIFY request.
 
192
 *
 
193
 * @param sub           The subscription object.
 
194
 * @param tdata         Request message to be sent.
 
195
 *
 
196
 * @return              PJ_SUCCESS on success.
 
197
 */
 
198
PJ_DECL(pj_status_t) pjsip_mwi_send_request( pjsip_evsub *sub,
 
199
                                             pjsip_tx_data *tdata );
 
200
 
 
201
/**
 
202
 * @}
 
203
 */
 
204
 
 
205
PJ_END_DECL
 
206
 
 
207
 
 
208
#endif  /* __PJSIP_SIMPLE_MWI_H__ */