[Home]

Summary:ASTERISK-21815: SipRemoveHeader does not remove previously added Alert-Info Header
Reporter:Peter Katzmann (pk16208)Labels:
Date Opened:2013-05-24 06:38:31Date Closed:2013-05-24 13:51:10
Priority:MajorRegression?
Status:Closed/CompleteComponents:PBX/General
Versions:1.8.22.0 10.12.2 Frequency of
Occurrence
Constant
Related
Issues:
Environment:ubunue 10.04Attachments:( 0) full
Description:Hello,
we tried to remove a previously added alert-info header element to avoid wrong ringtones during call forwarding.
I tried several incarnations of SipRemoveHeader(Alert-Info:), Alert-Info, Alert-
But the info element is still in the header
Comments:By: Peter Katzmann (pk16208) 2013-05-24 06:39:13.838-0500

Logfile with dialplan and sip flow

By: Rusty Newton (rnewton) 2013-05-24 13:50:12.365-0500

This took me a bit to notice after attempting to reproduce.

You add the header, improperly including the quotes: (notice the double quotes, ""Alert-Info: ...)
{noformat}
[May 24 13:32:56] VERBOSE[14760] res_agi.c:     -- AGI Script Executing Application: (SipAddHeader) Options: ("Alert-Info: <http://130.10.14.249:8080/provisioning/ringtone/default?user=2205&id=0>")
[May 24 13:32:56] DEBUG[14760] chan_sip.c: SIP Header added ""Alert-Info: <http://130.10.14.249:8080/provisioning/ringtone/default?user=2205&id=0>"" as __SIPADDHEADER02
{noformat}

When you are attempting to remove the header you don't include any quotes:
{noformat}
[May 24 13:32:56] VERBOSE[14760] pbx.c:     -- Executing [2205@macro-dial-localext:55] SIPRemoveHeader("SIP/2202-0000010a", "Alert-Info:") in new stack
{noformat}

The SipRemoveHeader application, when supplied with a parameter matches from the beginning of the string. From the help text:

{noformat}
If a parameter is supplied, only the matching headers will
be removed.
For example you have added these 2 headers:
SIPAddHeader(P-Asserted-Identity: sip:foo@bar);
SIPAddHeader(P-Preferred-Identity: sip:bar@foo);
// remove all headers
SIPRemoveHeader();
// remove all P- headers
SIPRemoveHeader(P-);
// remove only the PAI header (note the : at the end)
SIPRemoveHeader(P-Asserted-Identity:);
Always returns '0'.
{noformat}

Remove the quotes and you should be good.

By: Peter Katzmann (pk16208) 2013-05-27 05:23:54.307-0500

You are right, the agi had double quotes.

But as a side thought, why does asterisk silently remove the quotes in the SIP Header ?

By: Rusty Newton (rnewton) 2013-06-05 14:54:01.044-0500

bq. But as a side thought, why does asterisk silently remove the quotes in the SIP Header ?

I don't understand the question. Asterisk doesn't remove any quotes. It was keeping the quotes that were sent to it.

The quotes you see in debug exist to denote that string. As in the quotes you see below:
{noformat}
SIPRemoveHeader("SIP/2202-0000010a", "Alert-Info:")
{noformat}

If you mean that Asterisk is removing the unintentional quotes before it sends out the SIP message.. I don't know. You could ask in #asterisk-dev or on the dev list