[asterisk-dev] Custom SIP headers and reinvites

Watkins, Bradley Bradley.Watkins at compuware.com
Tue Apr 17 18:56:11 MST 2007

There seems to be a timing-based issue with custom headers and

What happens is that if there is any kind of delay in processing a call
to SIP_HEADER (e.g., the extension is in Realtime or you have a Wait(x)
before Set), you lose access to the custom headers.  In my situation,
there is a pair of Asterisk boxes, with one calling the other (the first
one having been called by a SIP phone).  The first box essentially
immediately issues a reinvite so that media is directly from the phone
to the second Asterisk box.  If dialplan execution is fast enough, you
can successfully acquire the headers in the original invite.  But as
stated, any delay will cause the SIP_HEADER call to look for headers in
the reinvite, and you lose since they aren't sent.

I guess what I'm looking for is some guidance on what the correct
behavior is here.  Obviously, these headers should be available one way
or the other.  The question is whether the reinvite should have the
custom headers or whether they need to have some more persistant storage
at the receiving end.  I'm inclined to say the latter, as it's possible
that you could have this same issue with other B2BUA's in a similar

FWIW, this is the root cause for the bug I describe in:

I'm actually using Realtime, hence the description there (which after
some more debugging on my end is quite misleading, I'm afraid), but a
Wait(.5) using regular extensions.conf has the same effect.  Heck, I
tried Wait(.01) and it still happens, though I can't say with any (and I
mean *any*) authority what Wait's resolution is.  Of course, YMMV
depending on the speed of system you're running the instances of
Asterisk on.

- Brad
The contents of this e-mail are intended for the named addressee only. It contains information that may be confidential. Unless you are the named addressee or an authorized designee, you may not copy or use it, or disclose it to anyone else. If you received it in error please notify us immediately and then destroy it. 

More information about the asterisk-dev mailing list