Pjsip: How to identify endpoint by transport

I have created two endpoints:
- 1000 (normal sip client) with auth (username=1000) and transport protocol udp
- 1001 (webrtc client) with auth (username=1001) and transport protocol wss

This configuration works OK and webrtc client connects to 1001 and non webrtc connects to 1000.

No lets say that this is the same agent that would like to have the same user name/psw (1000) and will be able to connect using both different protocols. So when 1000 connects over webrtc, endpoint containing transport=transport_wss with all other webrtc settings will be selected, otherwise udp endpoint will be selected.

I have played with different configuration but was not able to make this working. If I set same auth for both endpoints, I can see that webrtc client connects to udp endpoint what will obviously not work.
It looks like that transport configuration has no influence in endpoint selection!

The only solution I see is using identify_by header and then adding some specific header in webrtc client. I haven’t tested this, but it is also far from being clean solution.

thanks in advance
edvin

There is no ability to identify based on transport, you can only use the header method like you mentioned.

Hi,
thanks, so for now I will try to use identify_by header. The problem with this method is that it is difficult to guarantee header values from clients that are not under your control.
So maybe it will be welcome addition to make identification based on protocol because webrtc client should be able to connect only to endpoint supporting webrtc protocol.

best regards
edvin

Hi @jcolp the identify on header would be acceptable to me. But I dont seem to be able to create multiple endpoint-configuration using pjsip_wizard.conf, can you confirm?

I haven’t used wizards so I can’t comment on that. What do you mean by “multiple endpoint-configuration” though?

correct me if I’m wrong, but i have the same usecase as edvinv: I want one user (e.g. 1000) to login either via a sip-softphone or webrtc with the same credentials. Likewise, if someone calls the extension 1000 both the sip-softphone and webrtc should ring.

The pjsip SIP softphone has endpoint/media_encryption = sdes set, while webrtc requires endpoint/media_encryption = dtls among some other settings ( https://wiki.asterisk.org/wiki/display/AST/Configuring+Asterisk+for+WebRTC+Clients ).

So my understanding is I have to create two endpoint configurations for the same user; one for the sip softphone and one for the webrtc. Is that correct?

PJSIP does not allow you to create two users with differing configuration, be it with wizards or standalone configuration file. They have to be separate.

okay, so my usecase is not possible at this moment? :frowning: Or is there some workaround to make this possible?

There’s been no change and noone has worked on such things.

Okay, unfortunate. Thanks for your quick responses!
Maybe I can hack something together in extensions.conf, e.g. when you dial 1000 both the softphone_1000 and webrtc_1000 user will be dialed…

You can add variables to your pjsip_wizard config to help with this…

; the "primary" webrtc line
[1000]
type = wizard
@alsoring = softphone_1000

Any variable starting with “@” is ignored.

Then in extensions.conf, when someone dials 1000 you can use the AST_CONFIG function to look up the @alsoring variable in context 1000 and add it to the dial string.

You could also create a hint in the dialplan that has both endpoint names in it…

exten = 1000,hint,PJSIP/softphone_1000&PJSIP/webrtc_1000
1 Like

Oh, just fyi… All pjsip objects support the “@” variables and you can query them in the dialplan…

In pjsip.conf:

[1000]
type=endpoint
@ABC=123

Or in the wizard…

[1000]
type=wizard
endpoint/@ABC=123

Then

[default]
exten = 1000,1,Verbose(${PJSIP_ENDPOINT(${EXTEN},@ABC)}