PJSIP: Change the user part of the Contact Header


#1

Hello,

I try to change the user part of the contact header. I have configured a SIP trunk.
If I made an outbound call the INVITE message contains always the following contact header sip:asterisk@192.168.40.33.

I have trying some changes in the pjsip.conf but nothing works. I’ve got always the same contact header.

Can I change the user part in the contact header?

Thank a lot!


#2

The only requirement on Contact headers is that they be recognizable by the entity that sets them and should route the response back to that entity. The user part does not have to represent anything meaningful in the real world.

What is the source of your requirement for semantics beyond those required by the RFCs?


#3

Hello,

Sorry, I have seen the first post missing the contact header example. Asterisk always includes the following contact header sip:asterisk@192.168.1.11

I need the possibility to configure the value of the user port.
Especially I replace the value ‘asterisk’ with the user part of the from header.

For example, a SIP device with the phone number 12345 make an outgoing call to the SIP trunk.
The INVITE message of the SIP trunk should contains the following contact header sip:12345@192.168.1.11 instead of sip:asterisk@192.168.1.11.


#4

There is no valid reason why this should be necessary. As I already said, your device seems to be reading more into the Contact header than it is allowed to read into it.


#5

As David mentions there should be no reason to do this, and as a result there is no ability to configure or change this without code modifcations.


#6

Does that mean there is not a way to change the hardset ‘asterisk’ to some other value?


#7

I don’t believe we’ve added a way to set such a thing, no. If we did it would be mentioned in the documentation for the pjsip.conf configuration.


#8

Would you happen to know where this is set in source code?


#9

It would start from ast_sip_create_dialog_uac in res_pjsip.c and trickle down from there. I don’t know precisely where.


#10

ok, thanks! I will try and locate.


#11

This seams like what I’m after, I may be mistaken though, I tried setting and doesn’t seam to change anything. Do you know what this does?

			<configOption name="contact_user" default="">
				<synopsis>Force the user on the outgoing Contact header to this value.</synopsis>
				<description><para>
					On outbound requests, force the user portion of the Contact header to this value.
				</para></description>
			</configOption>

#12

It appears to set the Contact user as documented, at least from looking at the code which is also in res_pjsip.c. I don’t know anything else about it.


#13

Not sure what I miss-typed the first time, but this does work and changes the default ‘asterisk’ to the the value set.

Thanks,