How to dial non-registered phone on LAN using PJSIP

I want to dial a SIP phone on my LAN which has never registered with Asterisk. Which I assume means I need to dial by IP address (since Asterisk doesn’t yet know how to connect to the phone).

Scenario 1: Assume the phone has not registered with asterisk and is not setup in pjsip.conf ; it was just plugged into the network. I found this in the docs:

Dial(PJSIP/mytrunk/sip:${EXTEN:1}@203.0.113.1:5060)

but since the phone is on my LAN, there is no “mytrunk”. Would I use:

DIAL(PJSIP/sip:123@1.1.1.1:5060)

I found this post that creates a generic PJSIP trunk (to place in “mytrunk” name field) and then per first example above, but that seems overly complex to setup a trunk just for that. Also, since this phone is configured for multiple phone accounts (e.g. 123 & 345), I assume I need to put the 123@ in the dial string to ensure I ring the right line on the phone…

Scenario 2: Assume the phone is setup in Asterisk (pjsip.conf), but the phone does not register. How would I dial that phone using info from PJSIP? I read that pjsip can have a contact line like this for each phone:

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

Does that mean I can just DIAL(PJSIP/123) and it will use that IP address, even if the phone has never registered?

You must specify an endpoint. It doesn’t have to have an AOR associated with it, but you must specify an endpoint. It defines the configuration (codecs, encryption, etc) to use. You do it like the first Dial line, specifying an endpoint. You can not just dial a SIP URI without an endpoint.

Yes, you can specify a contact in the configuration and dialing the endpoint would call it (provided the endpoint references the AOR).

Sorry if this should be obvious, but I’m new to PJSIP :slight_smile:

When you say I must specify an “endpoint”, do you mean the extension (like “123”) in the dial string, like this:

DIAL(PJSIP/sip:123@1.1.1.1:5060)

Or do you mean I have to create an entry in the pjsip.conf in the in the docs like this:

[123]
type=endpoint
context=default
disallow=all
allow=ulaw
transport=simpletrans

but leave out the auth= and aors= lines because you mentioned I don’t need an AOR? Or (which I suspect), do you mean I need to do both of the above?

And my first example above does not include trunk name (mytrunk), so just to confirm it’s correct to use PJSIP/sip:123 in front of the @, with no “trunk” in that part of the dial string?

Thanks

You have to create an endpoint entry in pjsip.conf. You don’t need to specify a transport. You then specify it in the dial line: PJSIP/123/sip:123@1.1.1.1

Ah, ok I think I’m getting it. This part of the dial string tells Asterisk what endpoint entry to use in pjsip.conf:

PJSIP/123/sip:123@1.1.1.1
^^^^^^^^^

and below this part is used for the invite (trunk section is optional),

PJSIP/123/sip:123@1.1.1.1
          ^^^^^^^^^^^^^^^

and below this part is used for the UDP/TCP connection

PJSIP/123/sip:123@1.1.1.1
                  ^^^^^^^

and if my pjsip.conf endpoint entry also specifies an AOR section which contains a contact= line, then I could simply dial

PJSIP/123

And since either way gives Asterisk the IP information, then the phone does not have to register and I can simply connect to it with a Dial.

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