<div dir="ltr">My only suggestion would be you could reduce your line count by replacing your GotoIf statements with ExecIF statements. <br><br>exten => addheader,1,ExecIf($["x${ARG1}" != "x"]?Set(PJSIP_HEADER(add,Route)=${ARG1}))<br> same => n,ExecIf($["x${ARG2}" != "x"]?Set(PJSIP_HEADER(add,P-Charging-Vector)=${ARG2}))<br> same => n,ExecIf($["x${ARG3}" != "x"]?Set(PJSIP_HEADER(add,P-Visited-Network-ID)=${ARG3}))<br> same => n,ExecIf($["x${ARG4}" != "x"]?Set(PJSIP_HEADER(add,X-C-Params)=${ARG4}))<br> same => n,ExecIf($["x${ARG5}" != "x"]?Set(PJSIP_HEADER(add,X-URI)=${ARG5}))<br> same => n,Return()<br><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Aug 2, 2017 at 6:39 AM, Carsten Bock <span dir="ltr"><<a href="mailto:carsten@ng-voice.com" target="_blank">carsten@ng-voice.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
quick question:<br>
I need to pass-through some headers from the A-Leg to the B-Leg, which<br>
are connected using PJSIP.<br>
Currently I do the following:<br>
<br>
[handler]<br>
exten => addheader,1,GotoIf($["${ARG1}" == ""]?3)<br>
exten => addheader,2,Set(PJSIP_HEADER(<wbr>add,Route)=${ARG1})<br>
exten => addheader,3,GotoIf($["${ARG2}" == ""]?5)<br>
exten => addheader,4,Set(PJSIP_HEADER(<wbr>add,P-Charging-Vector)=${ARG2}<wbr>)<br>
exten => addheader,5,GotoIf($["${ARG3}" == ""]?7)<br>
exten => addheader,6,Set(PJSIP_HEADER(<wbr>add,P-Visited-Network-ID)=${<wbr>ARG3})<br>
exten => addheader,7,GotoIf($["${ARG4}" == ""]?9)<br>
exten => addheader,8,Set(PJSIP_HEADER(<wbr>add,X-C-Params)=${ARG4})<br>
exten => addheader,9,GotoIf($["${ARG5}" == ""]?11)<br>
exten => addheader,10,Set(PJSIP_HEADER(<wbr>add,X-URI)=${ARG5})<br>
exten => addheader,11,Return<br>
<br>
[pcscf1]<br>
exten => _.,1,Dial(PJSIP/pcscf1/sip:${<wbr>EXTEN}@${SIPDOMAIN},,b(<wbr>handler^addheader^1,(${PJSIP_<wbr>HEADER(read,Route)},${PJSIP_<wbr>HEADER(read,P-Charging-Vector)<wbr>},${PJSIP_HEADER(read,P-<wbr>Visited-Network-ID)},${PJSIP_<wbr>HEADER(read,X-C-Params)},${<wbr>PJSIP_HEADER(read,X-URI)})))<br>
<br>
This works, but you'll have to admit, it's not the most<br>
readable-Version of an extensions.conf.<br>
<br>
Are there any better solutions around?<br>
<br>
Thanks,<br>
Carsten<br>
<br>
P.S.: I may have found an issue in Asterisk 13.x (LTS); if I send the<br>
right SIP-Message I can make it crash. I'm currently verifying, if it<br>
still happens with the latest 13.x release from GIT. If I can confirm<br>
it with the latest 13.x from GIT, should I post my findings to the<br>
dev-list or is there some security mailing list, as this would apply<br>
to all installations around there?<br>
<br>
--<br>
Carsten Bock<br>
CEO (Geschäftsführer)<br>
<br>
ng-voice GmbH<br>
Millerntorplatz 1<br>
20359 Hamburg / Germany<br>
<br>
<a href="http://www.ng-voice.com" rel="noreferrer" target="_blank">http://www.ng-voice.com</a><br>
mailto:<a href="mailto:carsten@ng-voice.com">carsten@ng-voice.com</a><br>
<br>
Office +49 40 5247593-40<br>
Fax +49 40 5247593-99<br>
<br>
Sitz der Gesellschaft: Hamburg<br>
Registergericht: Amtsgericht Hamburg, HRB 120189<br>
Geschäftsführer: Carsten Bock<br>
Ust-ID: DE279344284<br>
<br>
Hier finden Sie unsere handelsrechtlichen Pflichtangaben:<br>
<a href="http://www.ng-voice.com/imprint/" rel="noreferrer" target="_blank">http://www.ng-voice.com/<wbr>imprint/</a><br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
______________________________<wbr>______________________________<wbr>_________<br>
-- Bandwidth and Colocation Provided by <a href="http://www.api-digital.com" rel="noreferrer" target="_blank">http://www.api-digital.com</a> --<br>
<br>
Check out the new Asterisk community forum at: <a href="https://community.asterisk.org/" rel="noreferrer" target="_blank">https://community.asterisk.<wbr>org/</a><br>
<br>
New to Asterisk? Start here:<br>
      <a href="https://wiki.asterisk.org/wiki/display/AST/Getting+Started" rel="noreferrer" target="_blank">https://wiki.asterisk.org/<wbr>wiki/display/AST/Getting+<wbr>Started</a><br>
<br>
asterisk-users mailing list<br>
To UNSUBSCRIBE or update options visit:<br>
   <a href="http://lists.digium.com/mailman/listinfo/asterisk-users" rel="noreferrer" target="_blank">http://lists.digium.com/<wbr>mailman/listinfo/asterisk-<wbr>users</a></font></span></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">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.<br>---Heinlein</div>
</div>