<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <tt>That "3" you can load it from DB (via avp_db_query()) or you can
      get it from user profile (load_credentials) or it can be the
      result of a translation (dp_translate based on SIP domain).<br>
      <br>
      It is up to you where you get the value from - the important part
      is that you can pass it via a variable to do_routing().<br>
      <br>
      Regards,<br>
    </tt>
    <pre class="moz-signature" cols="72">Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
<a class="moz-txt-link-freetext" href="http://www.opensips-solutions.com">http://www.opensips-solutions.com</a></pre>
    <div class="moz-cite-prefix">On 28.09.2015 15:43, Sasmita Panda
      wrote:<br>
    </div>
    <blockquote
cite="mid:CALf-Q441A9dahay2H2Ftdj2VFbAVVaNt3BKD_vVEJ9w7VdCn-Q@mail.gmail.com"
      type="cite">
      <div dir="ltr">This is also give a fixed value 3 in do_routing() .
        I think so .  I want my do_routing() , parameter should be
        flexible . It should be decided on the basis of the domain of
        the group . Is this possible ?</div>
      <div class="gmail_extra"><br clear="all">
        <div>
          <div class="gmail_signature">
            <div dir="ltr"><b><i>Thanks &amp; Regards</i></b>
              <div><i>Sasmita Panda</i></div>
              <div><i>Network Testing and Software Engineer</i></div>
              <div><i>3CLogic , ph:07827611765</i></div>
            </div>
          </div>
        </div>
        <br>
        <div class="gmail_quote">On Mon, Sep 28, 2015 at 6:03 PM,
          Bogdan-Andrei Iancu <span dir="ltr">&lt;<a
              moz-do-not-send="true" href="mailto:bogdan@opensips.org"
              target="_blank">bogdan@opensips.org</a>&gt;</span> wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div text="#000000" bgcolor="#FFFFFF"> <tt>Use a variable
                then :)<br>
                <br>
                $avp(grp) = 3;<br>
                <br>
                do_routing("$avp(grp)");<br>
                <br>
                Regards,<br>
              </tt><span class="">
                <pre cols="72">Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
