[asterisk-commits] russell: branch group/security_events r246114 - in /team/group/security_event...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Feb 10 11:33:49 CST 2010


Author: russell
Date: Wed Feb 10 11:33:41 2010
New Revision: 246114

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=246114
Log:
resolve, reset

Added:
    team/group/security_events/channels/sip/   (props changed)
      - copied from r246070, trunk/channels/sip/
    team/group/security_events/channels/sip/config_parser.c
      - copied unchanged from r246070, trunk/channels/sip/config_parser.c
    team/group/security_events/channels/sip/include/
      - copied from r246070, trunk/channels/sip/include/
    team/group/security_events/channels/sip/include/config_parser.h
      - copied unchanged from r246070, trunk/channels/sip/include/config_parser.h
    team/group/security_events/channels/sip/include/reqresp_parser.h
      - copied unchanged from r246070, trunk/channels/sip/include/reqresp_parser.h
    team/group/security_events/channels/sip/include/sip.h
      - copied, changed from r246070, trunk/channels/sip/include/sip.h
    team/group/security_events/channels/sip/include/sip_utils.h
      - copied unchanged from r246070, trunk/channels/sip/include/sip_utils.h
    team/group/security_events/channels/sip/reqresp_parser.c
      - copied unchanged from r246070, trunk/channels/sip/reqresp_parser.c
Removed:
    team/group/security_events/contrib/firmware/
Modified:
    team/group/security_events/   (props changed)
    team/group/security_events/CHANGES
    team/group/security_events/LICENSE
    team/group/security_events/apps/app_fax.c
    team/group/security_events/channels/Makefile
    team/group/security_events/channels/chan_iax2.c
    team/group/security_events/channels/chan_local.c
    team/group/security_events/channels/chan_sip.c
    team/group/security_events/channels/chan_usbradio.c
    team/group/security_events/configs/extensions.conf.sample
    team/group/security_events/configs/sip.conf.sample
    team/group/security_events/configure
    team/group/security_events/configure.ac
    team/group/security_events/contrib/scripts/install_prereq
    team/group/security_events/funcs/func_math.c
    team/group/security_events/funcs/func_strings.c
    team/group/security_events/include/asterisk/astobj2.h
    team/group/security_events/include/asterisk/autoconfig.h.in
    team/group/security_events/include/asterisk/manager.h
    team/group/security_events/include/asterisk/test.h
    team/group/security_events/include/asterisk/utils.h
    team/group/security_events/main/Makefile
    team/group/security_events/main/ast_expr2.fl
    team/group/security_events/main/ast_expr2f.c
    team/group/security_events/main/asterisk.c
    team/group/security_events/main/astobj2.c
    team/group/security_events/main/event.c
    team/group/security_events/main/features.c
    team/group/security_events/main/file.c
    team/group/security_events/main/pbx.c
    team/group/security_events/main/test.c
    team/group/security_events/pbx/pbx_gtkconsole.c
    team/group/security_events/res/res_agi.c
    team/group/security_events/res/res_calendar_caldav.c
    team/group/security_events/res/res_calendar_exchange.c
    team/group/security_events/res/res_calendar_icalendar.c
    team/group/security_events/tests/test_ast_format_str_reduce.c
    team/group/security_events/tests/test_heap.c
    team/group/security_events/tests/test_sched.c
    team/group/security_events/tests/test_skel.c
    team/group/security_events/tests/test_substitution.c
    team/group/security_events/tests/test_utils.c

Propchange: team/group/security_events/
------------------------------------------------------------------------------
    automerge = *

Propchange: team/group/security_events/
------------------------------------------------------------------------------
Binary property 'branch-1.4-blocked' - no diff available.

Propchange: team/group/security_events/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Propchange: team/group/security_events/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Wed Feb 10 11:33:41 2010
@@ -1,1 +1,1 @@
-/trunk:1-244567
+/trunk:1-246101

Modified: team/group/security_events/CHANGES
URL: http://svnview.digium.com/svn/asterisk/team/group/security_events/CHANGES?view=diff&rev=246114&r1=246113&r2=246114
==============================================================================
--- team/group/security_events/CHANGES (original)
+++ team/group/security_events/CHANGES Wed Feb 10 11:33:41 2010
@@ -1300,6 +1300,8 @@
     pickup
   * Added parkedcallrecording option to control one-touch record w/ parking
     pickup
+  * Added parkedcallparking, parkedcallhangup, parkedcallrecording, and
+    parkedcalltransfers option support for multiple parking lots.
   * Added BRIDGE_FEATURES variable to set available features for a channel
   * The built-in method for doing attended transfers has been updated to
      include some new options that allow you to have the transferee sent

Modified: team/group/security_events/LICENSE
URL: http://svnview.digium.com/svn/asterisk/team/group/security_events/LICENSE?view=diff&rev=246114&r1=246113&r2=246114
==============================================================================
--- team/group/security_events/LICENSE (original)
+++ team/group/security_events/LICENSE Wed Feb 10 11:33:41 2010
@@ -7,15 +7,8 @@
 
 This package also includes various components that are not part of
 Asterisk itself; these components are in the 'contrib' directory
-and its subdirectories. Most of these components are also
-distributed under the GPL version 2 as well, except for the following:
-
-contrib/firmware/iax/iaxy.bin:
-	This file is Copyright (C) Digium, Inc. and is licensed for
-	use with Digium IAXy hardware devices only. It can be
-	distributed freely as long as the distribution is in the
-	original form present in this package (not reformatted or
-	modified).
+and its subdirectories. These components are also distributed under the
+GPL version 2 as well.
 
 Digium, Inc. (formerly Linux Support Services) holds copyright
 and/or sufficient licenses to all components of the Asterisk

