<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: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 15 (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:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.msonormal0, li.msonormal0, div.msonormal0
        {mso-style-name:msonormal;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.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>
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal">Yes, something just like that.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">For the algorithm, you’re right that example is in the documentation, but that usage is not actually described as being possible in the documentation. I guess it is declaring a different algorithm for each set provided for the query? Some
 documentation update may be in order there. Apologies for the incorrect response.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span style="color:black">Ben Newlin </span><o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:12.0pt;color:black">From: </span></b><span style="font-size:12.0pt;color:black">Users <users-bounces@lists.opensips.org> on behalf of Алексей Хамстр <homstr@gmail.com><br>
<b>Reply-To: </b>OpenSIPS users mailling list <users@lists.opensips.org><br>
<b>Date: </b>Friday, March 29, 2019 at 8:46 AM<br>
<b>To: </b>OpenSIPS users mailling list <users@lists.opensips.org><br>
<b>Subject: </b>Re: [OpenSIPS-Users] Some questions about module dispatcher.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<div>
<div>
<p class="MsoNormal">Thankyou, Ben, for such quick answer )))<br>
this example <span style="color:black;background:#FEFEEE">ds_select_dst ("part4 : 2,3", "0,1", "fuD M 5, fuS M 2"); </span>is from documentation/ and i thought that somebody had some expirience.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">You mean something like this? I took it from examples generated by "make menuconfig", but there is no any "F" :'-(<br>
i will try. Thankyou ))))<o:p></o:p></p>
<div>
<p class="MsoNormal">---------------------------------------------------------<br>
    if ( !ds_select_dst("1","0") ) {<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">                send_reply("500","No Destination available");<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">                exit;<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">        }<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">        t_on_failure("GW_FAILOVER");<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">        route(RELAY);<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">}<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">route[RELAY] {<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">        if (!t_relay()) {<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">                sl_reply_error();<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">        }<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">        exit;<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">}<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">failure_route[GW_FAILOVER] {<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">        if (t_was_cancelled()) {<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">                exit;<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">        }<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">        # failure detection with redirect to next available trunk<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">        if (t_check_status("(408)|([56][0-9][0-9])")) {<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">                xlog("Failed trunk $rd/$du detected \n");<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">                if ( ds_next_dst() ) {<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">                        t_on_failure("GW_FAILOVER");<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">                        t_relay();<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">                        exit;<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">                }<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">                send_reply("500","All GW are down");<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">        }<o:p></o:p></p>
</div>
</div>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal">пт, 29 мар. 2019 г. в 13:22, Ben Newlin <<a href="mailto:Ben.Newlin@genesys.com">Ben.Newlin@genesys.com</a>>:<o:p></o:p></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Hello,<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">I don’t think the second parameter (algorithm) will accept multiple values as you have. You are indicating that you want to hash over both the call-id and the from uri, which I
 don’t think is possible. You must choose one.<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">For the failover, it is described in the documentation [1]: “If the character 'f' in 'flags' is set, the rest of the addresses from the destination set is stored in AVP list. You
 can use 'ds_next_dst()' to use next address to achieve serial forking to all possible destinations.” So you need to use a failure_route [2] and arm it before you send the request [3]. Then in the failure route you would check the code that was returned [4]
 and if appropriate use ds_next_dst to select another endpoint to try and send the request back out.<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">I cannot answer about the “first_hit_counter, I’ve never looked at that before. I will say that we use the dispatcher module to send a lot of traffic and we have never had to reset
 it or anything, so it is either vary large or the module must handle it.<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">[1] -
