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