Quantcast
Channel: IP АТС Asterisk
Viewing all articles
Browse latest Browse all 1052

Asterisk pjsip.conf

$
0
0

Asterisk pjsip.conf

asterisk pjsip.conf Описание параметров настройки pjsip в Asterisk. Подробное руководство на русском. Примеры и сравнения. pjsip vs sip. pjsip cli.

PJSIP - драйвер канала SIP в Asterisk

Что такое PJSIP

PJSIP мультимедийная библиотека с открытым кодом, для реализации протоколов SIP, SDP, RTP, STUN, TURN и ICE. Она сочетает лучшие возможности SIP сигнализации, хорошую проходимость NAT и высокий уровень взаимодействия с приложениями. Подходит практически для любого типа систем, начиная от компьютеров и заканчивая встраиваемыми системами (embedded systems) и мобильными телефонами.

Формат файла pjsip.conf

Pjsip.conf обычный текстовый файл, как и все конфигурационные файлы Asterisk, состоит из секций. Каждая секция (раздел) определяет конфигурацию объекта res_pjsip. Секции отделены друг от друга именами, заключенными в квадратные скобки [какая неожиданность] и содержат одну или более конфигурационную опцию и её значение отделенное знаком равно.

[ SectionName ]
ConfigOption = Value
ConfigOption = Value

Имена секций pjsip.conf

В большинстве случаев имена секций могут быть произвольными, однако в случае с типами ENDPOINT и AOR имена должны совпадать со заголовком SIP URI«To» для идентификации входящих SIP запросов. Каждая секция имеет обязательную опцию type=, которой определяется назначение секции в конфигурации объектов res_pjsip.

Типы секций pjsip.conf

Ниже перечислены типы секций res_pjsipи простейшие примеры конфигурации.

Варианты и значения по умолчанию

Как узнать возможные варианты значений и параметры по умолчанию? В этом поможет встроенная справка интерфейса командной строки (CLI).

"config show help res_pjsip <configobject> <configoption>"

config show help res_pjsip aor

config show help res_pjsip aor

localhost*CLI> config show help res_pjsip aor contact[aor]
contact = [Custom](Default: )(Regex: false) 
Permanent contacts assigned to AoR 
 Contacts specified will be called whenever referenced by 'chan_pjsip'.
 Use a separate "contact=" entry for each contact required. Contacts are
 specified using a SIP URI.

ENDPOINT

Модуль ENDPOINT определяет многочисленные параметры SIP, а также связь с другими модулями - AUTH, AOR и TRANSPORT.
Секция ENDPOINT должна быть обязательно связана с одной или несколькими секциями AOR.
По сути дела, ENDPOINT является основным профилем SIP телефона или SIP транка в res_pjsip, аналогично пиру в sip.conf.
Только если там определялись почти все параметры, то здесь часть ключевых свойств вынесены в специальные секции (модули), которые и будут рассмотрены ниже.

config show help res_pjsip endpoint

config show help res_pjsip endpoint

localhost*CLI> config show help res_pjsip endpoint
endpoint: [category !~ /.?/] 
Endpoint 
 The *Endpoint* is the primary configuration object. It contains the core
