[ previous ] [ next ] [ threads ]
 To :  "Jamie Gordon" <jamie@d...>
 From :  "Ganapathi Chidambaram" <ganapathi.rj@g...>
 Subject :  Re :Re[3]: [yate] [ YATE 6.0 ] Routing call using PgSQL Storedfunction
 Date :  Sat, 30 Sep 2017 18:52:43 +0000
Hi 
As i tried the same but am getting error as Unaccepted on SIP channel when i called the SIP by using attached script.
require_once("libyate.php");
Yate::Init();
Yate::Output(true);
Yate::Debug(true);

Yate::SetLocal("trackparam","inbound_handle.php");
Yate::Install("call.route",80);
for (;;) {
    $ev=Yate::GetEvent();
         if ($ev === false)
                break;
         if ($ev === true) {

                continue;

            }
        switch ($ev->type) {
           case "incoming":
                $ev->retval = "fork";

                $ev->params["callto.1"] = 'sip/sip:49781807@1...:5060';
                $ev->params["callto.1.timeout"]  = "3000";

                $ev->handled = true;
                $ev->Acknowledge();
                break;

         case "answer":
            Yate::Output("PHP Answered: " . $ev->name . " id: " . $ev->id);
            break;
        case "installed":
            Yate::Output("PHP Installed: " . $ev->name);
            break;
        case "uninstalled":
            Yate::Output("PHP Uninstalled: " . $ev->name);
            break;
        default:
            Yate::Output("PHP Event: " . $ev->type);
        }
}
And for accessing the database as i need to initiate the another DB connection for get the results from database or i can use existing yate DB connection?
Regards,
Ganapathi
From : Jamie Gordon  
 TO : Ganapathi Chidambaram  
 CC: Yate mailing list 
 Sent : Sat, Sep 30, 2017 08:49 PM, 
Subject: Re: Re :Re: [yate] [ YATE 6.0 ] Routing call using PgSQL Stored function 

 there's a sample script in that post, but you'd need to have a read about setting up external modules / scripts first.
 Here's a good place to start:

 http://docs.yate.ro/wiki/External_Module (http://docs.yate.ro/wiki/External_Module)
 From memory, Windows is (or was) not as straightforward as Linux when using external scripts, they had to be global, not channel based.

 but ... if it's simple forking, the location parameter can handle this.
On 30/09/2017 16:07, Ganapathi Chidambaram wrote:
  Yes. I already read that forum post. Even though i have doubt to implement the same. Is there any sample to integrate external module.  
As of now i didn't integrated /started external module on this.
 Regards, 
Ganapathi 
From : Jamie Gordon  (mailto:jamie@d...) 
 TO : Ganapathi Chidambaram  (mailto:ganapathi.rj@g...), Yate mailing list  (mailto:yate@v...) 
 Sent : Sat, Sep 30, 2017 08:29 PM, 
 Subject: Re: [yate] [ YATE 6.0 ] Routing call using PgSQL Stored function 
  actually ... reading my post again, as long as you're not mixing direct locations and the nee to use lines, you can do the following:
 set the field location to eg:
 fork sip/sip:testuser1@1... (mailto:sip/sip:testuser1@1...) sip/sip:testuser2@1... (mailto:sip/sip:testuser2@1...)
 so, return 1 row, but with the multiple fork targets set as above

 but again, it's hard to include complex extra parameters, as far as i know. So an external script maybe the netter way to go.
On 30/09/2017 13:43, Ganapathi Chidambaram wrote:
  Hi 
As i used pgsql stored function to route a call to user/group. Whereas i am getting result properly but even though calls are not routing to the user . 
find the below mentioned configuration for the same. 
register.conf 
query=SELECT * FROM route_master('${billid}','${called}','${trace}'); 
result=location 

 Output of PgSQL: 
field value 
trace 4444407 
callto.1 sip/sip:4444407@1...:5060 (mailto:sip/sip:4444407@1...:5060) 
dtmfpass false 
location fork 
pbxassist true 
copyparams pbxassist,dtmfpass 
tonedetect_out true 
callto.1.secure yes  
Logs : 
 Query for 'db.1' returned 8 rows, 8 affected [0xcbd510] 
Returned true 'database' delay=0.230988 
  thread=0x7f6e54002c10 'Call Router' 
  data=0x7f6e4c006200 
  retval='(null)' 
  param['account'] = 'technobureau_db' 
  param['query'] = 'SELECT * FROM route_master('1506767265-8','4444407','');' 
  param['results'] = 'true' 
  param['handlers'] = 'pgsqldb:100' 
  param['columns'] = '2' 
  param['rows'] = '8' 
  param['affected'] = '8' 
  param['dbtype'] = 'pgsqldb' 
2017-09-30_17:34:43.806147  Skipping void route #2 
2017-09-30_17:34:43.806158  Skipping void route #3 
2017-09-30_17:34:43.806172  Skipping void route #4 
2017-09-30_17:34:43.806182  Skipping void route #5 
2017-09-30_17:34:43.806192  Skipping void route #6 
2017-09-30_17:34:43.806202  Skipping void route #7 
2017-09-30_17:34:43.806211  Skipping void route #8 
Call.cdr : 
Status :hangup 
Reason : Offline 
 But actually user logged-in. 
 Kindly help me out. 
 Regards, 
Ganapathi 
	-- Jamie Gordon Office: +44 (0)330 3310810 Mobile: +44 (0)781 7639737 http://www.digitallines.net (http://www.digitallines.net) Digital Lines Limited's registered office is Snappers, Church Road, Rudgeway, Bristol BS35 3SH. Registered in England, number 05293518 *************************************************************************************************************** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager.      
	-- Jamie Gordon Office: +44 (0)330 3310810 Mobile: +44 (0)781 7639737 http://www.digitallines.net (http://www.digitallines.net) Digital Lines Limited's registered office is Snappers, Church Road, Rudgeway, Bristol BS35 3SH. Registered in England, number 05293518 *************************************************************************************************************** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager.



