Asterisk-pjsip.conf: Difference between revisions

From 탱이의 잡동사니
Jump to navigation Jump to search
Line 76: Line 76:


You'll need to set up the auth example "mytrunk_auth" below to enable outbound authentication. Note that we "outbound_auth=" use for outbound authentication instead of "auth=", which is for inbound authentication.
You'll need to set up the auth example "mytrunk_auth" below to enable outbound authentication. Note that we "outbound_auth=" use for outbound authentication instead of "auth=", which is for inbound authentication.
If you are registering to a server from behind NAT, be sure you assign a transport that is appropriately configured with NAT related settings. See the NAT transport example.
"contact_user=" sets the SIP contact header's user portion ofthe SIP URI this will affect the extension reached in dialplan when the far end calls you at this registration. The default is 's'.
If you would like to enable line support and have incoming calls related wo this registration to to an endpoint automatically the "line" and "endpoint" options must be set. The "endpoint" option specifies what endpoint the incoming call should be associated with.
<pre>
<pre>
[mytrunk]
[mytrunk]

Revision as of 14:37, 25 October 2017

Overview

Asterisk 의 pjsip 모듈 설정파일 pjsip.conf 내용 정리.

Basic

; Overview of Configuration Section Types Used in the Examples
;
; * Transport "transport"
;   * Configures res_pjsip transport layer interaction.
; * Endpoint "endpoint"
;   * Configures core SIP functionality related to SIP endpoints.
; * Authentication "auth"
;   * Stores inbound or outbound authentication credentials for use by trunks,
;     endpoints, registrations.
; * Address of Record "aor"
;   * Stores contact information for use by endpoints.
; * Endpoint Identification "identify"
;   * Maps a host directly to an endpoint
; * Access Control List "acl"
;   * Defines a permission list or references one stored in acl.conf
; * Registration "registration"
;   * Contains information about an outbound SIP registration
; * Phone Provisioning "phoneprov"
;   * Contains information needed by res_phoneprov for autoprovisioning

ENDPOINT

transport type

transport type. TCP, UDP 혹은 WebSocket 과 같은 프로토콜이나 TLS/SSL 과 같은 암호화를 설정한다.

Example

Basic UDP transport

[transport-udp]
type=transport
protocol=udp    ;udp,tcp,tls,ws,wss
bind=0.0.0.0

UDP transport behind NAT

[transport-udp-nat]
type=transport
protocol=udp
bind=0.0.0.0
local_net=192.0.2.0/24
external_media_address=203.0.113.1
external_signaling_address=203.0.113.1

Basic IPv6 UDP tranport

[transport-udp-ipv6]
type=transport
protocol=udp
bind=::

Exmple IPv4 TLS transport

[transport-tls]
type=transport
protocol=tls
bind=0.0.0.0
cert_file=/path/mycert.crt
priv_key_file=/path/mykey.key
cipher=ADH-AES256-SHA,ADH-AES128-SHA
method=tlsv1

registration type

Example

outbound registration with outbound authentication

This is a simple registration that works with some SIP trunking providers.

You'll need to set up the auth example "mytrunk_auth" below to enable outbound authentication. Note that we "outbound_auth=" use for outbound authentication instead of "auth=", which is for inbound authentication.

If you are registering to a server from behind NAT, be sure you assign a transport that is appropriately configured with NAT related settings. See the NAT transport example.

"contact_user=" sets the SIP contact header's user portion ofthe SIP URI this will affect the extension reached in dialplan when the far end calls you at this registration. The default is 's'.

If you would like to enable line support and have incoming calls related wo this registration to to an endpoint automatically the "line" and "endpoint" options must be set. The "endpoint" option specifies what endpoint the incoming call should be associated with.

[mytrunk]
type=registration
transport=transport-udp
outbound_auth=mytrunk_auth
server_uri=sip:sip.example.com
client_uri=sip:1234567890@sip.example.com
contact_user=1234567890
retry_interval=60
forbidden_retry_interval=600
expiration=3600
line=yes
endpoint=mytrunk

[mytrunk_auth]
type=auth
auth_type=userpass
password=1234567890
username=1234567890
realm=sip.example.com

endpoint type

Example

Example

endpoint configured as a trunk, outbound authentication

[mytrunk]
type=endpoint
transport=transport-udp
context=from-external
disallow=all
allow=ulaw
outbound_auth=mytrunk_auth
aors=mytrunk
                   ;A few NAT relevant options that may come in handy.
force_rport=yes    ;It's a good idea to read the configuration help for each
direct_media=no    ;of these options.
ice_support=yes

[mytrunk]
type=aor
contact=sip:198.51.100.1:5060
contact=sip:198.51.100.2:5060

[mytrunk]
type=identify
endpoint=mytrunk
match=198.51.100.1
match=198.51.100.2

endpoint configured as a trunk, inbound auth and registration

[7000]
type=endpoint
context=from-external
disallow=all
allow=ulaw
transport=transport-udp
auth=7000
aors=7000

[7000]
type=auth
auth_type=userpass
password=7000
username=7000

[7000]
type=aor
max_contacts=1

endpoint configured for use with a sip phone

[6001]
type=endpoint
transport=transport-udp
context=from-internal
disallow=all
allow=ulaw
allow=gsm
auth=6001
aors=6001
;
; A few more transports to pick from, and some related options below them.
;
transport=transport-tls
media_encryption=sdes
transport=transport-udp-ipv6
rtp_ipv6=yes
transport=transport-udp-nat
direct_media=no
;
; MWI related options

aggregate_mwi=yes
mailboxes=6001@default,7001@default
mwi_from_user=6001
;
; Extension and Device state options
;
device_state_busy_at=1
allow_subscribe=yes
sub_min_expiry=30

[6001]
type=auth
auth_type=userpass
password=6001
username=6001

[6001]
type=aor
max_contacts=1
contact=sip:6001@192.0.2.1:5060

AUTH

접속 인증 설정.

Example

An example with username and password authentication.

[auth6001]
type=auth
auth_type=userpass
password=6001
username=6001

MD5 authentication

[auth6001]
type=auth
auth_type=md5
md5_cred=51e63a3da6425a39aecc045ec45f1ae8
username=6001

AOR(Address of Record)

Example

Create automatic contact objects.

[6001]
type=aor
max_contacts=1

Create manual contact objects.

[6001]
type=aor
contact=sip:6001@192.0.2.1:5060

It's useful to note that you could define only the domain and omit the user portion of the SIP URI ifyou wanted. Then you could define the user portion dynamically in your dialplan when calling the Dial application. You'll likely do this when building an AOR/Endpoint combo to use for dialing out to an ITSP. For example: "Dial(PJSIP/${EXTEN}@mytrunk)"

[mytrunk]
type=aor
contact=sip:203.0.113.1:5060

See also