Asterisk - The Open Source Telephony Project  18.5.0
sip_utils.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 utils header file
20  */
21 
22 #ifndef _SIP_UTILS_H
23 #define _SIP_UTILS_H
24 
25 /* wrapper macro to tell whether t points to one of the sip_tech descriptors */
26 #define IS_SIP_TECH(t) ((t) == &sip_tech || (t) == &sip_tech_info)
27 
28 /*!
29  * \brief converts ascii port to int representation.
30  *
31  * \arg pt[in] string that contains a port.
32  * \arg standard[in] port to return in case the port string input is NULL
33  * or if there is a parsing error.
34  *
35  * \return An integer port representation.
36  */
37 unsigned int port_str2int(const char *pt, unsigned int standard);
38 
39 /*! \brief Locate closing quote in a string, skipping escaped quotes.
40  * optionally with a limit on the search.
41  * start must be past the first quote.
42  */
43 const char *find_closing_quote(const char *start, const char *lim);
44 
45 
46 /*! \brief Convert SIP hangup causes to Asterisk hangup causes */
47 int hangup_sip2cause(int cause);
48 
49 /*! \brief Convert Asterisk hangup causes to SIP codes
50 \verbatim
51  Possible values from causes.h
52  AST_CAUSE_NOTDEFINED AST_CAUSE_NORMAL AST_CAUSE_BUSY
53  AST_CAUSE_FAILURE AST_CAUSE_CONGESTION AST_CAUSE_UNALLOCATED
54 
55  In addition to these, a lot of PRI codes is defined in causes.h
56  ...should we take care of them too ?
57 
58  Quote RFC 3398
59 
60  ISUP Cause value SIP response
61  ---------------- ------------
62  1 unallocated number 404 Not Found
63  2 no route to network 404 Not found
64  3 no route to destination 404 Not found
65  16 normal call clearing --- (*)
66  17 user busy 486 Busy here
67  18 no user responding 408 Request Timeout
68  19 no answer from the user 480 Temporarily unavailable
69  20 subscriber absent 480 Temporarily unavailable
70  21 call rejected 403 Forbidden (+)
71  22 number changed (w/o diagnostic) 410 Gone
72  22 number changed (w/ diagnostic) 301 Moved Permanently
73  23 redirection to new destination 410 Gone
74  26 non-selected user clearing 404 Not Found (=)
75  27 destination out of order 502 Bad Gateway
76  28 address incomplete 484 Address incomplete
77  29 facility rejected 501 Not implemented
78  31 normal unspecified 480 Temporarily unavailable
79 \endverbatim
80 */
81 const char *hangup_cause2sip(int cause);
82 
83 /*! \brief Return a string describing the force_rport value for the given flags */
84 const char *force_rport_string(struct ast_flags *flags);
85 
86 /*! \brief Return a string describing the comedia value for the given flags */
87 const char *comedia_string(struct ast_flags *flags);
88 
89 #endif
const char * comedia_string(struct ast_flags *flags)
Return a string describing the comedia value for the given flags.
const char * find_closing_quote(const char *start, const char *lim)
Locate closing quote in a string, skipping escaped quotes. optionally with a limit on the search...
Definition: chan_sip.c:5074
int hangup_sip2cause(int cause)
Convert SIP hangup causes to Asterisk hangup causes.
Definition: chan_sip.c:6986
const char * force_rport_string(struct ast_flags *flags)
Return a string describing the force_rport value for the given flags.
Structure used to handle boolean flags.
Definition: utils.h:199
unsigned int port_str2int(const char *pt, unsigned int standard)
converts ascii port to int representation.
Definition: chan_sip.c:3538
const char * hangup_cause2sip(int cause)
Convert Asterisk hangup causes to SIP codes.
Definition: chan_sip.c:7108