Skip to content
Snippets Groups Projects
res_pjsip.c 246 KiB
Newer Older
  • Learn to ignore specific revisions
  • /*
     * Asterisk -- An open source telephony toolkit.
     *
     * Copyright (C) 2013, Digium, Inc.
     *
     * Mark Michelson <mmichelson@digium.com>
     *
     * See http://www.asterisk.org for more information about
     * the Asterisk project. Please do not directly contact
     * any of the maintainers of this project for assistance;
     * the project provides a web site, mailing lists and IRC
     * channels for your use.
     *
     * This program is free software, distributed under the terms of
     * the GNU General Public License Version 2. See the LICENSE file
     * at the top of the source tree.
     */
    
    #include "asterisk.h"
    
    #include <pjsip.h>
    /* Needed for SUBSCRIBE, NOTIFY, and PUBLISH method definitions */
    #include <pjsip_simple.h>
    
    #include <pjsip/sip_transaction.h>
    #include <pj/timer.h>
    
    #include <pjlib.h>
    
    #include <pjmedia/errno.h>
    
    #include "asterisk/res_pjsip.h"
    #include "res_pjsip/include/res_pjsip_private.h"
    
    #include "asterisk/linkedlists.h"
    #include "asterisk/logger.h"
    #include "asterisk/lock.h"
    #include "asterisk/utils.h"
    #include "asterisk/astobj2.h"
    #include "asterisk/module.h"
    
    #include "asterisk/serializer.h"
    
    #include "asterisk/threadpool.h"
    #include "asterisk/taskprocessor.h"
    #include "asterisk/uuid.h"
    #include "asterisk/sorcery.h"
    
    #include "asterisk/res_pjsip_cli.h"
    
    #include "asterisk/test.h"
    #include "asterisk/res_pjsip_presence_xml.h"
    
    #include "asterisk/res_pjproject.h"
    
    
    /*** MODULEINFO
    	<depend>pjproject</depend>
    
    	<depend>res_pjproject</depend>
    
    	<depend>res_sorcery_config</depend>
    
    	<depend>res_sorcery_memory</depend>
    	<depend>res_sorcery_astdb</depend>
    
    	<use type="module">res_statsd</use>
    
    	<support_level>core</support_level>
     ***/
    
    
    /*** DOCUMENTATION
    
    	<configInfo name="res_pjsip" language="en_US">
    
    		<synopsis>SIP Resource using PJProject</synopsis>
    
    		<configFile name="pjsip.conf">
    
    			<configObject name="endpoint">
    				<synopsis>Endpoint</synopsis>
    				<description><para>
    					The <emphasis>Endpoint</emphasis> is the primary configuration object.
    					It contains the core SIP related options only, endpoints are <emphasis>NOT</emphasis>
    					dialable entries of their own. Communication with another SIP device is
    					accomplished via Addresses of Record (AoRs) which have one or more
    
    					contacts associated with them. Endpoints <emphasis>NOT</emphasis> configured to
    
    					use a <literal>transport</literal> will default to first transport found
    
    					in <filename>pjsip.conf</filename> that matches its type.
    
    					</para>
    					<para>Example: An Endpoint has been configured with no transport.
    					When it comes time to call an AoR, PJSIP will find the
    					first transport that matches the type. A SIP URI of <literal>sip:5000@[11::33]</literal>
    					will use the first IPv6 transport and try to send the request.
    					</para>
    
    					<para>If the anonymous endpoint identifier is in use an endpoint with the name
    					"anonymous@domain" will be searched for as a last resort. If this is not found
    					it will fall back to searching for "anonymous". If neither endpoints are found
    					the anonymous endpoint identifier will not return an endpoint and anonymous
    					calling will not be possible.
    					</para>
    
    				</description>
    				<configOption name="100rel" default="yes">
    					<synopsis>Allow support for RFC3262 provisional ACK tags</synopsis>
    					<description>
    						<enumlist>
    							<enum name="no" />
    							<enum name="required" />
    							<enum name="yes" />
    						</enumlist>
    					</description>
    				</configOption>
    				<configOption name="aggregate_mwi" default="yes">
    
    					<synopsis>Condense MWI notifications into a single NOTIFY.</synopsis>
    
    					<description><para>When enabled, <replaceable>aggregate_mwi</replaceable> condenses message
    					waiting notifications from multiple mailboxes into a single NOTIFY. If it is disabled,
    					individual NOTIFYs are sent for each mailbox.</para></description>
    				</configOption>
    				<configOption name="allow">
    					<synopsis>Media Codec(s) to allow</synopsis>
    				</configOption>
    
    				<configOption name="codec_prefs_incoming_offer">
    
    					<synopsis>Codec negotiation prefs for incoming offers.</synopsis>
    					<description>
    						<para>
    							This is a string that describes how the codecs
    							specified on an incoming SDP offer (pending) are reconciled with the codecs specified
    							on an endpoint (configured) before being sent to the Asterisk core.
    							The string actually specifies 4 <literal>name:value</literal> pair parameters
    							separated by commas. Whitespace is ignored and they may be specified in any order.
    
    							Note that this option is reserved for future functionality.
    
    
    						</para>
    						<para>
    							Parameters:
    						</para>
    						<enumlist>
    							<enum name="prefer: &lt; pending | configured &gt;">
    								<para>
    								</para>
    								<enumlist>
    									<enum name="pending"><para>The codec list from the caller. (default)</para></enum>
    									<enum name="configured"><para>The codec list from the endpoint.</para></enum>
    								</enumlist>
    							</enum>
    							<enum name="operation : &lt; intersect | only_preferred | only_nonpreferred &gt;">
    								<para>
    								</para>
    								<enumlist>
    									<enum name="intersect"><para>Only common codecs with the preferred codecs first. (default)</para></enum>
    									<enum name="only_preferred"><para>Use only the preferred codecs.</para></enum>
    									<enum name="only_nonpreferred"><para>Use only the non-preferred codecs.</para></enum>
    								</enumlist>
    							</enum>
    							<enum name="keep : &lt; all | first &gt;">
    								<para>
    								</para>
    								<enumlist>
    									<enum name="all"><para>After the operation, keep all codecs. (default)</para></enum>
    									<enum name="first"><para>After the operation, keep only the first codec.</para></enum>
    								</enumlist>
    							</enum>
    							<enum name="transcode : &lt; allow | prevent &gt;">
    								<para>
    								</para>
    								<enumlist>
    									<enum name="allow"><para>Allow transcoding. (default)</para></enum>
    									<enum name="prevent"><para>Prevent transcoding.</para></enum>
    								</enumlist>
    							</enum>
    						</enumlist>
    						<para>
    						</para>
    						<example>
    
    							codec_prefs_incoming_offer = prefer: pending, operation: intersect, keep: all, transcode: allow
    
    						</example>
    						<para>
    							Prefer the codecs coming from the caller.  Use only the ones that are common.
    							keeping the order of the preferred list. Keep all codecs in the result. Allow transcoding.
    						</para>
    					</description>
    				</configOption>
    
    				<configOption name="codec_prefs_outgoing_offer">
    
    					<synopsis>Codec negotiation prefs for outgoing offers.</synopsis>
    					<description>
    						<para>
    							This is a string that describes how the codecs specified in the topology that
    							comes from the Asterisk core (pending) are reconciled with the codecs specified on an
    							endpoint (configured) when sending an SDP offer.
    							The string actually specifies 4 <literal>name:value</literal> pair parameters
    							separated by commas. Whitespace is ignored and they may be specified in any order.
    
    							Note that this option is reserved for future functionality.
    
    
    						</para>
    						<para>
    							Parameters:
    						</para>
    						<enumlist>
    							<enum name="prefer: &lt; pending | configured &gt;">
    								<para>
    								</para>
    								<enumlist>
    									<enum name="pending"><para>The codec list from the core. (default)</para></enum>
    									<enum name="configured"><para>The codec list from the endpoint.</para></enum>
    								</enumlist>
    							</enum>
    							<enum name="operation : &lt; union | intersect | only_preferred | only_nonpreferred &gt;">
    								<para>
    								</para>
    								<enumlist>
    									<enum name="union"><para>Merge the lists with the preferred codecs first. (default)</para></enum>
    									<enum name="intersect"><para>Only common codecs with the preferred codecs first. (default)</para></enum>
    									<enum name="only_preferred"><para>Use only the preferred codecs.</para></enum>
    									<enum name="only_nonpreferred"><para>Use only the non-preferred codecs.</para></enum>
    								</enumlist>
    							</enum>
    							<enum name="keep : &lt; all | first &gt;">
    								<para>
    								</para>
    								<enumlist>
    									<enum name="all"><para>After the operation, keep all codecs. (default)</para></enum>
    									<enum name="first"><para>After the operation, keep only the first codec.</para></enum>
    								</enumlist>
    							</enum>
    							<enum name="transcode : &lt; allow | prevent &gt;">
    								<para>
    								</para>
    								<enumlist>
    									<enum name="allow"><para>Allow transcoding. (default)</para></enum>
    									<enum name="prevent"><para>Prevent transcoding.</para></enum>
    								</enumlist>
    							</enum>
    						</enumlist>
    						<para>
    						</para>
    						<example>
    
    						codec_prefs_outgoing_offer = prefer: configured, operation: union, keep: first, transcode: prevent
    
    						</example>
    						<para>
    						Prefer the codecs coming from the endpoint.  Merge them with the codecs from the core
    						keeping the order of the preferred list. Keep only the first one. No transcoding allowed.
    						</para>
    					</description>
    				</configOption>
    
    				<configOption name="codec_prefs_incoming_answer">
    
    					<synopsis>Codec negotiation prefs for incoming answers.</synopsis>
    					<description>
    						<para>
    							This is a string that describes how the codecs specified in an incoming SDP answer
    							(pending) are reconciled with the codecs specified on an endpoint (configured)
    							when receiving an SDP answer.
    							The string actually specifies 4 <literal>name:value</literal> pair parameters
    							separated by commas. Whitespace is ignored and they may be specified in any order.
    
    							Note that this option is reserved for future functionality.
    
    
    						</para>
    						<para>
    							Parameters:
    						</para>
    						<enumlist>
    							<enum name="prefer: &lt; pending | configured &gt;">
    								<para>
    								</para>
    								<enumlist>
    									<enum name="pending"><para>The codec list in the received SDP answer. (default)</para></enum>
    									<enum name="configured"><para>The codec list from the endpoint.</para></enum>
    								</enumlist>
    							</enum>
    							<enum name="operation : &lt; union | intersect | only_preferred | only_nonpreferred &gt;">
    								<para>
    								</para>
    								<enumlist>
    									<enum name="union"><para>Merge the lists with the preferred codecs first.</para></enum>
    									<enum name="intersect"><para>Only common codecs with the preferred codecs first. (default)</para></enum>
    									<enum name="only_preferred"><para>Use only the preferred codecs.</para></enum>
    									<enum name="only_nonpreferred"><para>Use only the non-preferred codecs.</para></enum>
    								</enumlist>
    							</enum>
    							<enum name="keep : &lt; all | first &gt;">
    								<para>
    								</para>
    								<enumlist>
    									<enum name="all"><para>After the operation, keep all codecs. (default)</para></enum>
    									<enum name="first"><para>After the operation, keep only the first codec.</para></enum>
    								</enumlist>
    							</enum>
    							<enum name="transcode : &lt; allow | prevent &gt;">
    								<para>
    								The transcode parameter is ignored when processing answers.
    								</para>
    							</enum>
    						</enumlist>
    						<para>
    						</para>
    						<example>
    
    						codec_prefs_incoming_answer = keep: first
    
    						</example>
    						<para>
    						Use the defaults but keep oinly the first codec.
    						</para>
    					</description>
    				</configOption>
    
    				<configOption name="codec_prefs_outgoing_answer">
    
    					<synopsis>Codec negotiation prefs for outgoing answers.</synopsis>
    					<description>
    						<para>
    							This is a string that describes how the codecs that come from the core (pending)
    							are reconciled with the codecs specified on an endpoint (configured)
    							when sending an SDP answer.
    							The string actually specifies 4 <literal>name:value</literal> pair parameters
    							separated by commas. Whitespace is ignored and they may be specified in any order.
    
    							Note that this option is reserved for future functionality.
    
    
    						</para>
    						<para>
    							Parameters:
    						</para>
    						<enumlist>
    							<enum name="prefer: &lt; pending | configured &gt;">
    								<para>
    								</para>
    								<enumlist>
    									<enum name="pending"><para>The codec list that came from the core. (default)</para></enum>
    									<enum name="configured"><para>The codec list from the endpoint.</para></enum>
    								</enumlist>
    							</enum>
    							<enum name="operation : &lt; union | intersect | only_preferred | only_nonpreferred &gt;">
    								<para>
    								</para>
    								<enumlist>
    									<enum name="union"><para>Merge the lists with the preferred codecs first.</para></enum>
    									<enum name="intersect"><para>Only common codecs with the preferred codecs first. (default)</para></enum>
    									<enum name="only_preferred"><para>Use only the preferred codecs.</para></enum>
    									<enum name="only_nonpreferred"><para>Use only the non-preferred codecs.</para></enum>
    								</enumlist>
    							</enum>
    							<enum name="keep : &lt; all | first &gt;">
    								<para>
    								</para>
    								<enumlist>
    									<enum name="all"><para>After the operation, keep all codecs. (default)</para></enum>
    									<enum name="first"><para>After the operation, keep only the first codec.</para></enum>
    								</enumlist>
    							</enum>
    							<enum name="transcode : &lt; allow | prevent &gt;">
    								<para>
    								The transcode parameter is ignored when processing answers.
    								</para>
    							</enum>
    						</enumlist>
    						<para>
    						</para>
    						<example>
    
    						codec_prefs_incoming_answer = keep: first
    
    						</example>
    						<para>
    						Use the defaults but keep oinly the first codec.
    						</para>
    					</description>
    				</configOption>
    
    				<configOption name="allow_overlap" default="yes">
    					<synopsis>Enable RFC3578 overlap dialing support.</synopsis>
    				</configOption>
    
    				<configOption name="aors">
    					<synopsis>AoR(s) to be used with the endpoint</synopsis>
    					<description><para>
    						List of comma separated AoRs that the endpoint should be associated with.
    					</para></description>
    				</configOption>
    				<configOption name="auth">
    					<synopsis>Authentication Object(s) associated with the endpoint</synopsis>
    					<description><para>
    						This is a comma-delimited list of <replaceable>auth</replaceable> sections defined
    
    						in <filename>pjsip.conf</filename> to be used to verify inbound connection attempts.
    
    						</para><para>
    
    						Endpoints without an authentication object
    						configured will allow connections without verification.</para>
    						<note><para>
    						Using the same auth section for inbound and outbound
    						authentication is not recommended.  There is a difference in
    						meaning for an empty realm setting between inbound and outbound
    						authentication uses.  See the auth realm description for details.
    						</para></note>
    					</description>
    
    				</configOption>
    				<configOption name="callerid">
    					<synopsis>CallerID information for the endpoint</synopsis>
    					<description><para>
    						Must be in the format <literal>Name &lt;Number&gt;</literal>,
    						or only <literal>&lt;Number&gt;</literal>.
    					</para></description>
    				</configOption>
    				<configOption name="callerid_privacy">
    					<synopsis>Default privacy level</synopsis>
    					<description>
    						<enumlist>
    							<enum name="allowed_not_screened" />
    
    							<enum name="allowed_passed_screen" />
    							<enum name="allowed_failed_screen" />
    
    							<enum name="allowed" />
    							<enum name="prohib_not_screened" />
    
    							<enum name="prohib_passed_screen" />
    							<enum name="prohib_failed_screen" />
    
    							<enum name="prohib" />
    							<enum name="unavailable" />
    						</enumlist>
    					</description>
    				</configOption>
    				<configOption name="callerid_tag">
    					<synopsis>Internal id_tag for the endpoint</synopsis>
    				</configOption>
    				<configOption name="context">
    					<synopsis>Dialplan context for inbound sessions</synopsis>
    				</configOption>
    				<configOption name="direct_media_glare_mitigation" default="none">
    					<synopsis>Mitigation of direct media (re)INVITE glare</synopsis>
    					<description>
    						<para>
    						This setting attempts to avoid creating INVITE glare scenarios
    						by disabling direct media reINVITEs in one direction thereby allowing
    						designated servers (according to this option) to initiate direct
    						media reINVITEs without contention and significantly reducing call
    						setup time.
    						</para>
    						<para>
    						A more detailed description of how this option functions can be found on
    						the Asterisk wiki https://wiki.asterisk.org/wiki/display/AST/SIP+Direct+Media+Reinvite+Glare+Avoidance
    						</para>
    						<enumlist>
    							<enum name="none" />
    							<enum name="outgoing" />
    							<enum name="incoming" />
    						</enumlist>
    					</description>
    				</configOption>
    				<configOption name="direct_media_method" default="invite">
    					<synopsis>Direct Media method type</synopsis>
    					<description>
    						<para>Method for setting up Direct Media between endpoints.</para>
    						<enumlist>
    							<enum name="invite" />
    							<enum name="reinvite">
    								<para>Alias for the <literal>invite</literal> value.</para>
    							</enum>
    							<enum name="update" />
    						</enumlist>
    					</description>
    				</configOption>
    
    				<configOption name="trust_connected_line">
    					<synopsis>Accept Connected Line updates from this endpoint</synopsis>
    				</configOption>
    				<configOption name="send_connected_line">
    					<synopsis>Send Connected Line updates to this endpoint</synopsis>
    				</configOption>
    
    				<configOption name="connected_line_method" default="invite">
    					<synopsis>Connected line method type</synopsis>
    					<description>
    						<para>Method used when updating connected line information.</para>
    						<enumlist>
    
    							<enum name="invite">
    							<para>When set to <literal>invite</literal>, check the remote's Allow header and
    							if UPDATE is allowed, send UPDATE instead of INVITE to avoid SDP
    							renegotiation.  If UPDATE is not Allowed, send INVITE.</para>
    							</enum>
    
    							<enum name="reinvite">
    								<para>Alias for the <literal>invite</literal> value.</para>
    							</enum>
    
    							<enum name="update">
    							<para>If set to <literal>update</literal>, send UPDATE regardless of what the remote
    							Allows. </para>
    							</enum>
    
    						</enumlist>
    					</description>
    				</configOption>
    
    				<configOption name="direct_media" default="yes">
    					<synopsis>Determines whether media may flow directly between endpoints.</synopsis>
    				</configOption>
    				<configOption name="disable_direct_media_on_nat" default="no">
    					<synopsis>Disable direct media session refreshes when NAT obstructs the media session</synopsis>
    				</configOption>
    				<configOption name="disallow">
    					<synopsis>Media Codec(s) to disallow</synopsis>
    				</configOption>
    
    				<configOption name="dtmf_mode" default="rfc4733">
    
    					<synopsis>DTMF mode</synopsis>
    					<description>
    						<para>This setting allows to choose the DTMF mode for endpoint communication.</para>
    						<enumlist>
    							<enum name="rfc4733">
    
    								<para>DTMF is sent out of band of the main audio stream.  This
    
    								supercedes the older <emphasis>RFC-2833</emphasis> used within
    								the older <literal>chan_sip</literal>.</para>
    							</enum>
    							<enum name="inband">
    								<para>DTMF is sent as part of audio stream.</para>
    							</enum>
    							<enum name="info">
    								<para>DTMF is sent as SIP INFO packets.</para>
    							</enum>
    
    							<enum name="auto">
    								<para>DTMF is sent as RFC 4733 if the other side supports it or as INBAND if not.</para>
    							</enum>
    
    							<enum name="auto_info">
    								<para>DTMF is sent as RFC 4733 if the other side supports it or as SIP INFO if not.</para>
    							</enum>
    
    						</enumlist>
    					</description>
    				</configOption>
    
    				<configOption name="media_address">
    					<synopsis>IP address used in SDP for media handling</synopsis>
    					<description><para>
    						At the time of SDP creation, the IP address defined here will be used as
    						the media address for individual streams in the SDP.
    
    						Be aware that the <literal>external_media_address</literal> option, set in Transport
    						configuration, can also affect the final media address used in the SDP.
    
    				</configOption>
    
    				<configOption name="bind_rtp_to_media_address">
    					<synopsis>Bind the RTP instance to the media_address</synopsis>
    					<description><para>
    						If media_address is specified, this option causes the RTP instance to be bound to the
    						specified ip address which causes the packets to be sent from that address.
    					</para>
    					</description>
    				</configOption>
    
    				<configOption name="force_rport" default="yes">
    					<synopsis>Force use of return port</synopsis>
    				</configOption>
    				<configOption name="ice_support" default="no">
    					<synopsis>Enable the ICE mechanism to help traverse NAT</synopsis>
    				</configOption>
    
    				<configOption name="identify_by">
    					<synopsis>Way(s) for the endpoint to be identified</synopsis>
    					<description>
    						<para>Endpoints and AORs can be identified in multiple ways.  This
    						option is a comma separated list of methods the endpoint can be
    						identified.
    
    						This option controls both how an endpoint is matched for incoming
    						traffic and also how an AOR is determined if a registration
    						occurs.  You must list at least one method that also matches for
    						AORs or the registration will fail.
    
    							<enum name="username">
    								<para>Matches the endpoint or AOR ID based on the username
    								and domain in the From header (or To header for AORs).  If
    								an exact match on both username and domain/realm fails, the
    								match is retried with just the username.
    								</para>
    							</enum>
    							<enum name="auth_username">
    								<para>Matches the endpoint or AOR ID based on the username
    								and realm in the Authentication header.  If an exact match
    								on both username and domain/realm fails, the match is
    								retried with just the username.
    								</para>
    								<note><para>This method of identification has some security
    								considerations because an Authentication header is not
    								present on the first message of a dialog when digest
    								authentication is used.  The client can't generate it until
    								the server sends the challenge in a 401 response.  Since
    								Asterisk normally sends a security event when an incoming
    								request can't be matched to an endpoint, using this method
    								requires that the security event be deferred until a request
    								is received with the Authentication header and only
    								generated if the username doesn't result in a match.  This
    								may result in a delay before an attack is recognized.  You
    								can control how many unmatched requests are received from
    								a single ip address before a security event is generated
    								using the <literal>unidentified_request</literal>
    								parameters in the "global" configuration object.
    								</para></note>
    							</enum>
    							<enum name="ip">
    								<para>Matches the endpoint based on the source IP address.
    								</para>
    								<para>This method of identification is not configured here
    								but simply allowed by this configuration option.  See the
    								documentation for the <literal>identify</literal>
    								configuration section for more details on this method of
    								endpoint identification.
    								</para>
    							</enum>
    
    							<enum name="header">
    								<para>Matches the endpoint based on a configured SIP header
    								value.
    								</para>
    								<para>This method of identification is not configured here
    								but simply allowed by this configuration option.  See the
    								documentation for the <literal>identify</literal>
    								configuration section for more details on this method of
    								endpoint identification.
    								</para>
    							</enum>
    
    						</enumlist>
    					</description>
    				</configOption>
    
    				<configOption name="redirect_method">
    					<synopsis>How redirects received from an endpoint are handled</synopsis>
    					<description><para>
    						When a redirect is received from an endpoint there are multiple ways it can be handled.
    						If this option is set to <literal>user</literal> the user portion of the redirect target
    						is treated as an extension within the dialplan and dialed using a Local channel. If this option
    						is set to <literal>uri_core</literal> the target URI is returned to the dialing application
    						which dials it using the PJSIP channel driver and endpoint originally used. If this option is
    						set to <literal>uri_pjsip</literal> the redirect occurs within chan_pjsip itself and is not exposed
    						to the core at all. The <literal>uri_pjsip</literal> option has the benefit of being more efficient
    						and also supporting multiple potential redirect targets. The con is that since redirection occurs
    						within chan_pjsip redirecting information is not forwarded and redirection can not be
    						prevented.
    						</para>
    						<enumlist>
    							<enum name="user" />
    							<enum name="uri_core" />
    							<enum name="uri_pjsip" />
    						</enumlist>
    					</description>
    				</configOption>
    
    				<configOption name="mailboxes">
    
    					<synopsis>NOTIFY the endpoint when state changes for any of the specified mailboxes</synopsis>
    					<description><para>
    						Asterisk will send unsolicited MWI NOTIFY messages to the endpoint when state
    						changes happen for any of the specified mailboxes. More than one mailbox can be
    
    						specified with a comma-delimited string. app_voicemail mailboxes must be specified
    						as mailbox@context; for example: mailboxes=6001@default. For mailboxes provided by
    
    						external sources, such as through the res_mwi_external module, you must specify
    
    						strings supported by the external system.
    					</para><para>
    						For endpoints that SUBSCRIBE for MWI, use the <literal>mailboxes</literal> option in your AOR
    
    				</configOption>
    
    				<configOption name="mwi_subscribe_replaces_unsolicited">
    					<synopsis>An MWI subscribe will replace sending unsolicited NOTIFYs</synopsis>
    				</configOption>
    				<configOption name="voicemail_extension">
    					<synopsis>The voicemail extension to send in the NOTIFY Message-Account header</synopsis>
    				</configOption>
    
    				<configOption name="moh_suggest" default="default">
    
    					<synopsis>Default Music On Hold class</synopsis>
    				</configOption>
    				<configOption name="outbound_auth">
    
    					<synopsis>Authentication object(s) used for outbound requests</synopsis>
    					<description><para>
    						This is a comma-delimited list of <replaceable>auth</replaceable>
    						sections defined in <filename>pjsip.conf</filename> used to respond
    						to outbound connection authentication challenges.</para>
    						<note><para>
    						Using the same auth section for inbound and outbound
    						authentication is not recommended.  There is a difference in
    						meaning for an empty realm setting between inbound and outbound
    						authentication uses.  See the auth realm description for details.
    						</para></note>
    					</description>
    
    				</configOption>
    				<configOption name="outbound_proxy">
    
    					<synopsis>Full SIP URI of the outbound proxy used to send requests</synopsis>
    
    				</configOption>
    				<configOption name="rewrite_contact">
    					<synopsis>Allow Contact header to be rewritten with the source IP address-port</synopsis>
    
    						On inbound SIP messages from this endpoint, the Contact header or an
    						appropriate Record-Route header will be changed to have the source IP
    						address and port.  This option does not affect outbound messages sent to
    						this endpoint.  This option helps servers communicate with endpoints
    						that are behind NATs.  This option also helps reuse reliable transport
    						connections such as TCP and TLS.
    
    				</configOption>
    				<configOption name="rtp_ipv6" default="no">
    					<synopsis>Allow use of IPv6 for RTP traffic</synopsis>
    				</configOption>
    				<configOption name="rtp_symmetric" default="no">
    					<synopsis>Enforce that RTP must be symmetric</synopsis>
    				</configOption>
    
    				<configOption name="send_diversion" default="yes">
    					<synopsis>Send the Diversion header, conveying the diversion
    					information to the called user agent</synopsis>
    
    				</configOption>
    				<configOption name="send_history_info" default="no">
    					<synopsis>Send the History-Info header, conveying the diversion
    					information to the called and calling user agents</synopsis>
    
    				<configOption name="send_pai" default="no">
    					<synopsis>Send the P-Asserted-Identity header</synopsis>
    				</configOption>
    				<configOption name="send_rpid" default="no">
    					<synopsis>Send the Remote-Party-ID header</synopsis>
    				</configOption>
    
    				<configOption name="rpid_immediate" default="no">
    					<synopsis>Immediately send connected line updates on unanswered incoming calls.</synopsis>
    					<description>
    						<para>When enabled, immediately send <emphasis>180 Ringing</emphasis>
    						or <emphasis>183 Progress</emphasis> response messages to the
    						caller if the connected line information is updated before
    						the call is answered.  This can send a <emphasis>180 Ringing</emphasis>
    						response before the call has even reached the far end.  The
    						caller can start hearing ringback before the far end even gets
    						the call.  Many phones tend to grab the first connected line
    						information and refuse to update the display if it changes.  The
    						first information is not likely to be correct if the call
    						goes to an endpoint not under the control of this Asterisk
    						box.</para>
    						<para>When disabled, a connected line update must wait for
    						another reason to send a message with the connected line
    						information to the caller before the call is answered.  You can
    						trigger the sending of the information by using an appropriate
    						dialplan application such as <emphasis>Ringing</emphasis>.</para>
    					</description>
    				</configOption>
    
    				<configOption name="timers_min_se" default="90">
    					<synopsis>Minimum session timers expiration period</synopsis>
    					<description><para>
    
    						Minimum session timer expiration period. Time in seconds.
    
    					</para></description>
    				</configOption>
    				<configOption name="timers" default="yes">
    					<synopsis>Session timers for SIP packets</synopsis>
    					<description>
    						<enumlist>
    							<enum name="no" />
    							<enum name="yes" />
    
    							<enum name="required" />
    							<enum name="always" />
    							<enum name="forced"><para>Alias of always</para></enum>
    
    						</enumlist>
    					</description>
    				</configOption>
    				<configOption name="timers_sess_expires" default="1800">
    					<synopsis>Maximum session timer expiration period</synopsis>
    					<description><para>
    
    						Maximum session timer expiration period. Time in seconds.
    
    					</para></description>
    				</configOption>
    				<configOption name="transport">
    
    					<synopsis>Explicit transport configuration to use</synopsis>
    					<description>
    						<para>This will <emphasis>force</emphasis> the endpoint to use the
    						specified transport configuration to send SIP messages.  You need
    						to already know what kind of transport (UDP/TCP/IPv4/etc) the
    						endpoint device will use.
    
    						<note><para>Not specifying a transport will select the first
    						configured transport in <filename>pjsip.conf</filename> which is
    						compatible with the URI we are trying to contact.
    						</para></note>
    
    						<warning><para>Transport configuration is not affected by reloads. In order to
    						change transports, a full Asterisk restart is required</para></warning>
    
    					</description>
    				</configOption>
    				<configOption name="trust_id_inbound" default="no">
    
    					<synopsis>Accept identification information received from this endpoint</synopsis>
    					<description><para>This option determines whether Asterisk will accept
    					identification from the endpoint from headers such as P-Asserted-Identity
    					or Remote-Party-ID header. This option applies both to calls originating from the
    					endpoint and calls originating from Asterisk. If <literal>no</literal>, the
    
    					configured Caller-ID from pjsip.conf will always be used as the identity for
    
    					the endpoint.</para></description>
    
    				</configOption>
    				<configOption name="trust_id_outbound" default="no">
    
    					<synopsis>Send private identification details to the endpoint.</synopsis>
    
    					<description><para>This option determines whether res_pjsip will send private
    
    					identification information to the endpoint. If <literal>no</literal>,
    					private Caller-ID information will not be forwarded to the endpoint.
    					"Private" in this case refers to any method of restricting identification.
    					Example: setting <replaceable>callerid_privacy</replaceable> to any
    					<literal>prohib</literal> variation.
    					Example: If <replaceable>trust_id_inbound</replaceable> is set to
    					<literal>yes</literal>, the presence of a <literal>Privacy: id</literal>
    					header in a SIP request or response would indicate the identification
    					provided in the request is private.</para></description>
    
    				</configOption>
    				<configOption name="type">
    					<synopsis>Must be of type 'endpoint'.</synopsis>
    				</configOption>
    				<configOption name="use_ptime" default="no">
    
    					<synopsis>Use Endpoint's requested packetization interval</synopsis>
    
    				</configOption>
    
    				<configOption name="use_avpf" default="no">
    
    					<synopsis>Determines whether res_pjsip will use and enforce usage of AVPF for this
    
    					endpoint.</synopsis>
    					<description><para>
    
    						If set to <literal>yes</literal>, res_pjsip will use the AVPF or SAVPF RTP
    
    						profile for all media offers on outbound calls and media updates and will
    						decline media offers not using the AVPF or SAVPF profile.
    					</para><para>
    
    						If set to <literal>no</literal>, res_pjsip will use the AVP or SAVP RTP
    
    						profile for all media offers on outbound calls and media updates, and will
    						decline media offers not using the AVP or SAVP profile.
    
    					</para></description>
    				</configOption>
    
    				<configOption name="force_avp" default="no">
    					<synopsis>Determines whether res_pjsip will use and enforce usage of AVP,
    					regardless of the RTP profile in use for this endpoint.</synopsis>
    					<description><para>
    						If set to <literal>yes</literal>, res_pjsip will use the AVP, AVPF, SAVP, or
    						SAVPF RTP profile for all media offers on outbound calls and media updates including
    						those for DTLS-SRTP streams.
    					</para><para>
    						If set to <literal>no</literal>, res_pjsip will use the respective RTP profile
    						depending on configuration.
    					</para></description>
    				</configOption>
    				<configOption name="media_use_received_transport" default="no">
    					<synopsis>Determines whether res_pjsip will use the media transport received in the
    					offer SDP in the corresponding answer SDP.</synopsis>
    					<description><para>
    						If set to <literal>yes</literal>, res_pjsip will use the received media transport.
    					</para><para>
    						If set to <literal>no</literal>, res_pjsip will use the respective RTP profile
    						depending on configuration.
    					</para></description>
    				</configOption>
    
    				<configOption name="media_encryption" default="no">
    
    					<synopsis>Determines whether res_pjsip will use and enforce usage of media encryption
    
    					for this endpoint.</synopsis>
    					<description>
    						<enumlist>
    							<enum name="no"><para>
    
    								res_pjsip will offer no encryption and allow no encryption to be setup.
    
    							</para></enum>
    							<enum name="sdes"><para>
    
    								res_pjsip will offer standard SRTP setup via in-SDP keys. Encrypted SIP
    
    								transport should be used in conjunction with this option to prevent
    								exposure of media encryption keys.
    							</para></enum>
    
    							<enum name="dtls"><para>
    
    								res_pjsip will offer DTLS-SRTP setup.
    
    							</para></enum>
    
    						</enumlist>
    					</description>
    				</configOption>
    
    				<configOption name="media_encryption_optimistic" default="no">
    					<synopsis>Determines whether encryption should be used if possible but does not terminate the
    					session if not achieved.</synopsis>
    					<description><para>
    						This option only applies if <replaceable>media_encryption</replaceable> is
    						set to <literal>sdes</literal> or <literal>dtls</literal>.
    					</para></description>
    				</configOption>
    
    				<configOption name="g726_non_standard" default="no">
    					<synopsis>Force g.726 to use AAL2 packing order when negotiating g.726 audio</synopsis>
    					<description><para>
    
    						When set to "yes" and an endpoint negotiates g.726 audio then use g.726 for AAL2
    						packing order instead of what is recommended by RFC3551. Since this essentially
    						replaces the underlying 'g726' codec with 'g726aal2' then 'g726aal2' needs to be
    						specified in the endpoint's allowed codec list.
    
    					</para></description>
    				</configOption>
    
    				<configOption name="inband_progress" default="no">
    
    					<synopsis>Determines whether chan_pjsip will indicate ringing using inband
    
    						progress.</synopsis>
    
    					<description><para>
    
    						If set to <literal>yes</literal>, chan_pjsip will send a 183 Session Progress
    
    						when told to indicate ringing and will immediately start sending ringing
    						as audio.
    					</para><para>
    
    						If set to <literal>no</literal>, chan_pjsip will send a 180 Ringing when told
    
    						to indicate ringing and will NOT send it as audio.
    					</para></description>
    				</configOption>
    
    				<configOption name="call_group">
    
    					<synopsis>The numeric pickup groups for a channel.</synopsis>
    					<description><para>
    						Can be set to a comma separated list of numbers or ranges between the values
    						of 0-63 (maximum of 64 groups).
    					</para></description>
    				</configOption>
    
    				<configOption name="pickup_group">
    
    					<synopsis>The numeric pickup groups that a channel can pickup.</synopsis>
    					<description><para>
    						Can be set to a comma separated list of numbers or ranges between the values
    						of 0-63 (maximum of 64 groups).
    					</para></description>
    				</configOption>
    
    				<configOption name="named_call_group">
    
    					<synopsis>The named pickup groups for a channel.</synopsis>
    					<description><para>
    						Can be set to a comma separated list of case sensitive strings limited by
    						supported line length.
    					</para></description>
    				</configOption>
    
    				<configOption name="named_pickup_group">
    
    					<synopsis>The named pickup groups that a channel can pickup.</synopsis>
    					<description><para>
    						Can be set to a comma separated list of case sensitive strings limited by
    						supported line length.
    					</para></description>
    				</configOption>
    
    				<configOption name="device_state_busy_at" default="0">
    
    					<synopsis>The number of in-use channels which will cause busy to be returned as device state</synopsis>
    					<description><para>
    						When the number of in-use channels for the endpoint matches the devicestate_busy_at setting the
    
    						PJSIP channel driver will return busy as the device state instead of in use.
    
    				<configOption name="t38_udptl" default="no">
    
    					<synopsis>Whether T.38 UDPTL support is enabled or not</synopsis>
    					<description><para>
    						If set to yes T.38 UDPTL support will be enabled, and T.38 negotiation requests will be accepted
    						and relayed.
    					</para></description>
    				</configOption>
    
    				<configOption name="t38_udptl_ec" default="none">
    
    					<synopsis>T.38 UDPTL error correction method</synopsis>
    					<description>
    						<enumlist>
    							<enum name="none"><para>
    								No error correction should be used.
    							</para></enum>
    							<enum name="fec"><para>
    								Forward error correction should be used.
    							</para></enum>
    							<enum name="redundancy"><para>
    
    								Redundancy error correction should be used.
    
    							</para></enum>
    						</enumlist>
    					</description>
    				</configOption>
    
    				<configOption name="t38_udptl_maxdatagram" default="0">
    
    					<synopsis>T.38 UDPTL maximum datagram size</synopsis>
    					<description><para>
    						This option can be set to override the maximum datagram of a remote endpoint for broken
    						endpoints.
    					</para></description>
    				</configOption>
    
    				<configOption name="fax_detect" default="no">
    
    					<synopsis>Whether CNG tone detection is enabled</synopsis>
    					<description><para>
    						This option can be set to send the session to the fax extension when a CNG tone is
    						detected.
    					</para></description>
    				</configOption>
    
    				<configOption name="fax_detect_timeout">
    					<synopsis>How long into a call before fax_detect is disabled for the call</synopsis>
    					<description><para>
    						The option determines how many seconds into a call before the
    						fax_detect option is disabled for the call.  Setting the value
    						to zero disables the timeout.
    					</para></description>
    				</configOption>
    
    				<configOption name="t38_udptl_nat" default="no">
    
    					<synopsis>Whether NAT support is enabled on UDPTL sessions</synopsis>
    					<description><para>
    						When enabled the UDPTL stack will send UDPTL packets to the source address of
    						received packets.
    					</para></description>
    				</configOption>
    
    				<configOption name="t38_udptl_ipv6" default="no">
    
    					<synopsis>Whether IPv6 is used for UDPTL Sessions</synopsis>
    					<description><para>
    						When enabled the UDPTL stack will use IPv6.
    					</para></description>
    				</configOption>
    
    				<configOption name="t38_bind_udptl_to_media_address" default="no">
    					<synopsis>Bind the UDPTL instance to the media_adress</synopsis>
    					<description><para>
    						If media_address is specified, this option causes the UDPTL instance to be bound to
    						the specified ip address which causes the packets to be sent from that address.
    					</para></description>
    				</configOption>
    
    				<configOption name="tone_zone">
    
    					<synopsis>Set which country's indications to use for channels created for this endpoint.</synopsis>
    				</configOption>
    				<configOption name="language">
    					<synopsis>Set the default language to use for channels created for this endpoint.</synopsis>
    				</configOption>
    				<configOption name="one_touch_recording" default="no">
    					<synopsis>Determines whether one-touch recording is allowed for this endpoint.</synopsis>
    					<see-also>
    
    						<ref type="configOption">record_on_feature</ref>
    						<ref type="configOption">record_off_feature</ref>
    
    					</see-also>
    				</configOption>
    
    				<configOption name="record_on_feature" default="automixmon">
    
    					<synopsis>The feature to enact when one-touch recording is turned on.</synopsis>
    					<description>
    						<para>When an INFO request for one-touch recording arrives with a Record header set to "on", this
    						feature will be enabled for the channel. The feature designated here can be any built-in
    						or dynamic feature defined in features.conf.</para>
    						<note><para>This setting has no effect if the endpoint's one_touch_recording option is disabled</para></note>
    					</description>
    					<see-also>
    						<ref type="configOption">one_touch_recording</ref>
    
    						<ref type="configOption">record_off_feature</ref>
    
    					</see-also>
    				</configOption>
    
    				<configOption name="record_off_feature" default="automixmon">
    
    					<synopsis>The feature to enact when one-touch recording is turned off.</synopsis>
    					<description>
    						<para>When an INFO request for one-touch recording arrives with a Record header set to "off", this
    						feature will be enabled for the channel. The feature designated here can be any built-in
    						or dynamic feature defined in features.conf.</para>
    						<note><para>This setting has no effect if the endpoint's one_touch_recording option is disabled</para></note>
    					</description>
    					<see-also>
    						<ref type="configOption">one_touch_recording</ref>
    
    						<ref type="configOption">record_on_feature</ref>
    
    					</see-also>
    				</configOption>
    
    				<configOption name="rtp_engine" default="asterisk">
    
    					<synopsis>Name of the RTP engine to use for channels created for this endpoint</synopsis>
    				</configOption>
    
    				<configOption name="allow_transfer" default="yes">
    
    					<synopsis>Determines whether SIP REFER transfers are allowed for this endpoint</synopsis>
    				</configOption>
    
    				<configOption name="user_eq_phone" default="no">
    					<synopsis>Determines whether a user=phone parameter is placed into the request URI if the user is determined to be a phone number</synopsis>
    				</configOption>
    
    				<configOption name="moh_passthrough" default="no">
    					<synopsis>Determines whether hold and unhold will be passed through using re-INVITEs with recvonly and sendrecv to the remote side</synopsis>
    				</configOption>