[asterisk-dev] SIP headers not available on REFER

Brent Thomson bthomson at getjive.com
Thu Oct 1 17:52:43 CDT 2009

Brent Thomson wrote:
> Posting this here because it feels like a bug might be causing it.
> My phones all go through the [outgoing] context when they
> dial/forward/transfer. Here's the [outgoing] context:
>   '_[*0-9].' =>     1. Noop(X-foo: ${SIP_HEADER(X-foo)}) [pbx_config]
>                     2. Set(FOO=${SIP_HEADER(X-foo)}) [pbx_config]
>      [AGI]          3. Agi(hagi://agi/outgoing.agi) [pbx_config]
>                     4. Hangup() [pbx_config]
> Works fine for dialing (INVITE) and forward (302). Also works fine for
> attended transfers (INVITE). However, when the outgoing context is
> reached due to a blind transfer (REFER) the headers aren't available.
> Here's the output on a blind transfer (REFER):
> Executing [7112 at outgoing:1] NoOp("SIP/", "X-foo: ")
> in new stack
> And here's the output from an attended transfer (INVITE):
> Executing [7112 at outgoing:1]
> NoOp("SIP/0123ee70-3829-ef6d-a78e-0001012c0001-ac0e2978", "X-foo: bar")
> in new stack
> The SIP debug on the CLI shows that the header is in the message
> received in both cases. Any ideas why I can't query the header in the
> REFER scenario?
> Running

I apologize for responding to my own question. In doing some more
digging, it appears that Asterisk creates an INVITE structure when it
receives the REFER, populates the INVITE with some of the info from the
original message, then runs that INVITE through its normal INVITE
routine. If this is the case, I understand why my custom headers aren't
there--how could Asterisk be expected to know what I might set?

This does expose a problem, however. There is no new (real) message, yet
some headers disappear. Can anyone confirm that this is indeed what is
happening and how I might get around it?


More information about the asterisk-dev mailing list