Modified: team/group/security_events/apps/app_fax.c
URL: http://svnview.digium.com/svn/asterisk/team/group/security_events/apps/app_fax.c?view=diff&rev=246114&r1=246113&r2=246114
==============================================================================
--- team/group/security_events/apps/app_fax.c (original)
+++ team/group/security_events/apps/app_fax.c Wed Feb 10 11:33:41 2010
@@ -373,8 +373,12 @@
 							     .rate = AST_T38_RATE_14400,
 							     .rate_management = AST_T38_RATE_MANAGEMENT_TRANSFERRED_TCF,
 							     .fill_bit_removal = 1,
-							     .transcoding_mmr = 1,
-							     .transcoding_jbig = 1,
+/*
+ * spandsp has API calls to support MMR and JBIG transcoding, but they aren't
+ * implemented quite yet... so don't offer them to the remote endpoint
+ *							     .transcoding_mmr = 1,
+ *							     .transcoding_jbig = 1,
+*/
 	};
 
 	/* if in called party mode, try to use T.38 */
@@ -555,6 +559,7 @@
 		}
 
 		ast_frfree(inf);
+		inf = NULL;
 	}
 
 	ast_debug(1, "Loop finished, res=%d\n", res);
@@ -694,6 +699,7 @@
 		}
 
 		ast_frfree(inf);
+		inf = NULL;
 	}
 
 	ast_debug(1, "Loop finished, res=%d\n", res);

Modified: team/group/security_events/channels/Makefile
URL: http://svnview.digium.com/svn/asterisk/team/group/security_events/channels/Makefile?view=diff&rev=246114&r1=246113&r2=246114
==============================================================================
--- team/group/security_events/channels/Makefile (original)
+++ team/group/security_events/channels/Makefile Wed Feb 10 11:33:41 2010
@@ -64,11 +64,13 @@
 clean::
 	$(MAKE) -C misdn clean
 	if [ -f h323/Makefile ]; then $(MAKE) -C h323 clean; fi
+	rm -f sip/*.o
 
 dist-clean::
 	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
 $(if $(filter chan_dahdi,$(EMBEDDED_MODS)),modules.link,chan_dahdi.so): sig_analog.o sig_pri.o
 
 ifneq ($(filter chan_h323,$(EMBEDDED_MODS)),)
@@ -77,11 +79,11 @@
 ifeq ($(OSARCH),linux-gnu)
 chan_h323.so: chan_h323.o h323/libchanh323.a
 	$(ECHO_PREFIX) echo "   [LD] $^ -> $@"
-	$(CMD_PREFIX) $(CXX) $(PTHREAD_CFLAGS) $(ASTLDFLAGS) $(SOLINK) -o $@ $< h323/libchanh323.a $(H323LDLIBS)
+	$(CMD_PREFIX) $(CXX) $(PTHREAD_CFLAGS) $(_ASTLDFLAGS) $(ASTLDFLAGS) $(SOLINK) -o $@ $< h323/libchanh323.a $(H323LDLIBS)
 else
 chan_h323.so: chan_h323.o h323/libchanh323.a
 	$(ECHO_PREFIX) echo "   [LD] $^ -> $@"
-	$(CMD_PREFIX) $(CXX) $(PTHREAD_CFLAGS) $(ASTLDFLAGS) $(SOLINK) -o $@ $< h323/libchanh323.a $(CHANH323LIB) -L$(PWLIBDIR)/lib $(PTLIB) -L$(OPENH323DIR)/lib $(H323LIB) -L/usr/lib -lcrypto -lssl -lexpat
+	$(CMD_PREFIX) $(CXX) $(PTHREAD_CFLAGS) $(_ASTLDFLAGS) $(ASTLDFLAGS) $(SOLINK) -o $@ $< h323/libchanh323.a $(CHANH323LIB) -L$(PWLIBDIR)/lib $(PTLIB) -L$(OPENH323DIR)/lib $(H323LIB) -L/usr/lib -lcrypto -lssl -lexpat
 endif
 endif
 

Modified: team/group/security_events/channels/chan_iax2.c
URL: http://svnview.digium.com/svn/asterisk/team/group/security_events/channels/chan_iax2.c?view=diff&rev=246114&r1=246113&r2=246114
==============================================================================
--- team/group/security_events/channels/chan_iax2.c (original)
+++ team/group/security_events/channels/chan_iax2.c Wed Feb 10 11:33:41 2010
@@ -848,7 +848,7 @@
  *
  * \note Contents protected by the iaxsl[] locks
  */
-static AST_LIST_HEAD_NOLOCK(, iax_frame) frame_queue[IAX_MAX_CALLS];
+static AST_LIST_HEAD_NOLOCK(, iax_frame) frame_queue[IAX_MAX_CALLS + 1];
 
 static struct ast_taskprocessor *transmit_processor;
 
@@ -1049,7 +1049,7 @@
  * based on the local call number.  The local call number is used as the
  * index into the array where the associated pvt structure is stored.
  */
-static struct chan_iax2_pvt *iaxs[IAX_MAX_CALLS];
+static struct chan_iax2_pvt *iaxs[IAX_MAX_CALLS + 1];
 
 /*!
  * \brief Another container of iax2_pvt structures
@@ -1080,7 +1080,7 @@
 
 /* Flag to use with trunk calls, keeping these calls high up.  It halves our effective use
    but keeps the division between trunked and non-trunked better. */
-#define TRUNK_CALL_START	ARRAY_LEN(iaxs) / 2
+#define TRUNK_CALL_START	IAX_MAX_CALLS / 2
 
 /* Debug routines... */
 static struct sockaddr_in debugaddr;
@@ -2449,10 +2449,21 @@
 		ao2_iterator_destroy(&i);
 
 		if (a->argc == 4) {
-			ast_cli(a->fd, "\nNon-CallToken Validation Limit: %d\nNon-CallToken Validated: %d\n", global_maxcallno_nonval, total_nonval_callno_used);
+			ast_cli(a->fd, "\nNon-CallToken Validation Callno Limit: %d\n"
+			                 "Non-CallToken Validated Callno Used:   %d\n",
+				global_maxcallno_nonval,
+				total_nonval_callno_used);
+
+			ast_cli(a->fd,   "Total Available Callno:                %d\n"
+			                 "Regular Callno Available:              %d\n"
+			                 "Trunk Callno Available:                %d\n",
+				ao2_container_count(callno_pool) + ao2_container_count(callno_pool_trunk),
+				ao2_container_count(callno_pool),
+				ao2_container_count(callno_pool_trunk));
 		} else if (a->argc == 5 && !found) {
 			ast_cli(a->fd, "No callnumber table entries for %s found\n", a->argv[4] );
 		}
