This file is indexed.

/usr/share/yate/scripts/queue_in.php is in yate-scripts 5.4.0-1-1ubuntu2.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
#!/usr/bin/php -q
<?php
/**
 * queue_in.php
 * This file is part of the YATE Project http://YATE.null.ro
 *
 * Yet Another Telephony Engine - a fully featured software PBX and IVR
 * Copyright (C) 2008-2014 Null Team
 *
 * This software is distributed under multiple licenses;
 * see the COPYING file in the main directory for licensing
 * information for this specific distribution.
 *
 * This use of this software may be subject to additional restrictions.
 * See the LEGAL file in the main directory for details.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 */

/*
 * Queue inbound calls (waiting in queue)
 * The queue module should let the call.execute fall through to this script.
 * It will optionally play a short greeting and then attach an on-hold source.
 *
 * To use add in queues.conf:
 * [channels]
 * incoming=external/nodata/queue_in.php
 */
require_once("libyate.php");

$ourcallid = "q-in/" . uniqid(rand(),1);
$partycallid = "";
$newsource = "";
$answermode = "";
$override = "";

function SendMsg($msg)
{
    global $ourcallid;
    global $partycallid;
    $m = new Yate($msg);
    $m->id = "";
    $m->params["id"] = $ourcallid;
    $m->params["peerid"] = $partycallid;
    $m->params["targetid"] = $partycallid;
    $m->params["reason"] = "queued";
    $m->params["cdrcreate"] = "false";
    $m->Dispatch();
}

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

/* Uncomment next line to get debugging messages */
//Yate::Debug(true);

Yate::SetLocal("trackparam","queue_in.php");
Yate::SetLocal("id",$ourcallid);

/* The main loop. We pick events and handle them */
for (;;) {
    $ev=Yate::GetEvent();
    /* If Yate disconnected us then exit cleanly */
    if ($ev === false)
	break;
    /* No need to handle empty events in this application */
    if ($ev === true)
	continue;
    /* If we reached here we should have a valid object */
    switch ($ev->type) {
	case "incoming":
	    switch ($ev->name) {
		case "call.execute":
		    $partycallid = $ev->params["id"];
		    if (array_key_exists("targetid",$ev->params))
			$ourcallid = $ev->params["targetid"];
		    else
			$ev->params["targetid"] = $ourcallid;
		    $answermode = $ev->GetValue("answermode","late");
		    $ev->handled = true;
		    /* We must ACK this message before dispatching a call.answered */
		    $ev->Acknowledge();

		    if ($ev->GetValue("source") || $ev->GetValue("consumer") || $ev->GetValue("greeting")) {
			$m = new Yate("chan.attach");
			$m->params["id"] = $ourcallid;
			if ($ev->GetValue("consumer"))
			    $m->params["consumer"] = $ev->GetValue("consumer");
			$newsource = $ev->GetValue("source");
			if ($ev->GetValue("greeting"))
			    $m->params["source"] = $ev->GetValue("greeting");
			else if ($newsource) {
			    if (substr($newsource,0,4) == "moh/")
				$m->params["mohlist"] = $ev->GetValue("mohlist");
			    $m->params["source"] = $newsource;
			    $newsource = "";
			}
			if ($newsource) {
			    $m->params["notify"] = $ourcallid;
			    Yate::Install("chan.notify",100,"targetid",$ourcallid);
			}
			else if ($answermode == "late")
			    $answermode = "early";
			$m->Dispatch();
		    }

		    switch ($answermode) {
			case "early":
			    SendMsg("call.answered");
			    break;
			case "late":
			case "never":
			    SendMsg("call.ringing");
			    break;
		    }

		    /* Prevent a warning if trying to ACK this message again */
		    $ev = false;
		    break;
		case "chan.notify":
		    Yate::Uninstall("chan.notify");
		    $m = new Yate("chan.attach");
		    $m->params["id"] = $ourcallid;
		    $m->params["source"] = $newsource;
		    $m->Dispatch();
		    $newsource = "";
		    if ($answermode == "late")
			SendMsg("call.answered");
		    break;
	    }
	    /* This is extremely important.
	       We MUST let messages return, handled or not */
	    if ($ev)
		$ev->Acknowledge();
	    break;
	default:
	    Yate::Debug("PHP Event: " . $ev->type);
    }
}

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

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