PJSIP: Identifying by both IP and transport

Hello,

Sometimes, I need to set several trunks up with the same ITSP.
In such case, the remote IP I need to peer with, may often be shared between several SIP trunks so I can’t use it as a reliable way to identify incoming SIP traffic.

So I was thinking I could dedicate some SIP transport to some trunk instances so that if a SIP message comes in from a given IP, entering through a specific transport, then it would be correctly identified.

Can this be done ? How ?

Best regards

The endpoint matching doesn’t take account of the transport used.

If you are registering with the provider (SIP has no concept of a trunk), the line parameter may help.

If not, you will have to look at an INVITE and see if any part of it distinguishes between accounts.

Having several accounts with an ITSP tends to suggest that you are using a consumer, or sole owner business, account, for a medium size business, that really needs multiple numbers on a single, PABX use, account.

@david551
I followed the “line” route you recommend and I’m very pleased with the result.
I also found this [1] blog post useful.
I even wonder what is the downside of using line instead of identify sections in project as I find “line” simpler to set up and maintain. Maybe, I’ll open on thread of this specific question.

[1] The PJSIP Outbound Registration 'line' Option ⋆ Asterisk

Anyway, thank you very much for replying.

There is no downside, it’s just line doesn’t always work due to the policy/behavior/implementation of the remote SIP server.

The line option doesn’t work with Flowroute. I have several Flowroute accounts. Set up registration for each. Checked the status at Flowroute and asterisk. Everything was good. Did a test call and it failed. Turned on the log. The line option was being sent out. But when asterisk received the call I got an error that it couldn’t find the endpoint.

If the line option is actually present then it should be identified and the configured endpoint on the outbound registration used.

I turned on the pjsip log and the line option was present in the register sent to Flowroute. It looks like Flowroute doesn’t support it. I’m sending them a trouble ticket now to see what’s going on. Maybe we can get them to implement it?