+
 
 		return CLI_SUCCESS;
 	default:

Modified: team/group/security_events/channels/chan_local.c
URL: http://svnview.digium.com/svn/asterisk/team/group/security_events/channels/chan_local.c?view=diff&rev=246114&r1=246113&r2=246114
==============================================================================
--- team/group/security_events/channels/chan_local.c (original)
+++ team/group/security_events/channels/chan_local.c Wed Feb 10 11:33:41 2010
@@ -257,6 +257,45 @@
 	}
 
 	if (other) {
+		if (f->frametype == AST_FRAME_CONTROL) {
+			switch (f->subclass.integer) {
+			case AST_CONTROL_RINGING:
+				ast_setstate(other, AST_STATE_RINGING);
+				break;
+			case AST_CONTROL_ANSWER:
+				ast_setstate(other, AST_STATE_UP);
+				break;
+			case AST_CONTROL_BUSY:
+				ast_setstate(other, AST_STATE_BUSY);
+				break;
+
+			/* not going to handle these */
+			case AST_CONTROL_HANGUP:
+			case AST_CONTROL_RING:
+			case AST_CONTROL_TAKEOFFHOOK:
+			case AST_CONTROL_OFFHOOK:
+			case AST_CONTROL_CONGESTION:
+			case AST_CONTROL_FLASH:
+			case AST_CONTROL_WINK:
+			case AST_CONTROL_OPTION:
+			case AST_CONTROL_RADIO_KEY:
+			case AST_CONTROL_RADIO_UNKEY:
+			case AST_CONTROL_PROGRESS:
+			case AST_CONTROL_PROCEEDING:
+			case AST_CONTROL_HOLD:
+			case AST_CONTROL_UNHOLD:
+			case AST_CONTROL_VIDUPDATE:
+			case AST_CONTROL_SRCUPDATE:
+			case AST_CONTROL_TRANSFER:
+			case AST_CONTROL_CONNECTED_LINE:
+			case AST_CONTROL_REDIRECTING:
+			case AST_CONTROL_T38_PARAMETERS:
+				break;
+			default:
+				/* since we're switching on an int, we can't rely on the compiler */
+				ast_log(LOG_WARNING, "New unhandled control frame added!!!\n");
+			}
+		}
 		ast_queue_frame(other, f);
 		ast_channel_unlock(other);
 	}

Modified: team/group/security_events/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/group/security_events/channels/chan_sip.c?view=diff&rev=246114&r1=246113&r2=246114
==============================================================================
--- team/group/security_events/channels/chan_sip.c (original)
+++ team/group/security_events/channels/chan_sip.c Wed Feb 10 11:33:41 2010
@@ -279,7 +279,6 @@
 #include "asterisk/paths.h"	/* need ast_config_AST_SYSTEM_NAME */
 
 #include "asterisk/lock.h"
-#include "asterisk/channel.h"
 #include "asterisk/config.h"
 #include "asterisk/module.h"
 #include "asterisk/pbx.h"
@@ -291,7 +290,6 @@
 #include "asterisk/manager.h"
 #include "asterisk/callerid.h"
 #include "asterisk/cli.h"
-#include "asterisk/app.h"
 #include "asterisk/musiconhold.h"
 #include "asterisk/dsp.h"
 #include "asterisk/features.h"
@@ -300,8 +298,6 @@
 #include "asterisk/causes.h"
 #include "asterisk/utils.h"
 #include "asterisk/file.h"
-#include "asterisk/astobj.h"
-#include "asterisk/test.h"
 /*
    Uncomment the define below,  if you are having refcount related memory leaks.
    With this uncommented, this module will generate a file, /tmp/refs, which contains
@@ -317,8 +313,6 @@
 #include "asterisk/astobj2.h"
 #include "asterisk/dnsmgr.h"
 #include "asterisk/devicestate.h"
-#include "asterisk/linkedlists.h"
-#include "asterisk/stringfields.h"
 #include "asterisk/monitor.h"
 #include "asterisk/netsock.h"
 #include "asterisk/localtime.h"
@@ -327,11 +321,14 @@
 #include "asterisk/translate.h"
 #include "asterisk/ast_version.h"
 #include "asterisk/event.h"
-#include "asterisk/tcptls.h"
 #include "asterisk/stun.h"
 #include "asterisk/cel.h"
 #include "asterisk/security_events.h"
 #include "asterisk/strings.h"
+#include "sip/include/sip.h"
+#include "sip/include/config_parser.h"
+#include "sip/include/reqresp_parser.h"
+#include "sip/include/sip_utils.h"
 
 /*** DOCUMENTATION
 	<application name="SIPDtmfMode" language="en_US">
@@ -608,82 +605,10 @@
 	</manager>
  ***/
 