Hi 

As i tried the same but am getting error as Unaccepted on SIP channel when i called the SIP by using attached script.


require_once("libyate.php");
Yate::Init();
Yate::Output(true);
Yate::Debug(true);
Yate::SetLocal("trackparam","inbound_handle.php");
Yate::Install("call.route",80);

for (;;) {
    $ev=Yate::GetEvent();
         if ($ev === false)
                break;
         if ($ev === true) {
                continue;
            }

        switch ($ev->type) {

           case "incoming":
                $ev->retval = "fork";
                $ev->params["callto.1"] = 'sip/sip:49781807@1...:5060';
                $ev->params["callto.1.timeout"]  = "3000";
                $ev->handled = true;
                $ev->Acknowledge();
                break;
         case "answer":
            Yate::Output("PHP Answered: " . $ev->name . " id: " . $ev->id);
            break;
        case "installed":
            Yate::Output("PHP Installed: " . $ev->name);
            break;
        case "uninstalled":
            Yate::Output("PHP Uninstalled: " . $ev->name);
            break;
        default:
            Yate::Output("PHP Event: " . $ev->type);
        }
}


And for accessing the database as i need to initiate the another DB connection for get the results from database or i can use existing yate DB connection?

Regards,
Ganapathi



From : Jamie Gordon <jamie@d...>
TO : Ganapathi Chidambaram <ganapathi.rj@g...>
CC: Yate mailing list <yate@v...>
Sent : Sat, Sep 30, 2017 08:49 PM,
Subject: Re: Re :Re: [yate] [ YATE 6.0 ] Routing call using PgSQL Stored function

there's a sample script in that post, but you'd need to have a read about setting up external modules / scripts first.
Here's a good place to start:

http://docs.yate.ro/wiki/External_Module
From memory, Windows is (or was) not as straightforward as Linux when using external scripts, they had to be global, not channel based.

but ... if it's simple forking, the location parameter can handle this.



On 30/09/2017 16:07, Ganapathi Chidambaram wrote:
Yes. I already read that forum post. Even though i have doubt to implement the same. Is there any sample to integrate external module. 

As of now i didn't integrated /started external module on this.


Regards,
Ganapathi



From : Jamie Gordon <jamie@d...>
TO : Ganapathi Chidambaram <ganapathi.rj@g...>, Yate mailing list <yate@v...>
Sent : Sat, Sep 30, 2017 08:29 PM,
Subject: Re: [yate] [ YATE 6.0 ] Routing call using PgSQL Stored function

actually ... reading my post again, as long as you're not mixing direct locations and the nee to use lines, you can do the following:
set the field location to eg:
fork sip/sip:testuser1@1... sip/sip:testuser2@1...
so, return 1 row, but with the multiple fork targets set as above

but again, it's hard to include complex extra parameters, as far as i know. So an external script maybe the netter way to go.






On 30/09/2017 13:43, Ganapathi Chidambaram wrote:
Hi

As i used pgsql stored function to route a call to user/group. Whereas i am getting result properly but even though calls are not routing to the user .

find the below mentioned configuration for the same.

register.conf

query=SELECT * FROM route_master('${billid}','${called}','${trace}');
result=location

Output of PgSQL:

field value
trace 4444407
dtmfpass false
location fork
pbxassist true
copyparams pbxassist,dtmfpass
tonedetect_out true
callto.1.secure yes

Logs :

<pgsqldb:ALL> Query for 'db.1' returned 8 rows, 8 affected [0xcbd510]
Returned true 'database' delay=0.230988
  thread=0x7f6e54002c10 'Call Router'
  data=0x7f6e4c006200
  retval='(null)'
  param['account'] = 'technobureau_db'
  param['query'] = 'SELECT * FROM route_master('1506767265-8','4444407','');'
  param['results'] = 'true'
  param['handlers'] = 'pgsqldb:100'
  param['columns'] = '2'
  param['rows'] = '8'
  param['affected'] = '8'
  param['dbtype'] = 'pgsqldb'
2017-09-30_17:34:43.806147 <register:WARN> Skipping void route #2
2017-09-30_17:34:43.806158 <register:WARN> Skipping void route #3
2017-09-30_17:34:43.806172 <register:WARN> Skipping void route #4
2017-09-30_17:34:43.806182 <register:WARN> Skipping void route #5
2017-09-30_17:34:43.806192 <register:WARN> Skipping void route #6
2017-09-30_17:34:43.806202 <register:WARN> Skipping void route #7
2017-09-30_17:34:43.806211 <register:WARN> Skipping void route #8

Call.cdr :

Status :hangup
Reason : Offline

But actually user logged-in.

Kindly help me out.

Regards,
Ganapathi



-- 


Jamie Gordon

Office: +44 (0)330 3310810
Mobile: +44 (0)781 7639737
http://www.digitallines.net



Digital Lines Limited's registered office is Snappers, Church Road, Rudgeway, Bristol BS35 3SH. Registered in England, number 05293518

***************************************************************************************************************
This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify the system manager.

-- 


Jamie Gordon

Office: +44 (0)330 3310810
Mobile: +44 (0)781 7639737
http://www.digitallines.net



Digital Lines Limited's registered office is Snappers, Church Road, Rudgeway, Bristol BS35 3SH. Registered in England, number 05293518

***************************************************************************************************************
This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify the system manager.