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