SIP related options only, endpoints are *NOT* dialable entries of their own.
Communication with another SIP device is accomplished via Addresses of Record(AoRs)which have one or more contacts assicated with them. Endpoints *NOT*
configured to use a 'transport' will default to first transport found in"pjsip.conf" that matches its type.
Example: An Endpoint has been configured with no transport. When it comestime to call an AoR, PJSIP will find the first transport that matches the
type. A SIP URI of 'sip:5000@[11::33]' will use the first IPv6 transport and
try to send the request.
If the anonymous endpoint identifier is in use an endpoint with the name"anonymous@domain" will be searched foras a last resort. If this is not found
it will fall back to searching for"anonymous". If neither endpoints are found
the anonymous endpoint identifier will not return an endpoint and anonymous
calling will not be possible. 
100rel                    -- Allow support for RFC3262 provisional ACK tags
aggregate_mwi             --
allow                     -- Media Codec(s) to allow
aors                      -- AoR(s) to be used with the endpoint
auth                      -- Authentication Object(s) associated with the endpoint
callerid                  -- CallerID information for the endpoint
callerid_privacy          -- Default privacy level
callerid_tag                 -- Internal id_tag for the endpoint
context                         -- Dialplan context for inbound sessions
direct_media_glare_mitigation -- Mitigation of direct media (re)INVITE glare
direct_media_method       -- Direct Media method type
connected_line_method     -- Connected line method type
direct_media              -- Determines whether media may flow directly between endpoints.
disable_direct_media_on_nat -- Disable direct media session refreshes when NAT obstructs the med
disallow                  -- Media Codec(s) to disallow
dtmf_mode                 -- DTMF mode
media_address             -- IP address used in SDP for media handling
force_rport               -- Force use of return port
ice_support               -- Enable the ICE mechanism to help traverse NAT
identify_by               -- Way(s)for Endpoint to be identified
redirect_method           -- How redirects received from an endpoint are handled
mailboxes                 -- NOTIFY the endpoint when state changes for any of the specified m
moh_suggest               -- Default Music On Hold class
outbound_auth             -- Authentication object used for outbound requests
outbound_proxy            -- Proxy through which to send requests, a full SIP URI must be prov
rewrite_contact           -- Allow Contact header to be rewritten with the source IP address-p
rtp_ipv6                  -- Allow use of IPv6 for RTP traffic
rtp_symmetric             -- Enforce that RTP must be symmetric
send_diversion            -- Send the Diversion header, conveying the diversion information to
send_pai                  -- Send the P-Asserted-Identity header
send_rpid                 -- Send the Remote-Party-ID header
timers_min_se             -- Minimum session timers expiration period
timers                    -- Session timers for SIP packets
timers_sess_expires       -- Maximum session timer expiration period
transport                 -- Desired transport configuration
trust_id_inbound          -- Accept identification information received from this endpoint
trust_id_outbound         -- Send private identification details to the endpoint.type-- Must be of type'endpoint'.
use_ptime                 -- Use Endpoints requested packetisation interval
use_avpf                  -- Determines whether res_pjsip will use and enforce usage of AVPF f
media_encryption          -- Determines whether res_pjsip will use and enforce usage of media
inband_progress           -- Determines whether chan_pjsip will indicate ringing using inband
call_group                -- The numeric pickup groupsfor a channel.
pickup_group              -- The numeric pickup groups that a channel can pickup.
named_call_group          -- The named pickup groupsfor a channel.
named_pickup_group        -- The named pickup groups that a channel can pickup.
device_state_busy_at      -- The number of in-use channels which will cause busy to be returne
t38_udptl                 -- Whether T.38 UDPTL support is enabled or not
t38_udptl_ec              -- T.38 UDPTL error correction method
t38_udptl_maxdatagram     -- T.38 UDPTL maximum datagram size
fax_detect                -- Whether CNG tone detection is enabled
t38_udptl_nat             -- Whether NAT support is enabled on UDPTL sessions
t38_udptl_ipv6            -- Whether IPv6 is used for UDPTL Sessions
tone_zone                 -- Set which countrys indications to use for channels created for t
language                  -- Set the default language to use for channels created for this end
one_touch_recording       -- Determines whether one-touch recording is allowed for this endpoi
record_on_feature         -- The feature to enact when one-touch recording is turned on.
record_off_feature        -- The feature to enact when one-touch recording is turned off.
rtp_engine                -- Name of the RTP engine to use for channels created for this endpo
allow_transfer            -- Determines whether SIP REFER transfers are allowed for this endpo
sdp_owner                 -- String placed as the username portion of an SDP origin (o=) line.
sdp_session               -- String used for the SDP session (s=) line.
tos_audio                 -- DSCP TOS bits for audio streams
tos_video                 -- DSCP TOS bits for video streams
cos_audio                 -- Priority for audio streams
cos_video                 -- Priority for video streams
allow_subscribe           -- Determines if endpoint is allowed to initiate subscriptions with
sub_min_expiry            -- The minimum allowed expiry timefor subscriptions initiated by th
from_user                 -- Username to use in From header for requests to this endpoint.
mwi_from_user             -- Username to use in From header for unsolicited MWI NOTIFYs to thi
from_domain               -- Domain to user in From header for requests to this endpoint.
dtls_verify               -- Verify that the provided peer certificate is valid
dtls_rekey                -- Interval at which to renegotiate the TLS session and rekey the SR
dtls_cert_file            -- Path to certificate file to present to peer
dtls_private_key          -- Path to private key for certificate file
dtls_cipher               -- Cipher to use for DTLS negotiation
dtls_ca_file              -- Path to certificate authority certificate
dtls_ca_path              -- Path to a directory containing certificate authority certificates
dtls_setup                -- Whether we are willing to accept connections, connect to the othe
srtp_tag_32               -- Determines whether 32 byte tags should be used instead of 80 byte
set_var                   -- Variable set on a channel involving the endpoint.
message_context           -- Context to route incoming MESSAGE requests to.
Простой пример конфигурации секции ENDPOINT
[777]
type=endpoint
context=from-internal
disallow=all
allow=alaw
transport=udp-transport
auth=auth777
aors=777