-#ifndef FALSE
-#define FALSE    0
-#endif
-
-#ifndef TRUE
-#define TRUE     1
-#endif
-
-/* Arguments for find_peer */
-#define FINDUSERS (1 << 0)
-#define FINDPEERS (1 << 1)
-#define FINDALLDEVICES (FINDUSERS | FINDPEERS)
-
-#define	SIPBUFSIZE		512		/*!< Buffer size for many operations */
-
-#define XMIT_ERROR		-2
-
-#define SIP_RESERVED ";/?:@&=+$,# "		/*!< Reserved characters in the username part of the URI */
-
-#define DEFAULT_DEFAULT_EXPIRY  120
-#define DEFAULT_MIN_EXPIRY      60
-#define DEFAULT_MAX_EXPIRY      3600
-#define DEFAULT_MWI_EXPIRY      3600
-#define DEFAULT_REGISTRATION_TIMEOUT 20
-#define DEFAULT_MAX_FORWARDS    "70"
-
-/* guard limit must be larger than guard secs */
-/* guard min must be < 1000, and should be >= 250 */
-#define EXPIRY_GUARD_SECS       15                /*!< How long before expiry do we reregister */
-#define EXPIRY_GUARD_LIMIT      30                /*!< Below here, we use EXPIRY_GUARD_PCT instead of
-	                                                 EXPIRY_GUARD_SECS */
-#define EXPIRY_GUARD_MIN        500                /*!< This is the minimum guard time applied. If
-                                                   GUARD_PCT turns out to be lower than this, it
-                                                   will use this time instead.
-                                                   This is in milliseconds. */
-#define EXPIRY_GUARD_PCT        0.20                /*!< Percentage of expires timeout to use when
-                                                    below EXPIRY_GUARD_LIMIT */
-#define DEFAULT_EXPIRY 900                          /*!< Expire slowly */
-
 static int min_expiry = DEFAULT_MIN_EXPIRY;        /*!< Minimum accepted registration time */
 static int max_expiry = DEFAULT_MAX_EXPIRY;        /*!< Maximum accepted registration time */
 static int default_expiry = DEFAULT_DEFAULT_EXPIRY;
 static int mwi_expiry = DEFAULT_MWI_EXPIRY;
-
-#define DEFAULT_QUALIFY_GAP   100
-#define DEFAULT_QUALIFY_PEERS 1
-
-
-#define CALLERID_UNKNOWN             "Anonymous"
-#define FROMDOMAIN_INVALID           "anonymous.invalid"
-
-#define DEFAULT_MAXMS                2000             /*!< Qualification: Must be faster than 2 seconds by default */
-#define DEFAULT_QUALIFYFREQ          60 * 1000        /*!< Qualification: How often to check for the host to be up */
-#define DEFAULT_FREQ_NOTOK           10 * 1000        /*!< Qualification: How often to check, if the host is down... */
-
-#define DEFAULT_RETRANS              1000             /*!< How frequently to retransmit Default: 2 * 500 ms in RFC 3261 */
-#define MAX_RETRANS                  6                /*!< Try only 6 times for retransmissions, a total of 7 transmissions */
-#define DEFAULT_TIMER_T1                 500              /*!< SIP timer T1 (according to RFC 3261) */
-#define SIP_TRANS_TIMEOUT            64 * DEFAULT_TIMER_T1 /*!< SIP request timeout (rfc 3261) 64*T1
-                                                      \todo Use known T1 for timeout (peerpoke)
-                                                      */
-#define DEFAULT_TRANS_TIMEOUT        -1               /*!< Use default SIP transaction timeout */
-#define PROVIS_KEEPALIVE_TIMEOUT     60000            /*!< How long to wait before retransmitting a provisional response (rfc 3261 13.3.1.1) */
-#define MAX_AUTHTRIES                3                /*!< Try authentication three times, then fail */
-
-#define SIP_MAX_HEADERS              64               /*!< Max amount of SIP headers to read */
-#define SIP_MAX_LINES                64               /*!< Max amount of lines in SIP attachment (like SDP) */
-#define SIP_MIN_PACKET               4096             /*!< Initialize size of memory to allocate for packets */
-#define MAX_HISTORY_ENTRIES		50	              /*!< Max entires in the history list for a sip_pvt */
-
-#define INITIAL_CSEQ                 101              /*!< Our initial sip sequence number */
-
-#define DEFAULT_MAX_SE               1800             /*!< Session-Timer Default Session-Expires period (RFC 4028) */
-#define DEFAULT_MIN_SE               90               /*!< Session-Timer Default Min-SE period (RFC 4028) */
-
-#define SDP_MAX_RTPMAP_CODECS        32               /*!< Maximum number of codecs allowed in received SDP */
 
 /*! \brief Global jitterbuffer configuration - by default, jb is disabled */
 static struct ast_jb_conf default_jbconf =
@@ -693,47 +618,13 @@
 	.resync_threshold = -1,
 	.impl = ""
 };
-static struct ast_jb_conf global_jbconf;		/*!< Global jitterbuffer configuration */
-
-static const char config[] = "sip.conf";		/*!< Main configuration file */
-static const char notify_config[] = "sip_notify.conf";	/*!< Configuration file for sending Notify with CLI commands to reconfigure or reboot phones */
-
-#define RTP	1
-#define NO_RTP	0
-
-/*! \brief Authorization scheme for call transfers
-
-\note Not a bitfield flag, since there are plans for other modes,
-	like "only allow transfers for authenticated devices" */
-enum transfermodes {
-	TRANSFER_OPENFORALL,            /*!< Allow all SIP transfers */
-	TRANSFER_CLOSED,                /*!< Allow no SIP transfers */
-};
-
-
-/*! \brief The result of a lot of functions */
-enum sip_result {
-	AST_SUCCESS = 0,		/*!< FALSE means success, funny enough */
-	AST_FAILURE = -1,		/*!< Failure code */
-};
-
-/*! \brief States for the INVITE transaction, not the dialog
-	\note this is for the INVITE that sets up the dialog
-*/
-enum invitestates {
-	INV_NONE = 0,	        /*!< No state at all, maybe not an INVITE dialog */
-	INV_CALLING = 1,	/*!< Invite sent, no answer */
-	INV_PROCEEDING = 2,	/*!< We got/sent 1xx message */
-	INV_EARLY_MEDIA = 3,    /*!< We got 18x message with to-tag back */
-	INV_COMPLETED = 4,	/*!< Got final response with error. Wait for ACK, then CONFIRMED */
-	INV_CONFIRMED = 5,	/*!< Confirmed response - we've got an ack (Incoming calls only) */
-	INV_TERMINATED = 6,	/*!< Transaction done - either successful (AST_STATE_UP) or failed, but done
-				     The only way out of this is a BYE from one side */
-	INV_CANCELLED = 7,	/*!< Transaction cancelled by client or server in non-terminated state */
-};
+static struct ast_jb_conf global_jbconf;                /*!< Global jitterbuffer configuration */
+
+static const char config[] = "sip.conf";                /*!< Main configuration file */
+static const char notify_config[] = "sip_notify.conf";  /*!< Configuration file for sending Notify with CLI commands to reconfigure or reboot phones */
 
 /*! \brief Readable descriptions of device states.
-       \note Should be aligned to above table as index */
+ *  \note Should be aligned to above table as index */
 static const struct invstate2stringtable {
 	const enum invitestates state;
 	const char *desc;
@@ -748,52 +639,11 @@
 	{INV_CANCELLED,         "Cancelled"}
 };
 
