Send popup or email to the queue agents about the DTMFs information

hi Guys,

I have come across a difficulty where I have a requirement to send the DTMFs pressed by the caller will be send instantaneously to the Agent so that when he picks up the call he know that the caller is looking for which particular information.

e.g in my case: key 1 for patient --> patient sub menu --> key 1 Existing patient and key 2 New patient --> more options.

now when caller reached the agent, the agent have all the options the caller pressed and he can smartly assist the caller.

i would consider using CID prefix’s in either the ring groups or queues you send those calls to when selected … should just work with no customization needed

I am already using CallerID prefixes but it’s like for example I have a number 12312312313 dedicated and 4 queues. no when call comes to 1 queue it will show my agent queue 1-12312312313.

so this is already implemented but it’s different than what I want now.

I want to have the DTMFs pressed and send to the agent before the call route to him and he know that what is caller actually looking for

So the Actual requirement is to read the DTMFs and store them to the Database.

how is this possible ?

hi

I have started to test an agi script but it’s not executing. please check for errors and mistakes.

getdtmf.php: Failed to execute '/var/lib/asterisk/agi-bin/getdtmf.php': Exec format error
[2020-10-12 16:15:12] ERROR[8005][C-00044b04] utils.c: write() returned error: Broken pipe

my test code:

#!/usr/bin/php -q

<?php 

require_once('phpagi.php');

$agi = new AGI();
$agi->verbose("AGI is Running -------------------------- Connected");

exit;

?>

This is the result of the code:

php /var/lib/asterisk/agi-bin/getdtmf.php

#!/usr/bin/php -q

VERBOSE “AGI is Running -------------------------- Connected” 1

I don’t know if these are your specific errors, but:

  1. Get rid of the <?php and ?> lines. They shouldn’t be required for this script. They shouldn’t make any difference, but I don’t think you need them in this context.

  2. Make sure the require_once is getting to the phpagi.php script. Adding the full path to the file might help.

New Code:

#!/usr/bin/php -q

require_once('/var/lib/asterisk/agi-bin/phpagi.php');

$agi = new AGI();

$callerid=$agi->request['agi_callerid'];
$agi->saydigits("$callerid");

$agi->verbose("CallerID is-------------------------- $callerid");
$agi->verbose("AGI is Running -------------------------- Connected");

exit;
~
~   

LOgs:

 [2020-10-13 14:55:32] VERBOSE[59973][C-00045f01] pbx.c:     -- Executing [s@ivr-23:11] AGI("SIP/Carrier-0004f413", "get-dtmf.php") in new stack
    [2020-10-13 14:55:32] VERBOSE[59973][C-00045f01] res_agi.c:     -- Launched AGI Script /var/lib/asterisk/agi-bin/get-dtmf.php