В данном примере мы видим тип секции: type=endpoint
контекст, разрешенные кодеки и также ассоциацию с другими секциями
transport=udp-transport, auth=auth777и aors=777.
Насколько я понимаю, опции typeи aorsявляются обязательными для работоспособности точки.
Для назначения Caller ID этому пиру(ENDPOINT), потребуется задать следующие параметры:

trust_id_outbound=yes
callerid=V Pupkin <777>

TRANSPORT

Настройка транспортного уровня res_pjsip. Используются протоколы UDP, TCP, WebSockets и методы шифрования TLS/SSL. Можно настроить одну транспортную секцию для использования множеством точек (ENDPOINT), или создать уникальный транспортный уровень для конкретной точки. Условно, можно сравнить TRANSPORT, с секцией [general] sip.conf.

config show help res_pjsip transport

config show help res_pjsip transport

localhost*CLI> config show help res_pjsip transport
transport: [category !~ /.?/] 
SIP Transport *Transports*
There are different transports and protocol derivatives supported by 're
s_pjsip'. They are in order of preference: UDP, TCP, and WebSocket (WS).
NOTE: Changes to transport configuration in pjsip.conf will only be effected
on a complete restart of Asterisk. A module reload will not suffice. 
async_operations          -- Number of simultaneous Asynchronous Operationsbind-- IP Address and optional port to bind to for this transport
ca_list_file              -- File containing a list of certificates to read(TLS ONLY)
cert_file                 -- Certificate filefor endpoint (TLS ONLY)
cipher                    -- Preferred Cryptography Cipher (TLS ONLY)
domain                    -- Domain the transport comes from
external_media_address    -- External IP address to use in RTP handling
external_signaling_address -- External address for SIP signalling
external_signaling_port   -- External port for SIP signalling
method                    -- Method of SSL transport (TLS ONLY)
local_net                 -- Network to consider local(used for NAT purposes).
password                  -- Password required for transport
priv_key_file             -- Private key file(TLS ONLY)
protocol                  -- Protocol to use for SIP traffic
require_client_cert       -- Require client certificate (TLS ONLY)type-- Must be of type'transport'.
verify_client             -- Require verification of client certificate (TLS ONLY)
verify_server             -- Require verification of server certificate (TLS ONLY)
tos                       -- Enable TOS for the signalling sent over this transport
cos                       -- Enable COS for the signalling sent over this transport

