[asterisk-dev] adding SIP Headers a SIP dialog

Klaus Darilion klaus.mailinglists at pernau.at
Tue Apr 29 10:01:53 CDT 2008


Marco Happenhofer wrote:
> Hi,
> 
> I need to insert a SIP Header in all SIP Messages for a single dialog.
> I tried the SIPAddHeader Method, but with this function the header is 
> only added to the first SIP INVITE.
> 
> Is there any possibility to add SIP Headers for the dialog (including 
> ACK and BYE), not only for the single Message?
> 
> If no, how much effort has to be taken to implement this feature?

1. grep for "SIPAddHeader" in the Asterisk directory. You will find out 
that it is implemented in chan_sip.

2. open chan_sip in an editor an search for: SIPAddHeader. You will find 
out, that the SIPAddHeader does nothing more then setting the 
SIPADDHEADER variable. (Using _ as prefix to mark it as a gobal variable 
- thus, this variable will be copied from the incoming channel to the 
outgoing channel).

3. search in chan_sip for SIPADDHEADER. You will the corresponding code 
  in transmit_invite(). I guess it should be rather easy to copy the 
code part also to other functions like transmit_reinvite_with_sdp() or 
transmit_request(). Probably you should extract the relevant code 
snippet into a new function which will be called from the other functions.

4. Mabye it might be useful to make a new VARIABLE for this, e.g. 
SIPADDHEADERALWAYS.

5. Post in bugs.digium.org ;-)

regards
klaus



More information about the asterisk-dev mailing list