[ previous ] [ next ] [ threads ]
 To :  "Jamie Gordon" <jamie@d...>
 From :  "Ganapathi Chidambaram" <ganapathi.rj@g...>
 Subject :  Re :Re: [yate] Execute Postgresql Query on Ext Module (php )
 Date :  Fri, 06 Oct 2017 21:22:31 +0000
Hi
Please find the mentioned below complete script for the same.
And reason why am not using ,i don't want to create multiple connection and mentioning credentials opened on multiple area. And also i except the Query to logged on log file of yate.
#!/usr/bin/php -q



Hi

Please find the mentioned below complete script for the same.

And reason why am not using ,i don't want to create multiple connection and mentioning credentials opened on multiple area. And also i except the Query to logged on log file of yate.


#!/usr/bin/php -q
<?php
require_once("libyate.php");
Yate::Init();

Yate::Output(true);

Yate::Debug(true);
Yate::SetLocal("trackparam","call_handle.php");

Yate::Install("call.route",80);

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

         if ($ev === true) {
                continue;
            }

        switch ($ev->type) {

           case "incoming":
                         if(check_local($ev->params["caller"]));
                           $ev->params["type"]='int';
                        $ev->Acknowledge();
                break;
        }
}

function check_local_user($num)
{
$m = new Yate("database");
$m->account = "db";
$m->query = "SELECT num from users where num = '$num'";
$m->Dispatch();
if( $m->rows > 0 ) return true;

}

Regards,
Ganapathi


From : Jamie Gordon <jamie@d...>
TO : Yate mailing list <yate@v...>
Sent : Sat, Oct 7, 2017 02:41 AM,
Subject: Re: [yate] Execute Postgresql Query on Ext Module (php )

Hi Ganapathi,
Without seeing the rest of your script, which may explain the reason ...

why not use the standard PHP database tools instead of involving YATE ?
For example PDO ?





On 06/10/2017 21:35, Ganapathi Chidambaram wrote:
Hi

As i am trying to execute the PostgreSQL Query on external script(php) like mentioned below. But it doesn't look like executing as per the flow/logging.

PHP :

$m = new Yate("database");
$m->account = "db";
$m->query = "SELECT num from users where num = '$num'";
$m->Dispatch();
if( $m->rows > 0 ) return true;


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.