По умолчанию, для применения настроек транспортного уровня недостаточно перечитать конфиги. Потребуется рестартовать Asterisk, если не задано allow_reload=true (по умолчанию - false)

простой пример конфигурации секции TRANSPORT
[udp-transport]
type=transport
protocol=udp
bind=0.0.0.0

или TLS транспорт:

[transport-tls]
type=transport
protocol=tls
bind=0.0.0.0:5066
cert_file=/etc/asterisk/keys/asterisk.crt
priv_key_file=/etc/asterisk/keys/asterisk.key
external_media_address=123.123.123.1
external_signaling_address=123.123.123.1
local_net=10.10.0.0/16
method=tlsv1

Каждый транспорт в системе должен иметь уникальный порт.

localhost*CLI> pjsip show transports

Transport:  <TransportId........>  <Type>  <cos>  <tos>  <BindAddress....................>
 =========================================================================================

Transport:  udp-transport             udp      0      0  0.0.0.0:5080
Transport:  udp-transport-infra       udp      0      0  192.168.1.110:5081
Transport:  udp-transport-megafon     udp      0      0  0.0.0.0:5060

AUTH

Секция аутентификации содержит опции и полномочия для входящих и исходящих регистраций. С этой секцией ассоциируются такие секции как ENDPOINT и REGISTRATIONS.
Разные ENDPOINT и REGISTRATIONS могут использовать одну и ту же секцию аутентификации, если требуется.

config show help res_pjsip auth

config show help res_pjsip auth

localhost*CLI> config show help res_pjsip auth
auth: [category !~ /.?/] 
Authentication type 
 Authentication objects hold the authentication information for use by other
objects such as'endpoints' or 'registrations'. This also allows for multiple
objects to use a single auth object. See the 'auth_type' config option for
password style choices. 
auth_type                    -- Authentication type
nonce_lifetime            -- Lifetime of a nonce associated with this authentication config.
md5_cred                    -- MD5 Hash used for authentication.
password                     -- PlainText password used for authentication.
realm                          -- SIP realm for endpointtype-- Must be 'auth'
username                    -- Username to use for account
Простой пример секции AUTH
[auth777]
type=auth
auth_type=userpass
password=password
username=777

с использованием MD5

[auth6001]
type=auth
auth_type=md5
md5_cred=5f4dcc3b5aa765d61d8327deb882cf99
username=777

AOR

Главная функция AoR (Address of Record) указать Asterisk, как связаться с ENDPOINT. Без соответствующей AOR секции, точка ENDPOINT будет недоступна для вызова. Здесь также задаются соответствия голосовой почте, MWI, продолжительность действия регистрации -expiration и настройки qualify (периодической отправки SIP сообщений OPTONS для мониторинга состояния устройств)

Когда Asterisk получает запрос на регистрацию от устройства, он в первую очередь ищет соответствующую SIP заголовку To: «777»<sip:777@192.168.1.21;transport=UDP> запись в именах секций AOR – в нашем прмере [777]

config show help res_pjsip aor

config show help res_pjsip aor

localhost*CLI> config show help res_pjsip aor
aor: [category !~ /.?/] 
The configuration for a location of an endpoint 
 An AoR is what allows Asterisk to contact an endpoint via res_pjsip. If no
AoRs are specified, an endpoint will not be reachable by Asterisk. Beyond
that, an AoR has other uses within Asterisk, such as inbound registration. 
 An 'AoR' is a way to allow dialing a group of 'Contacts' that all use the
 same 'endpoint'for calls.
 This can be used as another way of grouping a list of contacts to dial
 rather than specifing them each directly when dialing via the dialplan. This
 must be used in conjuction with the 'PJSIP_DIAL_CONTACTS'.
 Registrations: For Asterisk to match an inbound registration to an endpoint,
 the AoR object name must match the user portion of the SIP URI in the "To:"
 header of the inbound SIP registration. That will usually be equivalent to
 the "user name"setin your hard or soft phones configuration. 