[2020-10-13 14:55:32] ERROR[59973][C-00045f01] utils.c: write() returned error: Broken pipe
[2020-10-13 14:55:32] ERROR[59973][C-00045f01] utils.c: write() returned error: Broken pipe
[2020-10-13 14:55:32] ERROR[59973][C-00045f01] utils.c: write() returned error: Broken pipe
[2020-10-13 14:55:32] ERROR[59973][C-00045f01] utils.c: write() returned error: Broken pipe
[2020-10-13 14:55:32] ERROR[59973][C-00045f01] utils.c: write() returned error: Broken pipe
[2020-10-13 14:55:32] ERROR[59973][C-00045f01] utils.c: write() returned error: Broken pipe
[2020-10-13 14:55:32] ERROR[59973][C-00045f01] utils.c: write() returned error: Broken pipe
[2020-10-13 14:55:32] ERROR[59973][C-00045f01] utils.c: write() returned error: Broken pipe
[2020-10-13 14:55:32] ERROR[59973][C-00045f01] utils.c: write() returned error: Broken pipe
[2020-10-13 14:55:32] ERROR[59973][C-00045f01] utils.c: write() returned error: Broken pipe
[2020-10-13 14:55:32] ERROR[59973][C-00045f01] utils.c: write() returned error: Broken pipe
[2020-10-13 14:55:32] ERROR[59973][C-00045f01] utils.c: write() returned error: Broken pipe
[2020-10-13 14:55:32] ERROR[59973][C-00045f01] utils.c: write() returned error: Broken pipe
[2020-10-13 14:55:32] ERROR[59973][C-00045f01] utils.c: write() returned error: Broken pipe
[2020-10-13 14:55:32] ERROR[59973][C-00045f01] utils.c: write() returned error: Broken pipe
[2020-10-13 14:55:32] ERROR[59973][C-00045f01] utils.c: write() returned error: Broken pipe
[2020-10-13 14:55:32] ERROR[59973][C-00045f01] utils.c: write() returned error: Broken pipe
[2020-10-13 14:55:32] ERROR[59973][C-00045f01] utils.c: write() returned error: Broken pipe
[2020-10-13 14:55:32] ERROR[59973][C-00045f01] utils.c: write() returned error: Broken pipe
[2020-10-13 14:55:32] ERROR[59973][C-00045f01] utils.c: write() returned error: Broken pipe
[2020-10-13 14:55:32] ERROR[59973][C-00045f01] utils.c: write() returned error: Broken pipe
[2020-10-13 14:55:32] VERBOSE[59973][C-00045f01] res_agi.c:  get-dtmf.php: Failed to execute '/var/lib/asterisk/agi-bin/get-dtmf.php': Exec format error
[2020-10-13 14:55:32] ERROR[59973][C-00045f01] utils.c: write() returned error: Broken pipe

Please check this

[root@voip agi-bin]# su asterisk -c "/var/lib/asterisk/agi-bin/get-dtmf.php" 

/var/lib/asterisk/agi-bin/get-dtmf.php: line 5: syntax error near unexpected token `'phpagi.php''
/var/lib/asterisk/agi-bin/get-dtmf.php: line 5: `require_once('phpagi.php');'

Hi @cynjut,

I am able to run the script. it seems to be a permissions issue.

But now I am not able to get any verbose logs on the logs cli.

My code:

#!/usr/bin/php -q
<?php


require_once "phpagi.php";
require_once "phpagi-asmanager.php";
$AGI = new AGI();

$agi->verbose("AGI is Running -------------------------- Connected");
$callerid=$agi->request['agi_callerid'];
$agi->saydigits("$callerid");


$agi->stream_file("vm-extension");
$agi->verbose("CallerID is-------------------------- $callerid");
$agi->verbose("AGI is Running -------------------------- Connected");

exit;



[2020-10-13 16:48:45] VERBOSE[39419][C-000461bb] pbx.c:     -- Executing [s@ivr-23:8] AGI("SIP/DIDFS1-0004fab5", "get.dtmf.php") in new stack
[2020-10-13 16:48:45] VERBOSE[39419][C-000461bb] res_agi.c:     -- Launched AGI Script /var/lib/asterisk/agi-bin/get.dtmf.php
[2020-10-13 16:48:45] VERBOSE[39419][C-000461bb] res_agi.c:     -- <SIP/DIDFS1-0004fab5>AGI Script get.dtmf.php completed, returning 0

Case mismatch:

 $AGI = new AGI(); 
 $agi->verbose

change to

 $agi = new AGI();

@lgaetz thanks for showing up.

I did this but still not able to get any verbose message there.

however My main concern is in this output below:

