私の考えは、アスタリスクのダイヤルプランでPHPスクリプトを実行したいということです。これは、アスタリスクから値を取得し、それらと何かをするデアモン/プロセスのように機能します。しかし、システム(php script.php)コマンドを実行すると、アスタリスクが停止し、次のダイヤルプランのステップには進まない。その理由は、script.phpは "while(1){...}"ループを内部に持ち、アスタリスクがその終了を待っていると考えています...phpスクリプトのループがアスタリスクで実行される
私を助けて解決策を教えてください外部の "php-loop"スクリプトを実行し、一度にextensions.confの手順を実行する方法は?
extensions.confファイル
[internal]
exten => 100,1,Set(CallerId=${CALLERID(num)}) ;get number
exten => 100,n,System(php script.php ${CallerId}) ;execute php script with argv[1]
;now the script.php should run at the background and below part
;should be execute like in ordinary context
exten => 100,n,Dial(SIP/100)
exten => 100,n,Hangup()
script.php
#!/usr/bin/php
<?php
$num = argv[1]; //the value from [internal] in the extensions.conf
while(1) { //start the loop
/*
* do something in the infinite loop and END it IF something happen
* e.g. $someVal == 9999;
*/
}
?>
だから、あなたが見ることができるような考え方は単純です: 'ループ' とし、中にPHPスクリプトを開始その間に、[内部]コンテキストの最下位ステップから何かを実行します。 どのように処理するのですか?アスタリスクはscript.php実行の終了を待ち、次のステップに進みます。
ありがとうございました!