contact                   -- Permanent contacts assigned to AoR
default_expiration        -- Default expiration timein seconds for contacts that are dynamica
mailboxes                 -- Allow subscriptions for the specified mailbox(es)
maximum_expiration        -- Maximum time to keep an AoR
max_contacts              -- Maximum number of contacts that can bind to an AoR
minimum_expiration        -- Minimum keep alive timefor an AoR
remove_existing           -- Determines whether new contacts replace existing ones.type-- Must be of type'aor'.
qualify_frequency         -- Interval at which to qualify an AoR
authenticate_qualify      -- Authenticates a qualify request if needed
outbound_proxy            -- Outbound proxy used when sending OPTIONS request
support_path              -- Enables Path support for REGISTER requests and Route support for
Простейший пример секции AOR
[777]
type=aor
max_contacts=1

Опция max_contact=1 значит, что только один SIP User Agent может быть одновременно зарегистрирован через эту запись AOR. Можно указать и 10, если потребуется.

[777]
type=aor
contact=sip:777@192.168.1.21:5060

Во втором примере мы не ожидаем запроса на регистрацию от SIP UA,
а указываем вручную постоянный контакт для этой записи.
Можно не беспокоится о кол-ве подключений, адрес все равно один.

[siptrunk]
type=aor
contact=sip:123.123.1.1:5060

В последнем примере пропущен username, что позволяет использовать данную запись для исходящей связи,
определяя вызываемый номер при помощи диалплана «Dial(PJSIP/${EXTEN}@siptrunk)».

REGISTRATION

Секция регистраций отвечает за исходящие регистрации. Используется для регистрации в удаленных системах, будь то другой Asterisk или транк от провайдера.

config show help res_pjsip_outbound_registration registration

config show help res_pjsip_outbound_registration registration

localhost*CLI> config show help res_pjsip_outbound_registration  registration
registration: [category !~ /.?/] 
The configuration for outbound registration 
 Registration is *COMPLETELY* separate from the rest of 'pjsip.conf'. A minimal
configuration consists of setting a 'server_uri'        and a 'client_uri'. 
auth_rejection_permanent  -- Determines whether failed authentication challenges are treated a
client_uri                -- Client SIP URI used when attempting outbound registration
contact_user              -- Contact User to use in request
expiration                -- Expiration timefor registrations in seconds
max_retries               -- Maximum number of registration attempts.
outbound_auth             -- Authentication object to be used for outbound registrations.
outbound_proxy            -- Outbound Proxy used to send registrations
retry_interval            -- Interval in seconds between retries if outbound registration is u
forbidden_retry_interval  -- Interval used when receiving a 403 Forbidden response.
server_uri                -- SIP URI of the server to register against
transport                 -- Transport used for outbound authenticationtype-- Must be of type'registration'.
support_path              -- Enables Path support for outbound REGISTER requests  
Пример секции REGISTRATION
[siptrunk]
type=registration
transport=udp-transport
outbound_auth=siptrunk
server_uri=sip:123.123.1.1:5060
client_uri=sip:username@192.168.1.1:5060
retry_interval=60

Для регистрации понадобится определить используемый транспорт и секцию аутентификации.
Помимо этого, наверняка, потребуется указать контакт для входящих вызовов.

[providertrunk]
type=registration
transport=udp-transport
outbound_auth=providertrunk
server_uri=sip:sip.example.com
client_uri=sip:1234567890@sip.example.com
retry_interval=60

Пример регистрации транка провайдера.

DOMAIN_ALIAS

Псевдоним домена. [Имя] данной секции является псевдонимом, а конфигурационная опция domain=, доменным именем, которому сопоставлен псевдоним.

config show help res_pjsip domain_alias

