<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)"><!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@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;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
@font-face
        {font-family:"Times New Roman \, serif";
        panose-1:0 0 0 0 0 0 0 0 0 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";
        color:black;}
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;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";
        color:black;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";
        color:black;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Balloon Text Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";
        color:black;}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:Consolas;}
span.EmailStyle20
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.EmailStyle21
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.EmailStyle22
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.BalloonTextChar
        {mso-style-name:"Balloon Text Char";
        mso-style-priority:99;
        mso-style-link:"Balloon Text";
        font-family:"Tahoma","sans-serif";
        color:black;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@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 bgcolor=white lang=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='color:#1F497D'>Hello,<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>Thank you for the idea!<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='color:#1F497D'>When executing my stored procedure to select the route, one of my columns is built up like below.<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas;color:gray'><o:p> </o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas;color:gray'>(</span><span style='font-size:9.5pt;font-family:Consolas;color:red'>'routeid='</span><span style='font-size:9.5pt;font-family:Consolas;color:gray'>+</span><span style='font-size:9.5pt;font-family:Consolas;color:windowtext'> </span><span style='font-size:9.5pt;font-family:Consolas;color:fuchsia'>CAST</span><span style='font-size:9.5pt;font-family:Consolas;color:gray'>(</span><span style='font-size:9.5pt;font-family:Consolas;color:teal'>ID</span><span style='font-size:9.5pt;font-family:Consolas;color:windowtext'> </span><span style='font-size:9.5pt;font-family:Consolas;color:blue'>AS</span><span style='font-size:9.5pt;font-family:Consolas;color:windowtext'> </span><span style='font-size:9.5pt;font-family:Consolas;color:blue'>NVARCHAR</span><span style='font-size:9.5pt;font-family:Consolas;color:gray'>(</span><span style='font-size:9.5pt;font-family:Consolas;color:fuchsia'>MAX</span><span style='font-size:9.5pt;font-family:Consolas;color:gray'>))</span><span style='font-size:9.5pt;font-family:Consolas;color:windowtext'> </span><span style='font-size:9.5pt;font-family:Consolas;color:gray'>+</span><span style='font-size:9.5pt;font-family:Consolas;color:windowtext'> </span><span style='font-size:9.5pt;font-family:Consolas;color:red'>','</span><span style='font-size:9.5pt;font-family:Consolas;color:windowtext'> </span><span style='font-size:9.5pt;font-family:Consolas;color:gray'>+</span><span style='font-size:9.5pt;font-family:Consolas;color:windowtext'> </span><span style='font-size:9.5pt;font-family:Consolas;color:red'>'terminatingsbcaddress='</span><span style='font-size:9.5pt;font-family:Consolas;color:windowtext'> </span><span style='font-size:9.5pt;font-family:Consolas;color:gray'>+</span><span style='font-size:9.5pt;font-family:Consolas;color:windowtext'> </span><span style='font-size:9.5pt;font-family:Consolas;color:teal'>TerminatingSBCAddress</span><span style='font-size:9.5pt;font-family:Consolas;color:windowtext'> </span><span style='font-size:9.5pt;font-family:Consolas;color:gray'>+</span><span style='font-size:9.5pt;font-family:Consolas;color:windowtext'> </span><span style='font-size:9.5pt;font-family:Consolas;color:red'>','</span><span style='font-size:9.5pt;font-family:Consolas;color:windowtext'> </span><span style='font-size:9.5pt;font-family:Consolas;color:gray'>+</span><span style='font-size:9.5pt;font-family:Consolas;color:windowtext'> </span><span style='font-size:9.5pt;font-family:Consolas;color:teal'>Attributes</span><span style='font-size:9.5pt;font-family:Consolas;color:gray'>)</span><span style='font-size:9.5pt;font-family:Consolas;color:windowtext'> </span><span style='font-size:9.5pt;font-family:Consolas;color:blue'>AS</span><span style='font-size:9.5pt;font-family:Consolas;color:windowtext'> </span><span style='font-size:9.5pt;font-family:Consolas;color:teal'>Attributes<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas;color:teal'><o:p> </o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='color:#1F497D'>This gives me the already set attributes for the route, but also adds two additional key value pairs to the column.<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='color:#1F497D'>I should be able to store the values in avp’s right? And access them later in failure_route? The terminatingsbcaddress key stores the address which is used to reset the $du value.<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='color:#1F497D'>The less queries I can perform, the better. <o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>If this is possible, how do I extract the terminatingsbcaddress from this column and store it in an AVP? I’ve never worked with AVP’s before.<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>I know I have to start by doing:<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:9.0pt;font-family:"Courier New";color:windowtext'>$var(attributes) = $dbr(vd_query_result=>[0,0]);<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>If this is not possible, is there a way to insert this piece of SQL into the query the dispatcher executes to load its table, so that the attrs_avp is filled with these additional values?<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>I couldn’t find the SQL which was executed by the dispatcher in the source code.<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'><p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext'>From:</span></b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext'> sr-users-bounces@lists.sip-router.org [mailto:sr-users-bounces@lists.sip-router.org] <b>On Behalf Of </b>Daniel-Constantin Mierla<br><b>Sent:</b> Thursday, September 19, 2013 9:11 PM<br><b>To:</b> Kamailio (SER) - Users Mailing List<br><b>Subject:</b> Re: [SR-Users] dispatcher: set $du in failure_route<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><o:p> </o:p></p><div><p class=MsoNormal>On 9/18/13 4:53 PM, Grant Bagdasarian wrote:<o:p></o:p></p></div><blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><p class=MsoNormal><span style='color:#1F497D'>My Dispatcher table has been extended with more columns and also functions as our routing table.</span><o:p></o:p></p><p class=MsoNormal><span style='color:#1F497D'>I’ve modified the names of the columns Dispatcher uses to match the columns of the routing table. </span><o:p></o:p></p><p class=MsoNormal><span style='color:#1F497D'>One of the columns contains the address which is used to set the $du value. </span><o:p></o:p></p><p class=MsoNormal><span style='color:#1F497D'>So, for every request I’m executing a stored procedure using sqlops to select the address of the SBC (for $du) and the set id to use for the dispatcher.</span><o:p></o:p></p><p class=MsoNormal><span style='color:#1F497D'> </span><o:p></o:p></p><p class=MsoNormal><span style='color:#1F497D'>If I’m correct, the dispatcher table is loaded into memory once Kamailio is started or the table is reloaded.</span><o:p></o:p></p><p class=MsoNormal><span style='color:#1F497D'>In case the first destination fails, how would I get the address of the next SBC to reset the $du value in failure_route? </span><o:p></o:p></p><p class=MsoNormal><span style='color:#1F497D'>I think I can do it using the setid and the next priority, but how do I access these two values in failure_route? </span><o:p></o:p></p><p class=MsoNormal><span style='color:#1F497D'> </span><o:p></o:p></p><p class=MsoNormal><span style='color:#1F497D'>Are there any other solutions to this, perhaps other modules with similar functionality as the dispatcher module?</span><o:p></o:p></p></blockquote><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'><br>The setid and next hop address are stored in AVPs, the names of the avps are set via module parameters. See readme starting at:<br><br><a href="http://kamailio.org/docs/modules/stable/modules/dispatcher.html#idp15216488">http://kamailio.org/docs/modules/stable/modules/dispatcher.html#idp15216488</a><br><br>In failure route, before calling ds_next_*(), the first avps store the values used for next destination. You can probably use them for your db query.<br><br>Cheers,<br>Daniel<br><br><br><o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'> </span><o:p></o:p></p><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'><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"'> <a href="mailto:sr-users-bounces@lists.sip-router.org">sr-users-bounces@lists.sip-router.org</a> [<a href="mailto:sr-users-bounces@lists.sip-router.org">mailto:sr-users-bounces@lists.sip-router.org</a>] <b>On Behalf Of </b>Alex Balashov<br><b>Sent:</b> Wednesday, September 18, 2013 4:23 PM<br><b>To:</b> Kamailio (SER) - Users Mailing List<br><b>Subject:</b> Re: [SR-Users] dispatcher: set $du in failure_route</span><o:p></o:p></p></div></div><p class=MsoNormal> <o:p></o:p></p><p class=MsoNormal style='margin-bottom:12.0pt'><span style='font-size:12.0pt;font-family:"Times New Roman , serif","serif"'>Of course. </span><o:p></o:p></p><div><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman , serif","serif"'>Grant Bagdasarian <<a href="mailto:GB@cm.nl">GB@cm.nl</a>> wrote:</span><o:p></o:p></p><p class=MsoNormal>Hello,<o:p></o:p></p><p> <o:p></o:p></p><p class=MsoNormal>Can the $du value also be set in a failure_route? For instance in the case the first destination fails.<o:p></o:p></p><p> <o:p></o:p></p><p class=MsoNormal>I’m currently setting the $du value before I’m calling the ds_next_domain function in request_route.<o:p></o:p></p><p class=MsoNormal>We have multiple carriers which are connected to different SBCs. <o:p></o:p></p><p> <o:p></o:p></p><p class=MsoNormal>In case $du is not re-set in failure_route, Kamailio will try to send the INVITE to the carrier directly, bypassing the SBC, correct?<o:p></o:p></p><p> <o:p></o:p></p><p class=MsoNormal>Regards,<o:p></o:p></p><p> <o:p></o:p></p><p class=MsoNormal>Grant<o:p></o:p></p><pre style='text-align:center'><hr size=2 width="100%" align=center></pre><pre><o:p> </o:p></pre><pre>SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list<o:p></o:p></pre><pre><a href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a><o:p></o:p></pre><pre><a href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a><o:p></o:p></pre></div><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman , serif","serif"'><br>--<br>Sent from my mobile, and thus lacking in the refinement one might expect from a fully fledged keyboard. <br><br>Alex Balashov - Principal <br>Evariste Systems LLC<br>235 E Ponce de Leon Ave<br>Suite 106<br>Decatur, GA 30030<br>United States<br>Tel: +1-678-954-0671<br>Web: <a href="http://www.evaristesys.com">http://www.evaristesys.com</a>/, <a href="http://www.alexbalashov.com">http://www.alexbalashov.com</a></span><o:p></o:p></p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'><br><br><br><o:p></o:p></span></p><pre>_______________________________________________<o:p></o:p></pre><pre>SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list<o:p></o:p></pre><pre><a href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a><o:p></o:p></pre><pre><a href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a><o:p></o:p></pre><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'><br><br><o:p></o:p></span></p><pre>-- <o:p></o:p></pre><pre>Daniel-Constantin Mierla - <a href="http://www.asipto.com">http://www.asipto.com</a><o:p></o:p></pre><pre><a href="http://twitter.com/#!/miconda">http://twitter.com/#!/miconda</a> - <a href="http://www.linkedin.com/in/miconda">http://www.linkedin.com/in/miconda</a><o:p></o:p></pre><pre>Kamailio Advanced Trainings - Berlin, Oct 21-24; Miami, Nov 11-13, 2013<o:p></o:p></pre><pre>  - more details about Kamailio trainings at <a href="http://www.asipto.com">http://www.asipto.com</a> -<o:p></o:p></pre></div></body></html>