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