config show help res_pjsip domain_alias

localhost*CLI> config show help res_pjsip domain_alias
domain_alias: [category !~ /.?/] 
Domain Alias 
 Signifies that a domain is an alias. If the domain on a session is not found
to match an AoR then this object is used to see if we have an aliasfor the
AoR to which the endpoint is binding. This objects name as defined in
configuration should be the domain alias and a config option is provided to
specify the domain to be aliased. type-- Must be of type'domain_alias'.
domain                    -- Domain to be aliased
Пример секции DOMAIN_ALIAS
[example2.com]
type=domain_alias
domain=example.com

ACL

Модуль не привязан к какой-либо точке ENDPOINTs и управляет всеми входящими SIP коммуникациями с использованием res_pjsip. Установки ACl (Access Control Lis) могут быть назначены в самой секции, или в файле acl.confна который будет ссылаться секция.

config show help res_pjsip_acl acl

config show help res_pjsip_acl acl

localhost*CLI> config show help res_pjsip_acl  acl
acl: [category !~ /.?/] 
Access Control List 
acl                       -- List of IP ACL section names in acl.conf
contact_acl               -- List of Contact ACL section names in acl.conf
contact_deny              -- List of Contact header addresses to deny
contact_permit            -- List of Contact header addresses to permit
deny                      -- List of IP addresses to deny access from
permit                    -- List of IP addresses to permit access fromtype-- Must be of type'acl'.
Простые примеры ACL

Asterisk res_pjsip_acl

Настройки берутся из файла acl.conf:

[acl]
type=acl
acl=example_named_acl1

Настройки непосредственно в секции:

[acl]
type=acl
deny=0.0.0.0/0.0.0.0
permit=123.12.123.0
permit=123.12.123.1

Конфиг разрешающий регистрацию на основе SIP заголовка, а не IP адреса.

[acl]
type=acl
contactdeny=0.0.0.0/0.0.0.0
contactpermit=123.12.123.0
contactpermit=123.12.123.1

IDENTIFY

Определяет конечные точки с помощью IP-адреса источника.

config show help res_pjsip_endpoint_identifier_ip identify

config show help res_pjsip_endpoint_identifier_ip identify

localhost*CLI> config show help res_pjsip_endpoint_identifier_ip identify
identify: [category !~ /.?/]

Identifies endpoints via source IP address

endpoint                  -- Name of Endpoint
match                     -- IP addresses or networks to match against
type                      -- Must be of type 'identify'.
Пример identity
[777]
type=identify
endpoint=777
match=123.0.112.1

CONTACT

Контакты являются одним из способов не указывать явно SIP URIв плане набора (диалплане).

config show help res_pjsip contact

config show help res_pjsip contact

localhost*CLI> config show help res_pjsip contact
contact: [category !~ /.?/]

A way of creating an aliased name to a SIP URI

 Contacts are a way to hide SIP URIs from the dialplan directly. They are
also used to make a group of contactable parties when in use with 'AoR' lists.


type                      -- Must be of type 'contact'.
uri                       -- SIP URI to contact peer
expiration_time           -- Time to keep alive a contact
qualify_frequency         -- Interval at which to qualify a contact
outbound_proxy            -- Outbound proxy used when sending OPTIONS request
path                      -- Stored Path vector for use in Route headers on outgoing requests.

Отношения объектов конфигурации pjsip.conf

ENDPOINT

  • Множество ENDPOINTs связываются с множеством AORs
  • Ноль или больше ENDPOINTs связаны с ноль или одной AUTHs
  • Ноль или больше ENDPOINTs связаны с как минимум одним TRANSPORT
  • Ноль или одна ENDPOINTs связана с определенной IDENTIFY

REGISTRATION

  • Ноль или больше REGISTRATIONs связаны с ноль или одной AUTHs
  • Ноль или больше REGISTRATIONs связаны с как минимум одним TRANSPORT

