Hello,
I’m building a scenario that sometimes I’ll use PJSIP peers to act like a inbound call, so sasically it will be Server A and Server B, with Server A receiving external calls and redirecting them to Server B via pjsip dialing.
As Server A has multiple DID’s, I’ve created one PJSIP Endpoint for each DID, each with different credentials, and as I want them to have different proposes inside Server B, they have different contexts as well.
The problem is: no matter which endpoint make the call, and wich extension it dials, the call in Server B will always falls on the latest registered endpoint’s context, and not the endpoint’s context that receive the call (sometimes it is the correct endpoint, but only when this endpoint was registered by last).
Is there a way to receive the call in the correct context when the peers are connected in the same server?
It depends on how you have configured things. Are you doing IP based matching? If so, then one endpoint would be used. Are you doing user based matching? What is the configuration?
Sorry for the delayed response, was testing all the possibilities hehe
So, I’ve tryied to set “from_user” in the endpoints in Server A and Server B. Also used the “registration” configuration of “contact_user” to the username, and it keeps calling the last’s loaded endpoint context for every call:
And when in Server A I call the extension 1000, it does go to the context “1000-inbound”:
[Jul 28 10:39:35] -- Executing [1000@1000-inbound:1] NoOp("PJSIP/1000-endpt-00000002", "Call received in context 1000") in new stack
But when I call 2000, it also falls in the context “1000-inbound”:
[Jul 28 10:41:39] NOTICE[10268]: res_pjsip_session.c:3078 new_invite: Call from '1000-endpt' (UDP:172.16.15.2:5322) to extension '2000' rejected because extension not found in context '1000-inbound'.
I will try to change the “identify” value in every endpoint and see what happens, it looks like the asterisk is choosing the Endpoint based in the IP address, and not by the endpoint that is receiving the call.
How do I change that? I tryed to remove the “type=identify” from the endpoints, but then I get this NOTICE in console:
[Jul 28 11:59:00] NOTICE[8653]: res_pjsip/pjsip_distributor.c:676 log_failed_request: Request 'OPTIONS' from '<sip:1000@172.16.15.2>' failed for '172.16.15.2:5322' (callid: 60bf164e-076e-4845-aade-b234c7f90f3c) - No matching endpoint found
Thanks jcolp, changing every endpoint to match identically the “username” and removing the identify section resolved the issue, now each call gets redirected to it’s context.
Is there any way to achieve this without having the same name? Because thinking in the long term in my application we could have some trouble with duplicated endpoints.