About transfer to AGI script

General and Support topics relating to ViciDialNow and GoAutoDial ISO installers

Moderators: enjay, williamconley, Op3r, Staydog, gardo, mflorell, MJCoate, mcargile, Kumba, s0lid

About transfer to AGI script

Postby marship » Tue Sep 06, 2011 12:13 am

Hello.
I am running goautodial-2.1 on my local server. I wrote a php-agi script to collect user's account and password.
The plan is:
1) Agent dial out and talk with customer.
2) when it is time for customer to input their account number.
3) Agent click "transfer" button, then input AGI extension, then "dial with customer". Then agent, customer and agi script will be in same meetme room. in agi script, i mute the agent so customer can input without disturb. After the number is collected, agi simply hang up and unmute the agent. So agent and customer can keep talking.

The problem is, after I click "dial with customer", the AGI script immediately jump in and start run. But on vicidial screen, it is still showing "waiting for ring" and soon time out. Although agent,customer and AGI are already in same room. Agent can't click anything but only can 'hang up both lines'.

Is this a bug?


Thanks.
Regards.
Scott
marship
 
Posts: 11
Joined: Fri Jul 29, 2011 3:33 am

Postby marship » Tue Sep 06, 2011 4:03 am

I followed code and finally into AST_manager_listen.pl, which is used to listen to asterisk event and update database record. Not sure why it didn't update db when call AGI script. Bad event name?
marship
 
Posts: 11
Joined: Fri Jul 29, 2011 3:33 am

Postby williamconley » Tue Sep 06, 2011 6:52 pm

Wow. That's a cool mod.

Show the dialplan you're using, and perhaps a CLI output. Wouldn't hurt to post the agi script as well.

Did you "Answer"? the call on the first line of your exten for the addition of the agi script?

Did you "pause" recording during this process? (What a beautiful mod this could be ...). And did you post the mod (or will you soon) to the Issue Tracker as a diff/patch for inclusion so Matt can add it to the project? 8-)
Vicidial Installation and Repair, plus Hosting and Colocation
Newest Product: Vicidial Agent Only Beep - Beta
http://www.PoundTeam.com # 352-269-0000 # +44(203) 769-2294
williamconley
 
Posts: 20258
Joined: Wed Oct 31, 2007 4:17 pm
Location: Davenport, FL (By Disney!)

Postby marship » Tue Sep 06, 2011 8:38 pm

Hello. Thanks for replying.

Here is my dailplan.

exten => _7788XXXXXX,1,Answer()
exten => _7788XXXXXX,n,AGI(dtmf.php)


the number is 7788 followed 6 digits, 6 digits is our table's id. We will use that to update db in agi script
Here is dtmf.php

Code: Select all
#!/usr/bin/php -q
<?php
  const ZUUP_URL = "https://192.168.3.100/admin/save_creditcard.ashx";
  const SECRET = "7zekCd8JVwYeSNw";
  set_time_limit(30);
  require('phpagi.php');
  error_reporting(E_ALL);

  $agi = new AGI();
  $agi->answer();
  $cid = $agi->parse_callerid();
  var_dump($cid);
  $agi->text2wav("Hello, {$cid['name']}.  Let's enter some text.");

  //mute agent
  $agi->evaluate('meetme mute 8600051 01');

  $callee = $agi->request['agi_dnid'];
  $userId = substr($callee,4);
$agi->text2wav("user id is $userid");
function get_creditcard_info()
{
  global $agi;
  do{
          $agi->text2wav("Please input your credit card number then press the pound key.");
          $result = $agi->get_data('beep', 60000, 20);
          $ccNumber = $result['result'];
          $agi->text2wav("Please input your CSV code then press the pound key.");
          $result = $agi->get_data('beep', 3000, 20);
          $csv = $result['result'];
          do{
                $agi->text2wav("Your credit card number is ");
                $agi->say_digits($ccNumber);
                $agi->text2wav("Your csv code is ");
                $agi->say_digits($csv);
                $agi->text2wav("Confirm please press 1, re-input please press 2, go back to agent please press 0.");
                $result = $agi->get_data('beep', 3000, 20);
                if($result['result'] != "1" && $result['result'] != "0" && $result['result'] !="2"){
                        $agi->text2wav("Incorrect input, please try again.");
                        continue;
                }
                break;
          }while(true);
          if($result['result'] == "1")
          {
                //Save data, do online verification
                $agi->text2wav("Save data. Do online verification now.");
                //$ret = PostToServer("4", "421234124124234", "232", "02", "13");
                //$agi->exec_goto('default|8600051|1');
                break;
          }else if($result['result'] == "2")
          {
                continue;
                break;
          }else if($result['result'] == "0")
          {
                //redirect back to agent
                $agi->text2wav("We're redirecting you back to agent, please standby.");
                break;
          }
  }while(true);
}