AOR

  • Множество ENDPOINTs связываются с множеством AORs
  • Множество AORs связаны с множеством CONTACTs

CONTACT

  • Множество CONTACTs связываются с множеством AORs

IDENTIFY

  • Ноль или больше ENDPOINTs связаны с определенным IDENTIFY объектом.

ACL, DOMAIN_ALIAS

  • Эти объекты не имеют направленных связей с другими объектами.

Примеры диалплана для вызова PJSIP пиров и екстеншенов.

 exten => _6XXX,1,Dial(PJSIP/${EXTEN})
 exten => _9NXXNXXXXXX,1,Dial(PJSIP/mytrunk/sip:${EXTEN:1}@203.0.113.1:5060)
 exten => _9NXXNXXXXXX,1,Dial(PJSIP/${EXTEN:1}@mytrunk)

Примеры

Пример ENDPOINT для одного SIP телефона с регистрацией на Asterisk.
;===============TRANSPORT

[udp-transport]
type=transport
protocol=udp
bind=0.0.0.0

;===============EXTENSION 777

[777]
type=endpoint
context=from-internal
disallow=all
allow=alaw
transport=udp-transport
auth=auth777
aors=777

[auth777]
type=auth
auth_type=userpass
password=777
username=777

[777]
type=aor
max_contacts=1
  • auth= используется для входящей аутентификации
  • max_contacts= установите кол-во регистраций, одну или более, разрешенных для этой учетной записи.
Пример SIP транка с исходящей регистрацией
;==============TRANSPORTS

[udp-transport]
type=transport
protocol=udp
bind=0.0.0.0

;===============TRUNK

[siptrunk]
type=registration
transport=udp-transport
outbound_auth=siptrunk
server_uri=sip:sip.example.com
client_uri=sip:1234567890@sip.example.com
retry_interval=60

[siptrunk]
type=auth
auth_type=userpass
password=1234567890
username=1234567890

[siptrunk]
type=aor
contact=sip:123.0.112.1:5060

[siptrunk]
type=endpoint
transport=udp-transport
context=from-trunk
disallow=all
allow=alaw,ulaw
outbound_auth=siptrunk
aors=siptrunk

[siptrunk]
type=identify
endpoint=siptrunk
match=123.0.112.1
Пример регистрации множественных ENDPOINTs с использованием шаблонов
;===============TRANSPORT

[udp-transport]
type=transport
protocol=udp
bind=0.0.0.0

;===============ENDPOINT TEMPLATES

[endpoint-basic](!)
type=endpoint
transport=udp-transport
context=from-internal
disallow=all
allow=alaw

[auth-userpass](!)
type=auth
auth_type=userpass

[aor-single-reg](!)
type=aor
max_contacts=1

;===============EXTENSION 777

[777](endpoint-basic)
auth=auth777
aors=777

[auth777](auth-userpass)
password=777
username=777

[777](aor-single-reg)

;===============EXTENSION 778

[778](endpoint-basic)
auth=auth778
aors=778

[auth778](auth-userpass)
password=778
username=778

[778](aor-single-reg)

;===============EXTENSION 779

[779](endpoint-basic)
auth=auth779
aors=779

[auth779](auth-userpass)
password=779
username=779

[779](aor-single-reg) 

От старого к новому - sip.conf к pjsip.conf сравнение примеров.

Сравнение конфигурации ENDPOINT

  • Два SIP телефона должны звонить и принимать вызовы через Asterisk.
  • В обоих случаях для аутентификации используются username и password.
  • 777 регистрируется с динамического IP, 778 со статического IP адреса.

1

sip.confpjsip.conf
[general]
udpbindaddr=0.0.0.0

[777]
type=friend
host=dynamic
disallow=all
allow=alaw
context=from-internal
secret=1234

[778]
type=friend
host=192.168.1.2
disallow=all
allow=alaw
context=from-internal
secret=1234
[udp-transport]
type=transport
protocol=udp
bind=0.0.0.0

