PJSIP Wizard Endpoint Device/User Association Name

Hi, the title is probably a little vague, but I wasn’t quite sure how to describe this thread. I’m also not too sure how to explain what I’m trying to achieve, but I’ll try.

I have managed to set up PJSIP wizard configuration for SIP phone endpoints, that can authenticate and register. These SIP phones can also dial each other correctly.

The way that I’ve configured them is to name each PJSIP Wizard endpoint configuration section based on the extension number, so [100], [101], [102] etc.

This means that when I enter the phone number for the line in the SIP phone, (and add auth configuration), the phone registers.

As for the dialplan, I can do a quick match and dial an endpoint using the ${EXTEN} variable.

Provisioning also works great, with a profile setup, and variables within the profile to populate line telephone number, caller id/name, and other various settings etc.


What I would like to do is to not necessarily associate an endpoint to a user (or number), but rather to associate an endpoint to a device. For example, an endpoint name of the MAC address of the phone, or something like “phone1”, so it is more fluid, in that phone could be replaced, and only the phoneprov MAC address would need to be changed in the configuration, etc. (providing it is the same phone model/make, etc. etc. blah blah).

I would then like to contact an extension using just the number, however…
…this is fine, but what happens is that I run into the problem of having an easy “shortcut” in the dialplan. I can no longer get away with using the ${EXTEN} variable, as PJSIP expects an endpoint name.

The reason I want to do this, is in case I want to change the telephone number for a SIP phone. I’ve noticed that if I change it using the current configuration (as an endpoint name), when I reload PJSIP, the provisioning stops working because that endpoint associated with the MAC address (“phoneprov/MAC” setting) changed. Also I can no longer issue a “check-sync” SIP notify message to the phone because again the endpoint Asterisk thought the phone was at is no longer there. What I really want to do, is be able to remotely push configuration to a phone in case someone new wants to use a phone.

I played around and tried “endpoint/identify_by = auth_username”, using something like [phone1] as the endpoint name, so that at least I could use something that looks somewhat like a “device” specific configuration setting. That then allowed me to just change line phone number for that SIP phone.

The issue I have is when I go to call a phone, the configuration still expects the endpoint name, so I still need to define something in the dialplan like “PJSIP/phone1/123”. Dialing “phone1”, (if that could somehow be even possible), is not a practical solution.

I found “PJSIP_DIAL_CONTACTS()”, which works to an extent, BUT… that isn’t practical, because that is also requiring an endpoint, then dialing the contacts within it.

I looked at “PJSIP_AOR()”, and “PJSIP_CONTACT()”, but wasn’t sure what to do with these.

Ultimately, what I’m asking is, using the PJSIP Wizard, can I define an endpoint name as a configuration section, but define a different AOR/Contact name/number(ideally), and easily dial it using a shortcut in the dialplan?

I believe you should be able to do this with the hint_exten setting.

Say your phone is

hint_exten = 1000
endpoint/context = mycontext

Then in your dialplan

exten => 1000,1,Dial(${HINT})

This is perfect, thanks!

It works as expected, but something I have noticed in the logs when making a call between internal phones:

[Dec 17 23:22:39] NOTICE[5368]: res_pjsip/pjsip_distributor.c:659 log_failed_request: Request 'INVITE' from '<sip:666@>' failed for '' (callid: 33b2c3f3-3f21c32172cf614bf8920080f0808080@KX-HDV130X) - No matching endpoint found

Will this cause some other complications that i’m yet to discover?

To me that looks like a call from a phone that is not being matched by an endpoint you have defined.