"User-Agent" Header per trunk

Dear experts,

I have a simple scenario where I need to register my Asterisk box (15.3.0) to 3 SIP telecom providers. Each of the SIP providers gives me one trunk.
I am open to use either chan_sip or pjsip, depending on which of them could be albe to help me with my challenge - see below:

Each of my SIP providers requires me to set a specific constant string (some sort of a Base64 signature) in the User-Agent header of each SIP message that my Asterisk is sending out to them.
So basically: SIP provider 1 requires User-Agent: “xyz”, SIP provider 2 requires User-Agent: “abc” and SIP provider 3 requires User-Agent: “123” (I just used some dummy exmples).

I’ve read that the value of the User-Agent can be defined under the global section, whch seems to make this constant string the same for all trunks defined and does not help me at all…

What I need is to be able to specify in the definition of each trunk which static User-Agent header string should be used when “talking” to that SIP provider.

I’ve seen in https://wiki.asterisk.org/wiki/display/AST/PJSIP+Configuration+Wizard that some parameters can be passed unmodified to the native object and I was hoping that maybe the User-Agent could be passed as well when defining the trunk.

Does anyone know how to set a static User-Agent header per trunk?

User agent is not something that they can rely on a client being able to configure, and is not intended for routing!

The only way I can see of doing this is to run multiple instances of Asterisk.

The user agent can not be specified on a per-endpoint basis. It is global only.

Thank you for your replies!

Apparently there was a Jira ticket regarding the register command in chan_sip config file where one could use this syntax to specifiy a custom User-Agent string upon REGISTER:

Ref: https://issues.asterisk.org/jira/browse/ASTERISK-706 -> when reading the discussions in this old ticket is seems the patch was merged into the asterisk code…

However when I try to use this syntax I get syntax error…

I’d probably use something like OpenSips or Kamailio to do this outside of asterisk.