Ejemplo n.º 1
0
<?php

require_once 'PhpSIP.class.php';
/* Sends test message */
$item = $_GET['proxy'];
$item = $_GET['method'];
$item = $_GET['to'];
$item = $_GET['from'];
try {
    $api = new PhpSIP();
    $api->setProxy('sip.host.ext:5060');
    $api->addHeader('Event: Homer');
    $api->setMethod('OPTIONS');
    $api->setFrom('sip:1234@host.ext');
    $api->setUri('sip:1234@host.ext');
    $api->setUserAgent('HOMER SIPCAPTURE');
    $res = $api->send();
    echo "response: {$res}\n";
} catch (Exception $e) {
    echo $e;
}
Ejemplo n.º 2
0
function phpSip()
{
    require_once 'php-sip/PhpSIP.class.php';
    $phpsip_to = getVar('to', NULL, $_REQUEST, 'string');
    $phpsip_from = getVar('from', NULL, $_REQUEST, 'string');
    $phpsip_prox = getVar('proxy', NULL, $_REQUEST, 'string');
    $phpsip_meth = getVar('method', NULL, $_REQUEST, 'string');
    $phpsip_head = getVar('head', NULL, $_REQUEST, 'string');
    echo "FROM: " . $phpsip_from . "<br>TO: " . $phpsip_to . "<br>VIA " . $phpsip_prox . "<br>METHOD: " . $phpsip_meth . "<br>HEAD: " . $phpsip_head . "<br>";
    echo "<br>";
    /* Sends test message */
    try {
        $api = new PhpSIP();
        $api->setProxy('' . $phpsip_prox);
        $api->addHeader('X-Capture: ' . $phpsip_head);
        $api->setMethod('' . $phpsip_meth);
        $api->setFrom("sip:" . $phpsip_from);
        $api->setUri("sip:" . $phpsip_to);
        $api->setUserAgent('HOMER/Php-Sip');
        $res = $api->send();
        echo "SIP response: {$res}\n";
    } catch (Exception $e) {
        echo $e;
    }
}