[asterisk-users] SIP_HEADER function; what names are available?
Steve Langstaff
steve.langstaff at citel.com
Mon Oct 23 04:26:41 MST 2006
Minor update - use the following:
> if (strcasecmp(data,
> "x-Asterisk-Request-URI-pseudo-header")==0)
> {
> ast_copy_string(buf, p->initreq.rlPart2, len);
> -----Original Message-----
> From: Steve Langstaff
> Sent: 23 October 2006 09:58
> To: 'Asterisk Users Mailing List - Non-Commercial Discussion'
> Subject: RE: [asterisk-users] SIP_HEADER function; what names
> are available?
>
> Looking at the source code for Asterisk 1.2.7.1 (just what
> I've got handy), it appears that the SIP_HEADER() function
> just parses the SIP INVITE for whatever SIP *header* you specify - so:
> a) there's no list of headers you can check for - it depends
> on the user agent generating the request and
> b) the request URI is not a SIP header, so you can't get to
> it using a stock SIP_HEADER() function.
>
> However, I suppose that there is nothing stopping you from
> hacking the source for your Asterisk installation to provide
> access to the URI... In chan_sip.c:func_header_read() you
> could do something like:
>
> static char *func_header_read(struct ast_channel *chan, char
> *cmd, char *data, char *buf, size_t len) { <snip/>
> content = get_header(&p->initreq, data);
>
> if (ast_strlen_zero(content)) {
> <new>
> /* look for an experimental pseudo-header that
> allows us access to the request URI */
> /* but note that this is not a real header name! */
> if (strcmp(data,
> "x-Asterisk-Request-URI-pseudo-header")==0)
> {
> ast_copy_string(buf, &p->initreq.rlPart2, len);
> ast_mutex_unlock(&chan->lock);
> return buf;
> }
> </new>
> ast_mutex_unlock(&chan->lock);
> return NULL;
> }
> <snip/>
> }
>
> > -----Original Message-----
> > From: asterisk-users-bounces at lists.digium.com
> > [mailto:asterisk-users-bounces at lists.digium.com] On Behalf
> Of Ricardo
> > Carvalho
> > Sent: 20 October 2006 17:51
> > To: kjcsb; Asterisk Users Mailing List - Non-Commercial Discussion
> > Subject: Re: [asterisk-users] SIP_HEADER function; what names are
> > available?
> >
> > Any news on this thread? I also need to know the way to get
> the R-URI
> > from sip INVITE messages received by Asterisk, through
> > ${SIP_HEADER()}.
> >
> > Thanks in advance,
> > Ricardo.
> >
> >
> >
> >
> >
> >
> > kjcsb wrote:
> > >>> I have read the wiki about the SIP_HEADER function
> > (http://www.voip-
> > >>> info.org/wiki/index.php?page=Asterisk+func+sip_header).
> > Where can I
> > >>> get a list of the names that are available to be used with the
> > >>> function e.g. TO is one name as in ${SIP_HEADER(TO)}.
> > What are the
> > >>> others?
> > >>>
> > >>
> > >> I would guess that you can check the RFC. Easier is to
> > turn on SIP
> > >> debug and see the INVITE packet yourself and check the
> headers that
> > >> you have with your equipment.
> > >>
> > >> /Olle
> > >>
> > > Thanks but I don't know how to get the actual INVITE details (the
> > > request URI?). For example I want to get
> > sip:95556789 at 60.234.xxx.xxx
> > > SIP/2.0 from the following dialogue:
> > >
> > > INVITE sip:95556789 at 60.234.xxx.xxx SIP/2.0
> > > Record-Route: <sip:147.202.nn.nnn;ftag=bf7eced18eb7271b;lr=on>
> > > Via: SIP/2.0/UDP 147.202.nn.nnn;branch=z9hG4bKe49c.21b320a3.0
> > > Via: SIP/2.0/UDP 60.234.nnn.nnn;branch=z9hG4bK76bf3dec8d45b972
> > > From: "User"
> <sip:1122334455 at proxy.domain.com>;tag=bf7eced18eb7271b
> > > To: <sip:5556789 at domain.com>
> > >
> > > etc
> > >
> > > I can get Record-Route, Via, From, To etc but don't know
> how to get
> > > the bit after the INVITE. Interestingly only the first Via
> > is returned
> > > by ${SIP_HEADER(VIA)}.
> > >
> > > I've tried R-URI, RURI, URI, ALL, *, blank.
> > >
> > > Any advice appreciated.
> > >
> > > Cameron
> > > _______________________________________________
> > > --Bandwidth and Colocation provided by Easynews.com --
> > >
> > > asterisk-users mailing list
> > > To UNSUBSCRIBE or update options visit:
> > > http://lists.digium.com/mailman/listinfo/asterisk-users
> > >
> >
> > _______________________________________________
> > --Bandwidth and Colocation provided by Easynews.com --
> >
> > asterisk-users mailing list
> > To UNSUBSCRIBE or update options visit:
> > http://lists.digium.com/mailman/listinfo/asterisk-users
> >
More information about the asterisk-users
mailing list