Trying to Setup SIP trunks between Asterisk Servers

Hi,

I trying to Setup SIP trunks between Asterisk Servers. One is on chan_sip, the other with PJSIP.
On PJSIP side, got this error :

[Dec 31 16:37:30] NOTICE[4004724]: res_pjsip/pjsip_configuration.c:2526 ast_sip_retrieve_auths: Couldn’t find auth ‘Trunk-SIP-Centrex2’. Cannot authenticate
[Dec 31 16:37:30] WARNING[4004724]: res_pjsip_outbound_registration.c:840 handle_client_registration: Failed to set initial authentication credentials
[Dec 31 16:37:30] WARNING[4004724]: res_pjsip/pjsip_configuration.c:2552 ast_sip_retrieve_auths_vector: Auth object ‘Trunk-SIP-Centrex2’ could not be found
[Dec 31 16:37:30] WARNING[4004724]: res_pjsip_outbound_registration.c:1318 handle_registration_response: Failed to create authenticated REGISTER request to server ‘sip:217.X.X.X’ from client ‘sip:Trunk-SIP-Centrex2@217.X.X.X’
[Dec 31 16:37:30] WARNING[4004724]: res_pjsip_outbound_registration.c:1397 handle_registration_response: Fatal response ‘401’ received from ‘sip:217.X.X.X’ on registration attempt to ‘sip:Trunk-SIP-Centrex2@217.X.X.X’, stopping outbound registration

The configuration is :

[Trunk-SIP-Centrex2]
type=registration
outbound_auth=Trunk-SIP-Centrex2
server_uri=sip:217.X.X.X
client_uri=sip:Trunk-SIP-Centrex2@217.X.X.X
retry_interval=60

[Trunk-SIP-Centrex2]
type=auth
auth_type=userpass
username=Trunk-SIP-Centrex2
password=MYPASSWORD

[Trunk-SIP-Centrex2]
type=aor
contact=sip:217.X.X.X:5060

[Trunk-SIP-Centrex2]
type=endpoint
context=External
disallow=all
allow=alaw
outbound_auth=Trunk-SIP-Centrex
aors=Trunk-SIP-Centrex2

[Trunk-SIP-Centrex2]
type=identify
endpoint=Trunk-SIP-Centrex2
match=217.X.X.X

On the other side (CHAN_SIP) :

register=>Trunk-SIP-Centrex2:MYPASSWORD@217.Y.Y.Y

; Trunk vers Centrex2
[Trunk-SIP-Centrex2]
disallow=all
allow=alaw
allow=g729
allow=ulaw
directmedia=no
secret=MYPASSWORD
type=friend
host=dynamic
context=Trunk-SIP-Entreprise
call-limit=90
insecure=port,invite

Someone see where i’m wrong ?

Thanks for your help !

  1. To get access to people familiar with the channel drivers, use chan_pjsip on both sides.

This line is not consistent with the rest of the configuration, although the error message suggest that that configuration may not be the configuration actually in use, andt the above line is the good one for that configuration.

If this trunk is allowed to send chargeable calls, you really don’t want to do:

or

Why have you made the port number insecure?

(As well as the lack of maintenance of chan_sip, the preponderance of bad copy and pasted sip.conf settings means forcing one to go back to first principles for chan_pjsip is desirable for more than the one reason.

Hi,

Just trying some configuration I found on the Internet.

What is the best way to do that ? Do you have some sample ?

chan_pjsip or chan_iax2.

The best way is with static addresses, but at most one can be dynamic, if that is not possible.

For a mixed configuration, with chan_pjsip, the dynamic side should be configured like a “trunk” to a provider that uses registration, and the static side like you would for connecting it to a telephone. In a purely static case, the configuration is simpler. NAT adds complications.

See res_pjsip Configuration Examples - Asterisk Documentation for the mixed configuration. Please try to understand it, rather than copy it blindly. Ideally, you should use both auth and outbound_auth on both sides (most providers do not authenticate themselves at the SIP level). The secrets can be the same or different in each direction. If different, you will need two type=auth sections, at each side.