<a moz-do-not-send="true" href="http://www.opensips-solutions.com" target="_blank">http://www.opensips-solutions.com</a></pre>
              </span>
              <div>
                <div class="h5">
                  <div>On 28.09.2015 15:31, Sasmita Panda wrote:<br>
                  </div>
                  <blockquote type="cite">
                    <div dir="ltr">Hi Andrei, 
                      <div><br>
                      </div>
                      <div>    Yes , I know the do_routing() reflects
                        the routing groups . But in my case its not
                        fixed .</div>
                      <div>If i am doing  "do_routing("2")"  then it
                        only point to the group_id :2 of the dr_groups
                        table and do the perform the task .</div>
                      <div>But I dont want to fix this parameter .</div>
                      <div><br>
                      </div>
                      <div>Please have a look into the bellow tables :</div>
                      <div><br>
                      </div>
                      <div><br>
                      </div>
                      <div>
                        <div>mysql&gt; select * from dr_rules;</div>
                        <div>+--------+---------+--------+---------+----------+---------+--------+-------+---------------+</div>
                        <div>| ruleid | groupid | prefix | timerec |
                          priority | routeid | gwlist | attrs   |
                          description   |</div>
                        <div>+--------+---------+--------+---------+----------+---------+--------+-------+---------------+</div>
                        <div>|     13 | 3         |           |        
                          |        0    | NULL       | 3      | NULL  |
                          My Number     |</div>
                        <div>|     12 | 2         |           |        
                          |        0     | NULL      | 2     | NULL  |
                          My 2nd Number |</div>
                        <div>+--------+---------+--------+---------+----------+---------+--------+-------+---------------+</div>
                        <div><br>
                        </div>
                        <div>mysql&gt; select * from dr_groups;</div>
                        <div>+----+----------+--------------------------+---------+-------------+</div>
                        <div>| id | username | domain                  
                                        | groupid | description |</div>
                        <div>+----+----------+--------------------------+---------+-------------+</div>
                        <div>|  3 | .*             |
                          .*@mongodb5-sasmita.com.* |       2 | Outbound
                             |</div>
                        <div><br>
                        </div>
                      </div>
                      <div>
                        <div>|  4 | .*             |
                          .*@mongodb6-sasmita.com.* |       3 | Outbound
                             |</div>
                        <div>+----+----------+--------------------------+---------+-------------+</div>
                      </div>
                      <div><br>
                      </div>
                      <div>mysql&gt; select * from dr_gateways;<br>
                      </div>
                      <div>
                        <div>+----+------+------+-------------------+-------+------------+-------+------------+-------+--------+-------------+</div>
                        <div>| id | gwid | type | address              
                          | strip | pri_prefix | attrs   | probe_mode |
                          state | socket | description |</div>
                      </div>
                      <div><br>
                      </div>
                      <div>
                        <div>|  4 | 2    |    0   | <a
                            moz-do-not-send="true"
                            href="http://192.168.1.17:9900"
                            target="_blank">192.168.1.17:9900</a> |    
                          0 | NULL       | NULL  |          0       |  
                            0 | NULL   | Freeswitch1 |</div>
                        <div>|  5 | 3    |    1   | <a
                            moz-do-not-send="true"
                            href="http://192.168.1.17:7700"
                            target="_blank">192.168.1.17:7700</a> |    
                          0 | NULL       | NULL  |          0       |  
                            0 | NULL   | Freeswitch2 |</div>
                        <div>+----+------+------+-------------------+-------+------------+-------+------------+-------+--------+-------------+</div>
                      </div>
                      <div><br>
                      </div>
                      <div><br>
                      </div>
                      <div>This is my table . Now what I want is if call
                        comes from groupid:2  then route it to the
                        gwlist:2 , if its coming form </div>
                      <div>groupid:3  then route it to the gwlist:3 .<br>
                      </div>
                      <div><br>
                      </div>
                      <div>    In this case how I will do the routing in
                        my script ? </div>
                      <div><br>
                      </div>
                    </div>
                    <div class="gmail_extra"><br clear="all">
                      <div>
                        <div>
                          <div dir="ltr"><b><i>Thanks &amp; Regards</i></b>
                            <div><i>Sasmita Panda</i></div>
                            <div><i>Network Testing and Software
                                Engineer</i></div>
                            <div><i>3CLogic , ph:07827611765</i></div>
                          </div>
                        </div>
                      </div>
                      <br>
                      <div class="gmail_quote">On Mon, Sep 28, 2015 at
                        4:47 PM, Bogdan-Andrei Iancu <span dir="ltr">&lt;<a
                            moz-do-not-send="true"
                            href="mailto:bogdan@opensips.org"
                            target="_blank">bogdan@opensips.org</a>&gt;</span>
                        wrote:<br>
                        <blockquote class="gmail_quote" style="margin:0
                          0 0 .8ex;border-left:1px #ccc
                          solid;padding-left:1ex">
                          <div text="#000000" bgcolor="#FFFFFF"> <tt>Hi
                              Sasmita,<br>
                              <br>
                              The param of do_routing() has to reflct
                              the routing group you want to use (the
                              groupid in the dr_rules table) .<br>
                              <br>
                              Regards,<br>
                            </tt>
                            <pre cols="72">Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
