[asterisk-commits] eliel: branch group/data_api_gsoc2009 r253535 - in /team/group/data_api_gsoc2...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Mar 19 15:50:08 CDT 2010
Author: eliel
Date: Fri Mar 19 15:50:05 2010
New Revision: 253535
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=253535
Log:
Update branch.
Added:
team/group/data_api_gsoc2009/README-SERIOUSLY.bestpractices.txt (with props)
team/group/data_api_gsoc2009/agi/agi.xml (with props)
team/group/data_api_gsoc2009/configs/res_fax.conf.sample (with props)
team/group/data_api_gsoc2009/configs/res_pktccops.conf.sample (with props)
team/group/data_api_gsoc2009/contrib/init.d/org.asterisk.asterisk.plist (with props)
team/group/data_api_gsoc2009/contrib/upstart/asterisk.user.conf (with props)
team/group/data_api_gsoc2009/contrib/valgrind.supp (with props)
team/group/data_api_gsoc2009/doc/building_queues.txt (with props)
team/group/data_api_gsoc2009/doc/codec-64bit.txt (with props)
team/group/data_api_gsoc2009/doc/lang/vietnamese.ods (with props)
team/group/data_api_gsoc2009/funcs/func_pitchshift.c (with props)
team/group/data_api_gsoc2009/include/asterisk/doxygen/architecture.h (with props)
team/group/data_api_gsoc2009/include/asterisk/doxygen/asterisk-git-howto.h (with props)
team/group/data_api_gsoc2009/include/asterisk/doxygen/mantisworkflow.h (with props)
team/group/data_api_gsoc2009/include/asterisk/frame_defs.h (with props)
team/group/data_api_gsoc2009/include/asterisk/pktccops.h (with props)
team/group/data_api_gsoc2009/include/asterisk/res_fax.h (with props)
team/group/data_api_gsoc2009/include/asterisk/test.h (with props)
team/group/data_api_gsoc2009/main/test.c (with props)
team/group/data_api_gsoc2009/res/res_fax.c (with props)
team/group/data_api_gsoc2009/res/res_fax.exports (with props)
team/group/data_api_gsoc2009/res/res_fax_spandsp.c (with props)
team/group/data_api_gsoc2009/res/res_pktccops.c (with props)
team/group/data_api_gsoc2009/res/res_pktccops.exports (with props)
team/group/data_api_gsoc2009/tests/test_amihooks.c (with props)
team/group/data_api_gsoc2009/tests/test_app.c (with props)
team/group/data_api_gsoc2009/tests/test_ast_format_str_reduce.c (with props)
team/group/data_api_gsoc2009/tests/test_astobj2.c (with props)
team/group/data_api_gsoc2009/tests/test_devicestate.c (with props)
team/group/data_api_gsoc2009/tests/test_event.c (with props)
team/group/data_api_gsoc2009/tests/test_gosub.c (with props)
team/group/data_api_gsoc2009/tests/test_pbx.c (with props)
team/group/data_api_gsoc2009/tests/test_stringfields.c (with props)
team/group/data_api_gsoc2009/tests/test_strings.c (with props)
team/group/data_api_gsoc2009/tests/test_time.c (with props)
team/group/data_api_gsoc2009/tests/test_utils.c (with props)
team/group/data_api_gsoc2009/utils/utils.xml (with props)
Added: team/group/data_api_gsoc2009/README-SERIOUSLY.bestpractices.txt
URL: http://svnview.digium.com/svn/asterisk/team/group/data_api_gsoc2009/README-SERIOUSLY.bestpractices.txt?view=auto&rev=253535
==============================================================================
--- team/group/data_api_gsoc2009/README-SERIOUSLY.bestpractices.txt (added)
+++ team/group/data_api_gsoc2009/README-SERIOUSLY.bestpractices.txt Fri Mar 19 15:50:05 2010
@@ -1,0 +1,295 @@
+==================
+| Best Practices |
+==================
+
+The purpose of this document is to define best practices when working with
+Asterisk in order to minimize possible security breaches and to provide tried
+examples in field deployments. This is a living document and is subject to
+change over time as best practices are defined.
+
+--------
+Sections
+--------
+
+* Filtering Data:
+ How to protect yourself from redial attacks
+
+* Proper Device Naming:
+ Why to not use numbered extensions for devices
+
+* Secure Passwords:
+ Secure passwords limit your risk to brute force attacks
+
+* Reducing Pattern Match Typos:
+ Using the 'same' prefix, or using Goto()
+
+----------------
+Additional Links
+----------------
+
+Additional links that contain useful information about best practices or
+security are listed below.
+
+* Seven Steps to Better SIP Security:
+ http://blogs.digium.com/2009/03/28/sip-security/
+
+* Asterisk VoIP Security (webinar):
+ http://www.asterisk.org/security/webinar/
+
+
+==============
+Filtering Data
+==============
+
+In the Asterisk dialplan, several channel variables contain data potentially
+supplied by outside sources. This could lead to a potential security concern
+where those outside sources may send cleverly crafted strings of data which
+could be utilized, e.g. to place calls to unexpected locations.
+
+An example of this can be found in the use of pattern matching and the ${EXTEN}
+channel variable. Note that ${EXTEN} is not the only system created channel
+variable, so it is important to be aware of where the data you're using is
+coming from.
+
+For example, this common dialplan takes 2 or more characters of data, starting
+with a number 0-9, and then accepts any additional information supplied by the
+request.
+
+[NOTE: We use SIP in this example, but is not limited to SIP only; protocols
+ such as Jabber/XMPP or IAX2 are also susceptible to the same sort of
+ injection problem.]
+
+
+[incoming]
+exten => _X.,1,Verbose(2,Incoming call to extension ${EXTEN})
+exten => _X.,n,Dial(SIP/${EXTEN})
+exten => _X.,n,Hangup()
+
+This dialplan may be utilized to accept calls to extensions, which then dial a
+numbered device name configured in one of the channel configuration files (such
+as sip.conf, iax.conf, etc...) (see the section Proper Device Naming for more
+information on why this approach is flawed).
+
+The example we've given above looks harmless enough until you take into
+consideration that several channel technologies accept characters that could
+be utilized in a clever attack. For example, instead of just sending a request
+to dial extension 500 (which in our example above would create the string
+SIP/500 and is then used by the Dial() application to place a call), someone
+could potentially send a string like "500&SIP/itsp/14165551212".
+
+The string "500&SIP/itsp/14165551212" would then be contained within the
+${EXTEN} channel variable, which is then utilized by the Dial() application in
+our example, thereby giving you the dialplan line of:
+
+exten => _X.,n,Dial(SIP/500&SIP/itsp/14165551212)
+
+Our example above has now provided someone with a method to place calls out of
+your ITSP in a place where you didn't expect to allow it. There are a couple of
+ways in which you can mitigate this impact: stricter pattern matching, or using
+the FILTER() dialplan function.
+
+Strict Pattern Matching
+-----------------------
+
+The simple way to mitigate this problem is with a strict pattern match that does
+not utilize the period (.) or bang (!) characters to match on one-or-more
+characters or zero-or-more characters (respectively). To fine tune our example
+to only accept three digit extensions, we could change our pattern match to
+be:
+
+exten => _XXX,n,Dial(SIP/${EXTEN})
+
+In this way, we have minimized our impact because we're not allowing anything
+other than the numbers zero through nine. But in some cases we really do need to
+handle variable pattern matches, such as when dialing international numbers
+or when we want to handle something like a SIP URI. In this case, we'll need to
+utilize the FILTER() dialplan function.
+
+Using FILTER()
+--------------
+
+The FILTER() dialplan function is used to filter strings by only allowing
+characters that you have specified. This is a perfect candidate for controlling
+which characters you want to pass to the Dial() application, or any other
+application which will contain dynamic information passed to Asterisk from an
+external source. Lets take a look at how we can use FILTER() to control what
+data we allow.
+
+Using our previous example to accept any string length of 2 or more characters,
+starting with a number of zero through nine, we can use FILTER() to limit what
+we will accept to just numbers. Our example would then change to something like:
+
+[incoming]
+exten => _X.,1,Verbose(2,Incoming call to extension ${EXTEN})
+exten => _X.,n,Dial(SIP/${FILTER(0-9,${EXTEN})})
+exten => _X.,n,Hangup()
+
+Note how we've wrapped the ${EXTEN} channel variable with the FILTER() function
+which will then only pass back characters that fit into the numerical range that
+we've defined.
+
+Alternatively, if we didn't want to utilize the FILTER() function within the
+Dial() application directly, we could save the value to a channel variable,
+which has a side effect of being usable in other locations of your dialplan if
+necessary, and to handle error checking in a separate location.
+
+[incoming]
+exten => _X.,1,Verbose(2,Incoming call to extension ${EXTEN})
+exten => _X.,n,Set(SAFE_EXTEN=${FILTER(0-9,${EXTEN})})
+exten => _X.,n,Dial(SIP/${SAFE_EXTEN})
+exten => _X.,n,Hangup()
+
+Now we can use the ${SAFE_EXTEN} channel variable anywhere throughout the rest
+of our dialplan, knowing we've already filtered it. We could also perform an
+error check to verify that what we've received in ${EXTEN} also matches the data
+passed back by FILTER(), and to fail the call if things do not match.
+
+[incoming]
+exten => _X.,1,Verbose(2,Incoming call to extension ${EXTEN})
+exten => _X.,n,Set(SAFE_EXTEN=${FILTER(0-9,${EXTEN})})
+exten => _X.,n,GotoIf($[${EXTEN} != ${SAFE_EXTEN}]?error,1)
+exten => _X.,n,Dial(SIP/${SAFE_EXTEN})
+exten => _X.,n,Hangup()
+
+exten => error,1,Verbose(2,Values of EXTEN and SAFE_EXTEN did not match.)
+exten => error,n,Verbose(2,EXTEN: "${EXTEN}" -- SAFE_EXTEN: "${SAFE_EXTEN}")
+exten => error,n,Playback(silence/1&invalid)
+exten => error,n,Hangup()
+
+Another example would be using FILTER() to control the characters we accept when
+we're expecting to get a SIP URI for dialing.
+
+[incoming]
+exten => _[0-9a-zA-Z].,1,Verbose(2,Incoming call to extension ${EXTEN})
+exten => _[0-9a-zA-Z].,n,Dial(SIP/${FILTER(. at 0-9a-zA-Z,${EXTEN})
+exten => _[0-9a-zA-Z].,n,Hangup()
+
+Of course the FILTER() function doesn't check the formatting of the incoming
+request. There is also the REGEX() dialplan function which can be used to
+determine if the string passed to it matches the regular expression you've
+created, and to take proper action on whether it matches or not. The creation of
+regular expressions is left as an exercise for the reader.
+
+More information about the FILTER() and REGEX() dialplan functions can be found
+by typing "core show function FILTER" and "core show function REGEX" from your
+Asterisk console.
+
+
+====================
+Proper Device Naming
+====================
+
+In Asterisk, the concept of an extension number being tied to a specific device
+does not exist. Asterisk is aware of devices it can call or receive calls from,
+and how you define in your dialplan how to reach those devices is up to you.
+
+Because it has become common practice to think of a specific device as having an
+extension number associated with it, it only becomes natural to think about
+naming your devices the same as the extension number you're providing it. But
+by doing this, you're limiting the powerful concept of separating user from
+extensions, and extensions from devices.
+
+It can also be a security hazard to name your devices with a number, as this can
+open you up to brute force attacks. Many of the current exploits deal with
+device configurations which utilize a number, and even worse, a password that
+matches the devices name. For example, take a look at this poorly created device
+in sip.conf:
+
+[1000]
+type=friend
+context=international_dialing
+secret=1000
+
+As implied by the context, we've permitted a device named 1000 with a password
+of 1000 to place calls internationally. If your PBX system is accessible via
+the internet, then your system will be vulnerable to expensive international
+calls. Even if your system is not accessible via the internet, people within
+your organization could get access to dialing rules you'd prefer to reserve only
+for certain people.
+
+A more secure example for the device would be to use something like the MAC
+address of the device, along with a strong password (see the section Secure
+Passwords). The following example would be more secure:
+
+[0004f2040001]
+type=friend
+context=international_dialing
+secret=aE3%B8*$jk^G
+
+Then in your dialplan, you would reference the device via the MAC address of the
+device (or if using the softphone, a MAC address of a network interface on the
+computer).
+
+Also note that you should NOT use this password, as it will likely be one of the
+first ones added to the dictionary for brute force attacks.
+
+
+================
+Secure Passwords
+================
+
+Secure passwords are necessary in many (if not all) environments, and Asterisk
+is certainly no exception, especially when it comes to expensive long distance
+calls that could potentially cost your company hundreds or thousands of dollars
+on an expensive monthly phone bill, with little to no recourse to fight the
+charges.
+
+Whenever you are positioned to add a password to your system, whether that is
+for a device configuration, a database connection, or any other secure
+connection, be sure to use a secure password. A good example of a secure
+password would be something like:
+
+aE3%B8*$jk^G
+
+Our password also contains 12 characters with a mixture of upper and
+lower case characters, numbers, and symbols. Because these passwords are likely
+to only be entered once, or loaded via a configuration file, there is
+no need to create simple passwords, even in testing. Some of the holes found in
+production systems used for exploitations involve finding the one test extension
+that contains a weak password that was forgotten prior to putting a system into
+production.
+
+Using a web search you can find several online password generators such as
+http://www.strongpasswordgenerator.com or there are several scripts that can be
+used to generate a strong password.
+
+
+============================
+Reducing Pattern Match Typos
+============================
+
+As of Asterisk 1.6.2, a new method for reducing the number of complex pattern
+matches you need to enter, which can reduce typos in your dialplan, has been
+implemented. Traditionally, a dialplan with a complex pattern match would look
+something like:
+
+exten => _[3-5]XXX,1,Verbose(Incoming call to ${EXTEN})
+exten => _[3-5]XXX,n,Set(DEVICE=${DB(device/mac_address/${EXTEN})})
+exten => _[3-5]XXX,n,Set(TECHNOLOGY=${DB(device/technology/${EXTEN})})
+exten => _[3-5]XXX,n,GotoIf($[${ISNULL(${TECHNOLOGY})} | ${ISNULL(${DEVICE})}]?error,1)
+exten => _[3-5]XXX,n,Dial(${TECHNOLOGY}/${DEVICE},${GLOBAL(TIMEOUT)})
+exten => _[3-5]XXX,n,Set(vmFlag=${IF($[${DIALSTATUS} = BUSY]?b:u)})
+exten => _[3-5]XXX,n,Voicemail(${EXTEN}@${GLOBAL(VOICEMAIL_CONTEXT)},${vmFlag})
+exten => _[3-5]XXX,n,Hangup()
+
+exten => error,1,Verbose(2,Unable to lookup technology or device for extension)
+exten => error,n,Playback(silence/1&num-not-in-db)
+exten => error,n,Hangup()
+
+Of course there exists the possibility for a typo when retyping the pattern
+match _[3-5]XXX which will match on extensions 3000 through 5999. We can
+minimize this error by utilizing the same => prefix on all lines beyond the
+first one. Our same dialplan with using same => would look like the following:
+
+exten => _[3-5]XXX,1,Verbose(Incoming call to ${EXTEN})
+same => n,Set(DEVICE=${DB(device/mac_address/${EXTEN})})
+same => n,Set(TECHNOLOGY=${DB(device/technology/${EXTEN})})
+same => n,GotoIf($[${ISNULL(${TECHNOLOGY})} | ${ISNULL(${DEVICE})}]?error,1)
+same => n,Dial(${TECHNOLOGY}/${DEVICE},${GLOBAL(TIMEOUT)})
+same => n,Set(vmFlag=${IF($[${DIALSTATUS} = BUSY]?b:u)})
+same => n,Voicemail(${EXTEN}@${GLOBAL(VOICEMAIL_CONTEXT)},${vmFlag})
+same => n,Hangup()
+
+exten => error,1,Verbose(2,Unable to lookup technology or device for extension)
+same => n,Playback(silence/1&num-not-in-db)
+same => n,Hangup()
Propchange: team/group/data_api_gsoc2009/README-SERIOUSLY.bestpractices.txt
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: team/group/data_api_gsoc2009/README-SERIOUSLY.bestpractices.txt
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: team/group/data_api_gsoc2009/README-SERIOUSLY.bestpractices.txt
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: team/group/data_api_gsoc2009/agi/agi.xml
URL: http://svnview.digium.com/svn/asterisk/team/group/data_api_gsoc2009/agi/agi.xml?view=auto&rev=253535
==============================================================================
--- team/group/data_api_gsoc2009/agi/agi.xml (added)
+++ team/group/data_api_gsoc2009/agi/agi.xml Fri Mar 19 15:50:05 2010
@@ -1,0 +1,14 @@
+<category name="MENUSELECT_AGIS" displayname="AGI Samples" positive_output="yes">
+ <member name="agi-test.agi">
+ <defaultenabled>no</defaultenabled>
+ </member>
+ <member name="eagi-test">
+ <defaultenabled>no</defaultenabled>
+ </member>
+ <member name="eagi-sphinx-test">
+ <defaultenabled>no</defaultenabled>
+ </member>
+ <member name="jukebox.agi">
+ <defaultenabled>no</defaultenabled>
+ </member>
+</category>
Propchange: team/group/data_api_gsoc2009/agi/agi.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: team/group/data_api_gsoc2009/agi/agi.xml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: team/group/data_api_gsoc2009/agi/agi.xml
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: team/group/data_api_gsoc2009/configs/res_fax.conf.sample
URL: http://svnview.digium.com/svn/asterisk/team/group/data_api_gsoc2009/configs/res_fax.conf.sample?view=auto&rev=253535
==============================================================================
--- team/group/data_api_gsoc2009/configs/res_fax.conf.sample (added)
+++ team/group/data_api_gsoc2009/configs/res_fax.conf.sample Fri Mar 19 15:50:05 2010
@@ -1,0 +1,24 @@
+; Generic Fax Application configuration
+
+[general]
+; Maximum Transmission Rate
+; Possible values are { 2400 | 4800 | 7200 | 9600 | 12000 | 14400 }
+; Set this value to the maximum desired transfer rate. Default: 14400
+maxrate=14400
+
+; Minimum Transmission Rate
+; Possible values are { 2400 | 4800 | 7200 | 9600 | 12000 | 14400 }
+; Set this value to the minimum desired transfer rate. Default: 2400
+minrate=2400
+
+; Send Progress/Status events to manager session
+; Manager events with 'call' class permissions will receive events indicating the
+; steps to initiate a fax session. Fax completion events are always sent to manager
+; sessions with 'call' class permissions, regardless of the value of this option.
+; Default: no
+statusevents=yes
+
+; modem capabilities
+; Possible values are { v17 | v27 | v29 }
+; Set this value to modify the default modem options. Default: v17,v27,v29
+modems=v17,v27,v29
Propchange: team/group/data_api_gsoc2009/configs/res_fax.conf.sample
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: team/group/data_api_gsoc2009/configs/res_fax.conf.sample
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: team/group/data_api_gsoc2009/configs/res_fax.conf.sample
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: team/group/data_api_gsoc2009/configs/res_pktccops.conf.sample
URL: http://svnview.digium.com/svn/asterisk/team/group/data_api_gsoc2009/configs/res_pktccops.conf.sample?view=auto&rev=253535
==============================================================================
--- team/group/data_api_gsoc2009/configs/res_pktccops.conf.sample (added)
+++ team/group/data_api_gsoc2009/configs/res_pktccops.conf.sample Fri Mar 19 15:50:05 2010
@@ -1,0 +1,32 @@
+; Sample res_pktccops.conf
+
+[general]
+gateinfoperiod => 60 ; default 60s
+gatetimeout = 150 ; default 150
+t1 => 250 ; default 250s
+t7 => 200 ; default 200s
+t8 => 300 ; default 300s
+keepalive => 60 ; default 60s
+
+[teszt]
+host => 192.168.0.24
+pool => 10.0.1.0 10.0.1.255
+pool => 10.0.3.0 10.0.3.255
+pool => 10.0.7.0 10.0.8.255
+pool => 10.0.10.0 10.0.11.255
+
+[general]
+gateinfoperiod => 60 ; default 60s
+gatetimeout = 150 ; default 150
+t1 => 250 ; default 250s
+t7 => 200 ; default 200s
+t8 => 300 ; default 300s
+keepalive => 60 ; default 60s
+
+[test]
+host => 192.168.0.24
+pool => 10.0.1.0 10.0.1.255
+pool => 10.0.3.0 10.0.3.255
+pool => 10.0.7.0 10.0.8.255
+pool => 10.0.10.0 10.0.11.255
+
Propchange: team/group/data_api_gsoc2009/configs/res_pktccops.conf.sample
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: team/group/data_api_gsoc2009/configs/res_pktccops.conf.sample
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: team/group/data_api_gsoc2009/configs/res_pktccops.conf.sample
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: team/group/data_api_gsoc2009/contrib/init.d/org.asterisk.asterisk.plist
URL: http://svnview.digium.com/svn/asterisk/team/group/data_api_gsoc2009/contrib/init.d/org.asterisk.asterisk.plist?view=auto&rev=253535
==============================================================================
--- team/group/data_api_gsoc2009/contrib/init.d/org.asterisk.asterisk.plist (added)
+++ team/group/data_api_gsoc2009/contrib/init.d/org.asterisk.asterisk.plist Fri Mar 19 15:50:05 2010
@@ -1,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>Label</key>
+ <string>org.asterisk.asterisk.launchagent</string>
+ <key>Disabled</key>
+ <false/><!-- Change this to '<true/>' to disable Asterisk -->
+ <key>UserName</key>
+ <string>asterisk</string>
+ <key>GroupName</key>
+ <string>asterisk</string>
+ <key>OnDemand</key><!-- For 10.4 (deprecated in 10.5 and above) -->
+ <false/>
+ <key>KeepAlive</key><!-- For 10.5 and above -->
+ <true/>
+ <key>RunAtLoad</key>
+ <true/>
+ <key>Umask</key>
+ <integer>7</integer><!-- 0007 -->
+ <key>Program</key>
+ <string>/usr/local/sbin/asterisk</string>
+ <key>ProgramArguments</key>
+ <array>
+ <string>/usr/local/sbin/asterisk</string>
+ <string>-f</string><!-- Don't fork. This option is mandatory when running with launchd. -->
+ </array>
+ <key>EnvironmentVariables</key>
+ <dict>
+ <key>TERM</key>
+ <string>xterm-color</string>
+ </dict>
+ <key>SoftResourceLimits</key>
+ <dict>
+ <key>NumberOfFiles</key>
+ <integer>1024</integer>
+ <key>Core</key>
+ <integer>0</integer>
+ </dict>
+ <key>StandardInPath</key>
+ <string>/dev/null</string>
+ <key>StandardOutPath</key>
+ <string>/dev/null</string>
+ <key>StandardErrorPath</key>
+ <string>/dev/null</string>
+</dict>
+</plist>
Propchange: team/group/data_api_gsoc2009/contrib/init.d/org.asterisk.asterisk.plist
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: team/group/data_api_gsoc2009/contrib/init.d/org.asterisk.asterisk.plist
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: team/group/data_api_gsoc2009/contrib/init.d/org.asterisk.asterisk.plist
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: team/group/data_api_gsoc2009/contrib/upstart/asterisk.user.conf
URL: http://svnview.digium.com/svn/asterisk/team/group/data_api_gsoc2009/contrib/upstart/asterisk.user.conf?view=auto&rev=253535
==============================================================================
--- team/group/data_api_gsoc2009/contrib/upstart/asterisk.user.conf (added)
+++ team/group/data_api_gsoc2009/contrib/upstart/asterisk.user.conf Fri Mar 19 15:50:05 2010
@@ -1,0 +1,40 @@
+# asterisk
+#
+# Upstart control file for the Asterisk PBX
+#
+# To install, rename this file to 'asterisk' and copy it to /etc/event.d/
+# On Debian: copy to /etc/init/
+#
+# To start asterisk manually:
+# sudo start asterisk
+#
+# To stop asterisk manually:
+# sudo stop asterisk
+#
+# Asterisk is started with an "interactive console", though redirected
+# to/from /dev/null . The concept of a main console is bad. OTOH, the main
+# process should not detach from the console if we work with upstart and
+# alike.
+#
+# The username 'asterisk' is currently hardwired here, and likewise the
+# varrundir.
+#
+
+description "Asterisk PBX"
+#version "1.6.3"
+
+start on runlevel [2345]
+stop on runlevel [!2345]
+
+pre-start script
+ # Since Ubuntu clears /var/run on reboot, create this before we try to start
+ if [ ! -d /var/run/asterisk ]; then
+ mkdir -p asterisk /var/run/asterisk
+ chown asterisk: /var/run/asterisk
+ fi
+end script
+
+#console output
+respawn
+exec /usr/sbin/asterisk -U asterisk -g -f
+
Propchange: team/group/data_api_gsoc2009/contrib/upstart/asterisk.user.conf
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: team/group/data_api_gsoc2009/contrib/upstart/asterisk.user.conf
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: team/group/data_api_gsoc2009/contrib/upstart/asterisk.user.conf
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: team/group/data_api_gsoc2009/contrib/valgrind.supp
URL: http://svnview.digium.com/svn/asterisk/team/group/data_api_gsoc2009/contrib/valgrind.supp?view=auto&rev=253535
==============================================================================
--- team/group/data_api_gsoc2009/contrib/valgrind.supp (added)
+++ team/group/data_api_gsoc2009/contrib/valgrind.supp Fri Mar 19 15:50:05 2010
@@ -1,0 +1,41 @@
+#
+# _dl_close errors
+#
+
+{
+ dlclose-1
+ Memcheck:Addr1
+ ...
+ fun:dlclose
+ fun:load_dynamic_module
+ ...
+}
+{
+ dlclose-2
+ Memcheck:Addr2
+ ...
+ fun:dlclose
+ fun:load_dynamic_module
+ ...
+}
+{
+ dlclose-4
+ Memcheck:Addr4
+ ...
+ fun:dlclose
+ fun:load_dynamic_module
+ ...
+}
+
+
+#
+# codec_speex
+#
+
+{
+ speex_decode
+ Memcheck:Cond
+ fun:speex_decode_int
+ ...
+}
+
Propchange: team/group/data_api_gsoc2009/contrib/valgrind.supp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: team/group/data_api_gsoc2009/contrib/valgrind.supp
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: team/group/data_api_gsoc2009/contrib/valgrind.supp
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: team/group/data_api_gsoc2009/doc/building_queues.txt
URL: http://svnview.digium.com/svn/asterisk/team/group/data_api_gsoc2009/doc/building_queues.txt?view=auto&rev=253535
==============================================================================
--- team/group/data_api_gsoc2009/doc/building_queues.txt (added)
+++ team/group/data_api_gsoc2009/doc/building_queues.txt Fri Mar 19 15:50:05 2010
@@ -1,0 +1,823 @@
+=================
+ Building Queues
+=================
+
+Written by: Leif Madsen
+Initial version: 2010-01-14
+
+In this article, we'll look at setting up a pair of queues in Asterisk called
+'sales' and 'support'. These queues can be logged into by queue members, and
+those members will also have the ability to pause and unpause themselves.
+
+All configuration will be done in flat files on the system in order to maintain
+simplicity in configuration.
+
+Note that this documentation is based on Asterisk 1.6.2, and this is just one
+approach to creating queues and the dialplan logic. You may create a better way,
+and in that case, I would encourage you to submit it to the Asterisk issue
+tracker at http://issues.asterisk.org for inclusion in Asterisk.
+
+-------------------------------------
+| Adding SIP Devices to Your Server |
+-------------------------------------
+
+The first thing we want to do is register a couple of SIP devices to our server.
+These devices will be our agents that can login and out of the queues we'll
+create later. Our naming convention will be to use MAC addresses as we want to
+abstract the concepts of user (agent), device, and extension from each other.
+
+In sip.conf, we add the following to the bottom of our file:
+
+sip.conf
+--------
+
+[std-device](!)
+type=peer
+context=devices
+host=dynamic
+secret=s3CuR#p at s5
+dtmfmode=rfc2833
+disallow=all
+allow=ulaw
+
+[0004f2040001](std-device)
+
+[0004f2040002](std-device)
+
+
+
+What we're doing here is creating a [std-device] template and applying it to
+a pair of peers that we'll register as 0004f2040001 and 0004f2040002; our
+devices.
+
+Then our devices can register to Asterisk. In my case I have a hard phone and
+a soft phone registered. I can verify their connectivity by running 'sip show
+peers'.
+
+*CLI> sip show peers
+Name/username Host Dyn Nat ACL Port Status
+0004f2040001/0004f2040001 192.168.128.145 D 5060 Unmonitored
+0004f2040002/0004f2040002 192.168.128.126 D 5060 Unmonitored
+2 sip peers [Monitored: 0 online, 0 offline Unmonitored: 2 online, 0 offline]
+
+
+
+----------------------------
+| Configuring Device State |
+----------------------------
+
+Next, we need to configure our system to track the state of the devices. We do
+this by defining a 'hint' in the dialplan which creates the ability for a device
+subscription to be retained in memory. By default we can see there are no hints
+registered in our system by running the 'core show hints' command.
+
+*CLI> core show hints
+There are no registered dialplan hint
+
+
+We need to add the devices we're going to track to the extensions.conf file
+under the [default] context which is the default configuration in sip.conf,
+however we can change this to any context we want with the 'subscribecontext'
+option.
+
+Add the following lines to extensions.conf:
+
+[default]
+exten => 0004f2040001,hint,SIP/0004f2040001
+exten => 0004f2040002,hint,SIP/0004f2040002
+
+Then perform a 'dialplan reload' in order to reload the dialplan.
+
+After reloading our dialplan, you can see the status of the devices with 'core
+show hints' again.
+
+
+*CLI> core show hints
+
+ -= Registered Asterisk Dial Plan Hints =-
+ 0004f2040002 at default : SIP/0004f2040002 State:Idle Watchers 0
+ 0004f2040001 at default : SIP/0004f2040001 State:Idle Watchers 0
+----------------
+- 2 hints registered
+
+
+At this point, create an extension that you can dial that will play a prompt
+that is long enough for you to go back to the Asterisk console to check the
+state of your device while it is in use.
+
+To do this, add the 555 extension to the [devices] context and make it playback
+the tt-monkeys file.
+
+
+extensions.conf
+---------------
+
+[devices]
+exten => 555,1,Playback(tt-monkeys)
+
+
+Dial that extension and then check the state of your device on the console.
+
+*CLI> == Using SIP RTP CoS mark 5
+ -- Executing [555 at devices:1] Playback("SIP/0004f2040001-00000001", "tt-monkeys") in new stack
+ -- <SIP/0004f2040001-00000001> Playing 'tt-monkeys.slin' (language 'en')
+
+*CLI> core show hints
+
+ -= Registered Asterisk Dial Plan Hints =-
+ 0004f2040002 at default : SIP/0004f2040002 State:Idle Watchers 0
+ 0004f2040001 at default : SIP/0004f2040001 State:Idle Watchers 0
+----------------
+- 2 hints registered
+
+Aha, we're not getting the device state correctly. There must be something else
+we need to configure.
+
+In sip.conf, we need to enable 'callcounter' in order to activate the ability
+for Asterisk to monitor whether the device is in use or not. In versions prior
+to 1.6.0 we needed to use 'call-limit' for this functionality, but call-limit
+is now deprecated and is no longer necessary.
+
+So, in sip.conf, in our [std-device] template, we need to add the callcounter
+option.
+
+sip.conf
+--------
+
+[std-device](!)
+type=peer
+context=devices
+host=dynamic
+secret=s3CuR#p at s5
+dtmfmode=rfc2833
+disallow=all
+allow=ulaw
+callcounter=yes ; <-- add this
+
+
+Then reload chan_sip with 'sip reload' and perform our 555 test again. Dial 555
+and then check the device state with 'core show hints'.
+
+*CLI> == Using SIP RTP CoS mark 5
+ -- Executing [555 at devices:1] Playback("SIP/0004f2040001-00000002", "tt-monkeys") in new stack
+ -- <SIP/0004f2040001-00000002> Playing 'tt-monkeys.slin' (language 'en')
+
+*CLI> core show hints
+
+ -= Registered Asterisk Dial Plan Hints =-
+ 0004f2040002 at default : SIP/0004f2040002 State:Idle Watchers 0
+ 0004f2040001 at default : SIP/0004f2040001 State:InUse Watchers 0
+----------------
+- 2 hints registered
+
+
+Note that now we have the correct device state when extension 555 is dialed,
+showing that our device is InUse after dialing extension 555. This is important
+when creating queues, otherwise our queue members would get multiple calls from
+the queues.
+
+-----------------------------
+| Adding Queues to Asterisk |
+-----------------------------
+
+The next step is to add a couple of queues to Asterisk that we can assign queue
+members into. For now we'll work with two queues; sales and support. Lets create
+those queues now in queues.conf.
+
+We'll leave the default settings that are shipped with queues.conf.sample in the
+[general] section of queues.conf. See the queues.conf.sample file for more
+information about each of the available options.
+
+queues.conf
+-----------
+
+[general]
+persistantmembers=yes
+autofill=yes
+monitor-type=MixMonitor
+shared_lastcall=no
+
+
+We can then define a [queue_template] that we'll assign to each of the queues
+we create. These definitions can be overridden by each queue individually if you
+reassign them under the [sales] or [support] headers. So under the [general]
+section of your queues.conf file, add the following.
+
+
+queues.conf
+----------
+
+[queue_template](!)
+musicclass=default ; play [default] music
+strategy=rrmemory ; use the Round Robin Memory strategy
+joinempty=yes ; join the queue when no members available
+leavewhenempty=no ; don't leave the queue no members available
+ringinuse=no ; don't ring members when already InUse
+
+[sales](queue_template)
+; Sales queue
+
+[support](queue_template)
+; Support queue
+
+
+
+After defining our queues, lets reload our app_queue.so module.
+
+
+*CLI> module reload app_queue.so
+ -- Reloading module 'app_queue.so' (True Call Queueing)
+
+ == Parsing '/etc/asterisk/queues.conf': == Found
+
+
+Then verify our queues loaded with 'queue show'.
+
+
+*CLI> queue show
+support has 0 calls (max unlimited) in 'rrmemory' strategy (0s holdtime, 0s talktime), W:0, C:0, A:0, SL:0.0% within 0s
+ No Members
+ No Callers
+
+sales has 0 calls (max unlimited) in 'rrmemory' strategy (0s holdtime, 0s talktime), W:0, C:0, A:0, SL:0.0% within 0s
+ No Members
+ No Callers
+
+
+
+------------------------
+| Adding Queue Members |
+------------------------
+
+You'll notice that we have no queue members available to take calls from the
+queues. We can add queue members from the Asterisk CLI with the 'queue add
+member' command.
+
+This is the format of the 'queue add member' command:
+
+Usage: queue add member <channel> to <queue> [[[penalty <penalty>] as <membername>] state_interface <interface>]
+ Add a channel to a queue with optionally: a penalty, membername and a state_interface
+
+The penalty, membername, and state_interface are all optional values. Special
+attention should be brought to the 'state_interface' option for a member though.
+The reason for state_interface is that if you're using a channel that does not
+have device state itself (for example, if you were using the Local channel to
+deliver a call to an end point) then you could assign the device state of a SIP
+device to the pseudo channel. This allows the state of a SIP device to be
+applied to the Local channel for correct device state information.
+
+Lets add our device located at SIP/0004f2040001
+
+*CLI> queue add member SIP/0004f2040001 to sales
+Added interface 'SIP/0004f2040001' to queue 'sales'
+
+Then lets verify our member was indeed added.
+
+*CLI> queue show sales
+sales has 0 calls (max unlimited) in 'rrmemory' strategy (0s holdtime, 0s talktime), W:0, C:0, A:0, SL:0.0% within 0s
+ Members:
+ SIP/0004f2040001 (dynamic) (Not in use) has taken no calls yet
+ No Callers
+
+Now, if we dial our 555 extension, we should see that our member becomes InUse
+within the queue.
+
+*CLI> == Using SIP RTP CoS mark 5
+ -- Executing [555 at devices:1] Playback("SIP/0004f2040001-00000001", "tt-monkeys") in new stack
+ -- <SIP/0004f2040001-00000001> Playing 'tt-monkeys.slin' (language 'en')
+
+
+*CLI> queue show sales
+sales has 0 calls (max unlimited) in 'rrmemory' strategy (0s holdtime, 0s talktime), W:0, C:0, A:0, SL:0.0% within 0s
+ Members:
+ SIP/0004f2040001 (dynamic) (In use) has taken no calls yet
+ No Callers
+
+We can also remove our members from the queue using the 'queue remove' CLI
+command.
+
+*CLI> queue remove member SIP/0004f2040001 from sales
+Removed interface 'SIP/0004f2040001' from queue 'sales'
+
+Because we don't want to have to add queue members manually from the CLI, we
+should create a method that allows queue members to login and out from their
+devices. We'll do that in the next section.
+
+But first, lets add an extension to our dialplan in order to permit people to
+dial into our queues so calls can be delivered to our queue members.
+
+extensions.conf
+---------------
+
+[devices]
+exten => 555,1,Playback(tt-monkeys)
+
+exten => 100,1,Queue(sales)
+
+exten => 101,1,Queue(support)
+
+
+Then reload the dialplan, and try calling extension 100 from SIP/0004f2040002,
+which is the device we have not logged into the queue.
+
+*CLI> dialplan reload
+
+And now we call the queue at extension 100 which will ring our device at
+SIP/0004f2040001.
+
+*CLI> == Using SIP RTP CoS mark 5
+ -- Executing [100 at devices:1] Queue("SIP/0004f2040002-00000005", "sales") in new stack
+ -- Started music on hold, class 'default', on SIP/0004f2040002-00000005
+ == Using SIP RTP CoS mark 5
+ -- SIP/0004f2040001-00000006 is ringing
+
+
+We can see the device state has changed to Ringing while the device is ringing.
+
+*CLI> queue show sales
+sales has 1 calls (max unlimited) in 'rrmemory' strategy (2s holdtime, 3s talktime), W:0, C:1, A:1, SL:0.0% within 0s
+ Members:
+ SIP/0004f2040001 (dynamic) (Ringing) has taken 1 calls (last was 14 secs ago)
+ Callers:
+ 1. SIP/0004f2040002-00000005 (wait: 0:03, prio: 0)
+
+
+Our queue member then answers the phone.
+
[... 11187 lines stripped ...]
More information about the asterisk-commits
mailing list