-/*! \brief When sending a SIP message, we can send with a few options, depending on
-	type of SIP request. UNRELIABLE is moslty used for responses to repeated requests,
-	where the original response would be sent RELIABLE in an INVITE transaction */
-enum xmittype {
-	XMIT_CRITICAL = 2,              /*!< Transmit critical SIP message reliably, with re-transmits.
-                                              If it fails, it's critical and will cause a teardown of the session */
-	XMIT_RELIABLE = 1,              /*!< Transmit SIP message reliably, with re-transmits */
-	XMIT_UNRELIABLE = 0,            /*!< Transmit SIP message without bothering with re-transmits */
-};
-
-/*! \brief Results from the parse_register() function */
-enum parse_register_result {
-	PARSE_REGISTER_DENIED,
-	PARSE_REGISTER_FAILED,
-	PARSE_REGISTER_UPDATE,
-	PARSE_REGISTER_QUERY,
-};
-
-/*! \brief Type of subscription, based on the packages we do support, see \ref subscription_types */
-enum subscriptiontype {
-	NONE = 0,
-	XPIDF_XML,
-	DIALOG_INFO_XML,
-	CPIM_PIDF_XML,
-	PIDF_XML,
-	MWI_NOTIFICATION
-};
-
-/*! \brief The number of media types in enum \ref media_type below. */
-#define OFFERED_MEDIA_COUNT	4
-
-/*! \brief Media types generate different "dummy answers" for not accepting the offer of 
-	a media stream. We need to add definitions for each RTP profile. Secure RTP is not
-	the same as normal RTP and will require a new definition */
-enum media_type {
-	SDP_AUDIO,		/*!< RTP/AVP Audio */
-	SDP_VIDEO,		/*!< RTP/AVP Video */
-	SDP_IMAGE,	/*!< Image udptl, not TCP or RTP */
-	SDP_TEXT,		/*!< RTP/AVP Realtime Text */
-};
-
 /*! \brief Subscription types that we support. We support
-   - dialoginfo updates (really device status, not dialog info as was the original intent of the standard)
-   - SIMPLE presence used for device status
-   - Voicemail notification subscriptions
-*/
+ * - dialoginfo updates (really device status, not dialog info as was the original intent of the standard)
+ * - SIMPLE presence used for device status
+ * - Voicemail notification subscriptions
+ */
 static const struct cfsubscription_types {
 	enum subscriptiontype type;
 	const char * const event;
@@ -809,237 +659,42 @@
 	{ MWI_NOTIFICATION,	"message-summary", "application/simple-message-summary", "mwi" } /* RFC 3842: Mailbox notification */
 };
 
-
-/*! \brief Authentication types - proxy or www authentication
-	\note Endpoints, like Asterisk, should always use WWW authentication to
-	allow multiple authentications in the same call - to the proxy and
-	to the end point.
-*/
-enum sip_auth_type {
-	PROXY_AUTH = 407,
-	WWW_AUTH = 401,
-};
-
-/*! \brief Authentication result from check_auth* functions */
-enum check_auth_result {
-	AUTH_DONT_KNOW = -100,	/*!< no result, need to check further */
-		/* XXX maybe this is the same as AUTH_NOT_FOUND */
-
-	AUTH_SUCCESSFUL = 0,
-	AUTH_CHALLENGE_SENT = 1,
-	AUTH_SECRET_FAILED = -1,
-	AUTH_USERNAME_MISMATCH = -2,
-	AUTH_NOT_FOUND = -3,	/*!< returned by register_verify */
-	AUTH_FAKE_AUTH = -4,
-	AUTH_UNKNOWN_DOMAIN = -5,
-	AUTH_PEER_NOT_DYNAMIC = -6,
-	AUTH_ACL_FAILED = -7,
-	AUTH_BAD_TRANSPORT = -8,
-	AUTH_RTP_FAILED = 9,
-};
-
-/*! \brief States for outbound registrations (with register= lines in sip.conf */
-enum sipregistrystate {
-	REG_STATE_UNREGISTERED = 0,	/*!< We are not registered
-		 *  \note Initial state. We should have a timeout scheduled for the initial
-		 * (or next) registration transmission, calling sip_reregister
-		 */
-
-	REG_STATE_REGSENT,	/*!< Registration request sent
-		 * \note sent initial request, waiting for an ack or a timeout to
-		 * retransmit the initial request.
-		*/
-
-	REG_STATE_AUTHSENT,	/*!< We have tried to authenticate
-		 * \note entered after transmit_register with auth info,
-		 * waiting for an ack.
-		 */
-
-	REG_STATE_REGISTERED,	/*!< Registered and done */
-
-	REG_STATE_REJECTED,	/*!< Registration rejected
-		 * \note only used when the remote party has an expire larger than
-		 * our max-expire. This is a final state from which we do not
-		 * recover (not sure how correctly).
-		 */
-
-	REG_STATE_TIMEOUT,	/*!< Registration timed out
-		* \note XXX unused */
-
-	REG_STATE_NOAUTH,	/*!< We have no accepted credentials
-		 * \note fatal - no chance to proceed */
-
-	REG_STATE_FAILED,	/*!< Registration failed after several tries
-		 * \note fatal - no chance to proceed */
-};
-
-/*! \brief Modes in which Asterisk can be configured to run SIP Session-Timers */
-enum st_mode {
-        SESSION_TIMER_MODE_INVALID = 0, /*!< Invalid value */
-        SESSION_TIMER_MODE_ACCEPT,      /*!< Honor inbound Session-Timer requests */
-        SESSION_TIMER_MODE_ORIGINATE,   /*!< Originate outbound and honor inbound requests */
-        SESSION_TIMER_MODE_REFUSE       /*!< Ignore inbound Session-Timers requests */
-};
-
-/*! \brief The entity playing the refresher role for Session-Timers */
-enum st_refresher {
-        SESSION_TIMER_REFRESHER_AUTO,    /*!< Negotiated                      */
-        SESSION_TIMER_REFRESHER_UAC,     /*!< Session is refreshed by the UAC */
-        SESSION_TIMER_REFRESHER_UAS      /*!< Session is refreshed by the UAS */
-};
-
-/*! \brief Define some implemented SIP transports
-	\note Asterisk does not support SCTP or UDP/DTLS
-*/
-enum sip_transport {
-	SIP_TRANSPORT_UDP = 1,		/*!< Unreliable transport for SIP, needs retransmissions */
-	SIP_TRANSPORT_TCP = 1 << 1,	/*!< Reliable, but unsecure */
-	SIP_TRANSPORT_TLS = 1 << 2,	/*!< TCP/TLS - reliable and secure transport for signalling */
-};
-
-/*! \brief definition of a sip proxy server
+/*! \brief The core structure to setup dialogs. We parse incoming messages by using
+ *  structure and then route the messages according to the type.
  *
- * For outbound proxies, a sip_peer will contain a reference to a
- * dynamically allocated instance of a sip_proxy. A sip_pvt may also
- * contain a reference to a peer's outboundproxy, or it may contain
- * a reference to the sip_cfg.outboundproxy.
+ *  \note Note that sip_methods[i].id == i must hold or the code breaks
  */