[2020-10-13 20:28:46] DTMF[5155][C-000463e7]: channel.c:4170 __ast_read: DTMF begin '1' received on SIP/1004-0004fd97
[2020-10-13 20:28:46] DTMF[5155][C-000463e7]: channel.c:4181 __ast_read: DTMF begin passthrough '1' on SIP/1004-0004fd97
[2020-10-13 20:28:46] DTMF[5155][C-000463e7]: channel.c:4084 __ast_read: DTMF end '1' received on SIP/1004-0004fd97, duration 160 ms
[2020-10-13 20:28:46] DTMF[5155][C-000463e7]: channel.c:4125 __ast_read: DTMF end accepted with begin '1' on SIP/1004-0004fd97
[2020-10-13 20:28:46] DTMF[5155][C-000463e7]: channel.c:4154 __ast_read: DTMF end passthrough '1' on SIP/1004-0004fd97
[2020-10-13 20:28:46] DTMF[5190][C-000463e9]: channel.c:4170 __ast_read: DTMF begin '1' received on SIP/DIDFS2-0004fd9a
[2020-10-13 20:28:46] DTMF[5190][C-000463e9]: channel.c:4174 __ast_read: DTMF begin ignored '1' on SIP/DIDFS2-0004fd9a
[2020-10-13 20:28:46] DTMF[5190][C-000463e9]: channel.c:4084 __ast_read: DTMF end '1' received on SIP/DIDFS2-0004fd9a, duration 220 ms
[2020-10-13 20:28:46] DTMF[5190][C-000463e9]: channel.c:4154 __ast_read: DTMF end passthrough '1' on SIP/DIDFS2-0004fd9a 

I want to fetch these DTMFS and display their pattern to my queue agent before the calls connects to them.
if you can see Freepbx by default giving these values. please check below:
__ast_read: DTMF end '1' received on SIP/DIDFS2-0004fd9a, duration 220 ms

how can I get that output store in the database or where can I access that ?
I need these DTMF to print out and display to my queue agents.

where are these values stored in the database or in the system. How can I access this ?

any hint or guide on this.

not able to get any dtmf digits from the below code:

$result = $agi->get_data(${IVR_MSG}, 6000, 10);
$agi->verbose(“Result For DTMF is” .json_encode($result));
$agi->verbose(“Result is $result”);

   pbx.c:     -- Executing [s@ivr-23:10] AGI("SIP/DIDFS1-00054bce", "get.dtmf.php") in new stack
    /var/log/asterisk/full:[2020-10-15 14:32:24] VERBOSE[24709][C-00048c59] res_agi.c:     -- Launched AGI Script /var/lib/asterisk/agi-bin/get.dtmf.php
    /var/log/asterisk/full:[2020-10-15 14:32:24] VERBOSE[24709][C-00048c59] res_agi.c:  get.dtmf.php: Faisal Testing CID Superfecta 
    /var/log/asterisk/full:[2020-10-15 14:32:24] VERBOSE[24709][C-00048c59] res_agi.c:  get.dtmf.php: AGI is Running -------------------------- Connected
    /var/log/asterisk/full:[2020-10-15 14:32:24] VERBOSE[24709][C-00048c59] res_agi.c:  get.dtmf.php: CID Testing: number passed from Asterisk is: 123456789
    /var/log/asterisk/full:[2020-10-15 14:32:24] WARNING[24709][C-00048c59] file.c: File 6000 does not exist in any format
    /var/log/asterisk/full:[2020-10-15 14:32:24] WARNING[24709][C-00048c59] file.c: Unable to open 6000 (format (ulaw)): No such file or directory
    /var/log/asterisk/full:[2020-10-15 14:32:24] VERBOSE[24709][C-00048c59] res_agi.c:  get.dtmf.php: Result For DTMF is{code:200,result:-1,data:}
    /var/log/asterisk/full:[2020-10-15 14:32:24] VERBOSE[24709][C-00048c59] res_agi.c:  get.dtmf.php: Result is Array
    /var/log/asterisk/full:[2020-10-15 14:32:24] VERBOSE[24709][C-00048c59] res_agi.c:     -- <SIP/DIDFS1-00054bce>AGI Script get.dtmf.php completed, returning 0

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.