<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=us-ascii"><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;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
.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="#0563C1" vlink="#954F72"><div class=WordSection1><p class=MsoNormal>My ultimate goal is to receive a call from gateway-A manipulate the destination number and send the call to gateway-B. My test setup will bridge the call to extension 1001 instead to sending to gateway-B<o:p></o:p></p><p class=MsoNormal>Gatway-A is sending me destination number in the format <o:p></o:p></p><p class=MsoNormal>INVITE sip:9999188855512121877555121218665551212@10.10.10.10:5060 SIP/2.0<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Where First 4 digits are a predefined prefix. (9999)<o:p></o:p></p><p class=MsoNormal>Next 11 digits are real destination number. (18885551212)<o:p></o:p></p><p class=MsoNormal>Next 11 digits are original called number (OCN). (18775551212)<o:p></o:p></p><p class=MsoNormal>Next 11 digits are redirected number(RDN). (18665551212)<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>My plan is to receive the call with above invite, parse the destination number and export OCN and RDN into diversion sip header and send the call to gateway-B.<o:p></o:p></p><p class=MsoNormal>In the following config, I am exporting the diversion field twice but I see only one diversion (last one with RDN) filed on the leg-B side.<o:p></o:p></p><p class=MsoNormal>What can I do to see both diversion fields.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><extension name="public_did"><o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal> <!--matching prefix --><o:p></o:p></p><p class=MsoNormal> <condition field="destination_number" expression="^9999(\d{33})$"><o:p></o:p></p><p class=MsoNormal> <action application="set" data="orig_digits=$1"/><o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal> <!—parsing destination number --><o:p></o:p></p><p class=MsoNormal> <action application="set" data="my_ocn=${orig_digits:11:11}"/><o:p></o:p></p><p class=MsoNormal> <action application="set" data="my_rdn=${orig_digits:22:11}"/><o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal> <!--debugging --><o:p></o:p></p><p class=MsoNormal> <action application="log" data="INFO variable ORIG_DIGITS has a value = ${orig_digits}"/><o:p></o:p></p><p class=MsoNormal> <action application="log" data="INFO variable MY_OCN has a value = ${my_ocn}"/><o:p></o:p></p><p class=MsoNormal> <action application="log" data="INFO variable MY_RDN has a value = ${my_rdn}"/><o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal> <!—Exporting OCN/RDN into sip diversion header --><o:p></o:p></p><p class=MsoNormal> <action application="export" data=" nolocal:sip_h_Diversion =<sip:${my_ocn}@${network_addr}>;reason=user-busy;counter=3;privacy=off"/><o:p></o:p></p><p class=MsoNormal> <action application="export" data=" nolocal:sip_h_Diversion =<sip:${my_rdn}@${network_addr}>;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></include><o:p></o:p></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><o:p> </o:p></p></div></body></html>