diff options
author | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2010-02-17 06:25:15 +0000 |
---|---|---|
committer | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2010-02-17 06:25:15 +0000 |
commit | eae21bd2ffbe4dd555d4034aa12db55bf2ebbe8c (patch) | |
tree | 71fd1d739915bdaf45c20dc0cd3fda632194f03b /channels/sip/include | |
parent | fe7b2347a46062eb0d5e2a0247a1f5cabdd515b7 (diff) |
Make all of the various rtpqos parameters in this branch available from the CHANNEL function.
Also includes a test for retrieving rtpqos parameters, including a NULL RTP
driver. Additionally, some further separation of the SIP internal API into
headers was necessary.
(closes issue #16652)
Reported by: kkm
Patches:
20100204__issue16652.diff.txt uploaded by tilghman (license 14)
Review: https://reviewboard.asterisk.org/r/501/
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@247124 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/sip/include')
-rw-r--r-- | channels/sip/include/config_parser.h | 2 | ||||
-rw-r--r-- | channels/sip/include/dialog.h | 75 | ||||
-rw-r--r-- | channels/sip/include/dialplan_functions.h | 41 | ||||
-rw-r--r-- | channels/sip/include/globals.h | 42 | ||||
-rw-r--r-- | channels/sip/include/sip_utils.h | 44 |
5 files changed, 201 insertions, 3 deletions
diff --git a/channels/sip/include/config_parser.h b/channels/sip/include/config_parser.h index 0b86188c6..76fefc2c6 100644 --- a/channels/sip/include/config_parser.h +++ b/channels/sip/include/config_parser.h @@ -43,7 +43,7 @@ int sip_parse_register_line(struct sip_registry *reg, int default_expiry, const */ int sip_parse_host(char *line, int lineno, char **hostname, int *portnum, enum sip_transport *transport); -/*! +/*! * \brief register config parsing tests */ void sip_config_parser_register_tests(void); diff --git a/channels/sip/include/dialog.h b/channels/sip/include/dialog.h new file mode 100644 index 000000000..554aa5e6a --- /dev/null +++ b/channels/sip/include/dialog.h @@ -0,0 +1,75 @@ +/* + * Asterisk -- An open source telephony toolkit. + * + * Copyright (C) 2010, Digium, Inc. + * + * See http://www.asterisk.org for more information about + * the Asterisk project. Please do not directly contact + * any of the maintainers of this project for assistance; + * the project provides a web site, mailing lists and IRC + * channels for your use. + * + * This program is free software, distributed under the terms of + * the GNU General Public License Version 2. See the LICENSE file + * at the top of the source tree. + */ + +/*! + * \file + * \brief sip dialog management header file + */ + +#include "sip.h" + +#ifndef _SIP_DIALOG_H +#define _SIP_DIALOG_H + +/*! \brief + * when we create or delete references, make sure to use these + * functions so we keep track of the refcounts. + * To simplify the code, we allow a NULL to be passed to dialog_unref(). + */ +#define dialog_ref(arg1,arg2) dialog_ref_debug((arg1),(arg2), __FILE__, __LINE__, __PRETTY_FUNCTION__) +#define dialog_unref(arg1,arg2) dialog_unref_debug((arg1),(arg2), __FILE__, __LINE__, __PRETTY_FUNCTION__) +struct sip_pvt *dialog_ref_debug(struct sip_pvt *p, char *tag, char *file, int line, const char *func); +struct sip_pvt *dialog_unref_debug(struct sip_pvt *p, char *tag, char *file, int line, const char *func); + +struct sip_pvt *sip_alloc(ast_string_field callid, struct sockaddr_in *sin, + int useglobal_nat, const int intended_method, struct sip_request *req); +void sip_scheddestroy(struct sip_pvt *p, int ms); +int sip_cancel_destroy(struct sip_pvt *p); + +/*! \brief Destroy SIP call structure. + * Make it return NULL so the caller can do things like + * foo = sip_destroy(foo); + * and reduce the chance of bugs due to dangling pointers. + */ +struct sip_pvt *sip_destroy(struct sip_pvt *p); + +/*! \brief Destroy SIP call structure. + * Make it return NULL so the caller can do things like + * foo = sip_destroy(foo); + * and reduce the chance of bugs due to dangling pointers. + */ +void __sip_destroy(struct sip_pvt *p, int lockowner, int lockdialoglist); +/*! + * \brief Unlink a dialog from the dialogs container, as well as any other places + * that it may be currently stored. + * + * \note A reference to the dialog must be held before calling this function, and this + * function does not release that reference. + */ +void *dialog_unlink_all(struct sip_pvt *dialog, int lockowner, int lockdialoglist); + +/*! \brief Acknowledges receipt of a packet and stops retransmission + * called with p locked*/ +int __sip_ack(struct sip_pvt *p, int seqno, int resp, int sipmethod); + +/*! \brief Pretend to ack all packets + * called with p locked */ +void __sip_pretend_ack(struct sip_pvt *p); + +/*! \brief Acks receipt of packet, keep it around (used for provisional responses) */ +int __sip_semi_ack(struct sip_pvt *p, int seqno, int resp, int sipmethod); + +#endif /* defined(_SIP_DIALOG_H) */ diff --git a/channels/sip/include/dialplan_functions.h b/channels/sip/include/dialplan_functions.h new file mode 100644 index 000000000..1600d4314 --- /dev/null +++ b/channels/sip/include/dialplan_functions.h @@ -0,0 +1,41 @@ +/* + * Asterisk -- An open source telephony toolkit. + * + * Copyright (C) 2010, Digium, Inc. + * + * See http://www.asterisk.org for more information about + * the Asterisk project. Please do not directly contact + * any of the maintainers of this project for assistance; + * the project provides a web site, mailing lists and IRC + * channels for your use. + * + * This program is free software, distributed under the terms of + * the GNU General Public License Version 2. See the LICENSE file + * at the top of the source tree. + */ + +/*! + * \file + * \brief SIP dialplan functions header file + */ + +#include "sip.h" + +#ifndef _SIP_DIALPLAN_FUNCTIONS_H +#define _SIP_DIALPLAN_FUNCTIONS_H + +/*! + * \brief Channel read dialplan function for SIP + */ +int sip_acf_channel_read(struct ast_channel *chan, const char *funcname, char *preparse, char *buf, size_t buflen); + +/*! + * \brief register dialplan function tests + */ +void sip_dialplan_function_register_tests(void); +/*! + * \brief unregister dialplan function tests + */ +void sip_dialplan_function_unregister_tests(void); + +#endif /* !defined(_SIP_DIALPLAN_FUNCTIONS_H) */ diff --git a/channels/sip/include/globals.h b/channels/sip/include/globals.h new file mode 100644 index 000000000..0d7131d87 --- /dev/null +++ b/channels/sip/include/globals.h @@ -0,0 +1,42 @@ +/* + * Asterisk -- An open source telephony toolkit. + * + * Copyright (C) 2010, Digium, Inc. + * + * See http://www.asterisk.org for more information about + * the Asterisk project. Please do not directly contact + * any of the maintainers of this project for assistance; + * the project provides a web site, mailing lists and IRC + * channels for your use. + * + * This program is free software, distributed under the terms of + * the GNU General Public License Version 2. See the LICENSE file + * at the top of the source tree. + */ + +/*! + * \file + * \brief sip global declaration header file + */ + +#include "sip.h" + +#ifndef _SIP_GLOBALS_H +#define _SIP_GLOBALS_H + +extern struct sockaddr_in bindaddr; /*!< UDP: The address we bind to */ +extern struct sched_context *sched; /*!< The scheduling context */ + +/*! \brief Definition of this channel for PBX channel registration */ +extern const struct ast_channel_tech sip_tech; + +/*! \brief This version of the sip channel tech has no send_digit_begin + * callback so that the core knows that the channel does not want + * DTMF BEGIN frames. + * The struct is initialized just before registering the channel driver, + * and is for use with channels using SIP INFO DTMF. + */ +extern struct ast_channel_tech sip_tech_info; + +#endif /* !defined(SIP_GLOBALS_H) */ + diff --git a/channels/sip/include/sip_utils.h b/channels/sip/include/sip_utils.h index 549f9392f..47297ab68 100644 --- a/channels/sip/include/sip_utils.h +++ b/channels/sip/include/sip_utils.h @@ -22,8 +22,11 @@ #ifndef _SIP_UTILS_H #define _SIP_UTILS_H -/*! - * \brief converts ascii port to int representation. +/* wrapper macro to tell whether t points to one of the sip_tech descriptors */ +#define IS_SIP_TECH(t) ((t) == &sip_tech || (t) == &sip_tech_info) + +/*! + * \brief converts ascii port to int representation. * * \arg pt[in] string that contains a port. * \arg standard[in] port to return in case the port string input is NULL @@ -40,4 +43,41 @@ unsigned int port_str2int(const char *pt, unsigned int standard); const char *find_closing_quote(const char *start, const char *lim); +/*! \brief Convert SIP hangup causes to Asterisk hangup causes */ +int hangup_sip2cause(int cause); + +/*! \brief Convert Asterisk hangup causes to SIP codes +\verbatim + Possible values from causes.h + AST_CAUSE_NOTDEFINED AST_CAUSE_NORMAL AST_CAUSE_BUSY + AST_CAUSE_FAILURE AST_CAUSE_CONGESTION AST_CAUSE_UNALLOCATED + + In addition to these, a lot of PRI codes is defined in causes.h + ...should we take care of them too ? + + Quote RFC 3398 + + ISUP Cause value SIP response + ---------------- ------------ + 1 unallocated number 404 Not Found + 2 no route to network 404 Not found + 3 no route to destination 404 Not found + 16 normal call clearing --- (*) + 17 user busy 486 Busy here + 18 no user responding 408 Request Timeout + 19 no answer from the user 480 Temporarily unavailable + 20 subscriber absent 480 Temporarily unavailable + 21 call rejected 403 Forbidden (+) + 22 number changed (w/o diagnostic) 410 Gone + 22 number changed (w/ diagnostic) 301 Moved Permanently + 23 redirection to new destination 410 Gone + 26 non-selected user clearing 404 Not Found (=) + 27 destination out of order 502 Bad Gateway + 28 address incomplete 484 Address incomplete + 29 facility rejected 501 Not implemented + 31 normal unspecified 480 Temporarily unavailable +\endverbatim +*/ +const char *hangup_cause2sip(int cause); + #endif |