You need to use the pre-dial handler and set them on the newly created channel in chan_pjsip. That’s one of the differences between chan_sip and chan_pjsip.
The From header is fundamental to SIP. You should never try to set it manually. You should only ever set it using various component parts. Trying to set it manually, if not rejected early, will result in two From headers, which is invalid.
(In my view, the same should apply to RPID, and PAI, although it is possible to suppress automatic generation of these, and I would expect it to apply, unconditionally, to Call-ID, Allow, Supports, Content-Type, Via, Referrer, Contact, etc.)
My problem here is, that the sipprovider expects the From Header in a specific way. They told me to set it like this:
“CLIP phone number” <userid@siprovider.com>
I have to do this because Asterisks standard behavior without further configuration triggered some fraud detection mechanism on their side that resulted in an IP-ban.
So if I don’t send the headers the way they want it might trigger the ban again.
The provider is abusing the From display name to carry the actual caller ID, and using the From user field as an account code.
I’m not sure if there is an additional constraint here that that the Display Name should be an approved caller ID for the account.
A sufficient reason for the OPs last error is that the provider returned the bogus From header, unchanged, in their response, and Asterisk failed to find the from tag value, let alone find one that matched one that it had sent. This is one reason why you can never manually add a From header, as the dialplan code cannot know the correct from tag to add.
This would stop Asterisk successfully processing even a refusal by the provider.
I see. Yes the Display Name must be an approved caller ID for the account name. I set it in the correct way they told me.
I really hate to fiddle around like that with them, but it’s impossible to change the provider right now. Sadly it’s me they call @ 6:30 in the morning when “the phone is not working”.
Could it be an option to set the expected value directly in the configurations for all the peers (phones)?
You’re trying to cram an entire From header into those. That’s wrong. They’re literally the values for the name and number parts. Or in From header speak, display name and URI user portion.