[asterisk-dev] SIPAdd/RemoveHeader apps

Tilghman Lesher tilghman at mail.jeffandtilghman.com
Fri Jan 16 08:56:07 CST 2009


On Friday 16 January 2009 03:35:25 Johansson Olle E wrote:
> 16 jan 2009 kl. 09.39 skrev Klaus Darilion:
> > Russell Bryant schrieb:
> >> SVN commits to the Digium repositories wrote:
> >>> Author: oej
> >>> Date: Thu Jan 15 07:35:50 2009
> >>> New Revision: 168638
> >>>
> >>> URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=168638
> >>> Log:
> >>> Add capability to remove added SIP headers *before* INVITE is
> >>> generated.
> >>>
> >>> (closes issue #14246)
> >>> Reported by: klaus3000
> >>> Patches:
> >>>      2patch_chan_sip_SIPRemoveHeader_trunk.txt uploaded by
> >>> klaus3000 (license 65)
> >>
> >> I think this is fine, since it makes sense to have it along side the
> >> SIPAddHeader application.
> >>
> >> However, this stuff would probably be more appropriately handled
> >> all via
> >> the SIP_HEADER() function.  Right now, SIP_HEADER just lets you
> >> retrieve
> >> a header.  However, I think a write callback should be added to
> >> handle
> >> what is provided by the Add/Remove applications.  That would be
> >> more in
> >> line with what we've been doing with apps vs. functions.
> >
> > The difference between the function and the appliation is, that the
> > function works on received headers whereas the application works on
> > the
> > "to be sent" message. Thus I wonder if it is possible to have it all
> > in
> > one function - so if "SIPHEADER(Foo)=Bar" add this header, how is the
> > syntax to remove it?
>
> You are right, that it would confuse to have one function for reading
> and removing headers, especially since we might have to expand the
> SIP_header function in other directions later, for reading the first
> or the latest INVITE.
>
> Functions are built to return a value. Adding a header doesn't return
> a value, so addheader doesn't really make sense to put in a function.
> Removing a header could return true or false.

Not all methods of a function return a value.  You're neglecting the write
portion of a function, which returns no value.  If you set a header to contain
no value, I think that should be equivalent to deleting it.

> I still think, as I put in the note in the bug tracker, that you could
> add to the documentation a bit how the removal works by matching on
> the given characters. That effects the namespace used when adding
> headers and we need to make sure Asterisk admins understand that.

Agreed.

-- 
Tilghman



More information about the asterisk-dev mailing list