How to change or modify header

Hi there,

I am facing issue while connecting SIP trunk with my vendor (vendor using ZTE or huwawie PABX). When i send the call i send caller Id in two places, which is “From:” and "Contact:"
what my vendor wants, thy are saying I should not send callerId in “Contact:” , so i am confuse here that how can i change or disable this header.

Audio is at 15458
Adding codec 0x100 (g729) to SDP
Adding codec 0x8 (alaw) to SDP
Adding non-codec 0x1 (telephone-event) to SDP
Reliably Transmitting (no NAT) to xx.xx.xx.xx:5060:
INVITE sip:0xxxxxxxxxx@xx.xx.xx.xx SIP/2.0
Via: SIP/2.0/UDP;branch=z9hG4bK4133a30a
Max-Forwards: 70
From: “Company” sip:5665@xx.xx.xx.xx;tag=as7fe24d9b
To: sip:0xxxxxxxxxx@xx.xx.xx.xx
Contact: sip:5665@xx.xx.xx.xx:5060
Call-ID: 622e37542c66dd391224662e34fcb6e7@xx.xx.xx.xx
CSeq: 102 INVITE
User-Agent: Asterisk PBX

Their system is broken. The user part of Contact is opaque data used by the sender of the header to correctly route subsequent dialogues. Whilst I don’t think that Asterisk actually makes use of the user part of the header, it is not up to the peer to impose any semantics or restrictions on it.

There is no valid reason for Asterisk to allow this header to be overridden, although I haven’t checked the code to ensure that there isn’t some ability to do so.

Thank you David, now my point is cleared. you rocks :wink:

Hi David,

Now my vendor asking me to remove 5665 from contact and asking me to send only IP and port.
They want me to change Contact: sip:5665@xx.xx.xx.xx:5060 to Contact: sip:xx.xx.xx.xx:5060

Is that possible?

Actually what is happening, when i place call through this peer i send the normal cli which is 5665 but at their end thy receive it in national format which is “05665” add 0 before cli. thy think that this is happening becuase i am sending cli in two places, one in “From” header and another is “Contact” header

From: “Company” sip:5665@xx.xx.xx.xx;tag=as7fe24d9b
Contact: sip:5665@xx.xx.xx.xx:5060

Does that make sense?

You are sending CLI in one place and an opaque reference to be used when sending BYE and Re-INVITEs, in the other. The peer was no right to dictate what goes in the user part of the Contact header.

According to the latest version of the source code I have easily to hand, the Contact header user is either the connected line ID or or the “anonymous”, depending on whether or not presentation is allowed for that information (can be modified by the dialplan). This will be used as the default value for From as well. The only way of omitting the user field is to blank the connected line, but that will probably also lose you CLI. I guess you blank the connected line by blanking the CLID on the A side. This won’t help for re-INVITEs going the other way.

Hi david

Yes i have tried to remove the CLI but this removed the contact user but added asterisk instead of showing only IP

I am not sure what is making wrong this contact header at my vendor’s end.

i am using .call file to initiat automated call.

Hi david,

I have tried all presentation of CallerId but nothing worked. Also tried blanking the CLId but it also removed my callerid and placed asterisk instead.

I also tried to use SIPRemoveHeader(Contact:) but it also didn’t work.

any other suggestion?

Sohaib Khan

Either get the ITSP to fix their system, or modify the Asterisk source code and recompile.

Contact is a key header and cannot be modified by AddHeader, as it is defined by key parts of the SIP specification.

Thank you david,

I got it solved by my provider, I argued with them that this is not my issue. and also gave you reply, which helped me alot saved me. :smile:

thank you dear… you are the man.

Sohaib Khan