res_pjsip_session/res_pjsip_sdp_rtp: Be more tolerant of offers
[asterisk/asterisk.git] / res / res_pjsip.c
1 /*
2  * Asterisk -- An open source telephony toolkit.
3  *
4  * Copyright (C) 2013, Digium, Inc.
5  *
6  * Mark Michelson <mmichelson@digium.com>
7  *
8  * See http://www.asterisk.org for more information about
9  * the Asterisk project. Please do not directly contact
10  * any of the maintainers of this project for assistance;
11  * the project provides a web site, mailing lists and IRC
12  * channels for your use.
13  *
14  * This program is free software, distributed under the terms of
15  * the GNU General Public License Version 2. See the LICENSE file
16  * at the top of the source tree.
17  */
18
19 #include "asterisk.h"
20
21 #include <pjsip.h>
22 /* Needed for SUBSCRIBE, NOTIFY, and PUBLISH method definitions */
23 #include <pjsip_simple.h>
24 #include <pjlib.h>
25
26 #include "asterisk/res_pjsip.h"
27 #include "res_pjsip/include/res_pjsip_private.h"
28 #include "asterisk/linkedlists.h"
29 #include "asterisk/logger.h"
30 #include "asterisk/lock.h"
31 #include "asterisk/utils.h"
32 #include "asterisk/astobj2.h"
33 #include "asterisk/module.h"
34 #include "asterisk/threadpool.h"
35 #include "asterisk/taskprocessor.h"
36 #include "asterisk/uuid.h"
37 #include "asterisk/sorcery.h"
38 #include "asterisk/file.h"
39
40 /*** MODULEINFO
41         <depend>pjproject</depend>
42         <depend>res_sorcery_config</depend>
43         <support_level>core</support_level>
44  ***/
45
46 /*** DOCUMENTATION
47         <configInfo name="res_pjsip" language="en_US">
48                 <synopsis>SIP Resource using PJProject</synopsis>
49                 <configFile name="pjsip.conf">
50                         <configObject name="endpoint">
51                                 <synopsis>Endpoint</synopsis>
52                                 <description><para>
53                                         The <emphasis>Endpoint</emphasis> is the primary configuration object.
54                                         It contains the core SIP related options only, endpoints are <emphasis>NOT</emphasis>
55                                         dialable entries of their own. Communication with another SIP device is
56                                         accomplished via Addresses of Record (AoRs) which have one or more
57                                         contacts assicated with them. Endpoints <emphasis>NOT</emphasis> configured to
58                                         use a <literal>transport</literal> will default to first transport found
59                                         in <filename>pjsip.conf</filename> that matches its type.
60                                         </para>
61                                         <para>Example: An Endpoint has been configured with no transport.
62                                         When it comes time to call an AoR, PJSIP will find the
63                                         first transport that matches the type. A SIP URI of <literal>sip:5000@[11::33]</literal>
64                                         will use the first IPv6 transport and try to send the request.
65                                         </para>
66                                         <para>If the anonymous endpoint identifier is in use an endpoint with the name
67                                         "anonymous@domain" will be searched for as a last resort. If this is not found
68                                         it will fall back to searching for "anonymous". If neither endpoints are found
69                                         the anonymous endpoint identifier will not return an endpoint and anonymous
70                                         calling will not be possible.
71                                         </para>
72                                 </description>
73                                 <configOption name="100rel" default="yes">
74                                         <synopsis>Allow support for RFC3262 provisional ACK tags</synopsis>
75                                         <description>
76                                                 <enumlist>
77                                                         <enum name="no" />
78                                                         <enum name="required" />
79                                                         <enum name="yes" />
80                                                 </enumlist>
81                                         </description>
82                                 </configOption>
83                                 <configOption name="aggregate_mwi" default="yes">
84                                         <synopsis>Condense MWI notifications into a single NOTIFY.</synopsis>
85                                         <description><para>When enabled, <replaceable>aggregate_mwi</replaceable> condenses message
86                                         waiting notifications from multiple mailboxes into a single NOTIFY. If it is disabled,
87                                         individual NOTIFYs are sent for each mailbox.</para></description>
88                                 </configOption>
89                                 <configOption name="allow">
90                                         <synopsis>Media Codec(s) to allow</synopsis>
91                                 </configOption>
92                                 <configOption name="aors">
93                                         <synopsis>AoR(s) to be used with the endpoint</synopsis>
94                                         <description><para>
95                                                 List of comma separated AoRs that the endpoint should be associated with.
96                                         </para></description>
97                                 </configOption>
98                                 <configOption name="auth">
99                                         <synopsis>Authentication Object(s) associated with the endpoint</synopsis>
100                                         <description><para>
101                                                 This is a comma-delimited list of <replaceable>auth</replaceable> sections defined
102                                                 in <filename>pjsip.conf</filename> to be used to verify inbound connection attempts.
103                                                 </para><para>
104                                                 Endpoints without an <literal>authentication</literal> object
105                                                 configured will allow connections without vertification.
106                                         </para></description>
107                                 </configOption>
108                                 <configOption name="callerid">
109                                         <synopsis>CallerID information for the endpoint</synopsis>
110                                         <description><para>
111                                                 Must be in the format <literal>Name &lt;Number&gt;</literal>,
112                                                 or only <literal>&lt;Number&gt;</literal>.
113                                         </para></description>
114                                 </configOption>
115                                 <configOption name="callerid_privacy">
116                                         <synopsis>Default privacy level</synopsis>
117                                         <description>
118                                                 <enumlist>
119                                                         <enum name="allowed_not_screened" />
120                                                         <enum name="allowed_passed_screen" />
121                                                         <enum name="allowed_failed_screen" />
122                                                         <enum name="allowed" />
123                                                         <enum name="prohib_not_screened" />
124                                                         <enum name="prohib_passed_screen" />
125                                                         <enum name="prohib_failed_screen" />
126                                                         <enum name="prohib" />
127                                                         <enum name="unavailable" />
128                                                 </enumlist>
129                                         </description>
130                                 </configOption>
131                                 <configOption name="callerid_tag">
132                                         <synopsis>Internal id_tag for the endpoint</synopsis>
133                                 </configOption>
134                                 <configOption name="context">
135                                         <synopsis>Dialplan context for inbound sessions</synopsis>
136                                 </configOption>
137                                 <configOption name="direct_media_glare_mitigation" default="none">
138                                         <synopsis>Mitigation of direct media (re)INVITE glare</synopsis>
139                                         <description>
140                                                 <para>
141                                                 This setting attempts to avoid creating INVITE glare scenarios
142                                                 by disabling direct media reINVITEs in one direction thereby allowing
143                                                 designated servers (according to this option) to initiate direct
144                                                 media reINVITEs without contention and significantly reducing call
145                                                 setup time.
146                                                 </para>
147                                                 <para>
148                                                 A more detailed description of how this option functions can be found on
149                                                 the Asterisk wiki https://wiki.asterisk.org/wiki/display/AST/SIP+Direct+Media+Reinvite+Glare+Avoidance
150                                                 </para>
151                                                 <enumlist>
152                                                         <enum name="none" />
153                                                         <enum name="outgoing" />
154                                                         <enum name="incoming" />
155                                                 </enumlist>
156                                         </description>
157                                 </configOption>
158                                 <configOption name="direct_media_method" default="invite">
159                                         <synopsis>Direct Media method type</synopsis>
160                                         <description>
161                                                 <para>Method for setting up Direct Media between endpoints.</para>
162                                                 <enumlist>
163                                                         <enum name="invite" />
164                                                         <enum name="reinvite">
165                                                                 <para>Alias for the <literal>invite</literal> value.</para>
166                                                         </enum>
167                                                         <enum name="update" />
168                                                 </enumlist>
169                                         </description>
170                                 </configOption>
171                                 <configOption name="connected_line_method" default="invite">
172                                         <synopsis>Connected line method type</synopsis>
173                                         <description>
174                                                 <para>Method used when updating connected line information.</para>
175                                                 <enumlist>
176                                                         <enum name="invite" />
177                                                         <enum name="reinvite">
178                                                                 <para>Alias for the <literal>invite</literal> value.</para>
179                                                         </enum>
180                                                         <enum name="update" />
181                                                 </enumlist>
182                                         </description>
183                                 </configOption>
184                                 <configOption name="direct_media" default="yes">
185                                         <synopsis>Determines whether media may flow directly between endpoints.</synopsis>
186                                 </configOption>
187                                 <configOption name="disable_direct_media_on_nat" default="no">
188                                         <synopsis>Disable direct media session refreshes when NAT obstructs the media session</synopsis>
189                                 </configOption>
190                                 <configOption name="disallow">
191                                         <synopsis>Media Codec(s) to disallow</synopsis>
192                                 </configOption>
193                                 <configOption name="dtmf_mode" default="rfc4733">
194                                         <synopsis>DTMF mode</synopsis>
195                                         <description>
196                                                 <para>This setting allows to choose the DTMF mode for endpoint communication.</para>
197                                                 <enumlist>
198                                                         <enum name="rfc4733">
199                                                                 <para>DTMF is sent out of band of the main audio stream.This
200                                                                 supercedes the older <emphasis>RFC-2833</emphasis> used within
201                                                                 the older <literal>chan_sip</literal>.</para>
202                                                         </enum>
203                                                         <enum name="inband">
204                                                                 <para>DTMF is sent as part of audio stream.</para>
205                                                         </enum>
206                                                         <enum name="info">
207                                                                 <para>DTMF is sent as SIP INFO packets.</para>
208                                                         </enum>
209                                                 </enumlist>
210                                         </description>
211                                 </configOption>
212                                 <configOption name="media_address">
213                                         <synopsis>IP address used in SDP for media handling</synopsis>
214                                         <description><para>
215                                                 At the time of SDP creation, the IP address defined here will be used as
216                                                 the media address for individual streams in the SDP.
217                                         </para>
218                                         <note><para>
219                                                 Be aware that the <literal>external_media_address</literal> option, set in Transport
220                                                 configuration, can also affect the final media address used in the SDP.
221                                         </para></note>
222                                         </description>
223                                 </configOption>
224                                 <configOption name="force_rport" default="yes">
225                                         <synopsis>Force use of return port</synopsis>
226                                 </configOption>
227                                 <configOption name="ice_support" default="no">
228                                         <synopsis>Enable the ICE mechanism to help traverse NAT</synopsis>
229                                 </configOption>
230                                 <configOption name="identify_by" default="username,location">
231                                         <synopsis>Way(s) for Endpoint to be identified</synopsis>
232                                         <description><para>
233                                                 An endpoint can be identified in multiple ways. Currently, the only supported
234                                                 option is <literal>username</literal>, which matches the endpoint based on the
235                                                 username in the From header.
236                                                 </para>
237                                                 <note><para>Endpoints can also be identified by IP address; however, that method
238                                                 of identification is not handled by this configuration option. See the documentation
239                                                 for the <literal>identify</literal> configuration section for more details on that
240                                                 method of endpoint identification. If this option is set to <literal>username</literal>
241                                                 and an <literal>identify</literal> configuration section exists for the endpoint, then
242                                                 the endpoint can be identified in multiple ways.</para></note>
243                                                 <enumlist>
244                                                         <enum name="username" />
245                                                 </enumlist>
246                                         </description>
247                                 </configOption>
248                                 <configOption name="redirect_method">
249                                         <synopsis>How redirects received from an endpoint are handled</synopsis>
250                                         <description><para>
251                                                 When a redirect is received from an endpoint there are multiple ways it can be handled.
252                                                 If this option is set to <literal>user</literal> the user portion of the redirect target
253                                                 is treated as an extension within the dialplan and dialed using a Local channel. If this option
254                                                 is set to <literal>uri_core</literal> the target URI is returned to the dialing application
255                                                 which dials it using the PJSIP channel driver and endpoint originally used. If this option is
256                                                 set to <literal>uri_pjsip</literal> the redirect occurs within chan_pjsip itself and is not exposed
257                                                 to the core at all. The <literal>uri_pjsip</literal> option has the benefit of being more efficient
258                                                 and also supporting multiple potential redirect targets. The con is that since redirection occurs
259                                                 within chan_pjsip redirecting information is not forwarded and redirection can not be
260                                                 prevented.
261                                                 </para>
262                                                 <enumlist>
263                                                         <enum name="user" />
264                                                         <enum name="uri_core" />
265                                                         <enum name="uri_pjsip" />
266                                                 </enumlist>
267                                         </description>
268                                 </configOption>
269                                 <configOption name="mailboxes">
270                                         <synopsis>NOTIFY the endpoint when state changes for any of the specified mailboxes</synopsis>
271                                         <description><para>
272                                                 Asterisk will send unsolicited MWI NOTIFY messages to the endpoint when state
273                                                 changes happen for any of the specified mailboxes. More than one mailbox can be
274                                                 specified with a comma-delimited string. app_voicemail mailboxes must be specified
275                                                 as mailbox@context; for example: mailboxes=6001@default. For mailboxes provided by
276                                                 external sources, such as through the res_external_mwi module, you must specify
277                                                 strings supported by the external system.
278                                         </para><para>
279                                                 For endpoints that SUBSCRIBE for MWI, use the <literal>mailboxes</literal> option in your AOR
280                                                 configuration.
281                                         </para></description>
282                                 </configOption>
283                                 <configOption name="moh_suggest" default="default">
284                                         <synopsis>Default Music On Hold class</synopsis>
285                                 </configOption>
286                                 <configOption name="outbound_auth">
287                                         <synopsis>Authentication object used for outbound requests</synopsis>
288                                 </configOption>
289                                 <configOption name="outbound_proxy">
290                                         <synopsis>Proxy through which to send requests, a full SIP URI must be provided</synopsis>
291                                 </configOption>
292                                 <configOption name="rewrite_contact">
293                                         <synopsis>Allow Contact header to be rewritten with the source IP address-port</synopsis>
294                                         <description><para>
295                                                 On inbound SIP messages from this endpoint, the Contact header will be changed to have the
296                                                 source IP address and port. This option does not affect outbound messages send to this
297                                                 endpoint.
298                                         </para></description>
299                                 </configOption>
300                                 <configOption name="rtp_ipv6" default="no">
301                                         <synopsis>Allow use of IPv6 for RTP traffic</synopsis>
302                                 </configOption>
303                                 <configOption name="rtp_symmetric" default="no">
304                                         <synopsis>Enforce that RTP must be symmetric</synopsis>
305                                 </configOption>
306                                 <configOption name="send_diversion" default="yes">
307                                         <synopsis>Send the Diversion header, conveying the diversion
308                                         information to the called user agent</synopsis>
309                                 </configOption>
310                                 <configOption name="send_pai" default="no">
311                                         <synopsis>Send the P-Asserted-Identity header</synopsis>
312                                 </configOption>
313                                 <configOption name="send_rpid" default="no">
314                                         <synopsis>Send the Remote-Party-ID header</synopsis>
315                                 </configOption>
316                                 <configOption name="timers_min_se" default="90">
317                                         <synopsis>Minimum session timers expiration period</synopsis>
318                                         <description><para>
319                                                 Minimium session timer expiration period. Time in seconds.
320                                         </para></description>
321                                 </configOption>
322                                 <configOption name="timers" default="yes">
323                                         <synopsis>Session timers for SIP packets</synopsis>
324                                         <description>
325                                                 <enumlist>
326                                                         <enum name="forced" />
327                                                         <enum name="no" />
328                                                         <enum name="required" />
329                                                         <enum name="yes" />
330                                                 </enumlist>
331                                         </description>
332                                 </configOption>
333                                 <configOption name="timers_sess_expires" default="1800">
334                                         <synopsis>Maximum session timer expiration period</synopsis>
335                                         <description><para>
336                                                 Maximium session timer expiration period. Time in seconds.
337                                         </para></description>
338                                 </configOption>
339                                 <configOption name="transport">
340                                         <synopsis>Desired transport configuration</synopsis>
341                                         <description><para>
342                                                 This will set the desired transport configuration to send SIP data through.
343                                                 </para>
344                                                 <warning><para>Not specifying a transport will <emphasis>DEFAULT</emphasis>
345                                                 to the first configured transport in <filename>pjsip.conf</filename> which is
346                                                 valid for the URI we are trying to contact.
347                                                 </para></warning>
348                                                 <warning><para>Transport configuration is not affected by reloads. In order to
349                                                 change transports, a full Asterisk restart is required</para></warning>
350                                         </description>
351                                 </configOption>
352                                 <configOption name="trust_id_inbound" default="no">
353                                         <synopsis>Accept identification information received from this endpoint</synopsis>
354                                         <description><para>This option determines whether Asterisk will accept
355                                         identification from the endpoint from headers such as P-Asserted-Identity
356                                         or Remote-Party-ID header. This option applies both to calls originating from the
357                                         endpoint and calls originating from Asterisk. If <literal>no</literal>, the
358                                         configured Caller-ID from pjsip.conf will always be used as the identity for
359                                         the endpoint.</para></description>
360                                 </configOption>
361                                 <configOption name="trust_id_outbound" default="no">
362                                         <synopsis>Send private identification details to the endpoint.</synopsis>
363                                         <description><para>This option determines whether res_pjsip will send private
364                                         identification information to the endpoint. If <literal>no</literal>,
365                                         private Caller-ID information will not be forwarded to the endpoint.
366                                         "Private" in this case refers to any method of restricting identification.
367                                         Example: setting <replaceable>callerid_privacy</replaceable> to any
368                                         <literal>prohib</literal> variation.
369                                         Example: If <replaceable>trust_id_inbound</replaceable> is set to
370                                         <literal>yes</literal>, the presence of a <literal>Privacy: id</literal>
371                                         header in a SIP request or response would indicate the identification
372                                         provided in the request is private.</para></description>
373                                 </configOption>
374                                 <configOption name="type">
375                                         <synopsis>Must be of type 'endpoint'.</synopsis>
376                                 </configOption>
377                                 <configOption name="use_ptime" default="no">
378                                         <synopsis>Use Endpoint's requested packetisation interval</synopsis>
379                                 </configOption>
380                                 <configOption name="use_avpf" default="no">
381                                         <synopsis>Determines whether res_pjsip will use and enforce usage of AVPF for this
382                                         endpoint.</synopsis>
383                                         <description><para>
384                                                 If set to <literal>yes</literal>, res_pjsip will use the AVPF or SAVPF RTP
385                                                 profile for all media offers on outbound calls and media updates and will
386                                                 decline media offers not using the AVPF or SAVPF profile.
387                                         </para><para>
388                                                 If set to <literal>no</literal>, res_pjsip will use the AVP or SAVP RTP
389                                                 profile for all media offers on outbound calls and media updates, and will
390                                                 decline media offers not using the AVP or SAVP profile.
391                                         </para></description>
392                                 </configOption>
393                                 <configOption name="force_avp" default="no">
394                                         <synopsis>Determines whether res_pjsip will use and enforce usage of AVP,
395                                         regardless of the RTP profile in use for this endpoint.</synopsis>
396                                         <description><para>
397                                                 If set to <literal>yes</literal>, res_pjsip will use the AVP, AVPF, SAVP, or
398                                                 SAVPF RTP profile for all media offers on outbound calls and media updates including
399                                                 those for DTLS-SRTP streams.
400                                         </para><para>
401                                                 If set to <literal>no</literal>, res_pjsip will use the respective RTP profile
402                                                 depending on configuration.
403                                         </para></description>
404                                 </configOption>
405                                 <configOption name="media_use_received_transport" default="no">
406                                         <synopsis>Determines whether res_pjsip will use the media transport received in the
407                                         offer SDP in the corresponding answer SDP.</synopsis>
408                                         <description><para>
409                                                 If set to <literal>yes</literal>, res_pjsip will use the received media transport.
410                                         </para><para>
411                                                 If set to <literal>no</literal>, res_pjsip will use the respective RTP profile
412                                                 depending on configuration.
413                                         </para></description>
414                                 </configOption>
415                                 <configOption name="media_encryption" default="no">
416                                         <synopsis>Determines whether res_pjsip will use and enforce usage of media encryption
417                                         for this endpoint.</synopsis>
418                                         <description>
419                                                 <enumlist>
420                                                         <enum name="no"><para>
421                                                                 res_pjsip will offer no encryption and allow no encryption to be setup.
422                                                         </para></enum>
423                                                         <enum name="sdes"><para>
424                                                                 res_pjsip will offer standard SRTP setup via in-SDP keys. Encrypted SIP
425                                                                 transport should be used in conjunction with this option to prevent
426                                                                 exposure of media encryption keys.
427                                                         </para></enum>
428                                                         <enum name="dtls"><para>
429                                                                 res_pjsip will offer DTLS-SRTP setup.
430                                                         </para></enum>
431                                                 </enumlist>
432                                         </description>
433                                 </configOption>
434                                 <configOption name="inband_progress" default="no">
435                                         <synopsis>Determines whether chan_pjsip will indicate ringing using inband
436                                             progress.</synopsis>
437                                         <description><para>
438                                                 If set to <literal>yes</literal>, chan_pjsip will send a 183 Session Progress
439                                                 when told to indicate ringing and will immediately start sending ringing
440                                                 as audio.
441                                         </para><para>
442                                                 If set to <literal>no</literal>, chan_pjsip will send a 180 Ringing when told
443                                                 to indicate ringing and will NOT send it as audio.
444                                         </para></description>
445                                 </configOption>
446                                 <configOption name="call_group">
447                                         <synopsis>The numeric pickup groups for a channel.</synopsis>
448                                         <description><para>
449                                                 Can be set to a comma separated list of numbers or ranges between the values
450                                                 of 0-63 (maximum of 64 groups).
451                                         </para></description>
452                                 </configOption>
453                                 <configOption name="pickup_group">
454                                         <synopsis>The numeric pickup groups that a channel can pickup.</synopsis>
455                                         <description><para>
456                                                 Can be set to a comma separated list of numbers or ranges between the values
457                                                 of 0-63 (maximum of 64 groups).
458                                         </para></description>
459                                 </configOption>
460                                 <configOption name="named_call_group">
461                                         <synopsis>The named pickup groups for a channel.</synopsis>
462                                         <description><para>
463                                                 Can be set to a comma separated list of case sensitive strings limited by
464                                                 supported line length.
465                                         </para></description>
466                                 </configOption>
467                                 <configOption name="named_pickup_group">
468                                         <synopsis>The named pickup groups that a channel can pickup.</synopsis>
469                                         <description><para>
470                                                 Can be set to a comma separated list of case sensitive strings limited by
471                                                 supported line length.
472                                         </para></description>
473                                 </configOption>
474                                 <configOption name="device_state_busy_at" default="0">
475                                         <synopsis>The number of in-use channels which will cause busy to be returned as device state</synopsis>
476                                         <description><para>
477                                                 When the number of in-use channels for the endpoint matches the devicestate_busy_at setting the
478                                                 PJSIP channel driver will return busy as the device state instead of in use.
479                                         </para></description>
480                                 </configOption>
481                                 <configOption name="t38_udptl" default="no">
482                                         <synopsis>Whether T.38 UDPTL support is enabled or not</synopsis>
483                                         <description><para>
484                                                 If set to yes T.38 UDPTL support will be enabled, and T.38 negotiation requests will be accepted
485                                                 and relayed.
486                                         </para></description>
487                                 </configOption>
488                                 <configOption name="t38_udptl_ec" default="none">
489                                         <synopsis>T.38 UDPTL error correction method</synopsis>
490                                         <description>
491                                                 <enumlist>
492                                                         <enum name="none"><para>
493                                                                 No error correction should be used.
494                                                         </para></enum>
495                                                         <enum name="fec"><para>
496                                                                 Forward error correction should be used.
497                                                         </para></enum>
498                                                         <enum name="redundancy"><para>
499                                                                 Redundacy error correction should be used.
500                                                         </para></enum>
501                                                 </enumlist>
502                                         </description>
503                                 </configOption>
504                                 <configOption name="t38_udptl_maxdatagram" default="0">
505                                         <synopsis>T.38 UDPTL maximum datagram size</synopsis>
506                                         <description><para>
507                                                 This option can be set to override the maximum datagram of a remote endpoint for broken
508                                                 endpoints.
509                                         </para></description>
510                                 </configOption>
511                                 <configOption name="fax_detect" default="no">
512                                         <synopsis>Whether CNG tone detection is enabled</synopsis>
513                                         <description><para>
514                                                 This option can be set to send the session to the fax extension when a CNG tone is
515                                                 detected.
516                                         </para></description>
517                                 </configOption>
518                                 <configOption name="t38_udptl_nat" default="no">
519                                         <synopsis>Whether NAT support is enabled on UDPTL sessions</synopsis>
520                                         <description><para>
521                                                 When enabled the UDPTL stack will send UDPTL packets to the source address of
522                                                 received packets.
523                                         </para></description>
524                                 </configOption>
525                                 <configOption name="t38_udptl_ipv6" default="no">
526                                         <synopsis>Whether IPv6 is used for UDPTL Sessions</synopsis>
527                                         <description><para>
528                                                 When enabled the UDPTL stack will use IPv6.
529                                         </para></description>
530                                 </configOption>
531                                 <configOption name="tone_zone">
532                                         <synopsis>Set which country's indications to use for channels created for this endpoint.</synopsis>
533                                 </configOption>
534                                 <configOption name="language">
535                                         <synopsis>Set the default language to use for channels created for this endpoint.</synopsis>
536                                 </configOption>
537                                 <configOption name="one_touch_recording" default="no">
538                                         <synopsis>Determines whether one-touch recording is allowed for this endpoint.</synopsis>
539                                         <see-also>
540                                                 <ref type="configOption">record_on_feature</ref>
541                                                 <ref type="configOption">record_off_feature</ref>
542                                         </see-also>
543                                 </configOption>
544                                 <configOption name="record_on_feature" default="automixmon">
545                                         <synopsis>The feature to enact when one-touch recording is turned on.</synopsis>
546                                         <description>
547                                                 <para>When an INFO request for one-touch recording arrives with a Record header set to "on", this
548                                                 feature will be enabled for the channel. The feature designated here can be any built-in
549                                                 or dynamic feature defined in features.conf.</para>
550                                                 <note><para>This setting has no effect if the endpoint's one_touch_recording option is disabled</para></note>
551                                         </description>
552                                         <see-also>
553                                                 <ref type="configOption">one_touch_recording</ref>
554                                                 <ref type="configOption">record_off_feature</ref>
555                                         </see-also>
556                                 </configOption>
557                                 <configOption name="record_off_feature" default="automixmon">
558                                         <synopsis>The feature to enact when one-touch recording is turned off.</synopsis>
559                                         <description>
560                                                 <para>When an INFO request for one-touch recording arrives with a Record header set to "off", this
561                                                 feature will be enabled for the channel. The feature designated here can be any built-in
562                                                 or dynamic feature defined in features.conf.</para>
563                                                 <note><para>This setting has no effect if the endpoint's one_touch_recording option is disabled</para></note>
564                                         </description>
565                                         <see-also>
566                                                 <ref type="configOption">one_touch_recording</ref>
567                                                 <ref type="configOption">record_on_feature</ref>
568                                         </see-also>
569                                 </configOption>
570                                 <configOption name="rtp_engine" default="asterisk">
571                                         <synopsis>Name of the RTP engine to use for channels created for this endpoint</synopsis>
572                                 </configOption>
573                                 <configOption name="allow_transfer" default="yes">
574                                         <synopsis>Determines whether SIP REFER transfers are allowed for this endpoint</synopsis>
575                                 </configOption>
576                                 <configOption name="user_eq_phone" default="no">
577                                         <synopsis>Determines whether a user=phone parameter is placed into the request URI if the user is determined to be a phone number</synopsis>
578                                 </configOption>
579                                 <configOption name="sdp_owner" default="-">
580                                         <synopsis>String placed as the username portion of an SDP origin (o=) line.</synopsis>
581                                 </configOption>
582                                 <configOption name="sdp_session" default="Asterisk">
583                                         <synopsis>String used for the SDP session (s=) line.</synopsis>
584                                 </configOption>
585                                 <configOption name="tos_audio">
586                                         <synopsis>DSCP TOS bits for audio streams</synopsis>
587                                         <description><para>
588                                                 See https://wiki.asterisk.org/wiki/display/AST/IP+Quality+of+Service for more information about QoS settings
589                                         </para></description>
590                                 </configOption>
591                                 <configOption name="tos_video">
592                                         <synopsis>DSCP TOS bits for video streams</synopsis>
593                                         <description><para>
594                                                 See https://wiki.asterisk.org/wiki/display/AST/IP+Quality+of+Service for more information about QoS settings
595                                         </para></description>
596                                 </configOption>
597                                 <configOption name="cos_audio">
598                                         <synopsis>Priority for audio streams</synopsis>
599                                         <description><para>
600                                                 See https://wiki.asterisk.org/wiki/display/AST/IP+Quality+of+Service for more information about QoS settings
601                                         </para></description>
602                                 </configOption>
603                                 <configOption name="cos_video">
604                                         <synopsis>Priority for video streams</synopsis>
605                                         <description><para>
606                                                 See https://wiki.asterisk.org/wiki/display/AST/IP+Quality+of+Service for more information about QoS settings
607                                         </para></description>
608                                 </configOption>
609                                 <configOption name="allow_subscribe" default="yes">
610                                         <synopsis>Determines if endpoint is allowed to initiate subscriptions with Asterisk.</synopsis>
611                                 </configOption>
612                                 <configOption name="sub_min_expiry" default="60">
613                                         <synopsis>The minimum allowed expiry time for subscriptions initiated by the endpoint.</synopsis>
614                                 </configOption>
615                                 <configOption name="from_user">
616                                         <synopsis>Username to use in From header for requests to this endpoint.</synopsis>
617                                 </configOption>
618                                 <configOption name="mwi_from_user">
619                                         <synopsis>Username to use in From header for unsolicited MWI NOTIFYs to this endpoint.</synopsis>
620                                 </configOption>
621                                 <configOption name="from_domain">
622                                         <synopsis>Domain to user in From header for requests to this endpoint.</synopsis>
623                                 </configOption>
624                                 <configOption name="dtls_verify">
625                                         <synopsis>Verify that the provided peer certificate is valid</synopsis>
626                                         <description><para>
627                                                 This option only applies if <replaceable>media_encryption</replaceable> is
628                                                 set to <literal>dtls</literal>.
629                                         </para></description>
630                                 </configOption>
631                                 <configOption name="dtls_rekey">
632                                         <synopsis>Interval at which to renegotiate the TLS session and rekey the SRTP session</synopsis>
633                                         <description><para>
634                                                 This option only applies if <replaceable>media_encryption</replaceable> is
635                                                 set to <literal>dtls</literal>.
636                                         </para><para>
637                                                 If this is not set or the value provided is 0 rekeying will be disabled.
638                                         </para></description>
639                                 </configOption>
640                                 <configOption name="dtls_cert_file">
641                                         <synopsis>Path to certificate file to present to peer</synopsis>
642                                         <description><para>
643                                                 This option only applies if <replaceable>media_encryption</replaceable> is
644                                                 set to <literal>dtls</literal>.
645                                         </para></description>
646                                 </configOption>
647                                 <configOption name="dtls_private_key">
648                                         <synopsis>Path to private key for certificate file</synopsis>
649                                         <description><para>
650                                                 This option only applies if <replaceable>media_encryption</replaceable> is
651                                                 set to <literal>dtls</literal>.
652                                         </para></description>
653                                 </configOption>
654                                 <configOption name="dtls_cipher">
655                                         <synopsis>Cipher to use for DTLS negotiation</synopsis>
656                                         <description><para>
657                                                 This option only applies if <replaceable>media_encryption</replaceable> is
658                                                 set to <literal>dtls</literal>.
659                                         </para>
660                                         <para>Many options for acceptable ciphers. See link for more:</para>
661                                         <para>http://www.openssl.org/docs/apps/ciphers.html#CIPHER_STRINGS
662                                         </para></description>
663                                 </configOption>
664                                 <configOption name="dtls_ca_file">
665                                         <synopsis>Path to certificate authority certificate</synopsis>
666                                         <description><para>
667                                                 This option only applies if <replaceable>media_encryption</replaceable> is
668                                                 set to <literal>dtls</literal>.
669                                         </para></description>
670                                 </configOption>
671                                 <configOption name="dtls_ca_path">
672                                         <synopsis>Path to a directory containing certificate authority certificates</synopsis>
673                                         <description><para>
674                                                 This option only applies if <replaceable>media_encryption</replaceable> is
675                                                 set to <literal>dtls</literal>.
676                                         </para></description>
677                                 </configOption>
678                                 <configOption name="dtls_setup">
679                                         <synopsis>Whether we are willing to accept connections, connect to the other party, or both.</synopsis>
680                                         <description>
681                                                 <para>
682                                                         This option only applies if <replaceable>media_encryption</replaceable> is
683                                                         set to <literal>dtls</literal>.
684                                                 </para>
685                                                 <enumlist>
686                                                         <enum name="active"><para>
687                                                                 res_pjsip will make a connection to the peer.
688                                                         </para></enum>
689                                                         <enum name="passive"><para>
690                                                                 res_pjsip will accept connections from the peer.
691                                                         </para></enum>
692                                                         <enum name="actpass"><para>
693                                                                 res_pjsip will offer and accept connections from the peer.
694                                                         </para></enum>
695                                                 </enumlist>
696                                         </description>
697                                 </configOption>
698                                 <configOption name="dtls_fingerprint">
699                                         <synopsis>Type of hash to use for the DTLS fingerprint in the SDP.</synopsis>
700                                         <description>
701                                                 <para>
702                                                         This option only applies if <replaceable>media_encryption</replaceable> is
703                                                         set to <literal>dtls</literal>.
704                                                 </para>
705                                                 <enumlist>
706                                                         <enum name="SHA-256"></enum>
707                                                         <enum name="SHA-1"></enum>
708                                                 </enumlist>
709                                         </description>
710                                 </configOption>
711                                 <configOption name="srtp_tag_32">
712                                         <synopsis>Determines whether 32 byte tags should be used instead of 80 byte tags.</synopsis>
713                                         <description><para>
714                                                 This option only applies if <replaceable>media_encryption</replaceable> is
715                                                 set to <literal>sdes</literal> or <literal>dtls</literal>.
716                                         </para></description>
717                                 </configOption>
718                                 <configOption name="set_var">
719                                         <synopsis>Variable set on a channel involving the endpoint.</synopsis>
720                                         <description><para>
721                                                 When a new channel is created using the endpoint set the specified
722                                                 variable(s) on that channel. For multiple channel variables specify
723                                                 multiple 'set_var'(s).
724                                         </para></description>
725                                 </configOption>
726                                 <configOption name="message_context">
727                                         <synopsis>Context to route incoming MESSAGE requests to.</synopsis>
728                                         <description><para>
729                                                 If specified, incoming MESSAGE requests will be routed to the indicated
730                                                 dialplan context. If no <replaceable>message_context</replaceable> is
731                                                 specified, then the <replaceable>context</replaceable> setting is used.
732                                         </para></description>
733                                 </configOption>
734                                 <configOption name="accountcode">
735                                         <synopsis>An accountcode to set automatically on any channels created for this endpoint.</synopsis>
736                                         <description><para>
737                                                 If specified, any channel created for this endpoint will automatically
738                                                 have this accountcode set on it.
739                                         </para></description>
740                                 </configOption>
741                         </configObject>
742                         <configObject name="auth">
743                                 <synopsis>Authentication type</synopsis>
744                                 <description><para>
745                                         Authentication objects hold the authentication information for use
746                                         by other objects such as <literal>endpoints</literal> or <literal>registrations</literal>.
747                                         This also allows for multiple objects to use a single auth object. See
748                                         the <literal>auth_type</literal> config option for password style choices.
749                                 </para></description>
750                                 <configOption name="auth_type" default="userpass">
751                                         <synopsis>Authentication type</synopsis>
752                                         <description><para>
753                                                 This option specifies which of the password style config options should be read
754                                                 when trying to authenticate an endpoint inbound request. If set to <literal>userpass</literal>
755                                                 then we'll read from the 'password' option. For <literal>md5</literal> we'll read
756                                                 from 'md5_cred'.
757                                                 </para>
758                                                 <enumlist>
759                                                         <enum name="md5"/>
760                                                         <enum name="userpass"/>
761                                                 </enumlist>
762                                         </description>
763                                 </configOption>
764                                 <configOption name="nonce_lifetime" default="32">
765                                         <synopsis>Lifetime of a nonce associated with this authentication config.</synopsis>
766                                 </configOption>
767                                 <configOption name="md5_cred">
768                                         <synopsis>MD5 Hash used for authentication.</synopsis>
769                                         <description><para>Only used when auth_type is <literal>md5</literal>.</para></description>
770                                 </configOption>
771                                 <configOption name="password">
772                                         <synopsis>PlainText password used for authentication.</synopsis>
773                                         <description><para>Only used when auth_type is <literal>userpass</literal>.</para></description>
774                                 </configOption>
775                                 <configOption name="realm" default="asterisk">
776                                         <synopsis>SIP realm for endpoint</synopsis>
777                                 </configOption>
778                                 <configOption name="type">
779                                         <synopsis>Must be 'auth'</synopsis>
780                                 </configOption>
781                                 <configOption name="username">
782                                         <synopsis>Username to use for account</synopsis>
783                                 </configOption>
784                         </configObject>
785                         <configObject name="domain_alias">
786                                 <synopsis>Domain Alias</synopsis>
787                                 <description><para>
788                                         Signifies that a domain is an alias. If the domain on a session is
789                                         not found to match an AoR then this object is used to see if we have
790                                         an alias for the AoR to which the endpoint is binding. This objects
791                                         name as defined in configuration should be the domain alias and a
792                                         config option is provided to specify the domain to be aliased.
793                                 </para></description>
794                                 <configOption name="type">
795                                         <synopsis>Must be of type 'domain_alias'.</synopsis>
796                                 </configOption>
797                                 <configOption name="domain">
798                                         <synopsis>Domain to be aliased</synopsis>
799                                 </configOption>
800                         </configObject>
801                         <configObject name="transport">
802                                 <synopsis>SIP Transport</synopsis>
803                                 <description><para>
804                                         <emphasis>Transports</emphasis>
805                                         </para>
806                                         <para>There are different transports and protocol derivatives
807                                                 supported by <literal>res_pjsip</literal>. They are in order of
808                                                 preference: UDP, TCP, and WebSocket (WS).</para>
809                                         <note><para>Changes to transport configuration in pjsip.conf will only be
810                                                 effected on a complete restart of Asterisk. A module reload
811                                                 will not suffice.</para></note>
812                                 </description>
813                                 <configOption name="async_operations" default="1">
814                                         <synopsis>Number of simultaneous Asynchronous Operations</synopsis>
815                                 </configOption>
816                                 <configOption name="bind">
817                                         <synopsis>IP Address and optional port to bind to for this transport</synopsis>
818                                 </configOption>
819                                 <configOption name="ca_list_file">
820                                         <synopsis>File containing a list of certificates to read (TLS ONLY)</synopsis>
821                                 </configOption>
822                                 <configOption name="cert_file">
823                                         <synopsis>Certificate file for endpoint (TLS ONLY)</synopsis>
824                                 </configOption>
825                                 <configOption name="cipher">
826                                         <synopsis>Preferred cryptography cipher names (TLS ONLY)</synopsis>
827                                         <description>
828                                         <para>Comma separated list of cipher names or numeric equivalents.
829                                                 Numeric equivalents can be either decimal or hexadecimal (0xX).
830                                         </para>
831                                         <para>There are many cipher names.  Use the CLI command
832                                                 <literal>pjsip list ciphers</literal> to see a list of cipher
833                                                 names available for your installation.  See link for more:</para>
834                                         <para>http://www.openssl.org/docs/apps/ciphers.html#CIPHER_SUITE_NAMES
835                                         </para>
836                                         </description>
837                                 </configOption>
838                                 <configOption name="domain">
839                                         <synopsis>Domain the transport comes from</synopsis>
840                                 </configOption>
841                                 <configOption name="external_media_address">
842                                         <synopsis>External IP address to use in RTP handling</synopsis>
843                                         <description><para>
844                                                 When a request or response is sent out, if the destination of the
845                                                 message is outside the IP network defined in the option <literal>localnet</literal>,
846                                                 and the media address in the SDP is within the localnet network, then the
847                                                 media address in the SDP will be rewritten to the value defined for
848                                                 <literal>external_media_address</literal>.
849                                         </para></description>
850                                 </configOption>
851                                 <configOption name="external_signaling_address">
852                                         <synopsis>External address for SIP signalling</synopsis>
853                                 </configOption>
854                                 <configOption name="external_signaling_port" default="0">
855                                         <synopsis>External port for SIP signalling</synopsis>
856                                 </configOption>
857                                 <configOption name="method">
858                                         <synopsis>Method of SSL transport (TLS ONLY)</synopsis>
859                                         <description>
860                                                 <enumlist>
861                                                         <enum name="default" />
862                                                         <enum name="unspecified" />
863                                                         <enum name="tlsv1" />
864                                                         <enum name="sslv2" />
865                                                         <enum name="sslv3" />
866                                                         <enum name="sslv23" />
867                                                 </enumlist>
868                                         </description>
869                                 </configOption>
870                                 <configOption name="local_net">
871                                         <synopsis>Network to consider local (used for NAT purposes).</synopsis>
872                                         <description><para>This must be in CIDR or dotted decimal format with the IP
873                                         and mask separated with a slash ('/').</para></description>
874                                 </configOption>
875                                 <configOption name="password">
876                                         <synopsis>Password required for transport</synopsis>
877                                 </configOption>
878                                 <configOption name="priv_key_file">
879                                         <synopsis>Private key file (TLS ONLY)</synopsis>
880                                 </configOption>
881                                 <configOption name="protocol" default="udp">
882                                         <synopsis>Protocol to use for SIP traffic</synopsis>
883                                         <description>
884                                                 <enumlist>
885                                                         <enum name="udp" />
886                                                         <enum name="tcp" />
887                                                         <enum name="tls" />
888                                                         <enum name="ws" />
889                                                         <enum name="wss" />
890                                                 </enumlist>
891                                         </description>
892                                 </configOption>
893                                 <configOption name="require_client_cert" default="false">
894                                         <synopsis>Require client certificate (TLS ONLY)</synopsis>
895                                 </configOption>
896                                 <configOption name="type">
897                                         <synopsis>Must be of type 'transport'.</synopsis>
898                                 </configOption>
899                                 <configOption name="verify_client" default="false">
900                                         <synopsis>Require verification of client certificate (TLS ONLY)</synopsis>
901                                 </configOption>
902                                 <configOption name="verify_server" default="false">
903                                         <synopsis>Require verification of server certificate (TLS ONLY)</synopsis>
904                                 </configOption>
905                                 <configOption name="tos" default="false">
906                                         <synopsis>Enable TOS for the signalling sent over this transport</synopsis>
907                                         <description>
908                                         <para>See <literal>https://wiki.asterisk.org/wiki/display/AST/IP+Quality+of+Service</literal>
909                                         for more information on this parameter.</para>
910                                         <note><para>This option does not apply to the <replaceable>ws</replaceable>
911                                         or the <replaceable>wss</replaceable> protocols.</para></note>
912                                         </description>
913                                 </configOption>
914                                 <configOption name="cos" default="false">
915                                         <synopsis>Enable COS for the signalling sent over this transport</synopsis>
916                                         <description>
917                                         <para>See <literal>https://wiki.asterisk.org/wiki/display/AST/IP+Quality+of+Service</literal>
918                                         for more information on this parameter.</para>
919                                         <note><para>This option does not apply to the <replaceable>ws</replaceable>
920                                         or the <replaceable>wss</replaceable> protocols.</para></note>
921                                         </description>
922                                 </configOption>
923                                 <configOption name="websocket_write_timeout">
924                                         <synopsis>The timeout (in milliseconds) to set on WebSocket connections.</synopsis>
925                                         <description>
926                                                 <para>If a websocket connection accepts input slowly, the timeout
927                                                 for writes to it can be increased to keep it from being disconnected.
928                                                 Value is in milliseconds; default is 100 ms.</para>
929                                         </description>
930                                 </configOption>
931                         </configObject>
932                         <configObject name="contact">
933                                 <synopsis>A way of creating an aliased name to a SIP URI</synopsis>
934                                 <description><para>
935                                         Contacts are a way to hide SIP URIs from the dialplan directly.
936                                         They are also used to make a group of contactable parties when
937                                         in use with <literal>AoR</literal> lists.
938                                 </para></description>
939                                 <configOption name="type">
940                                         <synopsis>Must be of type 'contact'.</synopsis>
941                                 </configOption>
942                                 <configOption name="uri">
943                                         <synopsis>SIP URI to contact peer</synopsis>
944                                 </configOption>
945                                 <configOption name="expiration_time">
946                                         <synopsis>Time to keep alive a contact</synopsis>
947                                         <description><para>
948                                                 Time to keep alive a contact. String style specification.
949                                         </para></description>
950                                 </configOption>
951                                 <configOption name="qualify_frequency" default="0">
952                                         <synopsis>Interval at which to qualify a contact</synopsis>
953                                         <description><para>
954                                                 Interval between attempts to qualify the contact for reachability.
955                                                 If <literal>0</literal> never qualify. Time in seconds.
956                                         </para></description>
957                                 </configOption>
958                                 <configOption name="outbound_proxy">
959                                         <synopsis>Outbound proxy used when sending OPTIONS request</synopsis>
960                                         <description><para>
961                                                 If set the provided URI will be used as the outbound proxy when an
962                                                 OPTIONS request is sent to a contact for qualify purposes.
963                                         </para></description>
964                                 </configOption>
965                                 <configOption name="path">
966                                         <synopsis>Stored Path vector for use in Route headers on outgoing requests.</synopsis>
967                                 </configOption>
968                                 <configOption name="user_agent">
969                                         <synopsis>User-Agent header from registration.</synopsis>
970                                         <description><para>
971                                                 The User-Agent is automatically stored based on data present in incoming SIP
972                                                 REGISTER requests and is not intended to be configured manually.
973                                         </para></description>
974                                 </configOption>
975                         </configObject>
976                         <configObject name="aor">
977                                 <synopsis>The configuration for a location of an endpoint</synopsis>
978                                 <description><para>
979                                         An AoR is what allows Asterisk to contact an endpoint via res_pjsip. If no
980                                         AoRs are specified, an endpoint will not be reachable by Asterisk.
981                                         Beyond that, an AoR has other uses within Asterisk, such as inbound
982                                         registration.
983                                         </para><para>
984                                         An <literal>AoR</literal> is a way to allow dialing a group
985                                         of <literal>Contacts</literal> that all use the same
986                                         <literal>endpoint</literal> for calls.
987                                         </para><para>
988                                         This can be used as another way of grouping a list of contacts to dial
989                                         rather than specifing them each directly when dialing via the dialplan.
990                                         This must be used in conjuction with the <literal>PJSIP_DIAL_CONTACTS</literal>.
991                                         </para><para>
992                                         Registrations: For Asterisk to match an inbound registration to an endpoint,
993                                         the AoR object name must match the user portion of the SIP URI in the "To:"
994                                         header of the inbound SIP registration. That will usually be equivalent
995                                         to the "user name" set in your hard or soft phones configuration.
996                                 </para></description>
997                                 <configOption name="contact">
998                                         <synopsis>Permanent contacts assigned to AoR</synopsis>
999                                         <description><para>
1000                                                 Contacts specified will be called whenever referenced
1001                                                 by <literal>chan_pjsip</literal>.
1002                                                 </para><para>
1003                                                 Use a separate "contact=" entry for each contact required. Contacts
1004                                                 are specified using a SIP URI.
1005                                         </para></description>
1006                                 </configOption>
1007                                 <configOption name="default_expiration" default="3600">
1008                                         <synopsis>Default expiration time in seconds for contacts that are dynamically bound to an AoR.</synopsis>
1009                                 </configOption>
1010                                 <configOption name="mailboxes">
1011                                         <synopsis>Allow subscriptions for the specified mailbox(es)</synopsis>
1012                                         <description><para>This option applies when an external entity subscribes to an AoR
1013                                                 for Message Waiting Indications. The mailboxes specified will be subscribed to.
1014                                                 More than one mailbox can be specified with a comma-delimited string.
1015                                                 app_voicemail mailboxes must be specified as mailbox@context;
1016                                                 for example: mailboxes=6001@default. For mailboxes provided by external sources,
1017                                                 such as through the res_external_mwi module, you must specify strings supported by
1018                                                 the external system.
1019                                         </para><para>
1020                                                 For endpoints that cannot SUBSCRIBE for MWI, you can set the <literal>mailboxes</literal> option in your
1021                                                 endpoint configuration section to enable unsolicited MWI NOTIFYs to the endpoint.
1022                                         </para></description>
1023                                 </configOption>
1024                                 <configOption name="maximum_expiration" default="7200">
1025                                         <synopsis>Maximum time to keep an AoR</synopsis>
1026                                         <description><para>
1027                                                 Maximium time to keep a peer with explicit expiration. Time in seconds.
1028                                         </para></description>
1029                                 </configOption>
1030                                 <configOption name="max_contacts" default="0">
1031                                         <synopsis>Maximum number of contacts that can bind to an AoR</synopsis>
1032                                         <description><para>
1033                                                 Maximum number of contacts that can associate with this AoR. This value does
1034                                                 not affect the number of contacts that can be added with the "contact" option.
1035                                                 It only limits contacts added through external interaction, such as
1036                                                 registration.
1037                                                 </para>
1038                                                 <note><para>This should be set to <literal>1</literal> and
1039                                                 <replaceable>remove_existing</replaceable> set to <literal>yes</literal> if you
1040                                                 wish to stick with the older <literal>chan_sip</literal> behaviour.
1041                                                 </para></note>
1042                                         </description>
1043                                 </configOption>
1044                                 <configOption name="minimum_expiration" default="60">
1045                                         <synopsis>Minimum keep alive time for an AoR</synopsis>
1046                                         <description><para>
1047                                                 Minimum time to keep a peer with an explict expiration. Time in seconds.
1048                                         </para></description>
1049                                 </configOption>
1050                                 <configOption name="remove_existing" default="no">
1051                                         <synopsis>Determines whether new contacts replace existing ones.</synopsis>
1052                                         <description><para>
1053                                                 On receiving a new registration to the AoR should it remove
1054                                                 the existing contact that was registered against it?
1055                                                 </para>
1056                                                 <note><para>This should be set to <literal>yes</literal> and
1057                                                 <replaceable>max_contacts</replaceable> set to <literal>1</literal> if you
1058                                                 wish to stick with the older <literal>chan_sip</literal> behaviour.
1059                                                 </para></note>
1060                                         </description>
1061                                 </configOption>
1062                                 <configOption name="type">
1063                                         <synopsis>Must be of type 'aor'.</synopsis>
1064                                 </configOption>
1065                                 <configOption name="qualify_frequency" default="0">
1066                                         <synopsis>Interval at which to qualify an AoR</synopsis>
1067                                         <description><para>
1068                                                 Interval between attempts to qualify the AoR for reachability.
1069                                                 If <literal>0</literal> never qualify. Time in seconds.
1070                                         </para></description>
1071                                 </configOption>
1072                                 <configOption name="authenticate_qualify" default="no">
1073                                         <synopsis>Authenticates a qualify request if needed</synopsis>
1074                                         <description><para>
1075                                                 If true and a qualify request receives a challenge or authenticate response
1076                                                 authentication is attempted before declaring the contact available.
1077                                         </para></description>
1078                                 </configOption>
1079                                 <configOption name="outbound_proxy">
1080                                         <synopsis>Outbound proxy used when sending OPTIONS request</synopsis>
1081                                         <description><para>
1082                                                 If set the provided URI will be used as the outbound proxy when an
1083                                                 OPTIONS request is sent to a contact for qualify purposes.
1084                                         </para></description>
1085                                 </configOption>
1086                                 <configOption name="support_path">
1087                                         <synopsis>Enables Path support for REGISTER requests and Route support for other requests.</synopsis>
1088                                         <description><para>
1089                                                 When this option is enabled, the Path headers in register requests will be saved
1090                                                 and its contents will be used in Route headers for outbound out-of-dialog requests
1091                                                 and in Path headers for outbound 200 responses. Path support will also be indicated
1092                                                 in the Supported header.
1093                                         </para></description>
1094                                 </configOption>
1095                         </configObject>
1096                         <configObject name="system">
1097                                 <synopsis>Options that apply to the SIP stack as well as other system-wide settings</synopsis>
1098                                 <description><para>
1099                                         The settings in this section are global. In addition to being global, the values will
1100                                         not be re-evaluated when a reload is performed. This is because the values must be set
1101                                         before the SIP stack is initialized. The only way to reset these values is to either
1102                                         restart Asterisk, or unload res_pjsip.so and then load it again.
1103                                 </para></description>
1104                                 <configOption name="timer_t1" default="500">
1105                                         <synopsis>Set transaction timer T1 value (milliseconds).</synopsis>
1106                                         <description><para>
1107                                                 Timer T1 is the base for determining how long to wait before retransmitting
1108                                                 requests that receive no response when using an unreliable transport (e.g. UDP).
1109                                                 For more information on this timer, see RFC 3261, Section 17.1.1.1.
1110                                         </para></description>
1111                                 </configOption>
1112                                 <configOption name="timer_b" default="32000">
1113                                         <synopsis>Set transaction timer B value (milliseconds).</synopsis>
1114                                         <description><para>
1115                                                 Timer B determines the maximum amount of time to wait after sending an INVITE
1116                                                 request before terminating the transaction. It is recommended that this be set
1117                                                 to 64 * Timer T1, but it may be set higher if desired. For more information on
1118                                                 this timer, see RFC 3261, Section 17.1.1.1.
1119                                         </para></description>
1120                                 </configOption>
1121                                 <configOption name="compact_headers" default="no">
1122                                         <synopsis>Use the short forms of common SIP header names.</synopsis>
1123                                 </configOption>
1124                                 <configOption name="threadpool_initial_size" default="0">
1125                                         <synopsis>Initial number of threads in the res_pjsip threadpool.</synopsis>
1126                                 </configOption>
1127                                 <configOption name="threadpool_auto_increment" default="5">
1128                                         <synopsis>The amount by which the number of threads is incremented when necessary.</synopsis>
1129                                 </configOption>
1130                                 <configOption name="threadpool_idle_timeout" default="60">
1131                                         <synopsis>Number of seconds before an idle thread should be disposed of.</synopsis>
1132                                 </configOption>
1133                                 <configOption name="threadpool_max_size" default="0">
1134                                         <synopsis>Maximum number of threads in the res_pjsip threadpool.
1135                                         A value of 0 indicates no maximum.</synopsis>
1136                                 </configOption>
1137                                 <configOption name="type">
1138                                         <synopsis>Must be of type 'system'.</synopsis>
1139                                 </configOption>
1140                         </configObject>
1141                         <configObject name="global">
1142                                 <synopsis>Options that apply globally to all SIP communications</synopsis>
1143                                 <description><para>
1144                                         The settings in this section are global. Unlike options in the <literal>system</literal>
1145                                         section, these options can be refreshed by performing a reload.
1146                                 </para></description>
1147                                 <configOption name="max_forwards" default="70">
1148                                         <synopsis>Value used in Max-Forwards header for SIP requests.</synopsis>
1149                                 </configOption>
1150                                 <configOption name="keep_alive_interval" default="0">
1151                                         <synopsis>The interval (in seconds) to send keepalives to active connection-oriented transports.</synopsis>
1152                                 </configOption>
1153                                 <configOption name="type">
1154                                         <synopsis>Must be of type 'global'.</synopsis>
1155                                 </configOption>
1156                                 <configOption name="user_agent" default="Asterisk &lt;Asterisk Version&gt;">
1157                                         <synopsis>Value used in User-Agent header for SIP requests and Server header for SIP responses.</synopsis>
1158                                 </configOption>
1159                                 <configOption name="default_outbound_endpoint" default="default_outbound_endpoint">
1160                                         <synopsis>Endpoint to use when sending an outbound request to a URI without a specified endpoint.</synopsis>
1161                                 </configOption>
1162                                 <configOption name="debug" default="no">
1163                                         <synopsis>Enable/Disable SIP debug logging.  Valid options include yes|no or
1164                                         a host address</synopsis>
1165                                 </configOption>
1166                         </configObject>
1167                 </configFile>
1168         </configInfo>
1169         <manager name="PJSIPQualify" language="en_US">
1170                 <synopsis>
1171                         Qualify a chan_pjsip endpoint.
1172                 </synopsis>
1173                 <syntax>
1174                         <xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
1175                         <parameter name="Endpoint" required="true">
1176                                 <para>The endpoint you want to qualify.</para>
1177                         </parameter>
1178                 </syntax>
1179                 <description>
1180                         <para>Qualify a chan_pjsip endpoint.</para>
1181                 </description>
1182         </manager>
1183         <managerEvent language="en_US" name="IdentifyDetail">
1184                 <managerEventInstance class="EVENT_FLAG_COMMAND">
1185                         <synopsis>Provide details about an identify section.</synopsis>
1186                         <syntax>
1187                                 <parameter name="ObjectType">
1188                                         <para>The object's type. This will always be 'identify'.</para>
1189                                 </parameter>
1190                                 <parameter name="ObjectName">
1191                                         <para>The name of this object.</para>
1192                                 </parameter>
1193                                 <parameter name="Endpoint">
1194                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip_endpoint_identifier_ip']/configFile[@name='pjsip.conf']/configObject[@name='identify']/configOption[@name='endpoint']/synopsis/node())"/></para>
1195                                 </parameter>
1196                                 <parameter name="Match">
1197                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip_endpoint_identifier_ip']/configFile[@name='pjsip.conf']/configObject[@name='identify']/configOption[@name='match']/synopsis/node())"/></para>
1198                                 </parameter>
1199                                 <parameter name="EndpointName">
1200                                         <para>The name of the endpoint associated with this information.</para>
1201                                 </parameter>
1202                         </syntax>
1203                 </managerEventInstance>
1204         </managerEvent>
1205         <managerEvent language="en_US" name="AorDetail">
1206                 <managerEventInstance class="EVENT_FLAG_COMMAND">
1207                         <synopsis>Provide details about an Address of Record (AoR) section.</synopsis>
1208                         <syntax>
1209                                 <parameter name="ObjectType">
1210                                         <para>The object's type. This will always be 'aor'.</para>
1211                                 </parameter>
1212                                 <parameter name="ObjectName">
1213                                         <para>The name of this object.</para>
1214                                 </parameter>
1215                                 <parameter name="MinimumExpiration">
1216                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='aor']/configOption[@name='minimum_expiration']/synopsis/node())"/></para>
1217                                 </parameter>
1218                                 <parameter name="MaximumExpiration">
1219                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='aor']/configOption[@name='maximum_expiration']/synopsis/node())"/></para>
1220                                 </parameter>
1221                                 <parameter name="DefaultExpiration">
1222                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='aor']/configOption[@name='default_expiration']/synopsis/node())"/></para>
1223                                 </parameter>
1224                                 <parameter name="QualifyFrequency">
1225                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='aor']/configOption[@name='qualify_frequency']/synopsis/node())"/></para>
1226                                 </parameter>
1227                                 <parameter name="AuthenticateQualify">
1228                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='aor']/configOption[@name='authenticate_qualify']/synopsis/node())"/></para>
1229                                 </parameter>
1230                                 <parameter name="MaxContacts">
1231                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='aor']/configOption[@name='max_contacts']/synopsis/node())"/></para>
1232                                 </parameter>
1233                                 <parameter name="RemoveExisting">
1234                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='aor']/configOption[@name='remove_existing']/synopsis/node())"/></para>
1235                                 </parameter>
1236                                 <parameter name="Mailboxes">
1237                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='aor']/configOption[@name='mailboxes']/synopsis/node())"/></para>
1238                                 </parameter>
1239                                 <parameter name="OutboundProxy">
1240                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='aor']/configOption[@name='outbound_proxy']/synopsis/node())"/></para>
1241                                 </parameter>
1242                                 <parameter name="SupportPath">
1243                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='aor']/configOption[@name='support_path']/synopsis/node())"/></para>
1244                                 </parameter>
1245                                 <parameter name="TotalContacts">
1246                                         <para>The total number of contacts associated with this AoR.</para>
1247                                 </parameter>
1248                                 <parameter name="ContactsRegistered">
1249                                         <para>The number of non-permanent contacts associated with this AoR.</para>
1250                                 </parameter>
1251                                 <parameter name="EndpointName">
1252                                         <para>The name of the endpoint associated with this information.</para>
1253                                 </parameter>
1254                         </syntax>
1255                 </managerEventInstance>
1256         </managerEvent>
1257         <managerEvent language="en_US" name="AuthDetail">
1258                 <managerEventInstance class="EVENT_FLAG_COMMAND">
1259                         <synopsis>Provide details about an authentication section.</synopsis>
1260                         <syntax>
1261                                 <parameter name="ObjectType">
1262                                         <para>The object's type. This will always be 'auth'.</para>
1263                                 </parameter>
1264                                 <parameter name="ObjectName">
1265                                         <para>The name of this object.</para>
1266                                 </parameter>
1267                                 <parameter name="Username">
1268                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='auth']/configOption[@name='username']/synopsis/node())"/></para>
1269                                 </parameter>
1270                                 <parameter name="Password">
1271                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='auth']/configOption[@name='username']/synopsis/node())"/></para>
1272                                 </parameter>
1273                                 <parameter name="Md5Cred">
1274                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='auth']/configOption[@name='md5_cred']/synopsis/node())"/></para>
1275                                 </parameter>
1276                                 <parameter name="Realm">
1277                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='auth']/configOption[@name='realm']/synopsis/node())"/></para>
1278                                 </parameter>
1279                                 <parameter name="NonceLifetime">
1280                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='auth']/configOption[@name='nonce_lifetime']/synopsis/node())"/></para>
1281                                 </parameter>
1282                                 <parameter name="AuthType">
1283                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='auth']/configOption[@name='auth_type']/synopsis/node())"/></para>
1284                                 </parameter>
1285                                 <parameter name="EndpointName">
1286                                         <para>The name of the endpoint associated with this information.</para>
1287                                 </parameter>
1288                         </syntax>
1289                 </managerEventInstance>
1290         </managerEvent>
1291         <managerEvent language="en_US" name="TransportDetail">
1292                 <managerEventInstance class="EVENT_FLAG_COMMAND">
1293                         <synopsis>Provide details about an authentication section.</synopsis>
1294                         <syntax>
1295                                 <parameter name="ObjectType">
1296                                         <para>The object's type. This will always be 'transport'.</para>
1297                                 </parameter>
1298                                 <parameter name="ObjectName">
1299                                         <para>The name of this object.</para>
1300                                 </parameter>
1301                                 <parameter name="Protocol">
1302                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='transport']/configOption[@name='protocol']/synopsis/node())"/></para>
1303                                 </parameter>
1304                                 <parameter name="Bind">
1305                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='transport']/configOption[@name='bind']/synopsis/node())"/></para>
1306                                 </parameter>
1307                                 <parameter name="AsycOperations">
1308                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='transport']/configOption[@name='async_operations']/synopsis/node())"/></para>
1309                                 </parameter>
1310                                 <parameter name="CaListFile">
1311                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='transport']/configOption[@name='ca_list_file']/synopsis/node())"/></para>
1312                                 </parameter>
1313                                 <parameter name="CertFile">
1314                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='transport']/configOption[@name='cert_file']/synopsis/node())"/></para>
1315                                 </parameter>
1316                                 <parameter name="PrivKeyFile">
1317                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='transport']/configOption[@name='priv_key_file']/synopsis/node())"/></para>
1318                                 </parameter>
1319                                 <parameter name="Password">
1320                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='transport']/configOption[@name='password']/synopsis/node())"/></para>
1321                                 </parameter>
1322                                 <parameter name="ExternalSignalingAddress">
1323                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='transport']/configOption[@name='external_signaling_address']/synopsis/node())"/></para>
1324                                 </parameter>
1325                                 <parameter name="ExternalSignalingPort">
1326                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='transport']/configOption[@name='external_signaling_port']/synopsis/node())"/></para>
1327                                 </parameter>
1328                                 <parameter name="ExternalMediaAddress">
1329                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='transport']/configOption[@name='external_media_address']/synopsis/node())"/></para>
1330                                 </parameter>
1331                                 <parameter name="Domain">
1332                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='transport']/configOption[@name='domain']/synopsis/node())"/></para>
1333                                 </parameter>
1334                                 <parameter name="VerifyServer">
1335                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='transport']/configOption[@name='verify_server']/synopsis/node())"/></para>
1336                                 </parameter>
1337                                 <parameter name="VerifyClient">
1338                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='transport']/configOption[@name='verify_client']/synopsis/node())"/></para>
1339                                 </parameter>
1340                                 <parameter name="RequireClientCert">
1341                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='transport']/configOption[@name='require_client_cert']/synopsis/node())"/></para>
1342                                 </parameter>
1343                                 <parameter name="Method">
1344                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='transport']/configOption[@name='method']/synopsis/node())"/></para>
1345                                 </parameter>
1346                                 <parameter name="Cipher">
1347                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='transport']/configOption[@name='cipher']/synopsis/node())"/></para>
1348                                 </parameter>
1349                                 <parameter name="LocalNet">
1350                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='transport']/configOption[@name='local_net']/synopsis/node())"/></para>
1351                                 </parameter>
1352                                 <parameter name="Tos">
1353                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='transport']/configOption[@name='tos']/synopsis/node())"/></para>
1354                                 </parameter>
1355                                 <parameter name="Cos">
1356                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='transport']/configOption[@name='cos']/synopsis/node())"/></para>
1357                                 </parameter>
1358                                 <parameter name="WebsocketWriteTimeout">
1359                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='transport']/configOption[@name='websocket_write_timeout']/synopsis/node())"/></para>
1360                                 </parameter>
1361                                 <parameter name="EndpointName">
1362                                         <para>The name of the endpoint associated with this information.</para>
1363                                 </parameter>
1364                         </syntax>
1365                 </managerEventInstance>
1366         </managerEvent>
1367         <managerEvent language="en_US" name="EndpointDetail">
1368                 <managerEventInstance class="EVENT_FLAG_COMMAND">
1369                         <synopsis>Provide details about an endpoint section.</synopsis>
1370                         <syntax>
1371                                 <parameter name="ObjectType">
1372                                         <para>The object's type. This will always be 'endpoint'.</para>
1373                                 </parameter>
1374                                 <parameter name="ObjectName">
1375                                         <para>The name of this object.</para>
1376                                 </parameter>
1377                                 <parameter name="Context">
1378                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='context']/synopsis/node())"/></para>
1379                                 </parameter>
1380                                 <parameter name="Disallow">
1381                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='disallow']/synopsis/node())"/></para>
1382                                 </parameter>
1383                                 <parameter name="Allow">
1384                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='allow']/synopsis/node())"/></para>
1385                                 </parameter>
1386                                 <parameter name="DtmfMode">
1387                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='dtmf_mode']/synopsis/node())"/></para>
1388                                 </parameter>
1389                                 <parameter name="RtpIpv6">
1390                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='rtp_ipv6']/synopsis/node())"/></para>
1391                                 </parameter>
1392                                 <parameter name="RtpSymmetric">
1393                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='rtp_symmetric']/synopsis/node())"/></para>
1394                                 </parameter>
1395                                 <parameter name="IceSupport">
1396                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='ice_support']/synopsis/node())"/></para>
1397                                 </parameter>
1398                                 <parameter name="UsePtime">
1399                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='use_ptime']/synopsis/node())"/></para>
1400                                 </parameter>
1401                                 <parameter name="ForceRport">
1402                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='force_rport']/synopsis/node())"/></para>
1403                                 </parameter>
1404                                 <parameter name="RewriteContact">
1405                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='rewrite_contact']/synopsis/node())"/></para>
1406                                 </parameter>
1407                                 <parameter name="Transport">
1408                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='transport']/synopsis/node())"/></para>
1409                                 </parameter>
1410                                 <parameter name="OutboundProxy">
1411                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='outbound_proxy']/synopsis/node())"/></para>
1412                                 </parameter>
1413                                 <parameter name="MohSuggest">
1414                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='moh_suggest']/synopsis/node())"/></para>
1415                                 </parameter>
1416                                 <parameter name="100rel">
1417                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='100rel']/synopsis/node())"/></para>
1418                                 </parameter>
1419                                 <parameter name="Timers">
1420                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='timers']/synopsis/node())"/></para>
1421                                 </parameter>
1422                                 <parameter name="TimersMinSe">
1423                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='timers_min_se']/synopsis/node())"/></para>
1424                                 </parameter>
1425                                 <parameter name="TimersSessExpires">
1426                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='timers_sess_expires']/synopsis/node())"/></para>
1427                                 </parameter>
1428                                 <parameter name="Auth">
1429                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='auth']/synopsis/node())"/></para>
1430                                 </parameter>
1431                                 <parameter name="OutboundAuth">
1432                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='outbound_auth']/synopsis/node())"/></para>
1433                                 </parameter>
1434                                 <parameter name="Aors">
1435                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='aors']/synopsis/node())"/></para>
1436                                 </parameter>
1437                                 <parameter name="MediaAddress">
1438                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='media_address']/synopsis/node())"/></para>
1439                                 </parameter>
1440                                 <parameter name="IdentifyBy">
1441                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='identify_by']/synopsis/node())"/></para>
1442                                 </parameter>
1443                                 <parameter name="DirectMedia">
1444                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='direct_media']/synopsis/node())"/></para>
1445                                 </parameter>
1446                                 <parameter name="DirectMediaMethod">
1447                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='direct_media_method']/synopsis/node())"/></para>
1448                                 </parameter>
1449                                 <parameter name="ConnectedLineMethod">
1450                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='connected_line_method']/synopsis/node())"/></para>
1451                                 </parameter>
1452                                 <parameter name="DirectMediaGlareMitigation">
1453                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='direct_media_glare_mitigation']/synopsis/node())"/></para>
1454                                 </parameter>
1455                                 <parameter name="DisableDirectMediaOnNat">
1456                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='disable_direct_media_on_nat']/synopsis/node())"/></para>
1457                                 </parameter>
1458                                 <parameter name="Callerid">
1459                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='callerid']/synopsis/node())"/></para>
1460                                 </parameter>
1461                                 <parameter name="CalleridPrivacy">
1462                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='callerid_privacy']/synopsis/node())"/></para>
1463                                 </parameter>
1464                                 <parameter name="CalleridTag">
1465                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='callerid_tag']/synopsis/node())"/></para>
1466                                 </parameter>
1467                                 <parameter name="TrustIdInbound">
1468                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='trust_id_inbound']/synopsis/node())"/></para>
1469                                 </parameter>
1470                                 <parameter name="TrustIdOutbound">
1471                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='trust_id_outbound']/synopsis/node())"/></para>
1472                                 </parameter>
1473                                 <parameter name="SendPai">
1474                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='send_pai']/synopsis/node())"/></para>
1475                                 </parameter>
1476                                 <parameter name="SendRpid">
1477                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='send_rpid']/synopsis/node())"/></para>
1478                                 </parameter>
1479                                 <parameter name="SendDiversion">
1480                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='send_diversion']/synopsis/node())"/></para>
1481                                 </parameter>
1482                                 <parameter name="Mailboxes">
1483                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='mailboxes']/synopsis/node())"/></para>
1484                                 </parameter>
1485                                 <parameter name="AggregateMwi">
1486                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='aggregate_mwi']/synopsis/node())"/></para>
1487                                 </parameter>
1488                                 <parameter name="MediaEncryption">
1489                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='media_encryption']/synopsis/node())"/></para>
1490                                 </parameter>
1491                                 <parameter name="UseAvpf">
1492                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='use_avpf']/synopsis/node())"/></para>
1493                                 </parameter>
1494                                 <parameter name="ForceAvp">
1495                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='force_avp']/synopsis/node())"/></para>
1496                                 </parameter>
1497                                 <parameter name="MediaUseReceivedTransport">
1498                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='media_use_received_transport']/synopsis/node())"/></para>
1499                                 </parameter>
1500                                 <parameter name="OneTouchRecording">
1501                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='one_touch_recording']/synopsis/node())"/></para>
1502                                 </parameter>
1503                                 <parameter name="InbandProgress">
1504                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='inband_progress']/synopsis/node())"/></para>
1505                                 </parameter>
1506                                 <parameter name="CallGroup">
1507                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='call_group']/synopsis/node())"/></para>
1508                                 </parameter>
1509                                 <parameter name="PickupGroup">
1510                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='pickup_group']/synopsis/node())"/></para>
1511                                 </parameter>
1512                                 <parameter name="NamedCallGroup">
1513                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='named_call_group']/synopsis/node())"/></para>
1514                                 </parameter>
1515                                 <parameter name="NamedPickupGroup">
1516                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='named_pickup_group']/synopsis/node())"/></para>
1517                                 </parameter>
1518                                 <parameter name="DeviceStateBusyAt">
1519                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='device_state_busy_at']/synopsis/node())"/></para>
1520                                 </parameter>
1521                                 <parameter name="T38Udptl">
1522                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='t38_udptl']/synopsis/node())"/></para>
1523                                 </parameter>
1524                                 <parameter name="T38UdptlEc">
1525                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='t38_udptl_ec']/synopsis/node())"/></para>
1526                                 </parameter>
1527                                 <parameter name="T38UdptlMaxdatagram">
1528                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='t38_udptl_maxdatagram']/synopsis/node())"/></para>
1529                                 </parameter>
1530                                 <parameter name="FaxDetect">
1531                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='fax_detect']/synopsis/node())"/></para>
1532                                 </parameter>
1533                                 <parameter name="T38UdptlNat">
1534                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='t38_udptl_nat']/synopsis/node())"/></para>
1535                                 </parameter>
1536                                 <parameter name="T38UdptlIpv6">
1537                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='t38_udptl_ipv6']/synopsis/node())"/></para>
1538                                 </parameter>
1539                                 <parameter name="ToneZone">
1540                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='tone_zone']/synopsis/node())"/></para>
1541                                 </parameter>
1542                                 <parameter name="Language">
1543                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='language']/synopsis/node())"/></para>
1544                                 </parameter>
1545                                 <parameter name="RecordOnFeature">
1546                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='record_on_feature']/synopsis/node())"/></para>
1547                                 </parameter>
1548                                 <parameter name="RecordOffFeature">
1549                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='record_off_feature']/synopsis/node())"/></para>
1550                                 </parameter>
1551                                 <parameter name="AllowTransfer">
1552                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='allow_transfer']/synopsis/node())"/></para>
1553                                 </parameter>
1554                                 <parameter name="UserEqPhone">
1555                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='user_eq_phone']/synopsis/node())"/></para>
1556                                 </parameter>
1557                                 <parameter name="SdpOwner">
1558                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='sdp_owner']/synopsis/node())"/></para>
1559                                 </parameter>
1560                                 <parameter name="SdpSession">
1561                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='sdp_session']/synopsis/node())"/></para>
1562                                 </parameter>
1563                                 <parameter name="TosAudio">
1564                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='tos_audio']/synopsis/node())"/></para>
1565                                 </parameter>
1566                                 <parameter name="TosVideo">
1567                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='tos_video']/synopsis/node())"/></para>
1568                                 </parameter>
1569                                 <parameter name="CosAudio">
1570                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='cos_audio']/synopsis/node())"/></para>
1571                                 </parameter>
1572                                 <parameter name="CosVideo">
1573                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='cos_video']/synopsis/node())"/></para>
1574                                 </parameter>
1575                                 <parameter name="AllowSubscribe">
1576                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='allow_subscribe']/synopsis/node())"/></para>
1577                                 </parameter>
1578                                 <parameter name="SubMinExpiry">
1579                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='sub_min_expiry']/synopsis/node())"/></para>
1580                                 </parameter>
1581                                 <parameter name="FromUser">
1582                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='from_user']/synopsis/node())"/></para>
1583                                 </parameter>
1584                                 <parameter name="FromDomain">
1585                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='from_domain']/synopsis/node())"/></para>
1586                                 </parameter>
1587                                 <parameter name="MwiFromUser">
1588                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='mwi_from_user']/synopsis/node())"/></para>
1589                                 </parameter>
1590                                 <parameter name="RtpEngine">
1591                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='rtp_engine']/synopsis/node())"/></para>
1592                                 </parameter>
1593                                 <parameter name="DtlsVerify">
1594                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='dtls_verify']/synopsis/node())"/></para>
1595                                 </parameter>
1596                                 <parameter name="DtlsRekey">
1597                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='dtls_rekey']/synopsis/node())"/></para>
1598                                 </parameter>
1599                                 <parameter name="DtlsCertFile">
1600                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='dtls_cert_file']/synopsis/node())"/></para>
1601                                 </parameter>
1602                                 <parameter name="DtlsPrivateKey">
1603                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='dtls_private_key']/synopsis/node())"/></para>
1604                                 </parameter>
1605                                 <parameter name="DtlsCipher">
1606                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='dtls_cipher']/synopsis/node())"/></para>
1607                                 </parameter>
1608                                 <parameter name="DtlsCaFile">
1609                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='dtls_ca_file']/synopsis/node())"/></para>
1610                                 </parameter>
1611                                 <parameter name="DtlsCaPath">
1612                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='dtls_ca_path']/synopsis/node())"/></para>
1613                                 </parameter>
1614                                 <parameter name="DtlsSetup">
1615                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='dtls_setup']/synopsis/node())"/></para>
1616                                 </parameter>
1617                                 <parameter name="SrtpTag32">
1618                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='srtp_tag_32']/synopsis/node())"/></para>
1619                                 </parameter>
1620                                 <parameter name="RedirectMethod">
1621                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='redirect_method']/synopsis/node())"/></para>
1622                                 </parameter>
1623                                 <parameter name="SetVar">
1624                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='set_var']/synopsis/node())"/></para>
1625                                 </parameter>
1626                                 <parameter name="MessageContext">
1627                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='message_context']/synopsis/node())"/></para>
1628                                 </parameter>
1629                                 <parameter name="Accountcode">
1630                                         <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='accountcode']/synopsis/node())"/></para>
1631                                 </parameter>
1632                                 <parameter name="DeviceState">
1633                                         <para>The aggregate device state for this endpoint.</para>
1634                                 </parameter>
1635                                 <parameter name="ActiveChannels">
1636                                         <para>The number of active channels associated with this endpoint.</para>
1637                                 </parameter>
1638                         </syntax>
1639                 </managerEventInstance>
1640         </managerEvent>
1641         <managerEvent language="en_US" name="ContactStatusDetail">
1642                 <managerEventInstance class="EVENT_FLAG_COMMAND">
1643                         <synopsis>Provide details about a contact's status.</synopsis>
1644                         <syntax>
1645                                 <parameter name="AOR">
1646                                         <para>The AoR that owns this contact.</para>
1647                                 </parameter>
1648                                 <parameter name="URI">
1649                                         <para>This contact's URI.</para>
1650                                 </parameter>
1651                                 <parameter name="Status">
1652                                         <para>This contact's status.</para>
1653                                         <enumlist>
1654                                                 <enum name="Reachable"/>
1655                                                 <enum name="Unreachable"/>
1656                                         </enumlist>
1657                                 </parameter>
1658                                 <parameter name="RoundtripUsec">
1659                                         <para>The round trip time in microseconds.</para>
1660                                 </parameter>
1661                                 <parameter name="EndpointName">
1662                                         <para>The name of the endpoint associated with this information.</para>
1663                                 </parameter>
1664                         </syntax>
1665                 </managerEventInstance>
1666         </managerEvent>
1667         <managerEvent language="en_US" name="EndpointList">
1668                 <managerEventInstance class="EVENT_FLAG_COMMAND">
1669                         <synopsis>Provide details about a contact's status.</synopsis>
1670                         <syntax>
1671                                 <parameter name="ObjectType">
1672                                         <para>The object's type. This will always be 'endpoint'.</para>
1673                                 </parameter>
1674                                 <parameter name="ObjectName">
1675                                         <para>The name of this object.</para>
1676                                 </parameter>
1677                                 <parameter name="Transport">
1678                                         <para>The transport configurations associated with this endpoint.</para>
1679                                 </parameter>
1680                                 <parameter name="Aor">
1681                                         <para>The aor configurations associated with this endpoint.</para>
1682                                 </parameter>
1683                                 <parameter name="Auths">
1684                                         <para>The inbound authentication configurations associated with this endpoint.</para>
1685                                 </parameter>
1686                                 <parameter name="OutboundAuths">
1687                                         <para>The outbound authentication configurations associated with this endpoint.</para>
1688                                 </parameter>
1689                                 <parameter name="DeviceState">
1690                                         <para>The aggregate device state for this endpoint.</para>
1691                                 </parameter>
1692                                 <parameter name="ActiveChannels">
1693                                         <para>The number of active channels associated with this endpoint.</para>
1694                                 </parameter>
1695                         </syntax>
1696                 </managerEventInstance>
1697         </managerEvent>
1698         <manager name="PJSIPShowEndpoints" language="en_US">
1699                 <synopsis>
1700                         Lists PJSIP endpoints.
1701                 </synopsis>
1702                 <syntax />
1703                 <description>
1704                         <para>
1705                         Provides a listing of all endpoints.  For each endpoint an <literal>EndpointList</literal> event
1706                         is raised that contains relevant attributes and status information.  Once all
1707                         endpoints have been listed an <literal>EndpointListComplete</literal> event is issued.
1708                         </para>
1709                 </description>
1710                 <responses>
1711                         <list-elements>
1712                                 <xi:include xpointer="xpointer(/docs/managerEvent[@name='EndpointList'])" />
1713                         </list-elements>
1714                         <managerEvent language="en_US" name="EndpointListComplete">
1715                                 <managerEventInstance class="EVENT_FLAG_COMMAND">
1716                                         <synopsis>Provide final information about an endpoint list.</synopsis>
1717                                         <syntax>
1718                                                 <parameter name="EventList"/>
1719                                                 <parameter name="ListItems"/>
1720                                         </syntax>
1721                                 </managerEventInstance>
1722                         </managerEvent>
1723                 </responses>
1724         </manager>
1725         <manager name="PJSIPShowEndpoint" language="en_US">
1726                 <synopsis>
1727                         Detail listing of an endpoint and its objects.
1728                 </synopsis>
1729                 <syntax>
1730                         <xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
1731                         <parameter name="Endpoint" required="true">
1732                                 <para>The endpoint to list.</para>
1733                         </parameter>
1734                 </syntax>
1735                 <description>
1736                         <para>
1737                         Provides a detailed listing of options for a given endpoint.  Events are issued
1738                         showing the configuration and status of the endpoint and associated objects.  These
1739                         events include <literal>EndpointDetail</literal>, <literal>AorDetail</literal>,
1740                         <literal>AuthDetail</literal>, <literal>TransportDetail</literal>, and
1741                         <literal>IdentifyDetail</literal>.  Some events may be listed multiple times if multiple objects are
1742                         associated (for instance AoRs).  Once all detail events have been raised a final
1743                         <literal>EndpointDetailComplete</literal> event is issued.
1744                         </para>
1745                 </description>
1746                 <responses>
1747                         <list-elements>
1748                                 <xi:include xpointer="xpointer(/docs/managerEvent[@name='EndpointDetail'])" />
1749                                 <xi:include xpointer="xpointer(/docs/managerEvent[@name='IdentifyDetail'])" />
1750                                 <xi:include xpointer="xpointer(/docs/managerEvent[@name='ContactStatusDetail'])" />
1751                                 <xi:include xpointer="xpointer(/docs/managerEvent[@name='AuthDetail'])" />
1752                                 <xi:include xpointer="xpointer(/docs/managerEvent[@name='TransportDetail'])" />
1753                                 <xi:include xpointer="xpointer(/docs/managerEvent[@name='AorDetail'])" />
1754                         </list-elements>
1755                         <managerEvent language="en_US" name="EndpointDetailComplete">
1756                                 <managerEventInstance class="EVENT_FLAG_COMMAND">
1757                                         <synopsis>Provide final information about endpoint details.</synopsis>
1758                                         <syntax>
1759                                                 <parameter name="EventList"/>
1760                                                 <parameter name="ListItems"/>
1761                                         </syntax>
1762                                 </managerEventInstance>
1763                         </managerEvent>
1764                 </responses>
1765         </manager>
1766  ***/
1767
1768 #define MOD_DATA_CONTACT "contact"
1769
1770 static pjsip_endpoint *ast_pjsip_endpoint;
1771
1772 static struct ast_threadpool *sip_threadpool;
1773
1774 static int register_service(void *data)
1775 {
1776         pjsip_module **module = data;
1777         if (!ast_pjsip_endpoint) {
1778                 ast_log(LOG_ERROR, "There is no PJSIP endpoint. Unable to register services\n");
1779                 return -1;
1780         }
1781         if (pjsip_endpt_register_module(ast_pjsip_endpoint, *module) != PJ_SUCCESS) {
1782                 ast_log(LOG_ERROR, "Unable to register module %.*s\n", (int) pj_strlen(&(*module)->name), pj_strbuf(&(*module)->name));
1783                 return -1;
1784         }
1785         ast_debug(1, "Registered SIP service %.*s (%p)\n", (int) pj_strlen(&(*module)->name), pj_strbuf(&(*module)->name), *module);
1786         ast_module_ref(ast_module_info->self);
1787         return 0;
1788 }
1789
1790 int ast_sip_register_service(pjsip_module *module)
1791 {
1792         return ast_sip_push_task_synchronous(NULL, register_service, &module);
1793 }
1794
1795 static int unregister_service(void *data)
1796 {
1797         pjsip_module **module = data;
1798         ast_module_unref(ast_module_info->self);
1799         if (!ast_pjsip_endpoint) {
1800                 return -1;
1801         }
1802         pjsip_endpt_unregister_module(ast_pjsip_endpoint, *module);
1803         ast_debug(1, "Unregistered SIP service %.*s\n", (int) pj_strlen(&(*module)->name), pj_strbuf(&(*module)->name));
1804         return 0;
1805 }
1806
1807 void ast_sip_unregister_service(pjsip_module *module)
1808 {
1809         ast_sip_push_task_synchronous(NULL, unregister_service, &module);
1810 }
1811
1812 static struct ast_sip_authenticator *registered_authenticator;
1813
1814 int ast_sip_register_authenticator(struct ast_sip_authenticator *auth)
1815 {
1816         if (registered_authenticator) {
1817                 ast_log(LOG_WARNING, "Authenticator %p is already registered. Cannot register a new one\n", registered_authenticator);
1818                 return -1;
1819         }
1820         registered_authenticator = auth;
1821         ast_debug(1, "Registered SIP authenticator module %p\n", auth);
1822         ast_module_ref(ast_module_info->self);
1823         return 0;
1824 }
1825
1826 void ast_sip_unregister_authenticator(struct ast_sip_authenticator *auth)
1827 {
1828         if (registered_authenticator != auth) {
1829                 ast_log(LOG_WARNING, "Trying to unregister authenticator %p but authenticator %p registered\n",
1830                                 auth, registered_authenticator);
1831                 return;
1832         }
1833         registered_authenticator = NULL;
1834         ast_debug(1, "Unregistered SIP authenticator %p\n", auth);
1835         ast_module_unref(ast_module_info->self);
1836 }
1837
1838 int ast_sip_requires_authentication(struct ast_sip_endpoint *endpoint, pjsip_rx_data *rdata)
1839 {
1840         if (!registered_authenticator) {
1841                 ast_log(LOG_WARNING, "No SIP authenticator registered. Assuming authentication is not required\n");
1842                 return 0;
1843         }
1844
1845         return registered_authenticator->requires_authentication(endpoint, rdata);
1846 }
1847
1848 enum ast_sip_check_auth_result ast_sip_check_authentication(struct ast_sip_endpoint *endpoint,
1849                 pjsip_rx_data *rdata, pjsip_tx_data *tdata)
1850 {
1851         if (!registered_authenticator) {
1852                 ast_log(LOG_WARNING, "No SIP authenticator registered. Assuming authentication is successful\n");
1853                 return 0;
1854         }
1855         return registered_authenticator->check_authentication(endpoint, rdata, tdata);
1856 }
1857
1858 static struct ast_sip_outbound_authenticator *registered_outbound_authenticator;
1859
1860 int ast_sip_register_outbound_authenticator(struct ast_sip_outbound_authenticator *auth)
1861 {
1862         if (registered_outbound_authenticator) {
1863                 ast_log(LOG_WARNING, "Outbound authenticator %p is already registered. Cannot register a new one\n", registered_outbound_authenticator);
1864                 return -1;
1865         }
1866         registered_outbound_authenticator = auth;
1867         ast_debug(1, "Registered SIP outbound authenticator module %p\n", auth);
1868         ast_module_ref(ast_module_info->self);
1869         return 0;
1870 }
1871
1872 void ast_sip_unregister_outbound_authenticator(struct ast_sip_outbound_authenticator *auth)
1873 {
1874         if (registered_outbound_authenticator != auth) {
1875                 ast_log(LOG_WARNING, "Trying to unregister outbound authenticator %p but outbound authenticator %p registered\n",
1876                                 auth, registered_outbound_authenticator);
1877                 return;
1878         }
1879         registered_outbound_authenticator = NULL;
1880         ast_debug(1, "Unregistered SIP outbound authenticator %p\n", auth);
1881         ast_module_unref(ast_module_info->self);
1882 }
1883
1884 int ast_sip_create_request_with_auth(const struct ast_sip_auth_vector *auths, pjsip_rx_data *challenge,
1885                 pjsip_transaction *tsx, pjsip_tx_data **new_request)
1886 {
1887         if (!registered_outbound_authenticator) {
1888                 ast_log(LOG_WARNING, "No SIP outbound authenticator registered. Cannot respond to authentication challenge\n");
1889                 return -1;
1890         }
1891         return registered_outbound_authenticator->create_request_with_auth(auths, challenge, tsx, new_request);
1892 }
1893
1894 struct endpoint_identifier_list {
1895         struct ast_sip_endpoint_identifier *identifier;
1896         AST_RWLIST_ENTRY(endpoint_identifier_list) list;
1897 };
1898
1899 static AST_RWLIST_HEAD_STATIC(endpoint_identifiers, endpoint_identifier_list);
1900
1901 int ast_sip_register_endpoint_identifier(struct ast_sip_endpoint_identifier *identifier)
1902 {
1903         struct endpoint_identifier_list *id_list_item;
1904         SCOPED_LOCK(lock, &endpoint_identifiers, AST_RWLIST_WRLOCK, AST_RWLIST_UNLOCK);
1905
1906         id_list_item = ast_calloc(1, sizeof(*id_list_item));
1907         if (!id_list_item) {
1908                 ast_log(LOG_ERROR, "Unabled to add endpoint identifier. Out of memory.\n");
1909                 return -1;
1910         }
1911         id_list_item->identifier = identifier;
1912
1913         AST_RWLIST_INSERT_TAIL(&endpoint_identifiers, id_list_item, list);
1914         ast_debug(1, "Registered endpoint identifier %p\n", identifier);
1915
1916         ast_module_ref(ast_module_info->self);
1917         return 0;
1918 }
1919
1920 void ast_sip_unregister_endpoint_identifier(struct ast_sip_endpoint_identifier *identifier)
1921 {
1922         struct endpoint_identifier_list *iter;
1923         SCOPED_LOCK(lock, &endpoint_identifiers, AST_RWLIST_WRLOCK, AST_RWLIST_UNLOCK);
1924         AST_RWLIST_TRAVERSE_SAFE_BEGIN(&endpoint_identifiers, iter, list) {
1925                 if (iter->identifier == identifier) {
1926                         AST_RWLIST_REMOVE_CURRENT(list);
1927                         ast_free(iter);
1928                         ast_debug(1, "Unregistered endpoint identifier %p\n", identifier);
1929                         ast_module_unref(ast_module_info->self);
1930                         break;
1931                 }
1932         }
1933         AST_RWLIST_TRAVERSE_SAFE_END;
1934 }
1935
1936 struct ast_sip_endpoint *ast_sip_identify_endpoint(pjsip_rx_data *rdata)
1937 {
1938         struct endpoint_identifier_list *iter;
1939         struct ast_sip_endpoint *endpoint = NULL;
1940         SCOPED_LOCK(lock, &endpoint_identifiers, AST_RWLIST_RDLOCK, AST_RWLIST_UNLOCK);
1941         AST_RWLIST_TRAVERSE(&endpoint_identifiers, iter, list) {
1942                 ast_assert(iter->identifier->identify_endpoint != NULL);
1943                 endpoint = iter->identifier->identify_endpoint(rdata);
1944                 if (endpoint) {
1945                         break;
1946                 }
1947         }
1948         return endpoint;
1949 }
1950
1951 AST_RWLIST_HEAD_STATIC(endpoint_formatters, ast_sip_endpoint_formatter);
1952
1953 int ast_sip_register_endpoint_formatter(struct ast_sip_endpoint_formatter *obj)
1954 {
1955         SCOPED_LOCK(lock, &endpoint_formatters, AST_RWLIST_WRLOCK, AST_RWLIST_UNLOCK);
1956         AST_RWLIST_INSERT_TAIL(&endpoint_formatters, obj, next);
1957         ast_module_ref(ast_module_info->self);
1958         return 0;
1959 }
1960
1961 void ast_sip_unregister_endpoint_formatter(struct ast_sip_endpoint_formatter *obj)
1962 {
1963         struct ast_sip_endpoint_formatter *i;
1964         SCOPED_LOCK(lock, &endpoint_formatters, AST_RWLIST_WRLOCK, AST_RWLIST_UNLOCK);
1965         AST_RWLIST_TRAVERSE_SAFE_BEGIN(&endpoint_formatters, i, next) {
1966                 if (i == obj) {
1967                         AST_RWLIST_REMOVE_CURRENT(next);
1968                         ast_module_unref(ast_module_info->self);
1969                         break;
1970                 }
1971         }
1972         AST_RWLIST_TRAVERSE_SAFE_END;
1973 }
1974
1975 int ast_sip_format_endpoint_ami(struct ast_sip_endpoint *endpoint,
1976                                 struct ast_sip_ami *ami, int *count)
1977 {
1978         int res = 0;
1979         struct ast_sip_endpoint_formatter *i;
1980         SCOPED_LOCK(lock, &endpoint_formatters, AST_RWLIST_RDLOCK, AST_RWLIST_UNLOCK);
1981         *count = 0;
1982         AST_RWLIST_TRAVERSE(&endpoint_formatters, i, next) {
1983                 if (i->format_ami && ((res = i->format_ami(endpoint, ami)) < 0)) {
1984                         return res;
1985                 }
1986
1987                 if (!res) {
1988                         (*count)++;
1989                 }
1990         }
1991         return 0;
1992 }
1993
1994 pjsip_endpoint *ast_sip_get_pjsip_endpoint(void)
1995 {
1996         return ast_pjsip_endpoint;
1997 }
1998
1999 static int sip_dialog_create_from(pj_pool_t *pool, pj_str_t *from, const char *user, const char *domain, const pj_str_t *target, pjsip_tpselector *selector)
2000 {
2001         pj_str_t tmp, local_addr;
2002         pjsip_uri *uri;
2003         pjsip_sip_uri *sip_uri;
2004         pjsip_transport_type_e type = PJSIP_TRANSPORT_UNSPECIFIED;
2005         int local_port;
2006         char uuid_str[AST_UUID_STR_LEN];
2007
2008         if (ast_strlen_zero(user)) {
2009                 user = ast_uuid_generate_str(uuid_str, sizeof(uuid_str));
2010         }
2011
2012         /* Parse the provided target URI so we can determine what transport it will end up using */
2013         pj_strdup_with_null(pool, &tmp, target);
2014
2015         if (!(uri = pjsip_parse_uri(pool, tmp.ptr, tmp.slen, 0)) ||
2016             (!PJSIP_URI_SCHEME_IS_SIP(uri) && !PJSIP_URI_SCHEME_IS_SIPS(uri))) {
2017                 return -1;
2018         }
2019
2020         sip_uri = pjsip_uri_get_uri(uri);
2021
2022         /* Determine the transport type to use */
2023         if (PJSIP_URI_SCHEME_IS_SIPS(sip_uri)) {
2024                 type = PJSIP_TRANSPORT_TLS;
2025         } else if (!sip_uri->transport_param.slen) {
2026                 type = PJSIP_TRANSPORT_UDP;
2027         } else {
2028                 type = pjsip_transport_get_type_from_name(&sip_uri->transport_param);
2029         }
2030
2031         if (type == PJSIP_TRANSPORT_UNSPECIFIED) {
2032                 return -1;
2033         }
2034
2035         /* If the host is IPv6 turn the transport into an IPv6 version */
2036         if (pj_strchr(&sip_uri->host, ':') && type < PJSIP_TRANSPORT_START_OTHER) {
2037                 type = (pjsip_transport_type_e)(((int)type) + PJSIP_TRANSPORT_IPV6);
2038         }
2039
2040         if (!ast_strlen_zero(domain)) {
2041                 from->ptr = pj_pool_alloc(pool, PJSIP_MAX_URL_SIZE);
2042                 from->slen = pj_ansi_snprintf(from->ptr, PJSIP_MAX_URL_SIZE,
2043                                 "<sip:%s@%s%s%s>",
2044                                 user,
2045                                 domain,
2046                                 (type != PJSIP_TRANSPORT_UDP && type != PJSIP_TRANSPORT_UDP6) ? ";transport=" : "",
2047                                 (type != PJSIP_TRANSPORT_UDP && type != PJSIP_TRANSPORT_UDP6) ? pjsip_transport_get_type_name(type) : "");
2048                 return 0;
2049         }
2050
2051         /* Get the local bound address for the transport that will be used when communicating with the provided URI */
2052         if (pjsip_tpmgr_find_local_addr(pjsip_endpt_get_tpmgr(ast_sip_get_pjsip_endpoint()), pool, type, selector,
2053                                                               &local_addr, &local_port) != PJ_SUCCESS) {
2054
2055                 /* If no local address can be retrieved using the transport manager use the host one */
2056                 pj_strdup(pool, &local_addr, pj_gethostname());
2057                 local_port = pjsip_transport_get_default_port_for_type(PJSIP_TRANSPORT_UDP);
2058         }
2059
2060         /* If IPv6 was specified in the transport, set the proper type */
2061         if (pj_strchr(&local_addr, ':') && type < PJSIP_TRANSPORT_START_OTHER) {
2062                 type = (pjsip_transport_type_e)(((int)type) + PJSIP_TRANSPORT_IPV6);
2063         }
2064
2065         from->ptr = pj_pool_alloc(pool, PJSIP_MAX_URL_SIZE);
2066         from->slen = pj_ansi_snprintf(from->ptr, PJSIP_MAX_URL_SIZE,
2067                                       "<sip:%s@%s%.*s%s:%d%s%s>",
2068                                       user,
2069                                       (type & PJSIP_TRANSPORT_IPV6) ? "[" : "",
2070                                       (int)local_addr.slen,
2071                                       local_addr.ptr,
2072                                       (type & PJSIP_TRANSPORT_IPV6) ? "]" : "",
2073                                       local_port,
2074                                       (type != PJSIP_TRANSPORT_UDP && type != PJSIP_TRANSPORT_UDP6) ? ";transport=" : "",
2075                                       (type != PJSIP_TRANSPORT_UDP && type != PJSIP_TRANSPORT_UDP6) ? pjsip_transport_get_type_name(type) : "");
2076
2077         return 0;
2078 }
2079
2080 static int sip_get_tpselector_from_endpoint(const struct ast_sip_endpoint *endpoint, pjsip_tpselector *selector)
2081 {
2082         RAII_VAR(struct ast_sip_transport *, transport, NULL, ao2_cleanup);
2083         const char *transport_name = endpoint->transport;
2084
2085         if (ast_strlen_zero(transport_name)) {
2086                 return 0;
2087         }
2088
2089         transport = ast_sorcery_retrieve_by_id(ast_sip_get_sorcery(), "transport", transport_name);
2090
2091         if (!transport || !transport->state) {
2092                 ast_log(LOG_ERROR, "Unable to retrieve PJSIP transport '%s' for endpoint '%s'\n",
2093                         transport_name, ast_sorcery_object_get_id(endpoint));
2094                 return -1;
2095         }
2096
2097         if (transport->state->transport) {
2098                 selector->type = PJSIP_TPSELECTOR_TRANSPORT;
2099                 selector->u.transport = transport->state->transport;
2100         } else if (transport->state->factory) {
2101                 selector->type = PJSIP_TPSELECTOR_LISTENER;
2102                 selector->u.listener = transport->state->factory;
2103         } else if (transport->type == AST_TRANSPORT_WS || transport->type == AST_TRANSPORT_WSS) {
2104                 /* The WebSocket transport has no factory as it can not create outgoing connections, so
2105                  * even if an endpoint is locked to a WebSocket transport we let the PJSIP logic
2106                  * find the existing connection if available and use it.
2107                  */
2108                 return 0;
2109         } else {
2110                 return -1;
2111         }
2112
2113         return 0;
2114 }
2115
2116 void ast_sip_add_usereqphone(const struct ast_sip_endpoint *endpoint, pj_pool_t *pool, pjsip_uri *uri)
2117 {
2118         pjsip_sip_uri *sip_uri;
2119         int i = 0;
2120         pjsip_param *param;
2121         const pj_str_t STR_USER = { "user", 4 };
2122         const pj_str_t STR_PHONE = { "phone", 5 };
2123
2124         if (!endpoint || !endpoint->usereqphone || (!PJSIP_URI_SCHEME_IS_SIP(uri) && !PJSIP_URI_SCHEME_IS_SIPS(uri))) {
2125                 return;
2126         }
2127
2128         sip_uri = pjsip_uri_get_uri(uri);
2129
2130         if (!pj_strlen(&sip_uri->user)) {
2131                 return;
2132         }
2133
2134         /* Test URI user against allowed characters in AST_DIGIT_ANY */
2135         for (; i < pj_strlen(&sip_uri->user); i++) {
2136                 if (!strchr(AST_DIGIT_ANYNUM, pj_strbuf(&sip_uri->user)[i])) {
2137                         break;
2138                 }
2139         }
2140
2141         if (i < pj_strlen(&sip_uri->user)) {
2142                 return;
2143         }
2144
2145         param = PJ_POOL_ALLOC_T(pool, pjsip_param);
2146         param->name = STR_USER;
2147         param->value = STR_PHONE;
2148         pj_list_insert_before(&sip_uri->other_param, param);
2149 }
2150
2151 pjsip_dialog *ast_sip_create_dialog_uac(const struct ast_sip_endpoint *endpoint, const char *uri, const char *request_user)
2152 {
2153         char enclosed_uri[PJSIP_MAX_URL_SIZE];
2154         pj_str_t local_uri = { "sip:temp@temp", 13 }, remote_uri, target_uri;
2155         pjsip_dialog *dlg = NULL;
2156         const char *outbound_proxy = endpoint->outbound_proxy;
2157         pjsip_tpselector selector = { .type = PJSIP_TPSELECTOR_NONE, };
2158         static const pj_str_t HCONTACT = { "Contact", 7 };
2159
2160         snprintf(enclosed_uri, sizeof(enclosed_uri), "<%s>", uri);
2161         pj_cstr(&remote_uri, enclosed_uri);
2162
2163         pj_cstr(&target_uri, uri);
2164
2165         if (pjsip_dlg_create_uac(pjsip_ua_instance(), &local_uri, NULL, &remote_uri, &target_uri, &dlg) != PJ_SUCCESS) {
2166                 return NULL;
2167         }
2168
2169         if (sip_get_tpselector_from_endpoint(endpoint, &selector)) {
2170                 pjsip_dlg_terminate(dlg);
2171                 return NULL;
2172         }
2173
2174         if (sip_dialog_create_from(dlg->pool, &local_uri, endpoint->fromuser, endpoint->fromdomain, &remote_uri, &selector)) {
2175                 pjsip_dlg_terminate(dlg);
2176                 return NULL;
2177         }
2178
2179         /* Update the dialog with the new local URI, we do it afterwards so we can use the dialog pool for construction */
2180         pj_strdup_with_null(dlg->pool, &dlg->local.info_str, &local_uri);
2181         dlg->local.info->uri = pjsip_parse_uri(dlg->pool, dlg->local.info_str.ptr, dlg->local.info_str.slen, 0);
2182         dlg->local.contact = pjsip_parse_hdr(dlg->pool, &HCONTACT, local_uri.ptr, local_uri.slen, NULL);
2183
2184         /* If a request user has been specified and we are permitted to change it, do so */
2185         if (!ast_strlen_zero(request_user)) {
2186                 pjsip_sip_uri *sip_uri;
2187
2188                 if (PJSIP_URI_SCHEME_IS_SIP(dlg->target) || PJSIP_URI_SCHEME_IS_SIPS(dlg->target)) {
2189                         sip_uri = pjsip_uri_get_uri(dlg->target);
2190                         pj_strdup2(dlg->pool, &sip_uri->user, request_user);
2191                 }
2192                 if (PJSIP_URI_SCHEME_IS_SIP(dlg->remote.info->uri) || PJSIP_URI_SCHEME_IS_SIPS(dlg->remote.info->uri)) {
2193                         sip_uri = pjsip_uri_get_uri(dlg->remote.info->uri);
2194                         pj_strdup2(dlg->pool, &sip_uri->user, request_user);
2195                 }
2196         }
2197
2198         /* Add the user=phone parameter if applicable */
2199         ast_sip_add_usereqphone(endpoint, dlg->pool, dlg->target);
2200
2201         /* We have to temporarily bump up the sess_count here so the dialog is not prematurely destroyed */
2202         dlg->sess_count++;
2203
2204         pjsip_dlg_set_transport(dlg, &selector);
2205
2206         if (!ast_strlen_zero(outbound_proxy)) {
2207                 pjsip_route_hdr route_set, *route;
2208                 static const pj_str_t ROUTE_HNAME = { "Route", 5 };
2209                 pj_str_t tmp;
2210
2211                 pj_list_init(&route_set);
2212
2213