<a href="https://opensips.org/html/docs/modules/2.4.x/dispatcher.html#func_ds_select_dst" target="_blank">
https://opensips.org/html/docs/modules/2.4.x/dispatcher.html#func_ds_select_dst</a><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">[2] -
<a href="https://www.opensips.org/Documentation/Script-Routes-2-4" target="_blank">
https://www.opensips.org/Documentation/Script-Routes-2-4</a><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">[3] -
<a href="https://opensips.org/html/docs/modules/2.4.x/tm.html#func_t_on_failure" target="_blank">
https://opensips.org/html/docs/modules/2.4.x/tm.html#func_t_on_failure</a><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">[4] -
<a href="https://opensips.org/html/docs/modules/2.4.x/tm.html#func_t_check_status" target="_blank">
https://opensips.org/html/docs/modules/2.4.x/tm.html#func_t_check_status</a><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="color:black">Ben Newlin
</span><o:p></o:p></p>
</div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><b><span style="font-size:12.0pt;color:black">From:
</span></b><span style="font-size:12.0pt;color:black">Users <<a href="mailto:users-bounces@lists.opensips.org" target="_blank">users-bounces@lists.opensips.org</a>> on behalf of Алексей Хамстр <<a href="mailto:homstr@gmail.com" target="_blank">homstr@gmail.com</a>><br>
<b>Reply-To: </b>OpenSIPS users mailling list <<a href="mailto:users@lists.opensips.org" target="_blank">users@lists.opensips.org</a>><br>
<b>Date: </b>Friday, March 29, 2019 at 8:05 AM<br>
<b>To: </b>"<a href="mailto:users@lists.opensips.org" target="_blank">users@lists.opensips.org</a>" <<a href="mailto:users@lists.opensips.org" target="_blank">users@lists.opensips.org</a>><br>
<b>Subject: </b>[OpenSIPS-Users] Some questions about module dispatcher.</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
</div>
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Hello.<br>
I wanted to ask, if anybody have some extra information about function <br>
<span style="color:black;background:#FEFEEE">ds_select_dst ("part4 : 2,3", "0,1", "fuD M 5, fuS M 2");</span><span style="background:#FEFEEE"><br>
<span style="color:black">Please, any examples will be appreciated. :-)</span></span> <span style="color:black;background:#FEFEEE"><br>
How is this working, when we have such komplex parameters? I need to set up <br>
</span><span style="background:#FEFEEE">failover in case of any error on my "Active" destinations. For example, what if yate1 have  an error in isdn channel and giving me back code 480, or 500? I need to try next  destination in this case. <br>
<span style="color:black">And another one question. How big could be "first_hit_counter</span></span>"?  Maybe i bether sould reset it by cron? <span style="background:#FEFEEE"><br>
<br>
<span style="color:black">lets say, I have a two gateways</span></span><o:p></o:p></p>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="color:black;background:#FEFEEE">        SET:: 1</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="color:black;background:#FEFEEE">                URI:: sip:<a href="http://10.10.128.97:5060" target="_blank">10.10.128.97:5060</a>
 state=Active first_hit_counter=1828</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="color:black;background:#FEFEEE">                URI:: sip:<a href="http://10.10.128.98:5060" target="_blank">10.10.128.98:5060</a>
 state=Active first_hit_counter=1849</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="color:black;background:#FEFEEE">root@sipproxy1:/home/it# opensipsctl dispatcher show</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="color:black;background:#FEFEEE">dispatcher gateways</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="color:black;background:#FEFEEE">+----+-------+------------------------+--------+-------+--------+----------+-------+-----------------------+</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="color:black;background:#FEFEEE">| id | setid | destination            | socket | state | weight | priority | attrs | description           |</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="color:black;background:#FEFEEE">+----+-------+------------------------+--------+-------+--------+----------+-------+-----------------------+</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="color:black;background:#FEFEEE">|  1 |     1 | sip:<a href="http://10.10.128.97:5062" target="_blank">10.10.128.97:5062</a>
 |        |     0 | 0      |        1 |       | YATE1    |</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="color:black;background:#FEFEEE">|  3 |     1 | sip:<a href="http://10.10.128.98:5062" target="_blank">10.10.128.98:5062</a>
 |        |     0 | 0      |        1 |       | YATE2    |</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="color:black;background:#FEFEEE"> </span><o:p></o:p></p>
</div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="background:#FEFEEE">Thankyou!</span><o:p></o:p></p>
</div>
</div>
</div>
</div>
<p class="MsoNormal">_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a><br>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><o:p></o:p></p>
</blockquote>
</div>
</div>
</body>
</html>