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