Asterisk - The Open Source Telephony Project  18.5.0
dialog.h
Go to the documentation of this file.
1 /*
2  * Asterisk -- An open source telephony toolkit.
3  *
4  * Copyright (C) 2010, Digium, Inc.
5  *
6  * See http://www.asterisk.org for more information about
7  * the Asterisk project. Please do not directly contact
8  * any of the maintainers of this project for assistance;
9  * the project provides a web site, mailing lists and IRC
10  * channels for your use.
11  *
12  * This program is free software, distributed under the terms of
13  * the GNU General Public License Version 2. See the LICENSE file
14  * at the top of the source tree.
15  */
16 
17 /*!
18  * \file
19  * \brief sip dialog management header file
20  */
21 
22 #include "sip.h"
23 
24 #ifndef _SIP_DIALOG_H
25 #define _SIP_DIALOG_H
26 
27 /*! \brief
28  * when we create or delete references, make sure to use these
29  * functions so we keep track of the refcounts.
30  * To simplify the code, we allow a NULL to be passed to dialog_unref().
31  */
32 #define dialog_ref(dialog, tag) ao2_t_bump(dialog, tag)
33 #define dialog_unref(dialog, tag) ({ ao2_t_cleanup(dialog, tag); (NULL); })
34 
36  int useglobal_nat, const int intended_method, struct sip_request *req, ast_callid logger_callid,
37  const char *file, int line, const char *func);
38 
39 #define sip_alloc(callid, addr, useglobal_nat, intended_method, req, logger_callid) \
40  __sip_alloc(callid, addr, useglobal_nat, intended_method, req, logger_callid, __FILE__, __LINE__, __PRETTY_FUNCTION__)
41 
42 /*!
43  * \brief Schedule final destruction of SIP dialog.
44  *
45  * \note This cannot be canceled.
46  *
47  * \details
48  * This function is used to keep a dialog around for a period of time in order
49  * to properly respond to any retransmits.
50  */
51 void sip_scheddestroy_final(struct sip_pvt *p, int ms);
52 
53 /*! \brief Schedule destruction of SIP dialog */
54 void sip_scheddestroy(struct sip_pvt *p, int ms);
55 
56 /*! \brief Cancel destruction of SIP dialog. */
57 void sip_cancel_destroy(struct sip_pvt *pvt);
58 
59 /*!
60  * \brief Unlink a dialog from the dialogs container, as well as any other places
61  * that it may be currently stored.
62  *
63  * \note A reference to the dialog must be held before calling
64  * this function, and this function does not release that
65  * reference.
66  *
67  * \note The dialog must not be locked when called.
68  */
69 void dialog_unlink_all(struct sip_pvt *dialog);
70 
71 /*! \brief Acknowledges receipt of a packet and stops retransmission
72  * called with p locked*/
73 int __sip_ack(struct sip_pvt *p, uint32_t seqno, int resp, int sipmethod);
74 
75 /*! \brief Pretend to ack all packets
76  * called with p locked */
77 void __sip_pretend_ack(struct sip_pvt *p);
78 
79 /*! \brief Acks receipt of packet, keep it around (used for provisional responses) */
80 int __sip_semi_ack(struct sip_pvt *p, uint32_t seqno, int resp, int sipmethod);
81 
82 #endif /* defined(_SIP_DIALOG_H) */
chan_sip header file
ast_callid logger_callid
Definition: sip.h:1008
unsigned int ast_callid
Definition: logger.h:87
const char * ast_string_field
Definition: stringfields.h:190
Socket address structure.
Definition: netsock2.h:97
int __sip_semi_ack(struct sip_pvt *p, uint32_t seqno, int resp, int sipmethod)
Acks receipt of packet, keep it around (used for provisional responses)
Definition: chan_sip.c:4632
void __sip_pretend_ack(struct sip_pvt *p)
Pretend to ack all packets called with p locked.
Definition: chan_sip.c:4615
sipmethod
SIP Request methods known by Asterisk.
Definition: sip.h:612
const ast_string_field callid
Definition: sip.h:1063
Structure used for each SIP dialog, ie. a call, a registration, a subscribe. Created and initialized ...
Definition: sip.h:1005
struct sip_pvt * __sip_alloc(ast_string_field callid, struct ast_sockaddr *sin, int useglobal_nat, const int intended_method, struct sip_request *req, ast_callid logger_callid, const char *file, int line, const char *func)
Allocate sip_pvt structure, set defaults and link in the container. Returns a reference to the object...
Definition: chan_sip.c:8942
void sip_cancel_destroy(struct sip_pvt *pvt)
Cancel destruction of SIP dialog.
Definition: chan_sip.c:4464
void sip_scheddestroy_final(struct sip_pvt *p, int ms)
Schedule final destruction of SIP dialog.
Definition: chan_sip.c:4557
sip_request: The data grabbed from the UDP socket
Definition: sip.h:829
void dialog_unlink_all(struct sip_pvt *dialog)
Unlink a dialog from the dialogs container, as well as any other places that it may be currently stor...
Definition: chan_sip.c:3367
int __sip_ack(struct sip_pvt *p, uint32_t seqno, int resp, int sipmethod)
Acknowledges receipt of a packet and stops retransmission called with p locked.
Definition: chan_sip.c:4570
void sip_scheddestroy(struct sip_pvt *p, int ms)
Schedule destruction of SIP dialog.
Definition: chan_sip.c:4549