Contact URI User in SIP header

My service provider is rejecting my calls due to the fact that in the Contact URI in the header is as per below:

I need the Contact URI User Part to be the root number. Does anyone know which field this is when configuring a PJSIP trunk?


I have tried entering the root number in the Contact User field within the advanced settings of the PJSIP trunk

strong text

That GUI field is for the trunk registration, and you are looking to set it for the trunk endpoint. AFAIK, the only way to do this is by looking in the file pjsip.endpoint.conf to determine the trunk name and then editing the file pjsip.endpoint_custom_post.conf with:

[trunk_name](+type=endpoint)   ; sub actual trunk name between []

It did not seem to work.

My endpoint configuration is as per below:

from_user=sip:[email protected]

I have then created the following into the

[to_supplier_pri](+type=endpoint)   ; sub actual trunk name between []

Restarted asterisk and the Contact URI has not changed and still getting all circuits are busy with a rejection from the SIP provider.

Would this be the only way?


You added the extra lines to the correct file? Did you do an apply config after the edit?

fwconsole reload

This is incorrect. This is not a user this is a URI, only the user goes here. Which would be +44852852852 because what you have here will basically make it

<sip:sip:[email protected]>


or maybe

Thanks! This worked and the contact user was changed, however the provider is now rejecting the calls because they say the To: user in the SIP header also needs to be the same.

Is this done in the same pjsip.endpoint_custom_post.conf file?

Why do they care about the Contact header? This is meant to be something you configure on your client to specify how the server contacts you.

Are you actually using a SIP trunk provider or is this a connection to a provisioned (residential, single-phone-type) service?

This is a SIP trunk provider.

Originally they specified that we must set the contact header as:
e.g. sip:[email protected]:5060

but it was sending as [email protected]:5060

We managed to get this working thanks to @lgaetz however they now specify that the To header is wrong and also needs to be sip:[email protected]:5060

When I am doing a wireshark, I can see that user is the number you have dialled. e.g. if I dialled 0191345678 it is [email protected]:5060 and not the same as the contact as previously fixed.

I think this provider does not understand SIP. There is really not a reason for them to demand how you set your Contact header. If you wanted to set it as sip:[email protected] so that incoming messages (INVITEs or whatever, attached to your registration, or in-dialog replies) are sent to that user, that is exactly what the Contact header is for…

This is where we just say “Sigh” and let it go. Some of these (especially new) SIP providers are just cray-cray sometimes.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.