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