Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get response from commands #15

Open
jsegra opened this issue Aug 23, 2017 · 7 comments
Open

Get response from commands #15

jsegra opened this issue Aug 23, 2017 · 7 comments

Comments

@jsegra
Copy link

jsegra commented Aug 23, 2017

Hi @enniel, I don't know if I'm doing something wrong or is just an issue.

I'm running the next code:

$algo = Artisan::call('ami:action', [
    'action' => 'ConfbridgeList',
    '--arguments' => [
        'ActionID' => '1',
        'Conference' => $extension
    ]
]);

dd($algo);

If the conference exist $algo equals 0 and if the conference don't exist the program never reach the dd($algo) statement.

Running the command version in the CLI I get the response succes if the conference exists, but when the conference don't exist I get nothing returned :(.

P.D: Sorry for my english, trying to improve 👍

@jsegra
Copy link
Author

jsegra commented Oct 5, 2017

Pls, some help?, what I'm doing bad.

@rnrstar
Copy link

rnrstar commented Oct 24, 2017

I'm having the same issue.

I have in a controller:

public function test()
    {
        $result = Artisan::call('ami:cli', [
    		'command'      => 'queue show',
    		'--autoclose' => true,
]);
dd($result);
    }

The output is always 0. When I do it at the command line it works:

php artisan ami: cli 'queue show' --autoclose

The above command generates the expected output.

@rnrstar
Copy link

rnrstar commented Oct 25, 2017

It looks like the output of 0 is correct in that Artisan::call is only going to return true or false depending on the success of the command.

@jsegra
Copy link
Author

jsegra commented Oct 26, 2017

Yes, it looks like output 0 is correct, but when an error occurs, it never reaches the dd ($ result) statement.

So what to do?, I need to know if the action was ok or not.

Thx.

@peymannavard
Copy link

I have the same that problem
always output show 0
public function Outcall (){

     $result = Artisan::call('ami:action', [
         'action' => 'Command',
         '--arguments' => [
             'Command' => "queue show"
         ]
     ]

);

     print_r($result);

How to fix this ?

@peymannavard
Copy link

Nobody help ?

@komilgulboev
Copy link

komilgulboev commented Mar 20, 2019

The same issue still in Laravel 5.7, query taking too long and failed again of timeout.
Using below script for check:

 $result = Artisan::call('ami:cli', [
    		'command'      => 'queue show',
    		'--autoclose' => true,
]);
return response()->json($result);

But test from cli is working well, from cli tested

php artisan ami:listen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants