All pastes #1190413 Raw Edit

Issue with route.php

public text v1 · immutable
#1190413 ·published 2008-09-01 13:08 UTC
rendered paste body
My regexroute.conf as follows,
^5454$=/external.nodata/route.php

This is the sample route.php file

#!/usr/bin/php -q

<?
/* Test script for the Yate PHP interface
   To test add in extmodule.conf

   [scripts]
   test.php=
*/
require_once("libyate.php");

/* Always the first action to do */
Yate::Init();

/* Install a handler for the call routing message */
Yate::Install("call.route",80);

/* The main loop. We pick events and handle them */
for (;;) {
    $ev=Yate::GetEvent();
    /* If Yate disconnected us then exit cleanly */
    if ($ev === false)
        break;
    /* Empty events are normal in non-blocking operation.
       This is an opportunity to do idle tasks and check timers */
    if ($ev === true) {
//        Yate::Output("PHP event: empty");
        continue;
    }
    /* If we reached here we should have a valid object */
    switch ($ev->type) {
	case "incoming":
	//    Yate::Output("PHP Message: " . $ev->name . " id: " . $ev->id . " called: " . $ev->params["called"] . " caller: " . $ev->params["caller"]);
	    if ($ev->getValue("called") == "321") {
		$ev->retval = "tone/dial";
		$ev->handled = true;
	    }
	    /* This is extremely important.
	       We MUST let messages return, handled or not */
	    $ev->Acknowledge();
	    break;
	case "answer":
	    Yate::Output("PHP Answered: " . $ev->name . " id: " . $ev->id);
	    break;
	case "installed":
	    Yate::Output("PHP Installed: " . $ev->name);
	    break;
	case "uninstalled":
	    Yate::Output("PHP Uninstalled: " . $ev->name);
	    break;
	default:
	    Yate::Output("PHP Event: " . $ev->type);
    }
}

Yate::Output("PHP: bye!");

/* vi: set ts=8 sw=4 sts=4 noet: */
?>

I am getting the following issue in yate console,
*<WARN> Message 0x83ba338 'call.execute' did not return in 10000
   msec [0x83b86f8]
   <WARN> ExtMod 'route.php' did not handle call message
   >>> ExtModChan::~ExtModChan() [0x83b4d28]
     <ALL> ExtModReceiver::die() pid=5698 dead=no [0x83b86f8]
     <ALL> ExtModReceiver::die() waiting for pid=5698 to die [0x83b86f8]
     <INFO> ExtModReceiver::die() pid=5698 did not exit? [0x83b86f8]
   <<< ExtModChan::~ExtModChan()
   Returned false 'call.execute' delay=10.269039*