Use a variable then :)

$avp(grp) = 3;

do_routing("$avp(grp)");

Regards,

Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
http://www.opensips-solutions.com

On 28.09.2015 15:31, Sasmita Panda wrote:
Hi Andrei,

Yes , I know the do_routing() reflects the routing groups . But in my case its not fixed . 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 .
But I dont want to fix this parameter .

Please have a look into the bellow tables :


mysql> select * from dr_rules;
+--------+---------+--------+---------+----------+---------+--------+-------+---------------+
| ruleid | groupid | prefix | timerec | priority | routeid | gwlist | attrs | description |
+--------+---------+--------+---------+----------+---------+--------+-------+---------------+
| 13 | 3 | | | 0 | NULL | 3 | NULL | My Number | | 12 | 2 | | | 0 | NULL | 2 | NULL | My 2nd Number |
+--------+---------+--------+---------+----------+---------+--------+-------+---------------+

mysql> select * from dr_groups;
+----+----------+--------------------------+---------+-------------+
| id | username | domain | groupid | description |
+----+----------+--------------------------+---------+-------------+
|  3 | .*             | .*@mongodb5-sasmita.com.* | 2 | Outbound    |

|  4 | .*             | .*@mongodb6-sasmita.com.* | 3 | Outbound    |
+----+----------+--------------------------+---------+-------------+

mysql> select * from dr_gateways;
+----+------+------+-------------------+-------+------------+-------+------------+-------+--------+-------------+
| id | gwid | type | address | strip | pri_prefix | attrs | probe_mode | state | socket | description |

| 4 | 2 | 0 | 192.168.1.17:9900 <http://192.168.1.17:9900> | 0 | NULL | NULL | 0 | 0 | NULL | Freeswitch1 | | 5 | 3 | 1 | 192.168.1.17:7700 <http://192.168.1.17:7700> | 0 | NULL | NULL | 0 | 0 | NULL | Freeswitch2 |
+----+------+------+-------------------+-------+------------+-------+------------+-------+--------+-------------+


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
groupid:3  then route it to the gwlist:3 .

    In this case how I will do the routing in my script ?


*/Thanks & Regards/*
/Sasmita Panda/
/Network Testing and Software Engineer/
/3CLogic , ph:07827611765/

On Mon, Sep 28, 2015 at 4:47 PM, Bogdan-Andrei Iancu <[email protected] <mailto:[email protected]>> wrote:

    Hi Sasmita,

    The param of do_routing() has to reflct the routing group you want
    to use (the groupid in the dr_rules table) .

    Regards,

    Bogdan-Andrei Iancu
    OpenSIPS Founder and Developer
    http://www.opensips-solutions.com

    On 28.09.2015 13:26, Sasmita Panda wrote:
    Hi All ,

        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 ?

        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 .


        So please help me how will I do this ? Any kind of suggestion
    is welcome .

    */Thanks & Regards/*
    /Sasmita Panda/
    /Network Testing and Software Engineer/
    /3CLogic , ph:07827611765/

    On Fri, Sep 25, 2015 at 7:08 PM, Sasmita Panda
    <[email protected] <mailto:[email protected]>> wrote:



        Hi All ,


            I am trying to use dynamic routing in opensips-1.11 .
         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 .
          In side my script , I have added do_routing(group_id) . Its
        working for me .

            Now I have multiple groups and for each group the gateway
        is different .
        like : group1 : gr_id:1 , domain : 1.1.1.1:5506
        <http://1.1.1.1:5506>
                group2 : gr_id2 . domain : 2.2.2.2:5506
        <http://2.2.2.2:5506>
           gatw1 : domain:x.x.x.x:5506 , gw_type:1 , gr_id:1
        gatw2 : domain:x.x.x.y:5506 , gw_type:1 , gr_id:2

             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 ?

        Please help. Thank you in advance .



        */Thanks & Regards/*
        /Sasmita Panda/
        /Network Testing and Software Engineer/
        /3CLogic , ph:07827611765/




    _______________________________________________
    Users mailing list
    [email protected]  <mailto:[email protected]>
    http://lists.opensips.org/cgi-bin/mailman/listinfo/users



_______________________________________________
Users mailing list
[email protected]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

Reply via email to