<div dir="ltr"><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">Maybe he is referring to session.setVariable()?</span><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><a href="https://freeswitch.org/confluence/display/FREESWITCH/Session+setVariable" target="_blank" style="color:rgb(17,85,204)">https://freeswitch.org/<wbr>confluence/display/FREESWITCH/<wbr>Session+setVariable</a></div><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, May 23, 2018 at 10:46 AM, Preston Hagar <span dir="ltr"><<a href="mailto:prestonh@gmail.com" target="_blank">prestonh@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I figured out my issue. I had left out part of my code in previous emails to try to make it simpler, and left out the part that was messing things up.<div><br></div><div>So after I set the sip Diversion header:</div><span class=""><div><div><br></div><div>var diversionHeader = 'sip_h_Diversion=<sip:' + $destination_number + '@<a href="http://pbx.example.org" target="_blank">pbx.example.org</a>>;privacy=<wbr>off;reason=unconditional;<wbr>counter=1;screen=no';</div><div><br></div><div>session.execute('set',<wbr>diversionHeader);</div><div><br></div></div><div><br></div></span><div>I would set a timeout:</div><div><br></div><div>session.execute('set', 'call_timeout=45');</div><div><br></div><div><br></div><div>Then I would ring all three receptionist stations at once with a bridge command:</div><div><br></div><div><br></div><div><div> var logic = '{ignore_early_media=true}<wbr>user/1000@' + $pbx_domain + ':_:user/1001@'</div><div> + $pbx_domain + ':_:user/1002@' + $pbx_domain;</div><div> session.execute('bridge', logic);</div></div><div><br></div><div><br></div><div>The problem ended up stemming from me ringing all three at once using the :_: to join the extensions. I switched it over to commas:</div><div><br></div><div><div> var logic = '{ignore_early_media=true}<wbr>user/1000@' + $pbx_domain + ',user/1001@'</div><div> + $pbx_domain + ',user/1002@' + $pbx_domain;</div><div> session.execute('bridge', logic);</div></div><div><br></div><div>and now the Diversion header shows up as expected. We shouldn't have multiple registrations for any of those numbers, so it shouldn't be an issue.</div><div><br></div><div>Thanks everyone for taking a look.</div><div><br></div><div><br></div><div>Out of curiosity, what is the "direct method" for setting the SIP header (instead of using session.execute)? I can't seem to find anything in the documentation.</div><div><br></div><div><br></div><div>Thanks again,</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On Wed, May 23, 2018 at 10:26 AM, Michael Jerris <span dir="ltr"><<a href="mailto:mike@jerris.com" target="_blank">mike@jerris.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div style="word-wrap:break-word;line-break:after-white-space">I’d avoid using the bridge function like this, but worthwhile to set the variable using the direct method instead of session execute for set application.<div><div class="m_-7127234862352672815h5"><div><br><div><br><blockquote type="cite"><div>On May 22, 2018, at 5:01 PM, Branden Jordan <<a href="mailto:BJordan@E-Teleco.com" target="_blank">BJordan@E-Teleco.com</a>> wrote:</div><br class="m_-7127234862352672815m_-3575020198842683695Apple-interchange-newline"><div><div class="m_-7127234862352672815m_-3575020198842683695WordSection1" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none"><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">I don’t see any reason why that wouldn’t work but maybe there is something weird going on with the javascript session object where it isn’t getting/setting the exported variables from the session when you are doing the bridge? Have you tried making a new session object and setting your variables for that session object instead of doing a session.execute? I found something like this on the Wiki that you might be able to do, small example below.<u></u><u></u></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><u></u> <u></u></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-family:"Droid Sans Mono";color:rgb(51,51,51)">var anotherSession = new Session(session,<span class="m_-7127234862352672815m_-3575020198842683695Apple-converted-space"> </span></span><span style="font-family:"Droid Sans Mono"">'{ignore_<wbr>early_media=true}user/1003@' + $pbx_domain</span><span style="font-family:"Droid Sans Mono";color:rgb(51,51,51)">);<u></u><u></u></span></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-family:"Droid Sans Mono";color:rgb(51,51,51)">anotherSession.execute(‘set’,d<wbr>iversionHeader);<u></u><u></u></span></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-family:"Droid Sans Mono";color:rgb(51,51,51)">bridge(session, anotherSession);<u></u><u></u></span></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-family:"Droid Sans Mono";color:rgb(51,51,51)">anotherSession.hangup();</span><span style="font-family:"Droid Sans Mono""><u></u><u></u></span></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><u></u> <u></u></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">Like I said earlier I am a bit rusty on the Javascript side, (no idea if bridge blocks or if you have to do a loop) but I know that would work on the LUA side which is where I am more familiar. I know Javascript examples are a little light on the wiki but you might be able to get the gist of what is going on in the LUA side and then mimic that in Javascript. <a href="https://freeswitch.org/confluence/display/FREESWITCH/Lua+example+Bridging+two+calls+with+retry" style="color:purple;text-decoration:underline" target="_blank">https://freeswitch<wbr>.org/confluence/display/<wbr>FREESWITCH/Lua+example+<wbr>Bridging+two+calls+with+retry</a><u></u><u></u></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><u></u> <u></u></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">Thanks,<u></u><u></u></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><u></u> <u></u></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">Branden Jordan<u></u><u></u></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><u></u> <u></u></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><b>From:</b><span class="m_-7127234862352672815m_-3575020198842683695Apple-converted-space"> </span>FreeSWITCH-users <<a href="mailto:freeswitch-users-bounces@lists.freeswitch.org" target="_blank">freeswitch-users-bounces@list<wbr>s.freeswitch.org</a>><span class="m_-7127234862352672815m_-3575020198842683695Apple-converted-space"> </span><b>On Behalf Of<span class="m_-7127234862352672815m_-3575020198842683695Apple-converted-space"> </span></b>Preston Hagar<br><b>Sent:</b><span class="m_-7127234862352672815m_-3575020198842683695Apple-converted-space"> </span>Monday, May 21, 2018 6:53 PM<br><b>To:</b><span class="m_-7127234862352672815m_-3575020198842683695Apple-converted-space"> </span>FreeSWITCH Users Help <<a href="mailto:freeswitch-users@lists.freeswitch.org" target="_blank">freeswitch-users@lists.freesw<wbr>itch.org</a>><br><b>Subject:</b><span class="m_-7127234862352672815m_-3575020198842683695Apple-converted-space"> </span>Re: [Freeswitch-users] Adding SIP Headers in Javascript<u></u><u></u></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><u></u> <u></u></div><div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">Thanks for responding!<u></u><u></u></div><div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><u></u> <u></u></div></div><div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">Below is a bit more code to fill in the gaps. I'm passing the destination_number from the XML as a third argument. When I test out the code below, the console_log does in fact print out a "correct" Diversion header line. If I use the exact same Diversion header, set in my XML dialplan, it shows up in the SIP packet and the VOP software reads it. When I set it using session.execute in javascript, then no Diversion header, even an incorrect one, gets added to the SIP packet. <u></u><u></u></div></div><div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><u></u> <u></u></div></div><div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">I don't think it is in the variable substitution or anything like that. I've also tried not passing a variable to session.execute and just putting the string in the command, as well as just hard coding a test number. In all cases, no Diversion header ever shows up. Either I'm not setting it right for javascript or there is something different about setting it in Javascript vs XML that I haven't figured out.<u></u><u></u></div></div><div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><u></u> <u></u></div></div><div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">Here is more expanded code:<u></u><u></u></div></div><div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><u></u> <u></u></div></div><div><div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><u></u> <u></u></div></div><div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">var $extension = argv[0];<u></u><u></u></div></div><div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">var $pbx_domain = argv[1];<u></u><u></u></div></div><div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">var $destination_number = argv[2];<u></u><u></u></div></div></div><div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><u></u> <u></u></div></div><div><div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">var diversionHeader = 'sip_h_Diversion=<<a>sip:'</a> + $destination_number + '@<a href="http://pbx.example.org/" style="color:purple;text-decoration:underline" target="_blank">pbx.example.org</a>>;privacy=off<wbr>;reason=unconditional;counter=<wbr>1;screen=no';<u></u><u></u></div></div><div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><u></u> <u></u></div></div><div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">session.execute('set',diversio<wbr>nHeader);<u></u><u></u></div></div><div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">session.execute('export','sip_<wbr>h_Diversion');<u></u><u></u></div></div><div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><u></u> <u></u></div></div><div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">onsole_log("notice","Trying receptionist");<u></u><u></u></div></div><div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">console_log("notice",session.s<wbr>tate);<u></u><u></u></div></div><div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">console_log("notice",diversion<wbr>Header);<u></u><u></u></div></div><div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">session.execute('set', 'call_timeout=15');<u></u><u></u></div></div><div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><u></u> <u></u></div></div><div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">var logic = '{ignore_early_media=true}user<wbr>/1003@' + $pbx_domain;<u></u><u></u></div></div><div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">session.execute('bridge', logic);<u></u><u></u></div></div><div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><u></u> <u></u></div></div><div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">console_log("notice","Trying Kim");<u></u><u></u></div></div><div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">console_log("notice",session.s<wbr>tate);<u></u><u></u></div></div><div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">session.execute('set', 'call_timeout=10');<u></u><u></u></div></div><div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">session.execute('bridge', 'user/2741@' + $pbx_domain);<u></u><u></u></div></div><div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><u></u> <u></u></div></div><div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">// No one answered, send to IVR<u></u><u></u></div></div><div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><u></u> <u></u></div></div><div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"> console_log("notice","No one is answering");<u></u><u></u></div></div><div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"> console_log("notice",session.<wbr>state);<u></u><u></u></div></div><div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">if (session.state == "CS_EXECUTE")<u></u><u></u></div></div><div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"> {<u></u><u></u></div></div><div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"> console_log("notice","Trying IVR");<u></u><u></u></div></div><div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"> session.execute('transfer', 'ivr');<u></u><u></u></div></div><div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"> }<u></u><u></u></div></div></div><div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><u></u> <u></u></div></div><div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><u></u> <u></u></div></div></div><div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><u></u> <u></u></div><div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">On Mon, May 21, 2018 at 6:57 PM, Branden Jordan <<a href="mailto:BJordan@e-teleco.com" style="color:purple;text-decoration:underline" target="_blank">BJordan@e-teleco.com</a>> wrote:<u></u><u></u></div><blockquote style="border-style:none none none solid;border-left-width:1pt;border-left-color:rgb(204,204,204);padding:0in 0in 0in 6pt;margin:5pt 0in 5pt 4.8pt"><div><div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">Not sure if you still need help with this but could you post some more of your javascript code? Something about this line is off to me but maybe it makes sense in the grander scheme of things.<span class="m_-7127234862352672815m_-3575020198842683695Apple-converted-space"> </span><u></u><u></u></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"> var diversionHeader = 'sip_h_Diversion=<<a>sip:'</a> + $destination_number + '@<a href="http://pbx.example.org/" style="color:purple;text-decoration:underline" target="_blank">pbx.example.org</a>>;privacy=off<wbr>;reason=unconditional;counter=<wbr>1;screen=no';<u></u><u></u></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"> <u></u><u></u></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">I have not used javascript with freeswitch in a little while, so I might be totally wrong but did you declare $destination_number? Because its possible its undefined if you didn’t declare that specifically equal to the value you passed in via args and thus javascript does you a solid and makes the whole string undefined which sets the sip_h_Diversion to null which is why it isn’t exporting. Maybe try argv[3] or argv[2] (console them out I am not sure which one it’ll be) instead of $destination_number in your concatenation?<u></u><u></u></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"> <u></u><u></u></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">If that isn’t it and you are still having an issue we can try some other stuff.<u></u><u></u></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"> <u></u><u></u></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">Thanks,<u></u><u></u></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">Branden Jordan<u></u><u></u></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"> <u></u><u></u></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"> <u></u><u></u></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><b>From:</b><span class="m_-7127234862352672815m_-3575020198842683695Apple-converted-space"> </span>FreeSWITCH-users <<a href="mailto:freeswitch-users-bounces@lists.freeswitch.org" style="color:purple;text-decoration:underline" target="_blank">freeswitch-users-bounces@list<wbr>s.freeswitch.org</a>><span class="m_-7127234862352672815m_-3575020198842683695Apple-converted-space"> </span><b>On Behalf Of<span class="m_-7127234862352672815m_-3575020198842683695Apple-converted-space"> </span></b>Preston Hagar<br><b>Sent:</b><span class="m_-7127234862352672815m_-3575020198842683695Apple-converted-space"> </span>Friday, May 18, 2018 8:55 AM<br><b>To:</b><span class="m_-7127234862352672815m_-3575020198842683695Apple-converted-space"> </span>FreeSWITCH Users Help <<a href="mailto:freeswitch-users@lists.freeswitch.org" style="color:purple;text-decoration:underline" target="_blank">freeswitch-users@lists.freesw<wbr>itch.org</a>><br><b>Subject:</b><span class="m_-7127234862352672815m_-3575020198842683695Apple-converted-space"> </span>[Freeswitch-users] Adding SIP Headers in Javascript<u></u><u></u></div><div><div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"> <u></u><u></u></div><div><div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">Quick Version: Is there some special way to set custom SIP headers when you are bridging a call from Javascript instead of XML?<u></u><u></u></div></div><div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"> <u></u><u></u></div></div><div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">Full Details:<u></u><u></u></div></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">We am using Voice Operator Panel (VOP) as a receptionist console. We have multiple external numbers that all funnel into a few receptionist desks. If I add a SIP Diversion header, then VOP will use that to show the receptionist which number the caller dialed to reach them, which would help things out a lot.<u></u><u></u></div><div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"> <u></u><u></u></div></div><div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">If I add it in an XML dialplan and then do a direct bridge to one of the receptionist numbers, it works great (snip of working direct dialplan):<u></u><u></u></div></div><div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"> <u></u><u></u></div></div><div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><action application="set" data="sip_h_Diversion=<<a>sip:$</a>{<a href="mailto:destination_number%7D@pbx.example.org" style="color:purple;text-decoration:underline" target="_blank">d<wbr>estination_number}@pbx.example<wbr>.org</a>>;privacy=off;reason=<wbr>unconditional;counter=1;<wbr>screen=no"/><u></u><u></u></div></div><div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><action application="bridge" data="user/<a href="mailto:1000@pbx.example.org" style="color:purple;text-decoration:underline" target="_blank">1000@pbx.example.or<wbr>g</a>"/><u></u><u></u></div></div><div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"> <u></u><u></u></div></div><div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">The problem is I need a bit of advanced logic to figure out which receptionist are online and then ring those, then fail over to other numbers and ultimately IVR if no one answers, so I instead pass calls to them off to javascript, so the bridge line above becomes something link:<u></u><u></u></div></div><div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"> <u></u><u></u></div></div><div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><action application="javascript" data="${jslib}/frontdesk.js ${dialed_extension} ${domain_name} ${destination_number}" /><u></u><u></u></div></div><div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"> <u></u><u></u></div></div><div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">I've tried setting the SIP header in the XML above the javascript line and then exporting it<u></u><u></u></div></div><div><div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"> <action application="set" data="sip_h_Diversion=<<a>sip:$</a>{<a href="mailto:destination_number%7D@pbx.example.org" style="color:purple;text-decoration:underline" target="_blank">d<wbr>estination_number}@pbx.example<wbr>.org</a>>;privacy=off;reason=<wbr>unconditional;counter=1;<wbr>screen=no"/> <u></u><u></u></div></div><div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"> <action application="export" data="sip_h_Diversion" /><u></u><u></u></div></div></div><div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"> <u></u><u></u></div></div><div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">and setting it in the Javascript:<u></u><u></u></div></div><div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"> <u></u><u></u></div></div><div><div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"> var diversionHeader = 'sip_h_Diversion=<<a>sip:'</a> + $destination_number + '@<a href="http://pbx.example.org/" style="color:purple;text-decoration:underline" target="_blank">pbx.example.org</a>>;privacy=off<wbr>;reason=unconditional;counter=<wbr>1;screen=no';<u></u><u></u></div></div><div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"> <u></u><u></u></div></div><div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"> session.execute('set',diversio<wbr>nHeader);<u></u><u></u></div></div><div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"> session.execute('export','sip_<wbr>h_Diversion');<u></u><u></u></div></div></div><div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"> <u></u><u></u></div></div><div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">but in both cases (or with both in place), the SIP header is never written.<u></u><u></u></div></div><div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"> <u></u><u></u></div></div><div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">Is there some magic to setting SIP headers in Javascript? I can't seem to find any examples or documentation about it.<u></u><u></u></div></div><div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"> <u></u><u></u></div></div><div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">Thanks!<u></u><u></u></div></div><div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"> <u></u><u></u></div></div><div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"> <u></u><u></u></div></div><div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"> <u></u><u></u></div></div><div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"> <u></u><u></u></div></div><div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"> </div></div></div></div></div></div></div></blockquote></div></div></div></div></blockquote></div></div></div></div></div><br></div></div><span class="">______________________________<wbr>______________________________<wbr>_____________<br>
Professional FreeSWITCH Consulting Services:<br>
<a href="mailto:consulting@freeswitch.org" target="_blank">consulting@freeswitch.org</a><br>
<a href="http://www.freeswitchsolutions.com" rel="noreferrer" target="_blank">http://www.freeswitchsolutions<wbr>.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a href="http://www.freeswitch.org" rel="noreferrer" target="_blank">http://www.freeswitch.org</a><br>
<a href="http://confluence.freeswitch.org" rel="noreferrer" target="_blank">http://confluence.freeswitch.o<wbr>rg</a><br>
<a href="http://www.cluecon.com" rel="noreferrer" target="_blank">http://www.cluecon.com</a><br>
<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswi<wbr>tch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" rel="noreferrer" target="_blank">http://lists.freeswitch.org/ma<wbr>ilman/listinfo/freeswitch-user<wbr>s</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" rel="noreferrer" target="_blank">http://lists.frees<wbr>witch.org/mailman/options/<wbr>freeswitch-users</a><br>
<a href="http://www.freeswitch.org" rel="noreferrer" target="_blank">http://www.freeswitch.org</a><br></span></blockquote></div><br></div>
<br>______________________________<wbr>______________________________<wbr>_____________<br>
Professional FreeSWITCH Consulting Services:<br>
<a href="mailto:consulting@freeswitch.org">consulting@freeswitch.org</a><br>
<a href="http://www.freeswitchsolutions.com" rel="noreferrer" target="_blank">http://www.<wbr>freeswitchsolutions.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a href="http://www.freeswitch.org" rel="noreferrer" target="_blank">http://www.freeswitch.org</a><br>
<a href="http://confluence.freeswitch.org" rel="noreferrer" target="_blank">http://confluence.freeswitch.<wbr>org</a><br>
<a href="http://www.cluecon.com" rel="noreferrer" target="_blank">http://www.cluecon.com</a><br>
<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.<wbr>freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" rel="noreferrer" target="_blank">http://lists.freeswitch.org/<wbr>mailman/listinfo/freeswitch-<wbr>users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" rel="noreferrer" target="_blank">http://lists.<wbr>freeswitch.org/mailman/<wbr>options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" rel="noreferrer" target="_blank">http://www.freeswitch.org</a><br></blockquote></div><br></div>