Summary:ASTERISK-06158: No "SIPAddHeader" function
Reporter:Trevor Hammonds (trevmeister)Labels:
Date Opened:2006-01-21 17:14:59.000-0600Date Closed:2006-01-23 09:27:41.000-0600
Versions:Frequency of
Description:On Friday, I upgraded to the latest trunk revision.  I have upgraded several time since.  With Friday's upgrade, the SIPAddHeader function no longer works.  I get the following error message:

WARNING[30500]: pbx.c:1556 pbx_extension_helper: No application 'SIPAddHeader' for extension (default, 8080, 11)

This completely breaks my dialplan in many places.  


The problem was non-existant a few days ago.  I will try to compile older revs to find when the error was introduced.  
Comments:By: Trevor Hammonds (trevmeister) 2006-01-21 17:44:30.000-0600

Rev 8059 works as expected, rev 8157 does not.  So The error was introduced somewhere in between.

By: Trevor Hammonds (trevmeister) 2006-01-21 17:56:33.000-0600

It appears as though SIPAddHeader and SIPGetHeader was purposely removed from chan_sip.c in SVN rev 8157.  The removal of those functions were the only changes to chan_sip.c in that revision.  

If these functions were deprecated, why were we not receiving error messages indicating so?  Also, what are the new alternative to these functions?

By: Tilghman Lesher (tilghman) 2006-01-21 21:50:01.000-0600

There is a SIP_HEADER() function, but it currently is read-only (even though the description implies otherwise).

By: Tilghman Lesher (tilghman) 2006-01-22 20:51:46.000-0600

FYI, you are not supposed to be using trunk for production.  We have a regular release of the 1.2 branch which is the version we believe is production-ready.  At any rate, SIPAddHeader and SIPGetHeader will be added back.  I'm going to use the remaining part of this bugnote to discuss the eventual replacement of these two applications with the dialplan function, SIP_HEADER.

Currently, we set _SIPGETHEADER01 through _SIPADDHEADER50 as the channel variables for which we store each additional header.  These are then inherited as variables by the destination SIP channel, where they become part of the request.  The current problem with this approach is that setting headers via this method are not retrievable the same way as native headers.  For example, SIP_HEADER() currently reads out the native headers, but should also be able to retrieve headers set by this function.  Since __get_header() currently takes no channel argument, there is no way to access channel variables.  Unfortunately, __get_header() is called from hundreds of places within chan_sip, so any change in the C function prototype would result in a needed change throughout the entire file.  The other possibility would be to store a reference back to the pvt structure (and by extension, the channel structure) in the sip_request structure.  This leads to a possible issue with race conditions, however.

By: Olle Johansson (oej) 2006-01-23 04:17:00.000-0600

The SIPAddHeader should *not* have been removed, since it was not replaced by anything else.

By: Olle Johansson (oej) 2006-01-23 09:22:48.000-0600

sipaddheader() re-instated in rev 8481. We need a SIP_ADDHEADER() function to add headers to outbound transactions and to be able to deprecate sipaddheader() in post-1.4

By: Olle Johansson (oej) 2006-01-23 09:27:22.000-0600

Fixed in rev 8481. Thank you for reporting this issue!