<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#44546A;}
span.mw-headline
        {mso-style-name:mw-headline;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#44546A'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#44546A'>I have tried following three options and I don’t multiple diversion header.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#44546A'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#44546A'>OPTION 1<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#44546A'>If I use “push” application, I get the diversion field like below<o:p></o:p></span></p><p class=MsoNormal><b><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#44546A'>Diversion: ARRAY::<sip:18005551212@10.10.10.10>;reason=user-busy;counter=3;privacy=off|:<sip:18005552323>;reason=no-answer;counter=1;privacy=off<o:p></o:p></span></b></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#44546A'><o:p> </o:p></span></p><p class=MsoNormal><extension name="public_did"><o:p></o:p></p><p class=MsoNormal> <condition field="destination_number" expression="^9999(\d{10})$"><o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal> <action application="set" data="ocn=18005551212"/><o:p></o:p></p><p class=MsoNormal> <action application="set" data="rdn=18005552323"/><o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal> <action application="push" data="sip_h_Diversion =<<a href="sip:$%7bocn%7d@$%7bnetwork_addr%7d">sip:${ocn}@${network_addr}</a>>;reason=user-busy;counter=3;privacy=off"/><o:p></o:p></p><p class=MsoNormal> <action application="push" data="sip_h_Diversion =<<a href="sip:$%7brdn%7d@$%7bnetwork_addr%7d">sip:${rdn}@${network_addr}</a>>;reason=no-answer;counter=1;privacy=off"/><o:p></o:p></p><p class=MsoNormal> <o:p></o:p></p><p class=MsoNormal> <action application="set" data="hangup_after_bridge=true" /><o:p></o:p></p><p class=MsoNormal> <action application="set" data="continue_on_fail=true"/><o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal> <action application="transfer" data="1001 XML default"/><o:p></o:p></p><p class=MsoNormal> </condition><o:p></o:p></p><p class=MsoNormal></extension><o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>OPTION 2<o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#44546A'>If I use export with “,” then I get the following results:<o:p></o:p></span></p><p class=MsoNormal><b><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#44546A'>Diversion: <sip:19082302337@216.1.185.103>;reason=user-busy;counter=3;privacy=off,<sip:13216938059@216.1.185.103>;reason=no-answer;counter=1;privacy=off<o:p></o:p></span></b></p><p class=MsoNormal><b><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#44546A'><o:p> </o:p></span></b></p><p class=MsoNormal><extension name="public_did"><o:p></o:p></p><p class=MsoNormal> <condition field="destination_number" expression="^9999(\d{10})$"><o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal> <action application="set" data="ocn=18005551212"/><o:p></o:p></p><p class=MsoNormal> <action application="set" data="rdn=18005552323"/><o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal> <action application="export" data="sip_h_Diversion =<<a href="sip:$%7bocn%7d@$%7bnetwork_addr%7d">sip:${ocn}@${network_addr}</a>>;reason=user-busy;counter=3;privacy=off, <<a href="sip:$%7brdn%7d@$%7bnetwork_addr%7d">sip:${rdn}@${network_addr}</a>>;reason=no-answer;counter=1;privacy=off "/><o:p></o:p></p><p class=MsoNormal> <o:p></o:p></p><p class=MsoNormal> <action application="set" data="hangup_after_bridge=true" /><o:p></o:p></p><p class=MsoNormal> <action application="set" data="continue_on_fail=true"/><o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal> <action application="transfer" data="1001 XML default"/><o:p></o:p></p><p class=MsoNormal> </condition><o:p></o:p></p><p class=MsoNormal></extension><o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><span class=mw-headline><span lang=EN>OPTION 3<o:p></o:p></span></span></p><p class=MsoNormal><span class=mw-headline><span lang=EN>Setting a specific array element I get the following result<o:p></o:p></span></span></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><b><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#44546A'>Diversion: ARRAY::<sip:19082302337@216.1.185.103>;reason=user-busy;counter=3;privacy=off}|:<sip:13216938059@216.1.185.103>;reason=no-answer;counter=1;privacy=off<o:p></o:p></span></b></p><p class=MsoNormal><extension name="public_did"><o:p></o:p></p><p class=MsoNormal> <condition field="destination_number" expression="^9999(\d{10})$"><o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal> <action application="set" data="ocn=18005551212"/><o:p></o:p></p><p class=MsoNormal> <action application="set" data="rdn=18005552323"/><o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal> <action application="set" data="sip_h_Diversion[0] =<<a href="sip:$%7bocn%7d@$%7bnetwork_addr%7d">sip:${ocn}@${network_addr}</a>>;reason=user-busy;counter=3;privacy=off"/><o:p></o:p></p><p class=MsoNormal> <action application="set" data="sip_h_Diversion[1] =<<a href="sip:$%7brdn%7d@$%7bnetwork_addr%7d">sip:${rdn}@${network_addr}</a>>;reason=no-answer;counter=1;privacy=off"/><o:p></o:p></p><p class=MsoNormal> <o:p></o:p></p><p class=MsoNormal> <action application="set" data="hangup_after_bridge=true" /><o:p></o:p></p><p class=MsoNormal> <action application="set" data="continue_on_fail=true"/><o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal> <action application="transfer" data="1001 XML default"/><o:p></o:p></p><p class=MsoNormal> </condition><o:p></o:p></p><p class=MsoNormal></extension><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#44546A'><o:p> </o:p></span></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#44546A'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#44546A'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#44546A'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#44546A'><o:p> </o:p></span></p><p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> Steven Ayre [mailto:steveayre@gmail.com] <br><b>Sent:</b> Wednesday, April 23, 2014 5:56 AM<br><b>To:</b> FreeSWITCH Users Help<br><b>Subject:</b> Re: [Freeswitch-users] Exporting Diversion Header Twice<o:p></o:p></span></p><p class=MsoNormal><o:p> </o:p></p><div><p class=MsoNormal>You could also try whether mod_sofia supports arrays for that variable<o:p></o:p></p><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal><a href="http://wiki.freeswitch.org/wiki/Dialplan_ARRAYS">http://wiki.freeswitch.org/wiki/Dialplan_ARRAYS</a><o:p></o:p></p><div><p class=MsoNormal><o:p> </o:p></p></div></div></div><div><p class=MsoNormal style='margin-bottom:12.0pt'><o:p> </o:p></p><div><p class=MsoNormal>On 23 April 2014 08:05, Dahlberg, David <<a href="mailto:david.dahlberg@fkie.fraunhofer.de" target="_blank">david.dahlberg@fkie.fraunhofer.de</a>> wrote:<o:p></o:p></p><p class=MsoNormal>Am Dienstag, den 22.04.2014, 12:40 -0400 schrieb Sanjiv Kumar:<o:p></o:p></p><div><p class=MsoNormal>> I am trying to export sip_h_Diversion header twice but I only see the<br>> last attempt on leg-B. It appears that second export attempt<br>> overwrites the first one.<o:p></o:p></p></div><p class=MsoNormal>[..]<o:p></o:p></p><div><p class=MsoNormal style='margin-bottom:12.0pt'>> <action application="export" data=" nolocal:sip_h_Diversion =<<a href="sip:%0b">sip:<br></a>> ${ocn}@${network_addr}>;reason=user-busy;counter=3;privacy=off"/><br>> <action application="export" data=" nolocal:sip_h_Diversion =<<a href="sip:%0b">sip:<br></a>> ${rdn}@${network_addr}>;reason=no-answer;counter=1;privacy=off"/><br>><o:p></o:p></p></div><p class=MsoNormal>(A) In Freeswitch/Sofia SIP you're not actually writing a header, but<br>you're writing a variable that in turn will tell mod_sofia to write a<br>header. If you write to the same variable a second time, you will<br>overwrite it.<br><br>(B) Sip (as good old RFC 822) allows for multiple headers in in multiple<br>formats. One possibility is actually adding multiple headers, the other<br>is having one header with multiple values, separated by comma.<br><br>So please try the following: Set the variable once, but with both<br>values, separated by comma. The result will be, that mod_sophia adds<br>indeed two separate headers.<br><br>Cheers<br> David<br><br>--<br>David Dahlberg<br><br>Fraunhofer FKIE, Dept. Communication Systems (KOM) | Tel: <a href="tel:%2B49-228-9435-845">+49-228-9435-845</a><br>Fraunhoferstr. 20, 53343 Wachtberg, Germany | Fax: <a href="tel:%2B49-228-856277">+49-228-856277</a><br>_________________________________________________________________________<br>Professional FreeSWITCH Consulting Services:<br><a href="mailto:consulting@freeswitch.org">consulting@freeswitch.org</a><br><a href="http://www.freeswitchsolutions.com" target="_blank">http://www.freeswitchsolutions.com</a><br><br>FreeSWITCH-powered IP PBX: The CudaTel Communication Server<br><a href="http://www.cudatel.com" target="_blank">http://www.cudatel.com</a><br><br>Official FreeSWITCH Sites<br><a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br><a href="http://wiki.freeswitch.org" target="_blank">http://wiki.freeswitch.org</a><br><a href="http://www.cluecon.com" 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.freeswitch.org</a><br><a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br><a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><o:p></o:p></p></div><p class=MsoNormal><o:p> </o:p></p></div></div></body></html>