It looks like if I call Getvar and pass PJSIP_HEADERS() I can get the entire SIP header for a channel. I also read (on stackoverflow) that the PJSIP_HEADER function will only return the headers from the INVITE of the inbound channel. If that’s correct, how would I get the headers from the outbound channel (second leg of the bridged call) INVITE ? Or will PJSIP_HEADERS() in fact return the header from either inbound out outbound legs? Thanks Brian From: asterisk-users [mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of Joshua C. Colp Sent: Monday, June 26, 2023 10:00 AM To: Asterisk Users Mailing List - Non-Commercial Discussion <asterisk-users at lists.digium.com> Subject: Re: [asterisk-users] Get channel variables via ARI/AMI On Mon, Jun 26, 2023 at 10:57 AM TTT <lists at telium.io <mailto:lists at telium.io> > wrote: I am connecting to the ARI with subscribe all, so I can see channels being created. I now want to extract a variety of header variables (at the moment the from and to tag). I tried to read them from the ARI but Asterisk refuses since the channel is not in a stasis app. Is there a way to read these from either the ARI or AMI ? I’m trying not to modify the dialplan. ARI, No. AMI, Yes[1]. [1] https://wiki.asterisk.org/wiki/display/AST/Asterisk+20+ManagerAction_Getvar -- Joshua C. Colp Asterisk Project Lead Sangoma Technologies Check us out at www.sangoma.com <http://www.sangoma.com> and www.asterisk.org <http://www.asterisk.org> -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20230626/ae792bed/attachment.html>
On Mon, Jun 26, 2023 at 4:04 PM TTT <lists at telium.io> wrote:> It looks like if I call Getvar and pass PJSIP_HEADERS() I can get the > entire SIP header for a channel. I also read (on stackoverflow) that the > PJSIP_HEADER function will only return the headers from the INVITE of the > *inbound* channel. > > > > If that’s correct, how would I get the headers from the outbound channel > (second leg of the bridged call) INVITE ? Or will PJSIP_HEADERS() in fact > return the header from either inbound out outbound legs? >The answer is, you can't. There are SOME protocol level things accessible using CHANNEL[1] but that's it. [1] https://wiki.asterisk.org/wiki/display/AST/Asterisk+20+Function_CHANNEL -- Joshua C. Colp Asterisk Project Lead Sangoma Technologies Check us out at www.sangoma.com and www.asterisk.org -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20230626/84bd7919/attachment.html>
If you want to do more than just get headers from the INVITE, then you'll need to use an actual SIP Proxy like Kamailio. On 6/26/23 15:03, TTT wrote:> It looks like if I call Getvar and pass PJSIP_HEADERS() I can get the > entire SIP header for a channel. I also read (on stackoverflow) that > the PJSIP_HEADER function will only return the headers from the INVITE > of the _inbound_ channel. > > If that’s correct, how would I get the headers from the outbound channel > (second leg of the bridged call) INVITE ? Or will PJSIP_HEADERS() in > fact return the header from either inbound out outbound legs? > > Thanks > > Brian > > *From:*asterisk-users [mailto:asterisk-users-bounces at lists.digium.com] > *On Behalf Of *Joshua C. Colp > *Sent:* Monday, June 26, 2023 10:00 AM > *To:* Asterisk Users Mailing List - Non-Commercial Discussion > <asterisk-users at lists.digium.com> > *Subject:* Re: [asterisk-users] Get channel variables via ARI/AMI > > On Mon, Jun 26, 2023 at 10:57 AM TTT <lists at telium.io > <mailto:lists at telium.io>> wrote: > > I am connecting to the ARI with subscribe all, so I can see channels > being created. I now want to extract a variety of header variables > (at the moment the from and to tag). I tried to read them from the > ARI but Asterisk refuses since the channel is not in a stasis app. > > Is there a way to read these from either the ARI or AMI ? I’m > trying not to modify the dialplan. > > ARI, No. > > AMI, Yes[1]. > > [1] > https://wiki.asterisk.org/wiki/display/AST/Asterisk+20+ManagerAction_Getvar <https://wiki.asterisk.org/wiki/display/AST/Asterisk+20+ManagerAction_Getvar> > > -- > > Joshua C. Colp > > Asterisk Project Lead > > Sangoma Technologies > > Check us out at www.sangoma.com <http://www.sangoma.com> and > www.asterisk.org <http://www.asterisk.org> > >-- http://help.nyigc.net/