-struct sip_proxy {
-	char name[MAXHOSTNAMELEN];      /*!< DNS name of domain/host or IP */
-	struct sockaddr_in ip;          /*!< Currently used IP address and port */
-	time_t last_dnsupdate;          /*!< When this was resolved */
-	enum sip_transport transport;
-	int force;                      /*!< If it's an outbound proxy, Force use of this outbound proxy for all outbound requests */
-	/* Room for a SRV record chain based on the name */
-};
-
-/*! \brief argument for the 'show channels|subscriptions' callback. */
-struct __show_chan_arg {
-	int fd;
-	int subscriptions;
-	int numchans;   /* return value */
-};
-
-
-/*! \brief States whether a SIP message can create a dialog in Asterisk. */
-enum can_create_dialog {
-	CAN_NOT_CREATE_DIALOG,
-	CAN_CREATE_DIALOG,
-	CAN_CREATE_DIALOG_UNSUPPORTED_METHOD,
-};
-
-/*! \brief SIP Request methods known by Asterisk
-
-   \note Do _NOT_ make any changes to this enum, or the array following it;
-   if you think you are doing the right thing, you are probably
-   not doing the right thing. If you think there are changes
-   needed, get someone else to review them first _before_
-   submitting a patch. If these two lists do not match properly
-   bad things will happen.
-*/
-
-enum sipmethod {
-	SIP_UNKNOWN,		/*!< Unknown response */
-	SIP_RESPONSE,		/*!< Not request, response to outbound request */
-	SIP_REGISTER,		/*!< Registration to the mothership, tell us where you are located */
-	SIP_OPTIONS,		/*!< Check capabilities of a device, used for "ping" too */
-	SIP_NOTIFY,		/*!< Status update, Part of the event package standard, result of a SUBSCRIBE or a REFER */
-	SIP_INVITE,		/*!< Set up a session */
-	SIP_ACK,		/*!< End of a three-way handshake started with INVITE. */
-	SIP_PRACK,		/*!< Reliable pre-call signalling. Not supported in Asterisk. */
-	SIP_BYE,		/*!< End of a session */
-	SIP_REFER,		/*!< Refer to another URI (transfer) */
-	SIP_SUBSCRIBE,		/*!< Subscribe for updates (voicemail, session status, device status, presence) */
-	SIP_MESSAGE,		/*!< Text messaging */
-	SIP_UPDATE,		/*!< Update a dialog. We can send UPDATE; but not accept it */
-	SIP_INFO,		/*!< Information updates during a session */
-	SIP_CANCEL,		/*!< Cancel an INVITE */
-	SIP_PUBLISH,		/*!< Not supported in Asterisk */
-	SIP_PING,		/*!< Not supported at all, no standard but still implemented out there */
-};
-
-/*! \brief Settings for the 'notifycid' option, see sip.conf.sample for details. */
-enum notifycid_setting {
-	DISABLED       = 0,
-	ENABLED        = 1,
-	IGNORE_CONTEXT = 2,
-};
-
-/*! \brief The core structure to setup dialogs. We parse incoming messages by using
-	structure and then route the messages according to the type.
-
-      \note Note that sip_methods[i].id == i must hold or the code breaks */
 static const struct  cfsip_methods {
 	enum sipmethod id;
 	int need_rtp;		/*!< when this is the 'primary' use for a pvt structure, does it need RTP? */
 	char * const text;
 	enum can_create_dialog can_create;
 } sip_methods[] = {
-	{ SIP_UNKNOWN,	 RTP,    "-UNKNOWN-", 	CAN_CREATE_DIALOG },
-	{ SIP_RESPONSE,	 NO_RTP, "SIP/2.0",	CAN_NOT_CREATE_DIALOG },
-	{ SIP_REGISTER,	 NO_RTP, "REGISTER", 	CAN_CREATE_DIALOG },
-	{ SIP_OPTIONS,	 NO_RTP, "OPTIONS", 	CAN_CREATE_DIALOG },
-	{ SIP_NOTIFY,	 NO_RTP, "NOTIFY", 	CAN_CREATE_DIALOG },
-	{ SIP_INVITE,	 RTP,    "INVITE", 	CAN_CREATE_DIALOG },
-	{ SIP_ACK,	 NO_RTP, "ACK", 	CAN_NOT_CREATE_DIALOG },
-	{ SIP_PRACK,	 NO_RTP, "PRACK", 	CAN_NOT_CREATE_DIALOG },
-	{ SIP_BYE,	 NO_RTP, "BYE", 	CAN_NOT_CREATE_DIALOG },
-	{ SIP_REFER,	 NO_RTP, "REFER", 	CAN_CREATE_DIALOG },
-	{ SIP_SUBSCRIBE, NO_RTP, "SUBSCRIBE", 	CAN_CREATE_DIALOG },
-	{ SIP_MESSAGE,	 NO_RTP, "MESSAGE", 	CAN_CREATE_DIALOG },
-	{ SIP_UPDATE,	 NO_RTP, "UPDATE", 	CAN_NOT_CREATE_DIALOG },
-	{ SIP_INFO,	 NO_RTP, "INFO", 	CAN_NOT_CREATE_DIALOG },
-	{ SIP_CANCEL,	 NO_RTP, "CANCEL", 	CAN_NOT_CREATE_DIALOG },
-	{ SIP_PUBLISH,	 NO_RTP, "PUBLISH", 	CAN_CREATE_DIALOG_UNSUPPORTED_METHOD },
-	{ SIP_PING,	 NO_RTP, "PING", 	CAN_CREATE_DIALOG_UNSUPPORTED_METHOD }
+	{ SIP_UNKNOWN,   RTP,    "-UNKNOWN-",CAN_CREATE_DIALOG },
+	{ SIP_RESPONSE,  NO_RTP, "SIP/2.0",  CAN_NOT_CREATE_DIALOG },
+	{ SIP_REGISTER,  NO_RTP, "REGISTER", CAN_CREATE_DIALOG },
+	{ SIP_OPTIONS,   NO_RTP, "OPTIONS",  CAN_CREATE_DIALOG },
+	{ SIP_NOTIFY,    NO_RTP, "NOTIFY",   CAN_CREATE_DIALOG },
+	{ SIP_INVITE,    RTP,    "INVITE",   CAN_CREATE_DIALOG },
+	{ SIP_ACK,       NO_RTP, "ACK",      CAN_NOT_CREATE_DIALOG },
+	{ SIP_PRACK,     NO_RTP, "PRACK",    CAN_NOT_CREATE_DIALOG },
+	{ SIP_BYE,       NO_RTP, "BYE",      CAN_NOT_CREATE_DIALOG },
+	{ SIP_REFER,     NO_RTP, "REFER",    CAN_CREATE_DIALOG },
+	{ SIP_SUBSCRIBE, NO_RTP, "SUBSCRIBE",CAN_CREATE_DIALOG },
+	{ SIP_MESSAGE,   NO_RTP, "MESSAGE",  CAN_CREATE_DIALOG },
+	{ SIP_UPDATE,    NO_RTP, "UPDATE",   CAN_NOT_CREATE_DIALOG },
+	{ SIP_INFO,      NO_RTP, "INFO",     CAN_NOT_CREATE_DIALOG },
+	{ SIP_CANCEL,    NO_RTP, "CANCEL",   CAN_NOT_CREATE_DIALOG },
+	{ SIP_PUBLISH,   NO_RTP, "PUBLISH",  CAN_CREATE_DIALOG_UNSUPPORTED_METHOD },
+	{ SIP_PING,      NO_RTP, "PING",     CAN_CREATE_DIALOG_UNSUPPORTED_METHOD }
 };