[777]
type = endpoint
transport = udp-transport
context = from-internal
disallow = all
allow = alaw
aors = 777
auth = auth777

[777]
type = aor
max_contacts = 1

[auth777]
type=auth
auth_type=userpass
password=1234
username=777

[778]
type = endpoint
transport = udp-transport
context = from-internal
disallow = all
allow = alaw
aors = 778
auth = auth778

[778]
type = aor
contact = sip:778@192.168.1.2:5060

[auth778]
type=auth
auth_type=userpass
password=1234
username=778

Сравнение конфигурации trunk

sip.confpjsip.conf
[general]
udpbindaddr=0.0.0.0

register => myname:1234@203.0.113.1:5060

[mytrunk]
type=friend
secret=1234
username=myname
host=123.0.112.1
disallow=all
allow=alaw
context=from-trunk
[simpletrans]
type=transport
protocol=udp
bind=0.0.0.0
[mytrunk]
type=registration
transport=simpletrans
outbound_auth=mytrunk
server_uri=sip:@123.0.112.1:5060
client_uri=sip:myname@123.0.112.1:5060

[mytrunk]
type=auth
auth_type=userpass
password=1234
username=myname

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

[mytrunk]
type=endpoint
transport=simpletrans
context=from-trunk
disallow=all
allow=alaw
outbound_auth=mytrunk
aors=mytrunk

[mytrunk]
type=identify
endpoint=mytrunk
match=123.0.112.1

PJSIP CLI

Connected to Asterisk 13.9.1 currently running on aster2 (pid = 17401)
asterisk*CLI> core show help pjsip
pjsip dump endpt               -- Dump the res_pjsip endpt internals
pjsip export config_wizard primitives [to] -- Export config wizard primitives
pjsip list aors                -- List PJSIP Aors
pjsip list auths               -- List PJSIP Auths
pjsip list channels            -- List PJSIP Channels
pjsip list ciphers             -- List available OpenSSL cipher names
pjsip list contacts            -- List PJSIP Contacts
pjsip list endpoints           -- List PJSIP Endpoints
pjsip list identifies          -- List PJSIP Identifies
pjsip list registrations       -- List PJSIP Registrations
pjsip list transports          -- List PJSIP Transports
pjsip qualify                  -- Send an OPTIONS request to a PJSIP endpoint
pjsip send register            -- Registers an outbound registration target
pjsip send unregister          -- Unregisters outbound registration target
pjsip set history {on|off|clear} -- Enable/Disable PJSIP History
pjsip set logger {on|off|host} -- Enable/Disable PJSIP Logger Output
pjsip show aors                -- Show PJSIP Aors
pjsip show aor                 -- Show PJSIP Aor
pjsip show auths               -- Show PJSIP Auths
pjsip show auth                -- Show PJSIP Auth
pjsip show channels            -- Show PJSIP Channels
pjsip show channel             -- Show PJSIP Channel
pjsip show channelstats        -- Show PJSIP Channel Stats
pjsip show contacts            -- Show PJSIP Contacts
pjsip show contact             -- Show PJSIP Contact
pjsip show endpoints           -- Show PJSIP Endpoints
pjsip show endpoint            -- Show PJSIP Endpoint
pjsip show history             -- Display PJSIP History
pjsip show identifiers         -- List registered endpoint identifiers
pjsip show identifies          -- Show PJSIP Identifies
pjsip show identify            -- Show PJSIP Identify
pjsip show registrations       -- Show PJSIP Registrations
pjsip show registration        -- Show PJSIP Registration
pjsip show settings            -- Show global and system configuration options
pjsip show transports          -- Show PJSIP Transports
pjsip show transport           -- Show PJSIP Transport
pjsip show version             -- Show the version of pjproject in use

Asterisk настройка


Viewing all articles
Browse latest Browse all 1052

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>