Only 1 of 3 phones on PJSIP extension ring when dialled

I have 3 phones registered to extension PJSIP/123 on Asterisk as shown here (result of “PJSIP show endpoint 123”):

 Endpoint:  123/123                                              Not in use    0 of inf
    OutAuth:  123-auth/123
     InAuth:  123-auth/123
        Aor:  123                                                5
      Contact:  123/sip:123@192.168.1.20:5060;line=17640  0e6b27d6cb Avail        38.857
      Contact:  123/sip:123@192.168.1.10:5060             1c9c7859ae Avail        53.683
      Contact:  123/sip:123@192.168.1.20:5060;line=1677   20cdab8669 Avail        19.974

I then create a channel with /channels/create (to endpoint PJSIP/123), and add it to a bridge with /bridges/{bridegeId}/addChannel, and finally dial with /channels/{channelId}/dial. After doing so, only a single phone registered to Asterisk as extension 123 rings. The other two phones don’t ring or show any indication of activity.

I turned on logging for PJSIP invites, and only a single invite goes out, to the first phone listed on the extension (see above). Is this expected behavior? How do I tell Asterisk to ring all three phones registered to PJSIP/123 ?

I’m aware of a PJSIP_DIAL_CONTACTS function I can use in in the dialplan (to create a dial string), but how would I use that with the /create function, assuming that’s the right approach? I don’t see any reference to this in the docs, but is there a DIAL_STRING variable accepted by the /create function that I can pass? I asked MS Copilot and it offered the following solution:

curl -X POST http://<asterisk-server>:8088/ari/channels \
     -H "Content-Type: application/json" \
     -d '{
           "endpoint": "PJSIP/123",
           "extension": "123",
           "context": "default",
           "priority": 1,
           "variables": {
             "DIAL_STRING": "${PJSIP_DIAL_CONTACTS(123)}"
           }
         }'

However, I’ve encountered many times where Copilot just makes up answers that don’t actually work…

I don’t know if this is “the right way” or not, but I give all my extensions unique extension #s and put them all in a ring group. If I want to assign a “special” extension that they all can pick up, I put BLF keys on the phones for that extension.

I’m interested in responses to this since trying to do it your way doesn’t seem to work for me but I had just put that down to the phonesets I’m using being P.O.S.

I realize ring groups would work around the problem by forcing each endpoint to have its own extension. But, since my app would be deployed to PBX’s where the admin’s use PJSIP’s multiple endpoints per extension feature, I need to figure this one out. I suspect the PJSIP_DIAL_CONTACTS function is key…just not sure how/when to use that.

This isn’t any help is it?

Using PJSIP_DIAL_CONTACTS in Asterisk - RDI Intuitive Technical

Also, I’d start with 2 PC’s or a PC and an Android phone running linphone just to make sure that there isn’t anything stupid going on, on the phone side of things.

Even the big Cisco system I admin at work, one of our rules is not to have multiple phones on a single extension, and to use BLF keys for different line appearances on the phone.

While the author of the above link claims the “old way” (I ASSUME he’s talking chan_sip) of doing it is a hack, the “new way” of having pjsip allow multiple deskphones to register into the same extension number is, IMHO, an utter hack and a half.

That’s old key system crap approach and the ring group+BLF method was ALSO used on Northern Telecom meridian systems back in the day. I distinctly remember asking an old grizzled telephone guy back in 1998 about doing this (long before I got into phone systems) and got a “that’s key system crap, this is a PBX, son” growl out of him

Unfortunately no - the important information missing is how to use the PJSIP_DIAL_CONTACTS function with the ARI’s /create function. Unfortunately the ARI documentation doesn’t mention if this capability is already integrated into the /create function…or if I have to call PJSIP_DIAL_CONTACTS separately then somehow integrate the results with the /create parameters (like ‘endpoint’).

I’ve burned up many evenings guessing at ARI parameters, so best to ask. I would actually LIKE to add some of what I’ve learned to the documentation online but it isn’t modifiable by end users…

Your original question was saying that not all 3 extensions would ring when they were all registered - and then now you are bringing in ARI and an application.

I think you need to go back to the basics. Setup a couple different extensions and register them into chan_pjsip using the dialplan method detailed on the web link, and forget ARI and your application. If that link won’t work then here’s another explanation that’s more explicit:

Multiple devices on same extension - Issabel

Or you could also test it under the FreePBX GUI as such:

Extensions Module - PJSIP Extension - PBX GUI - Sangoma Documentation

Make sure it’s working with just a normal extension to multi-phone-extension call with just Asterisk only so that there’s no chance that you are getting messed up by the phones you are testing with.

Once you have that running - post a code fragment you are using with ARI to make a call.

Remember this is an open source project. If you can write code, you can certainly read it - you have the Asterisk source right there and can see how they implemented the ARI API. If you can’t figure that out - well the ONLY way I’ve EVER seen a developer get help on an app they were writing on any forum be it this one or stackexchange or any of those, is by posting the code they wrote to call the API.

Nobody is going to care how primitive and amateurish your code might be. We all have written primitive code when we were starting out and for heaven’s sake most commercial apps out on the market are almost certainly stuffed with primitive and amateurish code, including some of the biggest ones (Linux, Windows, MS Office…) based on the number of bugs they have fixed all the time.

Just to clarify this question is only ARI related (that why I posted it in the API subforum). I have no trouble making all 3 phones registered to a single extension ring at once, through the Asterisk dialplan. My problem is strictly related to the ARI.

When I create a channel via ARI to PJSIP/123 only the first device registered rings. And only a single invite goes out from Asterisk. So somehow I need to tell the ARI to send invites to multiple devices (where first answered grabs the call). In the dialplan the PJSIP_DIAL_CONTACTS converts the single extension (eg. PJSIP/123) into a string for multiple devices that you can dial. But I can’t figure out how to use that function with the ARI. (Not documented)

If I perform the call via the dialplan, Asterisk dials:
"PJSIP/123/sip:123@192.168.1.20:5060;line=17640&PJSIP/123/sip:123@192.168.1.10:5060&PJSIP/123/sip:123@192.168.1.20:5060;line=1677"

So I tried setting the "endpoint " to the above value, but the ARI chokes and returns ‘allocation failed’ error. So that’s not the right way to do it. There must be a way to integrate the PJSIP_DIAL_CONTACTS dialplan function into the ARI /create call.

Asterisk doesn’t have a ring group context. FreePBX ring groups are a dialplan construct (I think just the & notation, multi-destination dial, which is also how multi contact PJSIP endpoints are actually handled when it comes to dialling.

PJSIP_DIAL_CONTACTS is just a way of getting the & delimited list of contacts that you would use when dialling multiple endpoints from the dial plan. I don’t know if ARI provides a way of enumerating the contacts, but basically you need to enumerate them and issue concurrent requests for all of them, concurrent in the same was as if calling independent endpoints.

PS the title should say endpoint, not extension, and probably actually AOR, not endpoint.