[asterisk-dev] SIPAdd/RemoveHeader apps
Johansson Olle E
oej at edvina.net
Fri Jan 16 03:35:25 CST 2009
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.
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.
Otherwise, thanks for a nice application!
/O
More information about the asterisk-dev
mailing list