-
-static unsigned int chan_idx;
-
-/*!  Define SIP option tags, used in Require: and Supported: headers
-	We need to be aware of these properties in the phones to use
-	the replace: header. We should not do that without knowing
-	that the other end supports it...
-	This is nothing we can configure, we learn by the dialog
-	Supported: header on the REGISTER (peer) or the INVITE
-	(other devices)
-	We are not using many of these today, but will in the future.
-	This is documented in RFC 3261
-*/
-#define SUPPORTED		1
-#define NOT_SUPPORTED		0
-
-/* SIP options */
-#define SIP_OPT_REPLACES	(1 << 0)
-#define SIP_OPT_100REL		(1 << 1)
-#define SIP_OPT_TIMER		(1 << 2)
-#define SIP_OPT_EARLY_SESSION	(1 << 3)
-#define SIP_OPT_JOIN		(1 << 4)
-#define SIP_OPT_PATH		(1 << 5)
-#define SIP_OPT_PREF		(1 << 6)
-#define SIP_OPT_PRECONDITION	(1 << 7)
-#define SIP_OPT_PRIVACY		(1 << 8)
-#define SIP_OPT_SDP_ANAT	(1 << 9)
-#define SIP_OPT_SEC_AGREE	(1 << 10)
-#define SIP_OPT_EVENTLIST	(1 << 11)
-#define SIP_OPT_GRUU		(1 << 12)
-#define SIP_OPT_TARGET_DIALOG	(1 << 13)
-#define SIP_OPT_NOREFERSUB	(1 << 14)
-#define SIP_OPT_HISTINFO	(1 << 15)
-#define SIP_OPT_RESPRIORITY	(1 << 16)
-#define SIP_OPT_FROMCHANGE	(1 << 17)
-#define SIP_OPT_RECLISTINV	(1 << 18)
-#define SIP_OPT_RECLISTSUB	(1 << 19)
-#define SIP_OPT_OUTBOUND	(1 << 20)
-#define SIP_OPT_UNKNOWN		(1 << 21)
-
 
 /*! \brief List of well-known SIP options. If we get this in a require,
    we should check the list and answer accordingly. */
 static const struct cfsip_options {
-	int id;			/*!< Bitmap ID */
-	int supported;		/*!< Supported by Asterisk ? */
-	char * const text;	/*!< Text id, as in standard */
+	int id;             /*!< Bitmap ID */
+	int supported;      /*!< Supported by Asterisk ? */
+	char * const text;  /*!< Text id, as in standard */
 } sip_options[] = {	/* XXX used in 3 places */
 	/* RFC3262: PRACK 100% reliability */
 	{ SIP_OPT_100REL,	NOT_SUPPORTED,	"100rel" },
@@ -1112,175 +767,29 @@
 	{ AST_REDIRECTING_REASON_CALL_FWD_DTE, "unknown"}
 };
 
