Pjsip trunk 2 asterisk servers

I am trying to make a trunk with type registration between 2 asterisk servers.
but still could not find out how to do it.

asterisk1 xx.xx.xx.100
asterisk2 xx.xx.xx.90

at asterisk 1: pjsip.conf

[mytrunk]

type=registration

outbound_auth=mytrunk

server_uri=sip:xx.xx.xx.90

client_uri=sip:1234@xx.xx.xx.90

retry_interval=60

[mytrunk]

type=auth

auth_type=userpass

password=1234

username=1234

[mytrunk]

type=aor

contact=sip:xx.xx.xx.90:5060

[mytrunk]

type=endpoint

context=from-external

disallow=all

allow=ulaw

outbound_auth=mytrunk

aors=mytrunk

[mytrunk]

type=identify

endpoint=mytrunk

match=xx.xx.xx.90


at same asterisk 1:
i did the dialplan


at asterisk2 :

i created an endpoint
with username= 1234
password=1234


i tried to make a call from an endpoint at asterisk 1 to asterisk 2 but failed.


note: i am able to make a call from asterisk1 to asterisk2 if i created a trunk without registration. but i need it to register.

it looked like i have to add callerid num as the username of the trunk.
from extensions.conf

i have to set(callerid(num)=nameoftrunk).
then make the dial via this trunk.

You could also set the “from_user” option on the endpoint to the username/endpoint name to authenticate as.

would you be more specific please?

i tried these two scenarios but did not work.

1- extensions.conf: set(from_user=1234)

did not work

2- pjsip.conf: i added from_user parameter to the extension that i am dialing from to this trunk.

did not work as well.

maybe i have done something wrong.

The from_user option would be set on the endpoint used to the dial the remote side. It sets the user portion of the From header, commonly required for ITSPs and when connecting to other Asterisk instances when doing username/password authentication.

1 Like

oh yes it worked.

i added from_user option to the sip trunk at pjsip.conf but unfortunately this way i would be losing the callerID forever.

i still prefer this way:

but thanks anw.

That’s why you transport callerid using one of the alternate methods, P-Asserted-Identity or Remote-Party-ID.

1 Like

does this method have an advantage over the one I suggested ?

It’s how everyone else generally does it. If you want to do it your way, go ahead.

1 Like

It avoids abusing caller ID for the account name, and allows PAI or RPID to be used to send a caller ID that is not the same as the account name.

There does seem a tendency for FreePBX users to over from-user and manipulate the caller ID, but that is probably because FreePBX doesn’t expose users to the true SIP URIs so they don’t really understand the significance of the from user.

1 Like

oh then you guys are suggesting this method in case my account name is different from the CallerID i want to send! THAT IS WHAT I UNDERSTOOD. is it right @david551 ?

but in my case i just want to send the CALLERID which is the same as account name.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.