function PostToServer($id, $card_number, $csv, $month, $year)
{
        require_once 'HTTP/Request2.php';
        $request = new HTTP_Request2(ZUUP_URL, HTTP_Request2::METHOD_POST);
        $request->setConfig(array(
                'ssl_verify_peer' => false
        ));
        $request->addPostParameter("Secret", SECRET);
        $request->addPostParameter("id", $id);
        $request->addPostParameter("card_number", $card_number);
        $request->addPostParameter("csv", $csv);
        $request->addPostParameter("month", $month);
        $request->addPostParameter("year", $year);
        try {
                $response = $request->send();
                $data = $response->getBody();
                var_dump($data);
                if (200 == $response->getStatus()) {
                        $data = $response->getBody();
                        return $data;
                } else {
                        return -1;
                }
        } catch (HTTP_Request2_Exception $e) {
                echo $e->getMessage();
                return 1;
        }
}
  get_creditcard_info();
  //$ret = PostToServer("4", "421234124124234", "232", "02", "13");
  //echo "ret is $ret";
  $agi->text2wav('Goodbye');
  $agi->hangup();

?>


I'm not sure how to pause recording. Neither know where to post the mod(Sorry. What does the mod mean actually?) It is just we need this function so I am using what I can do to add this feature.
Please check and help.

Thanks
Regards.
Scott
marship
 
Posts: 11
Joined: Fri Jul 29, 2011 3:33 am

Postby williamconley » Tue Sep 06, 2011 8:47 pm

a brilliant beginning and a concept that should (in the end) work. what you need to do is try dialing that number (7788...) yourself with noone else on the system and watch your console debug and console agi debug to see what happens.

i'd even suggest pulling it out one function at a time to verify each piece of your puzzle works (instead of the whole kit and kaboodle at once). you'll find problems and working parts and be able to borrow from other agi scripts in the system to fix holes.

brilliant.
Vicidial Installation and Repair, plus Hosting and Colocation
Newest Product: Vicidial Agent Only Beep - Beta
http://www.PoundTeam.com # 352-269-0000 # +44(203) 769-2294
williamconley
 
Posts: 20258
Joined: Wed Oct 31, 2007 4:17 pm
Location: Davenport, FL (By Disney!)

Postby marship » Wed Sep 07, 2011 3:59 pm

Hello. williamconley.

I have implemented the AGI script as I need. I add an extra button on vicidial.php to call the basic_originate_call directly. So don't use the vicidial web buttons. Although at last vicidial will popup me "dial timeout" but these buttons are still working.

The problem is when I upload to our live server. I found my script is not working any more. After look into it, I found the difference between my local test server and live server is live server record every call. But my local server doesn't.
So on live server, there are already and existing AGI script named "recording" running there. And I see a meeting room, one channel for customer. I tried to dial my AGI script, it beep and on asterisk cli , it show some debug info when calling my AGI, but nothing speak out in meetme room. When I use 'meetme list 860051" to show channels in meetme room. mine is not there. why?

So I recall you mentioned "did you pause the recording" when you replied for first time? Why should I pause the recording? If I pause the recording, I believe my script will work. But is there a way without pause recording, my script can work as well?


Thanks.
Regards.
Scott
marship
 
Posts: 11
Joined: Fri Jul 29, 2011 3:33 am

Postby williamconley » Wed Sep 07, 2011 7:28 pm

i'd have to get a lot deeper to troubleshoot it, of course.

but to answer your question, i was not guessing that recording would pose an issue, i was referring to the fact that pausing the recording is a requirement for pci compliance (so the cc# is not recorded on the audio file, which means the audio file can be stored).

so the reason i asked about pausing the recording is because that is likely to be the point that makes this feature you are building unique and extremely useful.

properly set up, the agi script could validate the cc# and charge the card without storing the number anywhere on the server (including the audio recording) and then store a REFERENCE NUMBER returned from the merchant account in the client record for future use of the card (for capture and void).

that would be a powerful addition to vicidial.

(of course, you'd also have to destroy or turn off logging to avoid capturing the dtmf tones ...?)
Vicidial Installation and Repair, plus Hosting and Colocation
Newest Product: Vicidial Agent Only Beep - Beta
http://www.PoundTeam.com # 352-269-0000 # +44(203) 769-2294
williamconley
 
Posts: 20258
Joined: Wed Oct 31, 2007 4:17 pm
Location: Davenport, FL (By Disney!)

Postby marship » Fri Sep 09, 2011 3:08 am

Hello.
I did more test and realize the recording is not the problem. I tried to call AGI several time, apparently multiple AGI channels can talk in same meetme room. On live server it is not and I see it only supports 3. I remember another difference. My test server is a PC with x100p PCI card installed. The live server is a notebook using ztdummy driver. That maybe the cause. I will do more test.

thanks
marship
 
Posts: 11
Joined: Fri Jul 29, 2011 3:33 am


Return to ViciDialNow - GoAutoDial

Who is online

Users browsing this forum: Majestic-12 [Bot] and 71 guests