-static enum AST_REDIRECTING_REASON sip_reason_str_to_code(const char *text)
-{
-	enum AST_REDIRECTING_REASON ast = AST_REDIRECTING_REASON_UNKNOWN;
-	int i;
-
-	for (i = 0; i < ARRAY_LEN(sip_reason_table); ++i) {
-		if (!strcasecmp(text, sip_reason_table[i].text)) {
-			ast = sip_reason_table[i].code;
-			break;
-		}
-	}
-
-	return ast;
-}
-
-static const char *sip_reason_code_to_str(enum AST_REDIRECTING_REASON code)
-{
-	if (code >= 0 && code < ARRAY_LEN(sip_reason_table)) {
-		return sip_reason_table[code].text;
-	}
-
-	return "unknown";
-}
-
-/*! \brief SIP Methods we support
-	\todo This string should be set dynamically. We only support REFER and SUBSCRIBE if we have
-	allowsubscribe and allowrefer on in sip.conf.
-*/
-#define ALLOWED_METHODS "INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO"
-
-/*! \brief SIP Extensions we support
-	\note This should be generated based on the previous array
-		in combination with settings.
-	\todo We should not have "timer" if it's disabled in the configuration file.
-*/
-#define SUPPORTED_EXTENSIONS "replaces, timer"
-
-/*! \brief Standard SIP unsecure port for UDP and TCP from RFC 3261. DO NOT CHANGE THIS */
-#define STANDARD_SIP_PORT	5060
-/*! \brief Standard SIP TLS port from RFC 3261. DO NOT CHANGE THIS */
-#define STANDARD_TLS_PORT	5061
-
-/*! \note in many SIP headers, absence of a port number implies port 5060,
- * and this is why we cannot change the above constant.
- * There is a limited number of places in asterisk where we could,
- * in principle, use a different "default" port number, but
- * we do not support this feature at the moment.
- * You can run Asterisk with SIP on a different port with a configuration
- * option. If you change this value in the source code, the signalling will be incorrect.
- *
- */
-
-/*! \name DefaultValues Default values, set and reset in reload_config before reading configuration
-
-   These are default values in the source. There are other recommended values in the
-   sip.conf.sample for new installations. These may differ to keep backwards compatibility,
-   yet encouraging new behaviour on new installations
- */
-/*@{*/
-#define DEFAULT_CONTEXT		"default"	/*!< The default context for [general] section as well as devices */
-#define DEFAULT_MOHINTERPRET    "default"	/*!< The default music class */
-#define DEFAULT_MOHSUGGEST      ""
-#define DEFAULT_VMEXTEN 	"asterisk"	/*!< Default voicemail extension */
-#define DEFAULT_CALLERID 	"asterisk"	/*!< Default caller ID */
-#define DEFAULT_MWI_FROM ""
-#define DEFAULT_NOTIFYMIME 	"application/simple-message-summary"
-#define DEFAULT_ALLOWGUEST	TRUE
-#define DEFAULT_RTPKEEPALIVE	0		/*!< Default RTPkeepalive setting */
-#define DEFAULT_CALLCOUNTER	FALSE		/*!< Do not enable call counters by default */
-#define DEFAULT_SRVLOOKUP	TRUE		/*!< Recommended setting is ON */
-#define DEFAULT_COMPACTHEADERS	FALSE		/*!< Send compact (one-character) SIP headers. Default off */
-#define DEFAULT_TOS_SIP         0               /*!< Call signalling packets should be marked as DSCP CS3, but the default is 0 to be compatible with previous versions. */
-#define DEFAULT_TOS_AUDIO       0               /*!< Audio packets should be marked as DSCP EF (Expedited Forwarding), but the default is 0 to be compatible with previous versions. */
-#define DEFAULT_TOS_VIDEO       0               /*!< Video packets should be marked as DSCP AF41, but the default is 0 to be compatible with previous versions. */
-#define DEFAULT_TOS_TEXT        0               /*!< Text packets should be marked as XXXX XXXX, but the default is 0 to be compatible with previous versions. */
-#define DEFAULT_COS_SIP         4		/*!< Level 2 class of service for SIP signalling */
-#define DEFAULT_COS_AUDIO       5		/*!< Level 2 class of service for audio media  */
-#define DEFAULT_COS_VIDEO       6		/*!< Level 2 class of service for video media */
-#define DEFAULT_COS_TEXT        5		/*!< Level 2 class of service for text media (T.140) */
-#define DEFAULT_ALLOW_EXT_DOM	TRUE		/*!< Allow external domains */
-#define DEFAULT_REALM		"asterisk"	/*!< Realm for HTTP digest authentication */
-#define DEFAULT_DOMAINSASREALM	FALSE		/*!< Use the domain option to guess the realm for registration and invite requests */
-#define DEFAULT_NOTIFYRINGING	TRUE		/*!< Notify devicestate system on ringing state */
-#define DEFAULT_NOTIFYCID		DISABLED	/*!< Include CID with ringing notifications */
-#define DEFAULT_PEDANTIC	FALSE		/*!< Avoid following SIP standards for dialog matching */
-#define DEFAULT_AUTOCREATEPEER	FALSE		/*!< Don't create peers automagically */

[... 4481 lines stripped ...]



More information about the asterisk-commits mailing list