Hi, quick question: I need to pass-through some headers from the A-Leg to the B-Leg, which are connected using PJSIP. Currently I do the following: [handler] exten => addheader,1,GotoIf($["${ARG1}" == ""]?3) exten => addheader,2,Set(PJSIP_HEADER(add,Route)=${ARG1}) exten => addheader,3,GotoIf($["${ARG2}" == ""]?5) exten => addheader,4,Set(PJSIP_HEADER(add,P-Charging-Vector)=${ARG2}) exten => addheader,5,GotoIf($["${ARG3}" == ""]?7) exten => addheader,6,Set(PJSIP_HEADER(add,P-Visited-Network-ID)=${ARG3}) exten => addheader,7,GotoIf($["${ARG4}" == ""]?9) exten => addheader,8,Set(PJSIP_HEADER(add,X-C-Params)=${ARG4}) exten => addheader,9,GotoIf($["${ARG5}" == ""]?11) exten => addheader,10,Set(PJSIP_HEADER(add,X-URI)=${ARG5}) exten => addheader,11,Return [pcscf1] exten => _.,1,Dial(PJSIP/pcscf1/sip:${EXTEN}@${SIPDOMAIN},,b(handler^addheader^1,(${PJSIP_HEADER(read,Route)},${PJSIP_HEADER(read,P-Charging-Vector)},${PJSIP_HEADER(read,P-Visited-Network-ID)},${PJSIP_HEADER(read,X-C-Params)},${PJSIP_HEADER(read,X-URI)}))) This works, but you'll have to admit, it's not the most readable-Version of an extensions.conf. Are there any better solutions around? Thanks, Carsten P.S.: I may have found an issue in Asterisk 13.x (LTS); if I send the right SIP-Message I can make it crash. I'm currently verifying, if it still happens with the latest 13.x release from GIT. If I can confirm it with the latest 13.x from GIT, should I post my findings to the dev-list or is there some security mailing list, as this would apply to all installations around there? -- Carsten Bock CEO (Gesch?ftsf?hrer) ng-voice GmbH Millerntorplatz 1 20359 Hamburg / Germany http://www.ng-voice.com mailto:carsten at ng-voice.com Office +49 40 5247593-40 Fax +49 40 5247593-99 Sitz der Gesellschaft: Hamburg Registergericht: Amtsgericht Hamburg, HRB 120189 Gesch?ftsf?hrer: Carsten Bock Ust-ID: DE279344284 Hier finden Sie unsere handelsrechtlichen Pflichtangaben: http://www.ng-voice.com/imprint/
On Wed, Aug 2, 2017, at 10:39 AM, Carsten Bock wrote:> Hi, > > quick question: > I need to pass-through some headers from the A-Leg to the B-Leg, which > are connected using PJSIP. > Currently I do the following: > > [handler] > exten => addheader,1,GotoIf($["${ARG1}" == ""]?3) > exten => addheader,2,Set(PJSIP_HEADER(add,Route)=${ARG1}) > exten => addheader,3,GotoIf($["${ARG2}" == ""]?5) > exten => addheader,4,Set(PJSIP_HEADER(add,P-Charging-Vector)=${ARG2}) > exten => addheader,5,GotoIf($["${ARG3}" == ""]?7) > exten => addheader,6,Set(PJSIP_HEADER(add,P-Visited-Network-ID)=${ARG3}) > exten => addheader,7,GotoIf($["${ARG4}" == ""]?9) > exten => addheader,8,Set(PJSIP_HEADER(add,X-C-Params)=${ARG4}) > exten => addheader,9,GotoIf($["${ARG5}" == ""]?11) > exten => addheader,10,Set(PJSIP_HEADER(add,X-URI)=${ARG5}) > exten => addheader,11,Return > > [pcscf1] > exten => > _.,1,Dial(PJSIP/pcscf1/sip:${EXTEN}@${SIPDOMAIN},,b(handler^addheader^1,(${PJSIP_HEADER(read,Route)},${PJSIP_HEADER(read,P-Charging-Vector)},${PJSIP_HEADER(read,P-Visited-Network-ID)},${PJSIP_HEADER(read,X-C-Params)},${PJSIP_HEADER(read,X-URI)}))) > > This works, but you'll have to admit, it's not the most > readable-Version of an extensions.conf. > > Are there any better solutions around?Not really.> > Thanks, > Carsten > > P.S.: I may have found an issue in Asterisk 13.x (LTS); if I send the > right SIP-Message I can make it crash. I'm currently verifying, if it > still happens with the latest 13.x release from GIT. If I can confirm > it with the latest 13.x from GIT, should I post my findings to the > dev-list or is there some security mailing list, as this would apply > to all installations around there?The process for reporting security vulnerabilities is documented on the wiki[1]. [1] https://wiki.asterisk.org/wiki/display/AST/Asterisk+Security+Vulnerabilities -- Joshua Colp Digium, Inc. | Senior Software Developer 445 Jan Davis Drive NW - Huntsville, AL 35806 - US Check us out at: www.digium.com & www.asterisk.org
My only suggestion would be you could reduce your line count by replacing your GotoIf statements with ExecIF statements. exten => addheader,1,ExecIf($["x${ARG1}" !"x"]?Set(PJSIP_HEADER(add,Route)=${ARG1})) same => n,ExecIf($["x${ARG2}" !"x"]?Set(PJSIP_HEADER(add,P-Charging-Vector)=${ARG2})) same => n,ExecIf($["x${ARG3}" !"x"]?Set(PJSIP_HEADER(add,P-Visited-Network-ID)=${ARG3})) same => n,ExecIf($["x${ARG4}" !"x"]?Set(PJSIP_HEADER(add,X-C-Params)=${ARG4})) same => n,ExecIf($["x${ARG5}" != "x"]?Set(PJSIP_HEADER(add,X-URI)=${ARG5})) same => n,Return() On Wed, Aug 2, 2017 at 6:39 AM, Carsten Bock <carsten at ng-voice.com> wrote:> Hi, > > quick question: > I need to pass-through some headers from the A-Leg to the B-Leg, which > are connected using PJSIP. > Currently I do the following: > > [handler] > exten => addheader,1,GotoIf($["${ARG1}" == ""]?3) > exten => addheader,2,Set(PJSIP_HEADER(add,Route)=${ARG1}) > exten => addheader,3,GotoIf($["${ARG2}" == ""]?5) > exten => addheader,4,Set(PJSIP_HEADER(add,P-Charging-Vector)=${ARG2}) > exten => addheader,5,GotoIf($["${ARG3}" == ""]?7) > exten => addheader,6,Set(PJSIP_HEADER(add,P-Visited-Network-ID)=${ARG3}) > exten => addheader,7,GotoIf($["${ARG4}" == ""]?9) > exten => addheader,8,Set(PJSIP_HEADER(add,X-C-Params)=${ARG4}) > exten => addheader,9,GotoIf($["${ARG5}" == ""]?11) > exten => addheader,10,Set(PJSIP_HEADER(add,X-URI)=${ARG5}) > exten => addheader,11,Return > > [pcscf1] > exten => _.,1,Dial(PJSIP/pcscf1/sip:${EXTEN}@${SIPDOMAIN},,b( > handler^addheader^1,(${PJSIP_HEADER(read,Route)},${PJSIP_ > HEADER(read,P-Charging-Vector)},${PJSIP_HEADER(read,P- > Visited-Network-ID)},${PJSIP_HEADER(read,X-C-Params)},${ > PJSIP_HEADER(read,X-URI)}))) > > This works, but you'll have to admit, it's not the most > readable-Version of an extensions.conf. > > Are there any better solutions around? > > Thanks, > Carsten > > P.S.: I may have found an issue in Asterisk 13.x (LTS); if I send the > right SIP-Message I can make it crash. I'm currently verifying, if it > still happens with the latest 13.x release from GIT. If I can confirm > it with the latest 13.x from GIT, should I post my findings to the > dev-list or is there some security mailing list, as this would apply > to all installations around there? > > -- > Carsten Bock > CEO (Gesch?ftsf?hrer) > > ng-voice GmbH > Millerntorplatz 1 > 20359 Hamburg / Germany > > http://www.ng-voice.com > mailto:carsten at ng-voice.com > > Office +49 40 5247593-40 > Fax +49 40 5247593-99 > > Sitz der Gesellschaft: Hamburg > Registergericht: Amtsgericht Hamburg, HRB 120189 > Gesch?ftsf?hrer: Carsten Bock > Ust-ID: DE279344284 > > Hier finden Sie unsere handelsrechtlichen Pflichtangaben: > http://www.ng-voice.com/imprint/ > > -- > _____________________________________________________________________ > -- Bandwidth and Colocation Provided by http://www.api-digital.com -- > > Check out the new Asterisk community forum at: https://community.asterisk. > org/ > > New to Asterisk? Start here: > https://wiki.asterisk.org/wiki/display/AST/Getting+Started > > asterisk-users mailing list > To UNSUBSCRIBE or update options visit: > http://lists.digium.com/mailman/listinfo/asterisk-users-- A human being should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly. Specialization is for insects. ---Heinlein -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20170802/713bcb22/attachment.html>