public function actionCall2() { try { $api = new PhpSIP(); // IP we will bind to $api->setUsername('118338'); // authentication username $api->setPassword('55XI8N'); // authentication password $api->setProxy('202.153.128.34'); $api->addHeader('Event: resync'); $api->setMethod('NOTIFY'); $api->setFrom('sip:118338@voiprakyat.or.id'); $api->setUri('sip:118339@voiprakyat.or.id'); $res = $api->send(); echo "res1: {$res}\n"; } catch (Exception $e) { echo $e->getMessage() . "\n"; } }
<?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; }
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; } }