<a moz-do-not-send="true" href="http://www.opensips-solutions.com" target="_blank">http://www.opensips-solutions.com</a></pre>
                            <div>
                              <div>
                                <div>On 28.09.2015 13:26, Sasmita Panda
                                  wrote:<br>
                                </div>
                              </div>
                            </div>
                            <blockquote type="cite">
                              <div>
                                <div>
                                  <div dir="ltr">Hi All ,
                                    <div><br>
                                    </div>
                                    <div>    I mean to say , when there
                                      is more that one group and for
                                      each group there is different
                                      gateways then how I will set the
                                      do_routing parameter inside my
                                      script ? </div>
                                    <div><br>
                                    </div>
                                    <div>    If I have a single group
                                      then I am setting it as
                                      do_routing("1") . But for
                                      different groups this logic wont
                                      work . I don't want to add if...
                                      else loop for this . I don't want
                                      to change my config file every
                                      time I add an new group and its
                                      corresponding gateway . </div>
                                    <div><br>
                                    </div>
                                    <div><br>
                                    </div>
                                    <div>    So please help me how will
                                      I do this ? Any kind of suggestion
                                      is welcome .</div>
                                  </div>
                                  <div class="gmail_extra"><br
                                      clear="all">
                                    <div>
                                      <div>
                                        <div dir="ltr"><b><i>Thanks
                                              &amp; Regards</i></b>
                                          <div><i>Sasmita Panda</i></div>
                                          <div><i>Network Testing and
                                              Software Engineer</i></div>
                                          <div><i>3CLogic ,
                                              ph:07827611765</i></div>
                                        </div>
                                      </div>
                                    </div>
                                    <br>
                                    <div class="gmail_quote">On Fri, Sep
                                      25, 2015 at 7:08 PM, Sasmita Panda
                                      <span dir="ltr">&lt;<a
                                          moz-do-not-send="true"
                                          href="mailto:spanda@3clogic.com"
                                          target="_blank">spanda@3clogic.com</a>&gt;</span>
                                      wrote:<br>
                                      <blockquote class="gmail_quote"
                                        style="margin:0 0 0
                                        .8ex;border-left:1px #ccc
                                        solid;padding-left:1ex">
                                        <div dir="ltr">
                                          <div><br>
                                          </div>
                                          <div><br>
                                          </div>
                                          Hi All ,
                                          <div><br>
                                          </div>
                                          <div><br>
                                          </div>
                                          <div>    I am trying to use
                                            dynamic routing in
                                            opensips-1.11 .</div>
                                          <div> I have just done an
                                            single outbound call . I
                                            have added a group
                                            corresponding to  outbound
                                            domain then i had define a
                                            gate way corresponding to
                                            the group id . </div>
                                          <div>  In side my script , I
                                            have added
                                            do_routing(group_id) . Its
                                            working for me .</div>
                                          <div><br>
                                          </div>
                                          <div>    Now I have multiple
                                            groups and for each group
                                            the gateway is different .</div>
                                          <div>like : group1 : gr_id:1 ,
                                            domain : <a
                                              moz-do-not-send="true"
                                              href="http://1.1.1.1:5506"
                                              target="_blank">1.1.1.1:5506</a></div>
                                          <div>        group2 : gr_id2 .
                                            domain : <a
                                              moz-do-not-send="true"
                                              href="http://2.2.2.2:5506"
                                              target="_blank">2.2.2.2:5506</a></div>
                                          <div>   gatw1 :
                                            domain:x.x.x.x:5506 ,
                                            gw_type:1 , gr_id:1</div>
                                          <div>gatw2 :
                                            domain:x.x.x.y:5506 ,
                                            gw_type:1 , gr_id:2<br>
                                          </div>
                                          <div><br>
                                          </div>
                                          <div>     Now , I can add this
                                            in the table . but how will
                                            I define it in the script so
                                            that for different group
                                            different gateway will get
                                            selected and the call get
                                            routed ?</div>
                                          <div><br>
                                          </div>
                                          <div>Please help. Thank you in
                                            advance .</div>
                                          <div> </div>
                                          <div><br>
                                          </div>
                                          <div>    </div>
                                          <div><br>
                                          </div>
                                          <div><br clear="all">
                                            <div>
                                              <div>
                                                <div dir="ltr"><b><i>Thanks
                                                      &amp; Regards</i></b><span><font
                                                      color="#888888">
                                                      <div><i>Sasmita
                                                          Panda</i></div>
                                                      <div><i>Network
                                                          Testing and
                                                          Software
                                                          Engineer</i></div>
                                                      <div><i>3CLogic ,
                                                          ph:07827611765</i></div>
                                                    </font></span></div>
                                              </div>
                                            </div>
                                          </div>
                                        </div>
                                      </blockquote>
                                    </div>
                                    <br>
                                  </div>
                                  <br>
                                  <fieldset></fieldset>
                                  <br>
                                </div>
                              </div>
                              <pre>_______________________________________________
Users mailing list
<a moz-do-not-send="true" href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a>
<a moz-do-not-send="true" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
                            </blockquote>
                            <br>
                          </div>
                        </blockquote>
                      </div>
                      <br>
                    </div>
                  </blockquote>
                  <br>
                </div>
              </div>
            </div>
          </blockquote>
        </div>
        <br>
      </div>
    </blockquote>
    <br>
  </body>
</html>