PHP AGI Not working

Any and all non-support discussions

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

PHP AGI Not working

Postby devil008 » Thu Feb 18, 2016 2:43 am

randomcid.php: Failed to execute '/var/lib/asterisk/agi-bin/randomcid.php': Exec format error

My configuration:

#!/usr/bin/php
<?php
include 'phpagi-2.20/phpagi.php';
$agi = new AGI();
$numbers = file('/var/lib/asterisk/agi-bin/cids-list.txt');
$cid = array_rand($numbers, 1);
//return trim($numbers[$cid[0]]);
$newCID = trim($numbers[$cid]);
//echo $newCID;
$agi->set_variable("CALLERID(num)", $newCID);

?>


Steps to Reproduce:
i also download phpagi-2.20 , than its move to /var/lib/asterisk/agi-bin/

but when we run this error coming.

Additional Information:
I just move this folder phpagi-2.20 not is it need to install.Please help us how
to resolve.

Asterisk version: 1.4.39.1-vici
astGUIclient version: 2.4 RC 1
devil008
 
Posts: 1
Joined: Thu Feb 18, 2016 2:32 am

Re: PHP AGI Not working

Postby williamconley » Thu Feb 18, 2016 10:46 am

1) Welcome to the Party! 8-)

2) As you are obviously new here, I have some suggestions to help us all help you:

When you post, please post your entire configuration including (but not limited to) your installation method and vicidial version with build.

This IS a requirement for posting along with reading the stickies (at the top of each forum) and the manager's manual (available on EFLO.net, both free and paid versions)

You should also post: Asterisk version, telephony hardware (model number is helpful here), cluster information if you have one, and whether any other software is installed in the box. If your installation method is "from scratch" you must post your operating system and should also post the .iso version from which you installed your original operating system. If your installation is "Hosted" list the site name of the host.

If this is a "Cloud" or "Virtual" server, please note the technology involved along with the version of that techology (ie: VMware Server Version 2.0.2). If it is not, merely stating the Motherboard model # and CPU would be helpful.

Similar to This:

Vicibox X.X from .iso | Vicidial X.X.X-XXX Build XXXXXX-XXXX | Asterisk X.X.X | Single Server | No Digium/Sangoma Hardware | No Extra Software After Installation | Intel DG35EC | Core2Quad Q6600

3) Is this in any way related to Vicidial? Or Vicidial code? If not, you're asking an asterisk question on a Vicidial board. While I am a bit prejudiced and believe firmly that our community is much better than theirs and can probably be of more help, the Asterisk community is HUGE by comparison (if a bit spread out).

4) That being said: Your error is that a file failed to execute and the reason appears to be "Exec format error". And since it's a random number generator that is unnecessary in Vicidial ... my suggestion is that you install Vicidial and use the campaign "Custom CallerID" field to set each call's callerID instead of using a text file in a custom php script that appears to be broken.

5) Happy Hunting! 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: 20018
Joined: Wed Oct 31, 2007 4:17 pm
Location: Davenport, FL (By Disney!)

Re: PHP AGI Not working

Postby williamconley » Tue Apr 12, 2016 1:30 pm

Apparently your goal is to grab a random entry from a text file and use that as your CID when making an outbound call.

Simpler solution: Use the Vicidial feature that allows you to put the outbound CID in security_phrase and configure the campaign to use that field as the CID during the phone call.

Next up, your present problem:

The script is reporting an exec format error. You should look at other scripts in the agi-bin and see where you have made your error, or look up asterisk php agi scripting. Perhaps you should not have both the #!/usr/bin/php and the <?php invocation.

Regardless: There is already a function within Vicidial that accomplishes the task, thus your "non-vicidial-related" script debugging ... could simply be sidestepped by putting a random value on each record's security_phrase field instead of trying to run a script at dial time. And a mysql script to "rerandomize" that field after each reset would work nicely, too.

Usually, however, it's advised to use the AC-CID ("area code" based caller id) system which allows you to set the callerID based on the Area Code. Then each time you re-call an area code, you can switch to a new callerid by changing that single value (and purchase the new number and point it to your dialer for callbacks!).
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: 20018
Joined: Wed Oct 31, 2007 4:17 pm
Location: Davenport, FL (By Disney!)


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 61 guests