[asterisk-commits] twilson: branch group/srtp_reboot r247793 - in /team/group/srtp_reboot: ./ ap...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Feb 18 16:01:32 CST 2010
Author: twilson
Date: Thu Feb 18 16:01:28 2010
New Revision: 247793
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=247793
Log:
Merged revisions 247124-247125,247169 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
................
r247124 | tilghman | 2010-02-17 00:25:15 -0600 (Wed, 17 Feb 2010) | 13 lines
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/
................
r247125 | tilghman | 2010-02-17 01:01:13 -0600 (Wed, 17 Feb 2010) | 2 lines
RTP documentation states that you can pass NULL as the module, so make sure that's really the case.
................
r247169 | mmichelson | 2010-02-17 10:24:54 -0600 (Wed, 17 Feb 2010) | 9 lines
Merged revisions 247168 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r247168 | mmichelson | 2010-02-17 10:24:17 -0600 (Wed, 17 Feb 2010) | 3 lines
Make sure that when autofill is disabled that callers not in the front of the queue cannot place calls.
........
................
also changed ENCRYPT() to SECURE(), even though I will most likely be moving to using CHANNEL()
Added:
team/group/srtp_reboot/channels/sip/dialplan_functions.c
- copied unchanged from r247169, trunk/channels/sip/dialplan_functions.c
team/group/srtp_reboot/channels/sip/include/dialog.h
- copied unchanged from r247169, trunk/channels/sip/include/dialog.h
team/group/srtp_reboot/channels/sip/include/dialplan_functions.h
- copied unchanged from r247169, trunk/channels/sip/include/dialplan_functions.h
team/group/srtp_reboot/channels/sip/include/globals.h
- copied unchanged from r247169, trunk/channels/sip/include/globals.h
team/group/srtp_reboot/funcs/func_secure.c (contents, props changed)
- copied, changed from r247172, team/group/srtp_reboot/funcs/func_encrypt.c
Removed:
team/group/srtp_reboot/funcs/func_encrypt.c
Modified:
team/group/srtp_reboot/ (props changed)
team/group/srtp_reboot/apps/app_queue.c
team/group/srtp_reboot/channels/Makefile
team/group/srtp_reboot/channels/chan_sip.c
team/group/srtp_reboot/channels/sip/include/config_parser.h
team/group/srtp_reboot/channels/sip/include/sip_utils.h
team/group/srtp_reboot/main/loader.c
Propchange: team/group/srtp_reboot/
------------------------------------------------------------------------------
automerge = *
Propchange: team/group/srtp_reboot/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.
Propchange: team/group/srtp_reboot/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Thu Feb 18 16:01:28 2010
@@ -1,1 +1,1 @@
-/trunk:1-247090
+/trunk:1-247215
Modified: team/group/srtp_reboot/apps/app_queue.c
URL: http://svnview.digium.com/svn/asterisk/team/group/srtp_reboot/apps/app_queue.c?view=diff&rev=247793&r1=247792&r2=247793
==============================================================================
--- team/group/srtp_reboot/apps/app_queue.c (original)
+++ team/group/srtp_reboot/apps/app_queue.c Thu Feb 18 16:01:28 2010
@@ -3545,9 +3545,11 @@
}
ao2_unlock(qe->parent);
-
- /* If the queue entry is within avl [the number of available members] calls from the top ... */
- if (ch && idx < avl) {
+ /* If the queue entry is within avl [the number of available members] calls from the top ...
+ * Autofill and position check added to support autofill=no (as only calls
+ * from the front of the queue are valid when autofill is disabled)
+ */
+ if (ch && idx < avl && (qe->parent->autofill || qe->pos == 1)) {
ast_debug(1, "It's our turn (%s).\n", qe->chan->name);
res = 1;
} else {
Modified: team/group/srtp_reboot/channels/Makefile
URL: http://svnview.digium.com/svn/asterisk/team/group/srtp_reboot/channels/Makefile?view=diff&rev=247793&r1=247792&r2=247793
==============================================================================
--- team/group/srtp_reboot/channels/Makefile (original)
+++ team/group/srtp_reboot/channels/Makefile Thu Feb 18 16:01:28 2010
@@ -70,7 +70,7 @@
rm -f h323/Makefile
$(if $(filter chan_iax2,$(EMBEDDED_MODS)),modules.link,chan_iax2.so): iax2-parser.o iax2-provision.o
-$(if $(filter chan_sip,$(EMBEDDED_MODS)),modules.link,chan_sip.so): sip/config_parser.o sip/reqresp_parser.o sip/srtp.o sip/sdp_crypto.o
+$(if $(filter chan_sip,$(EMBEDDED_MODS)),modules.link,chan_sip.so): $(subst .c,.o,$(wildcard sip/*.c))
$(if $(filter chan_dahdi,$(EMBEDDED_MODS)),modules.link,chan_dahdi.so): sig_analog.o sig_pri.o
ifneq ($(filter chan_h323,$(EMBEDDED_MODS)),)
Modified: team/group/srtp_reboot/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/group/srtp_reboot/channels/chan_sip.c?view=diff&rev=247793&r1=247792&r2=247793
==============================================================================
--- team/group/srtp_reboot/channels/chan_sip.c (original)
+++ team/group/srtp_reboot/channels/chan_sip.c Thu Feb 18 16:01:28 2010
@@ -264,11 +264,14 @@
#include "asterisk/cel.h"
#include "asterisk/global_datastores.h"
#include "sip/include/sip.h"
+#include "sip/include/globals.h"
#include "sip/include/config_parser.h"
#include "sip/include/reqresp_parser.h"
#include "sip/include/sip_utils.h"
#include "sip/include/srtp.h"
#include "sip/include/sdp_crypto.h"
+#include "sip/include/dialog.h"
+#include "sip/include/dialplan_functions.h"
/*** DOCUMENTATION
@@ -814,7 +817,7 @@
static int sip_reloading = FALSE; /*!< Flag for avoiding multiple reloads at the same time */
static enum channelreloadreason sip_reloadreason; /*!< Reason for last reload/load of configuration */
-static struct sched_context *sched; /*!< The scheduling context */
+struct sched_context *sched; /*!< The scheduling context */
static struct io_context *io; /*!< The IO context */
static int *sipsock_read_id; /*!< ID of IO entry for sipsock FD */
struct sip_pkt;
@@ -910,7 +913,7 @@
*/
static int sipsock = -1;
-static struct sockaddr_in bindaddr; /*!< UDP: The address we bind to */
+struct sockaddr_in bindaddr; /*!< UDP: The address we bind to */
/*! \brief our (internal) default address/port to put in SIP/SDP messages
* internip is initialized picking a suitable address from one of the
@@ -1032,23 +1035,11 @@
static void parse_moved_contact(struct sip_pvt *p, struct sip_request *req, char **name, char **number, int set_call_forward);
static int sip_send_mwi_to_peer(struct sip_peer *peer, const struct ast_event *event, int cache_only);
-/*--- Dialog management */
-static struct sip_pvt *sip_alloc(ast_string_field callid, struct sockaddr_in *sin,
- int useglobal_nat, const int intended_method, struct sip_request *req);
+/* Misc dialog routines */
static int __sip_autodestruct(const void *data);
-static void sip_scheddestroy(struct sip_pvt *p, int ms);
-static int sip_cancel_destroy(struct sip_pvt *p);
-static struct sip_pvt *sip_destroy(struct sip_pvt *p);
-static void *dialog_unlink_all(struct sip_pvt *dialog, int lockowner, int lockdialoglist);
static void *registry_unref(struct sip_registry *reg, char *tag);
-static void __sip_destroy(struct sip_pvt *p, int lockowner, int lockdialoglist);
-static int __sip_ack(struct sip_pvt *p, int seqno, int resp, int sipmethod);
-static void __sip_pretend_ack(struct sip_pvt *p);
-static int __sip_semi_ack(struct sip_pvt *p, int seqno, int resp, int sipmethod);
+static int update_call_counter(struct sip_pvt *fup, int event);
static int auto_congest(const void *arg);
-static int update_call_counter(struct sip_pvt *fup, int event);
-static int hangup_sip2cause(int cause);
-static const char *hangup_cause2sip(int cause);
static struct sip_pvt *find_call(struct sip_request *req, struct sockaddr_in *sin, const int intended_method);
static void free_old_route(struct sip_route *route);
static void list_route(struct sip_route *route);
@@ -1176,7 +1167,6 @@
static int sip_addheader(struct ast_channel *chan, const char *data);
static int sip_do_reload(enum channelreloadreason reason);
static char *sip_reload(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a);
-static int acf_channel_read(struct ast_channel *chan, const char *funcname, char *preparse, char *buf, size_t buflen);
/*--- Debugging
Functions for enabling debug per IP or fully, or enabling history logging for
@@ -1353,7 +1343,7 @@
static int __sip_subscribe_mwi_do(struct sip_subscription_mwi *mwi);
/*! \brief Definition of this channel for PBX channel registration */
-static const struct ast_channel_tech sip_tech = {
+const struct ast_channel_tech sip_tech = {
.type = "SIP",
.description = "Session Initiation Protocol (SIP)",
.capabilities = AST_FORMAT_AUDIO_MASK, /* all audio formats */
@@ -1376,7 +1366,7 @@
.bridge = ast_rtp_instance_bridge, /* XXX chan unlocked ? */
.early_bridge = ast_rtp_instance_early_bridge,
.send_text = sip_sendtext, /* called with chan locked */
- .func_channel_read = acf_channel_read,
+ .func_channel_read = sip_acf_channel_read,
.setoption = sip_setoption,
.queryoption = sip_queryoption,
.get_pvt_uniqueid = sip_get_callid,
@@ -1388,7 +1378,7 @@
* The struct is initialized just before registering the channel driver,
* and is for use with channels using SIP INFO DTMF.
*/
-static struct ast_channel_tech sip_tech_info;
+struct ast_channel_tech sip_tech_info;
/*! \brief Working TLS connection configuration */
static struct ast_tls_config sip_tls_cfg;
@@ -1418,54 +1408,33 @@
.worker_fn = sip_tcp_worker_fn,
};
-/* 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 Append to SIP dialog history
\return Always returns 0 */
#define append_history(p, event, fmt , args... ) append_history_full(p, "%-15s " fmt, event, ## args)
-/*! \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().
- */
+struct sip_pvt *dialog_ref_debug(struct sip_pvt *p, char *tag, char *file, int line, const char *func)
+{
+ if (p)
#ifdef REF_DEBUG
-#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__)
-
-static struct sip_pvt *dialog_ref_debug(struct sip_pvt *p, char *tag, char *file, int line, const char *func)
-{
- if (p)
__ao2_ref_debug(p, 1, tag, file, line, func);
+#else
+ ao2_ref(p, 1);
+#endif
else
ast_log(LOG_ERROR, "Attempt to Ref a null pointer\n");
return p;
}
-static struct sip_pvt *dialog_unref_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)
{
if (p)
+#ifdef REF_DEBUG
__ao2_ref_debug(p, -1, tag, file, line, func);
+#else
+ ao2_ref(p, -1);
+#endif
return NULL;
}
-#else
-static struct sip_pvt *dialog_ref(struct sip_pvt *p, char *tag)
-{
- if (p)
- ao2_ref(p, 1);
- else
- ast_log(LOG_ERROR, "Attempt to Ref a null pointer\n");
- return p;
-}
-
-static struct sip_pvt *dialog_unref(struct sip_pvt *p, char *tag)
-{
- if (p)
- ao2_ref(p, -1);
- return NULL;
-}
-#endif
/*! \brief map from an integer value to a string.
* If no match is found, return errorstring
@@ -1949,7 +1918,7 @@
* \note A reference to the dialog must be held before calling this function, and this
* function does not release that reference.
*/
-static void *dialog_unlink_all(struct sip_pvt *dialog, int lockowner, int lockdialoglist)
+void *dialog_unlink_all(struct sip_pvt *dialog, int lockowner, int lockdialoglist)
{
struct sip_pkt *cp;
@@ -2014,7 +1983,7 @@
return NULL;
}
-static void *registry_unref(struct sip_registry *reg, char *tag)
+void *registry_unref(struct sip_registry *reg, char *tag)
{
ast_debug(3, "SIP Registry %s: refcount now %d\n", reg->hostname, reg->refcount - 1);
ASTOBJ_UNREF(reg, sip_registry_destroy);
@@ -2795,7 +2764,7 @@
}
/*! \brief Schedule destruction of SIP dialog */
-static void sip_scheddestroy(struct sip_pvt *p, int ms)
+void sip_scheddestroy(struct sip_pvt *p, int ms)
{
if (ms < 0) {
if (p->timer_t1 == 0) {
@@ -2823,7 +2792,7 @@
* Be careful as this also absorbs the reference - if you call it
* from within the scheduler, this might be the last reference.
*/
-static int sip_cancel_destroy(struct sip_pvt *p)
+int sip_cancel_destroy(struct sip_pvt *p)
{
int res = 0;
if (p->autokillid > -1) {
@@ -2840,7 +2809,7 @@
/*! \brief Acknowledges receipt of a packet and stops retransmission
* called with p locked*/
-static int __sip_ack(struct sip_pvt *p, int seqno, int resp, int sipmethod)
+int __sip_ack(struct sip_pvt *p, int seqno, int resp, int sipmethod)
{
struct sip_pkt *cur, *prev = NULL;
const char *msg = "Not Found"; /* used only for debugging */
@@ -2905,7 +2874,7 @@
/*! \brief Pretend to ack all packets
* called with p locked */
-static void __sip_pretend_ack(struct sip_pvt *p)
+void __sip_pretend_ack(struct sip_pvt *p)
{
struct sip_pkt *cur = NULL;
@@ -2922,7 +2891,7 @@
}
/*! \brief Acks receipt of packet, keep it around (used for provisional responses) */
-static int __sip_semi_ack(struct sip_pvt *p, int seqno, int resp, int sipmethod)
+int __sip_semi_ack(struct sip_pvt *p, int seqno, int resp, int sipmethod)
{
struct sip_pkt *cur;
int res = FALSE;
@@ -4320,7 +4289,7 @@
}
/*! \brief Execute destruction of SIP dialog structure, release memory */
-static void __sip_destroy(struct sip_pvt *p, int lockowner, int lockdialoglist)
+void __sip_destroy(struct sip_pvt *p, int lockowner, int lockdialoglist)
{
struct sip_request *req;
@@ -4458,7 +4427,7 @@
*
* \return 0 if call is ok (no call limit, below threshold)
* -1 on rejection of call
- *
+ *
*/
static int update_call_counter(struct sip_pvt *fup, int event)
{
@@ -4612,7 +4581,7 @@
* foo = sip_destroy(foo);
* and reduce the chance of bugs due to dangling pointers.
*/
-static struct sip_pvt * sip_destroy(struct sip_pvt *p)
+struct sip_pvt *sip_destroy(struct sip_pvt *p)
{
ast_debug(3, "Destroying SIP dialog %s\n", p->callid);
__sip_destroy(p, TRUE, TRUE);
@@ -4620,7 +4589,7 @@
}
/*! \brief Convert SIP hangup causes to Asterisk hangup causes */
-static int hangup_sip2cause(int cause)
+int hangup_sip2cause(int cause)
{
/* Possible values taken from causes.h */
@@ -4677,7 +4646,7 @@
return AST_CAUSE_FAILURE;
case 501: /* Call rejected */
return AST_CAUSE_FACILITY_REJECTED;
- case 502:
+ case 502:
return AST_CAUSE_DESTINATION_OUT_OF_ORDER;
case 503: /* Service unavailable */
return AST_CAUSE_CONGESTION;
@@ -4718,7 +4687,7 @@
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
@@ -4742,7 +4711,7 @@
31 normal unspecified 480 Temporarily unavailable
\endverbatim
*/
-static const char *hangup_cause2sip(int cause)
+const char *hangup_cause2sip(int cause)
{
switch (cause) {
case AST_CAUSE_UNALLOCATED: /* 1 */
@@ -6001,7 +5970,7 @@
* Returns a reference to the object so whoever uses it later must
* remember to release the reference.
*/
-static struct sip_pvt *sip_alloc(ast_string_field callid, struct sockaddr_in *sin,
+struct sip_pvt *sip_alloc(ast_string_field callid, struct sockaddr_in *sin,
int useglobal_nat, const int intended_method, struct sip_request *req)
{
struct sip_pvt *p;
@@ -20315,122 +20284,6 @@
transmit_response(p, "481 Call Leg Does Not Exist", req);
return 0;
}
-}
-
-static int acf_channel_read(struct ast_channel *chan, const char *funcname, char *preparse, char *buf, size_t buflen)
-{
- struct sip_pvt *p = chan->tech_pvt;
- char *parse = ast_strdupa(preparse);
- int res = 0;
- AST_DECLARE_APP_ARGS(args,
- AST_APP_ARG(param);
- AST_APP_ARG(type);
- AST_APP_ARG(field);
- );
- AST_STANDARD_APP_ARGS(args, parse);
-
- /* Sanity check */
- if (!IS_SIP_TECH(chan->tech)) {
- ast_log(LOG_ERROR, "Cannot call %s on a non-SIP channel\n", funcname);
- return 0;
- }
-
- memset(buf, 0, buflen);
-
- if (p == NULL) {
- return -1;
- }
-
- if (!strcasecmp(args.param, "peerip")) {
- ast_copy_string(buf, p->sa.sin_addr.s_addr ? ast_inet_ntoa(p->sa.sin_addr) : "", buflen);
- } else if (!strcasecmp(args.param, "recvip")) {
- ast_copy_string(buf, p->recv.sin_addr.s_addr ? ast_inet_ntoa(p->recv.sin_addr) : "", buflen);
- } else if (!strcasecmp(args.param, "from")) {
- ast_copy_string(buf, p->from, buflen);
- } else if (!strcasecmp(args.param, "uri")) {
- ast_copy_string(buf, p->uri, buflen);
- } else if (!strcasecmp(args.param, "useragent")) {
- ast_copy_string(buf, p->useragent, buflen);
- } else if (!strcasecmp(args.param, "peername")) {
- ast_copy_string(buf, p->peername, buflen);
- } else if (!strcasecmp(args.param, "t38passthrough")) {
- ast_copy_string(buf, (p->t38.state == T38_DISABLED) ? "0" : "1", buflen);
- } else if (!strcasecmp(args.param, "rtpdest")) {
- struct sockaddr_in sin;
-
- if (ast_strlen_zero(args.type))
- args.type = "audio";
-
- if (!strcasecmp(args.type, "audio"))
- ast_rtp_instance_get_remote_address(p->rtp, &sin);
- else if (!strcasecmp(args.type, "video"))
- ast_rtp_instance_get_remote_address(p->vrtp, &sin);
- else if (!strcasecmp(args.type, "text"))
- ast_rtp_instance_get_remote_address(p->trtp, &sin);
- else
- return -1;
-
- snprintf(buf, buflen, "%s:%d", ast_inet_ntoa(sin.sin_addr), ntohs(sin.sin_port));
- } else if (!strcasecmp(args.param, "rtpqos")) {
- struct ast_rtp_instance *rtp = NULL;
-
- if (ast_strlen_zero(args.type)) {
- args.type = "audio";
- }
-
- if (!strcasecmp(args.type, "audio")) {
- rtp = p->rtp;
- } else if (!strcasecmp(args.type, "video")) {
- rtp = p->vrtp;
- } else if (!strcasecmp(args.type, "text")) {
- rtp = p->trtp;
- } else {
- return -1;
- }
-
- if (ast_strlen_zero(args.field) || !strcasecmp(args.field, "all")) {
- char quality_buf[AST_MAX_USER_FIELD], *quality;
-
- if (!(quality = ast_rtp_instance_get_quality(rtp, AST_RTP_INSTANCE_STAT_FIELD_QUALITY, quality_buf, sizeof(quality_buf)))) {
- return -1;
- }
-
- ast_copy_string(buf, quality_buf, buflen);
- return res;
- } else {
- struct ast_rtp_instance_stats stats;
-
- if (ast_rtp_instance_get_stats(rtp, &stats, AST_RTP_INSTANCE_STAT_ALL)) {
- return -1;
- }
-
- if (!strcasecmp(args.field, "local_ssrc")) {
- snprintf(buf, buflen, "%u", stats.local_ssrc);
- } else if (!strcasecmp(args.field, "local_lostpackets")) {
- snprintf(buf, buflen, "%u", stats.rxploss);
- } else if (!strcasecmp(args.field, "local_jitter")) {
- snprintf(buf, buflen, "%u", stats.rxjitter);
- } else if (!strcasecmp(args.field, "local_count")) {
- snprintf(buf, buflen, "%u", stats.rxcount);
- } else if (!strcasecmp(args.field, "remote_ssrc")) {
- snprintf(buf, buflen, "%u", stats.remote_ssrc);
- } else if (!strcasecmp(args.field, "remote_lostpackets")) {
- snprintf(buf, buflen, "%u", stats.txploss);
- } else if (!strcasecmp(args.field, "remote_jitter")) {
- snprintf(buf, buflen, "%u", stats.txjitter);
- } else if (!strcasecmp(args.field, "remote_count")) {
- snprintf(buf, buflen, "%u", stats.txcount);
- } else if (!strcasecmp(args.field, "rtt")) {
- snprintf(buf, buflen, "%u", stats.rtt);
- } else {
- ast_log(LOG_WARNING, "Unrecognized argument '%s' to %s\n", preparse, funcname);
- return -1;
- }
- }
- } else {
- res = -1;
- }
- return res;
}
/*! \brief Handle incoming BYE request */
@@ -25335,6 +25188,7 @@
{
sip_config_parser_register_tests();
sip_request_parser_register_tests();
+ sip_dialplan_function_register_tests();
}
/*! \brief SIP test registration */
@@ -25342,6 +25196,7 @@
{
sip_config_parser_unregister_tests();
sip_request_parser_unregister_tests();
+ sip_dialplan_function_unregister_tests();
}
/*! \brief PBX load module - initialization */
Modified: team/group/srtp_reboot/channels/sip/include/config_parser.h
URL: http://svnview.digium.com/svn/asterisk/team/group/srtp_reboot/channels/sip/include/config_parser.h?view=diff&rev=247793&r1=247792&r2=247793
==============================================================================
--- team/group/srtp_reboot/channels/sip/include/config_parser.h (original)
+++ team/group/srtp_reboot/channels/sip/include/config_parser.h Thu Feb 18 16:01:28 2010
@@ -43,7 +43,7 @@
*/
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);
Modified: team/group/srtp_reboot/channels/sip/include/sip_utils.h
URL: http://svnview.digium.com/svn/asterisk/team/group/srtp_reboot/channels/sip/include/sip_utils.h?view=diff&rev=247793&r1=247792&r2=247793
==============================================================================
--- team/group/srtp_reboot/channels/sip/include/sip_utils.h (original)
+++ team/group/srtp_reboot/channels/sip/include/sip_utils.h Thu Feb 18 16:01:28 2010
@@ -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 @@
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
Copied: team/group/srtp_reboot/funcs/func_secure.c (from r247172, team/group/srtp_reboot/funcs/func_encrypt.c)
URL: http://svnview.digium.com/svn/asterisk/team/group/srtp_reboot/funcs/func_secure.c?view=diff&rev=247793&p1=team/group/srtp_reboot/funcs/func_encrypt.c&r1=247172&p2=team/group/srtp_reboot/funcs/func_secure.c&r2=247793
==============================================================================
--- team/group/srtp_reboot/funcs/func_encrypt.c (original)
+++ team/group/srtp_reboot/funcs/func_secure.c Thu Feb 18 16:01:28 2010
@@ -34,10 +34,10 @@
/*** DOCUMENTATION
<function name="ENCRYPT" language="en_US">
<synopsis>
- Set whether a call's signalling or media should be encrypted.
+ Set whether a call's signaling or media should be encrypted.
</synopsis>
<syntax>
- <parameter name="signalling" />
+ <parameter name="signaling" />
<parameter name="media" />
</syntax>
<description>
@@ -46,7 +46,7 @@
</function>
***/
-static int encrypt_read(struct ast_channel *chan, const char *cmd,
+static int secure_read(struct ast_channel *chan, const char *cmd,
char *data, struct ast_str **buf, ssize_t len)
{
struct ast_datastore *ds;
@@ -57,8 +57,8 @@
return 0;
}
store = ds->data;
- if (!strcasecmp(data, "signalling")) {
- ast_str_set(buf, 0, "%u", store->signalling);
+ if (!strcasecmp(data, "signaling")) {
+ ast_str_set(buf, 0, "%u", store->signaling);
} else if (!strcasecmp(data, "media")) {
ast_str_set(buf, 0, "%u", store->media);
}
@@ -67,7 +67,7 @@
return 0;
}
-static int encrypt_write(struct ast_channel *chan, const char *cmd, char *data,
+static int secure_write(struct ast_channel *chan, const char *cmd, char *data,
const char *value)
{
struct ast_datastore *ds;
@@ -94,8 +94,8 @@
}
ast_channel_unlock(chan);
- if (!strcasecmp(data, "signalling")) {
- store->signalling = ast_true(value) ? 1 : 0;
+ if (!strcasecmp(data, "signaling")) {
+ store->signaling = ast_true(value) ? 1 : 0;
} else if (!strcasecmp(data, "media")) {
store->media = ast_true(value) ? 1 : 0;
} else {
@@ -107,9 +107,9 @@
}
static struct ast_custom_function encrypt_function = {
- .name = "ENCRYPT",
- .read2 = encrypt_read,
- .write = encrypt_write,
+ .name = "SECURE",
+ .read2 = secure_read,
+ .write = secure_write,
};
static int unload_module(void)
Propchange: team/group/srtp_reboot/funcs/func_secure.c
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: team/group/srtp_reboot/funcs/func_secure.c
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: team/group/srtp_reboot/funcs/func_secure.c
------------------------------------------------------------------------------
svn:mergeinfo =
Propchange: team/group/srtp_reboot/funcs/func_secure.c
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: team/group/srtp_reboot/main/loader.c
URL: http://svnview.digium.com/svn/asterisk/team/group/srtp_reboot/main/loader.c?view=diff&rev=247793&r1=247792&r2=247793
==============================================================================
--- team/group/srtp_reboot/main/loader.c (original)
+++ team/group/srtp_reboot/main/loader.c Thu Feb 18 16:01:28 2010
@@ -1200,6 +1200,10 @@
struct ast_module *ast_module_ref(struct ast_module *mod)
{
+ if (!mod) {
+ return NULL;
+ }
+
ast_atomic_fetchadd_int(&mod->usecount, +1);
ast_update_use_count();
@@ -1208,6 +1212,10 @@
void ast_module_unref(struct ast_module *mod)
{
+ if (!mod) {
+ return;
+ }
+
ast_atomic_fetchadd_int(&mod->usecount, -1);
ast_update_use_count();
}
More information about the asterisk-commits
mailing list