<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>&nbsp;</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>&nbsp;</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::&lt;sip:18005551212@10.10.10.10&gt;;reason=user-busy;counter=3;privacy=off|:&lt;sip:18005552323&gt;;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>&nbsp;</o:p></span></p><p class=MsoNormal>&lt;extension name=&quot;public_did&quot;&gt;<o:p></o:p></p><p class=MsoNormal>&nbsp;&nbsp;&nbsp; &lt;condition field=&quot;destination_number&quot; expression=&quot;^9999(\d{10})$&quot;&gt;<o:p></o:p></p><p class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;action application=&quot;set&quot; data=&quot;ocn=18005551212&quot;/&gt;<o:p></o:p></p><p class=MsoNormal>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;action application=&quot;set&quot; data=&quot;rdn=18005552323&quot;/&gt;<o:p></o:p></p><p class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;action application=&quot;push&quot; data=&quot;sip_h_Diversion =&lt;<a href="sip:$%7bocn%7d@$%7bnetwork_addr%7d">sip:${ocn}@${network_addr}</a>&gt;;reason=user-busy;counter=3;privacy=off&quot;/&gt;<o:p></o:p></p><p class=MsoNormal>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;action application=&quot;push&quot; data=&quot;sip_h_Diversion =&lt;<a href="sip:$%7brdn%7d@$%7bnetwork_addr%7d">sip:${rdn}@${network_addr}</a>&gt;;reason=no-answer;counter=1;privacy=off&quot;/&gt;<o:p></o:p></p><p class=MsoNormal>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <o:p></o:p></p><p class=MsoNormal>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;action application=&quot;set&quot; data=&quot;hangup_after_bridge=true&quot; /&gt;<o:p></o:p></p><p class=MsoNormal>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;action application=&quot;set&quot; data=&quot;continue_on_fail=true&quot;/&gt;<o:p></o:p></p><p class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&lt;action application=&quot;transfer&quot; data=&quot;1001 XML default&quot;/&gt;<o:p></o:p></p><p class=MsoNormal>&nbsp;&nbsp;&nbsp; &lt;/condition&gt;<o:p></o:p></p><p class=MsoNormal>&lt;/extension&gt;<o:p></o:p></p><p class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal><o:p>&nbsp;</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: &lt;sip:19082302337@216.1.185.103&gt;;reason=user-busy;counter=3;privacy=off,&lt;sip:13216938059@216.1.185.103&gt;;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>&nbsp;</o:p></span></b></p><p class=MsoNormal>&lt;extension name=&quot;public_did&quot;&gt;<o:p></o:p></p><p class=MsoNormal>&nbsp;&nbsp;&nbsp; &lt;condition field=&quot;destination_number&quot; expression=&quot;^9999(\d{10})$&quot;&gt;<o:p></o:p></p><p class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;action application=&quot;set&quot; data=&quot;ocn=18005551212&quot;/&gt;<o:p></o:p></p><p class=MsoNormal>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;action application=&quot;set&quot; data=&quot;rdn=18005552323&quot;/&gt;<o:p></o:p></p><p class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;action application=&quot;export&quot; data=&quot;sip_h_Diversion =&lt;<a href="sip:$%7bocn%7d@$%7bnetwork_addr%7d">sip:${ocn}@${network_addr}</a>&gt;;reason=user-busy;counter=3;privacy=off,  &lt;<a href="sip:$%7brdn%7d@$%7bnetwork_addr%7d">sip:${rdn}@${network_addr}</a>&gt;;reason=no-answer;counter=1;privacy=off &quot;/&gt;<o:p></o:p></p><p class=MsoNormal>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <o:p></o:p></p><p class=MsoNormal>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;action application=&quot;set&quot; data=&quot;hangup_after_bridge=true&quot; /&gt;<o:p></o:p></p><p class=MsoNormal>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;action application=&quot;set&quot; data=&quot;continue_on_fail=true&quot;/&gt;<o:p></o:p></p><p class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&lt;action application=&quot;transfer&quot; data=&quot;1001 XML default&quot;/&gt;<o:p></o:p></p><p class=MsoNormal>&nbsp;&nbsp;&nbsp; &lt;/condition&gt;<o:p></o:p></p><p class=MsoNormal>&lt;/extension&gt;<o:p></o:p></p><p class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal><o:p>&nbsp;</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>&nbsp;</o:p></p><p class=MsoNormal><b><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#44546A'>Diversion: ARRAY::&lt;sip:19082302337@216.1.185.103&gt;;reason=user-busy;counter=3;privacy=off}|:&lt;sip:13216938059@216.1.185.103&gt;;reason=no-answer;counter=1;privacy=off<o:p></o:p></span></b></p><p class=MsoNormal>&lt;extension name=&quot;public_did&quot;&gt;<o:p></o:p></p><p class=MsoNormal>&nbsp;&nbsp;&nbsp; &lt;condition field=&quot;destination_number&quot; expression=&quot;^9999(\d{10})$&quot;&gt;<o:p></o:p></p><p class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;action application=&quot;set&quot; data=&quot;ocn=18005551212&quot;/&gt;<o:p></o:p></p><p class=MsoNormal>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;action application=&quot;set&quot; data=&quot;rdn=18005552323&quot;/&gt;<o:p></o:p></p><p class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;action application=&quot;set&quot; data=&quot;sip_h_Diversion[0] =&lt;<a href="sip:$%7bocn%7d@$%7bnetwork_addr%7d">sip:${ocn}@${network_addr}</a>&gt;;reason=user-busy;counter=3;privacy=off&quot;/&gt;<o:p></o:p></p><p class=MsoNormal>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;action application=&quot;set&quot; data=&quot;sip_h_Diversion[1] =&lt;<a href="sip:$%7brdn%7d@$%7bnetwork_addr%7d">sip:${rdn}@${network_addr}</a>&gt;;reason=no-answer;counter=1;privacy=off&quot;/&gt;<o:p></o:p></p><p class=MsoNormal>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <o:p></o:p></p><p class=MsoNormal>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;action application=&quot;set&quot; data=&quot;hangup_after_bridge=true&quot; /&gt;<o:p></o:p></p><p class=MsoNormal>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;action application=&quot;set&quot; data=&quot;continue_on_fail=true&quot;/&gt;<o:p></o:p></p><p class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&lt;action application=&quot;transfer&quot; data=&quot;1001 XML default&quot;/&gt;<o:p></o:p></p><p class=MsoNormal>&nbsp;&nbsp;&nbsp; &lt;/condition&gt;<o:p></o:p></p><p class=MsoNormal>&lt;/extension&gt;<o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#44546A'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#44546A'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#44546A'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#44546A'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#44546A'><o:p>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</o:p></p></div></div></div><div><p class=MsoNormal style='margin-bottom:12.0pt'><o:p>&nbsp;</o:p></p><div><p class=MsoNormal>On 23 April 2014 08:05, Dahlberg, David &lt;<a href="mailto:david.dahlberg@fkie.fraunhofer.de" target="_blank">david.dahlberg@fkie.fraunhofer.de</a>&gt; 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>&gt; I am trying to export sip_h_Diversion header twice but I only see the<br>&gt; last attempt on leg-B. It appears that second export attempt<br>&gt; 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'>&gt; &nbsp;&lt;action application=&quot;export&quot; data=&quot; nolocal:sip_h_Diversion =&lt;<a href="sip:%0b">sip:<br></a>&gt; &nbsp; &nbsp; &nbsp;${ocn}@${network_addr}&gt;;reason=user-busy;counter=3;privacy=off&quot;/&gt;<br>&gt; &nbsp;&lt;action application=&quot;export&quot; data=&quot; nolocal:sip_h_Diversion =&lt;<a href="sip:%0b">sip:<br></a>&gt; &nbsp; &nbsp; ${rdn}@${network_addr}&gt;;reason=no-answer;counter=1;privacy=off&quot;/&gt;<br>&gt;<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>&nbsp; &nbsp; &nbsp; &nbsp; 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 &nbsp; &nbsp; &nbsp; &nbsp;| 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>&nbsp;</o:p></p></div></div></body></html>