Anish Basu
2005-Dec-19 09:08 UTC
[Asterisk-Users] Can't pass variables using Originate in PHPAGI 2.14
No matter what I try, I can't seem to pass variables to the local channel when using the Originate command through PHPAGI. Here is a small snippet of the PHP code: /*************************************************************************** **/ $channel = 'Local/warning@default/1'; $exten = ''; $context = ''; $priority = ''; $application = 'Meetme'; $data = '500|qt|1234'; $timeout = '20000'; $callerid = ''; $variable = 'minutes=5'; $account = ''; $async = true; $actionid = rand(); $asm->Originate($channel, $exten, $context, $priority, $application, $data, $timeout, $callerid, $variable, $account, $async, $actionid); /*************************************************************************** **/ The Originate command succeeds and joins one leg of the call to Meetme and the other leg to the local extension warning in the context default. But, the variable ${minutes} is not useable in the dialplan. NoOp(${minutes}) does not return anything. I added some echo statements in the phpagi-asmanager.php so that I could see the commands being passed to the Asterisk manager: Action: Originate Channel: Local/warning@default/1 Application: Meetme Data: 500|qt|1234 Timeout: 20000 Variable: minutes=5 Async: true ActionID: 20 The command sent to the manager seems to be fine, and I'm not trying to pass multiple variables. Has anyone had similar problems passing variables? Thank you, Anish Basu Field Systems Engineer Softel, Inc. Phone: (732) 705-9202 Cell: (732) 312-6634
Anish Basu
2005-Dec-21 15:43 UTC
[Asterisk-Users] RE: Can't pass variables using Originate in PHPAGI 2.14
Not sure if this email actually went through before. -----Original Message----- From: Anish Basu [mailto:anish@softelinc.com] Sent: Monday, December 19, 2005 11:08 AM To: asterisk-users@lists.digium.com Subject: Can't pass variables using Originate in PHPAGI 2.14 No matter what I try, I can't seem to pass variables to the local channel when using the Originate command through PHPAGI. Here is a small snippet of the PHP code: /*************************************************************************** **/ $channel = 'Local/warning@default/1'; $exten = ''; $context = ''; $priority = ''; $application = 'Meetme'; $data = '500|qt|1234'; $timeout = '20000'; $callerid = ''; $variable = 'minutes=5'; $account = ''; $async = true; $actionid = rand(); $asm->Originate($channel, $exten, $context, $priority, $application, $data, $timeout, $callerid, $variable, $account, $async, $actionid); /*************************************************************************** **/ The Originate command succeeds and joins one leg of the call to Meetme and the other leg to the local extension warning in the context default. But, the variable ${minutes} is not useable in the dialplan. NoOp(${minutes}) does not return anything. I added some echo statements in the phpagi-asmanager.php so that I could see the commands being passed to the Asterisk manager: Action: Originate Channel: Local/warning@default/1 Application: Meetme Data: 500|qt|1234 Timeout: 20000 Variable: minutes=5 Async: true ActionID: 20 The command sent to the manager seems to be fine, and I'm not trying to pass multiple variables. Has anyone had similar problems passing variables? Thank you, Anish Basu Field Systems Engineer Softel, Inc. Phone: (732) 705-9202 Cell: (732) 312-6634
Anish Basu
2005-Dec-21 16:24 UTC
[Asterisk-Users] Can't pass variables using Originate in PHPAGI 2.14
I finally figured it out...after painful trial and error. The variable being passed using the Originate command has to be preceded by an underscore: Action: Originate Channel: Local/warning@default/1 Application: Meetme Data: 500|qt|1234 Timeout: 20000 Variable: _minutes=5 Async: true ActionID: 20 The underscore is stripped off and in the dialpan NoOp(${minutes}) outputs 5. Any idea why this happens? Anish Basu Field Systems Engineer Softel, Inc. Phone: (732) 705-9202 Cell: (732) 312-6634