Asterisk 如何使用星号在浏览器上生成sip地址

Asterisk 如何使用星号在浏览器上生成sip地址,asterisk,webrtc,Asterisk,Webrtc,我需要在浏览器上生成一个动态sip地址,以便我的asterisk服务器可以在相同的sip地址上进行调用。 这样,我的web浏览器将成为可以接收呼叫的sip客户端 我可以看出webrtc是一种方式,但我不知道如何在浏览器上生成sip地址 谢谢您需要像在任何其他情况下一样在星号中创建sip用户,并通过WebRTC向其注册,但首先必须在配置中启用它。听说你有 若您想创建动态sip用户,您必须在星号中使用realtime,那个么您的配置将从数据库中读取。有用的链接如何从实时开始: 您需要像在任何其他情况

我需要在浏览器上生成一个动态sip地址,以便我的asterisk服务器可以在相同的sip地址上进行调用。 这样,我的web浏览器将成为可以接收呼叫的sip客户端

我可以看出webrtc是一种方式,但我不知道如何在浏览器上生成sip地址


谢谢

您需要像在任何其他情况下一样在星号中创建sip用户,并通过WebRTC向其注册,但首先必须在配置中启用它。听说你有

若您想创建动态sip用户,您必须在星号中使用realtime,那个么您的配置将从数据库中读取。有用的链接如何从实时开始:

您需要像在任何其他情况下一样在asterisk中创建sip用户,并通过WebRTC向其注册,但首先必须在配置中启用它。听说你有

若您想创建动态sip用户,您必须在星号中使用realtime,那个么您的配置将从数据库中读取。有用的链接如何从实时开始:

您需要像在任何其他情况下一样在asterisk中创建sip用户,并通过WebRTC向其注册,但首先必须在配置中启用它。听说你有

若您想创建动态sip用户,您必须在星号中使用realtime,那个么您的配置将从数据库中读取。有用的链接如何从实时开始:

您需要像在任何其他情况下一样在asterisk中创建sip用户,并通过WebRTC向其注册,但首先必须在配置中启用它。听说你有

若您想创建动态sip用户,您必须在星号中使用realtime,那个么您的配置将从数据库中读取。有用的链接如何从实时开始:

你可以查看我在星号12+实时+WebRTC上的帖子:

最重要的是,添加一个WebService,将一个peer插入到sippeers表中。您的系统将调用此Web服务,以创建可立即使用SIP或其他方式(通过WS/WSS的SIP、WebRTC…)进行注册的对等方

如果您在Unix上工作,并且需要.Net Web服务,那么可以使用NUSOAP和类似的东西:(sudo nano/var/html/www/mywebservice.php`。这是我用于测试的基本实现

<?php
require_once("nusoap.php");


$namespace = "http://yourdomain.com";
// create a new soap server
$server = new soap_server();
// configure your WSDL
$server->configureWSDL("AsteriskRealtime");
// set your namespace
$server->wsdl->schemaTargetNamespace = $namespace;
// register your WebMethod
$server->register(
                // method name:
                'HelloWorld',
            // parameter list:
                array('name'=>'xsd:string'),
                // return value(s):
                array('return'=>'xsd:string'),
                // namespace:
                $namespace,
                // soapaction: (use default)
                false,
                // style: rpc or document
                'rpc',
                // use: encoded or literal
                'encoded',
                // description: documentation for the method
                'A simple hello world');



$server->wsdl->addComplexType(
   'AsteriskExtensions',
   'complexType',
   'struct',
   'all','',
   array(
      'name' => array('name' => 'name', 'type' => 'xsd:string'),
      'custom_id' => array('name' => 'custom_id', 'type' => 'xsd:string')
   )
);

$server->wsdl->addComplexType(
   'AsteriskExtensionsArray',
   'complexType',
   'array','',
   'SOAP-ENC:Array',array(),
   array(
      array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'tns:AsteriskExtensions[]')
   ),
   'tns:AsteriskExtensions'
);


$server->register(
                // method name:
                'GetRegisteredExtensions',
                // parameter list:
                array(),
                // return value(s):
                array('AsteriskExtensions' => 'tns:AsteriskExtensionsArray'),
                // namespace:
                $namespace,
                // soapaction: (use default)
                false,
                // style: rpc or document
                'rpc',
                // use: encoded or literal
                'encoded',
                // description: documentation for the method
                'List the extensions registered in AsteriskRealtime database.');


$server->register(
                // method name:
                'AddUpdateExtension',
                // parameter list:
                array('name' => 'xsd:string', 'password' => 'xsd:string', 'custom_id' => 'xsd:string'),
                // return value(s):
                array('return' => 'xsd:string'),
                // namespace:
                $namespace,
                // soapaction: (use default)
                false,
                // style: rpc or document
                'rpc',
                // use: encoded or literal
                'encoded',
                // description: documentation for the method
                'Add or Update an extension in AsteriskRealtime database. NAME is the PRIMARY KEY.  Returns OK for success or ERR for failure.');



$server->register(
                // method name:
                'DeleteExtension',
                // parameter list:
                array('name' => 'xsd:string'),
                // return value(s):
                array('return' => 'xsd:string'),
                // namespace:
                $namespace,
                // soapaction: (use default)
                false,
                // style: rpc or document
                'rpc',
                // use: encoded or literal
                'encoded',
                // description: documentation for the method
                'Delete an extension registered in AsteriskRealtime database. Returns OK for success or ERR for failure. ');

$server->register(
                // method name:
                'GetByCustomId',
                // parameter list:
                array('name' => 'xsd:string'),
                // return value(s):
                array('AsteriskExtensions' => 'tns:AsteriskExtensionsArray'),
                // namespace:
                $namespace,
                // soapaction: (use default)
                false,
                // style: rpc or document
                'rpc',
                // use: encoded or literal
                'encoded',
                // description: documentation for the method
                'Gets an extension or a list of extensions for a CustomID. ');






function HelloWorld($sName)
{
    return 'Hello ' . $sName . '!  Hello world!';
}

function  GetRegisteredExtensions()
{ 
    $conn=odbc_connect('your-asterisk-connector-as-in-odbcinst.ini','your-mysql-user','your-mysql-password');
    $result = array();
    $req="SELECT * FROM `sippeers`";
    $res=odbc_exec($conn,$req);
    while($obj=odbc_fetch_object($res)) {
        $result[] = array( 'name' => $obj->name, 'custom_id' => $obj->custom_id);
    }
    return $result;
}

function  AddUpdateExtension($name,$password,$custom_id)
{
        $conn=odbc_connect('your-asterisk-connector-as-in-odbcinst.ini','your-mysql-user','your-mysql-password');
    $req="DELETE FROM `sippeers` WHERE `name` = '" . $name . "'";
        $res=odbc_exec($conn,$req);
        $req="insert into `sippeers` (`name`, `ipaddr`, `port`, `regseconds`, `defaultuser`, `fullcontact`, `regserver`, `useragent`, `lastms`, `host`, `type`, `context`, `permit`, `deny`, `secret`, `md5secret`, `remotesecret`, `transport`, `dtmfmode`, `directmedia`, `nat`, `callgroup`, `pickupgroup`, `language`, `disallow`, `allow`, `insecure`, `trustrpid`, `progressinband`, `promiscredir`, `useclientcode`, `accountcode`, `setvar`, `callerid`, `amaflags`, `callcounter`, `busylevel`, `allowoverlap`, `allowsubscribe`, `videosupport`, `maxcallbitrate`, `rfc2833compensate`, `mailbox`, `session-timers`, `session-expires`, `session-minse`, `session-refresher`, `t38pt_usertpsource`, `regexten`, `fromdomain`, `fromuser`, `qualify`, `defaultip`, `rtptimeout`, `rtpholdtimeout`, `sendrpid`, `outboundproxy`, `callbackextension`, `timert1`, `timerb`, `qualifyfreq`, `constantssrc`, `contactpermit`, `contactdeny`, `usereqphone`, `textsupport`, `faxdetect`, `buggymwi`, `auth`, `fullname`, `trunkname`, `cid_number`, `callingpres`, `mohinterpret`, `mohsuggest`, `parkinglot`, `hasvoicemail`, `subscribemwi`, `vmexten`, `autoframing`, `rtpkeepalive`, `call-limit`, `g726nonstandard`, `ignoresdpversion`, `allowtransfer`, `dynamic`, `path`, `supportpath`, `avpf`, `encryption`, `dtlsenable`, `dtlsverify`, `dtlscertfile`, `dtlsprivatekey`, `dtlssetup`, `force_avp`, `custom_id`) values('" . $name . "',NULL,NULL,NULL,'" . $name . "','','',NULL,'0','dynamic','friend','default',NULL,NULL,'" . $password . "',NULL,NULL,'udp,ws,wss','auto','no',NULL,NULL,NULL,NULL,NULL,'ulaw,alaw,g729,h264,g719,opus,vp8,gsm',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'no',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'yes','',NULL,'yes','yes','yes','no','/etc/asterisk/keys/asterisk.pem','/etc/asterisk/keys/asterisk.pem','actpass','yes','" . $custom_id . "')";
        $res=odbc_exec($conn,$req);

        return 'OK';
}


function  DeleteExtension($name)
{
        $conn=odbc_connect('your-asterisk-connector-as-in-odbcinst.ini','your-mysql-user','your-mysql-password');
        $req="DELETE FROM `sippeers` WHERE `name` = '" . $name . "'";
        $res=odbc_exec($conn,$req);
        return 'OK';
}

function GetByCustomId($name)
{
    $conn=odbc_connect('your-asterisk-connector-as-in-odbcinst.ini','your-mysql-user','your-mysql-password');
        $result = array();
        $req="SELECT * FROM `sippeers` WHERE `custom_id` = '" . $name . "'";
        $res=odbc_exec($conn,$req);
        while($obj=odbc_fetch_object($res)) {
                $result[] = array( 'name' => $obj->name, 'custom_id' => $obj->custom_id);
        }
        return $result;
}


// Get our posted data if the service is being consumed
// otherwise leave this data blank.
$POST_DATA = isset($GLOBALS['HTTP_RAW_POST_DATA']) ? $GLOBALS['HTTP_RAW_POST_DATA'] : '';

// pass our posted data (or nothing) to the soap service
$server->service($POST_DATA);
exit();
?>

你可以查看我在星号12+实时+WebRTC上的帖子:

最重要的是,添加一个Web服务,将一个对等点插入表sippeers中。您的系统将调用此Web服务,以创建可立即使用SIP或其他任何方式(通过WS/WSS的SIP、WebRTC…)进行注册的对等点

如果您在Unix上工作,并且需要.Net Web服务,那么可以使用NUSOAP和类似的东西:(sudo nano/var/html/www/mywebservice.php`。这是我用于测试的基本实现

<?php
require_once("nusoap.php");


$namespace = "http://yourdomain.com";
// create a new soap server
$server = new soap_server();
// configure your WSDL
$server->configureWSDL("AsteriskRealtime");
// set your namespace
$server->wsdl->schemaTargetNamespace = $namespace;
// register your WebMethod
$server->register(
                // method name:
                'HelloWorld',
            // parameter list:
                array('name'=>'xsd:string'),
                // return value(s):
                array('return'=>'xsd:string'),
                // namespace:
                $namespace,
                // soapaction: (use default)
                false,
                // style: rpc or document
                'rpc',
                // use: encoded or literal
                'encoded',
                // description: documentation for the method
                'A simple hello world');



$server->wsdl->addComplexType(
   'AsteriskExtensions',
   'complexType',
   'struct',
   'all','',
   array(
      'name' => array('name' => 'name', 'type' => 'xsd:string'),
      'custom_id' => array('name' => 'custom_id', 'type' => 'xsd:string')
   )
);

$server->wsdl->addComplexType(
   'AsteriskExtensionsArray',
   'complexType',
   'array','',
   'SOAP-ENC:Array',array(),
   array(
      array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'tns:AsteriskExtensions[]')
   ),
   'tns:AsteriskExtensions'
);


$server->register(
                // method name:
                'GetRegisteredExtensions',
                // parameter list:
                array(),
                // return value(s):
                array('AsteriskExtensions' => 'tns:AsteriskExtensionsArray'),
                // namespace:
                $namespace,
                // soapaction: (use default)
                false,
                // style: rpc or document
                'rpc',
                // use: encoded or literal
                'encoded',
                // description: documentation for the method
                'List the extensions registered in AsteriskRealtime database.');


$server->register(
                // method name:
                'AddUpdateExtension',
                // parameter list:
                array('name' => 'xsd:string', 'password' => 'xsd:string', 'custom_id' => 'xsd:string'),
                // return value(s):
                array('return' => 'xsd:string'),
                // namespace:
                $namespace,
                // soapaction: (use default)
                false,
                // style: rpc or document
                'rpc',
                // use: encoded or literal
                'encoded',
                // description: documentation for the method
                'Add or Update an extension in AsteriskRealtime database. NAME is the PRIMARY KEY.  Returns OK for success or ERR for failure.');



$server->register(
                // method name:
                'DeleteExtension',
                // parameter list:
                array('name' => 'xsd:string'),
                // return value(s):
                array('return' => 'xsd:string'),
                // namespace:
                $namespace,
                // soapaction: (use default)
                false,
                // style: rpc or document
                'rpc',
                // use: encoded or literal
                'encoded',
                // description: documentation for the method
                'Delete an extension registered in AsteriskRealtime database. Returns OK for success or ERR for failure. ');

$server->register(
                // method name:
                'GetByCustomId',
                // parameter list:
                array('name' => 'xsd:string'),
                // return value(s):
                array('AsteriskExtensions' => 'tns:AsteriskExtensionsArray'),
                // namespace:
                $namespace,
                // soapaction: (use default)
                false,
                // style: rpc or document
                'rpc',
                // use: encoded or literal
                'encoded',
                // description: documentation for the method
                'Gets an extension or a list of extensions for a CustomID. ');






function HelloWorld($sName)
{
    return 'Hello ' . $sName . '!  Hello world!';
}

function  GetRegisteredExtensions()
{ 
    $conn=odbc_connect('your-asterisk-connector-as-in-odbcinst.ini','your-mysql-user','your-mysql-password');
    $result = array();
    $req="SELECT * FROM `sippeers`";
    $res=odbc_exec($conn,$req);
    while($obj=odbc_fetch_object($res)) {
        $result[] = array( 'name' => $obj->name, 'custom_id' => $obj->custom_id);
    }
    return $result;
}

function  AddUpdateExtension($name,$password,$custom_id)
{
        $conn=odbc_connect('your-asterisk-connector-as-in-odbcinst.ini','your-mysql-user','your-mysql-password');
    $req="DELETE FROM `sippeers` WHERE `name` = '" . $name . "'";
        $res=odbc_exec($conn,$req);
        $req="insert into `sippeers` (`name`, `ipaddr`, `port`, `regseconds`, `defaultuser`, `fullcontact`, `regserver`, `useragent`, `lastms`, `host`, `type`, `context`, `permit`, `deny`, `secret`, `md5secret`, `remotesecret`, `transport`, `dtmfmode`, `directmedia`, `nat`, `callgroup`, `pickupgroup`, `language`, `disallow`, `allow`, `insecure`, `trustrpid`, `progressinband`, `promiscredir`, `useclientcode`, `accountcode`, `setvar`, `callerid`, `amaflags`, `callcounter`, `busylevel`, `allowoverlap`, `allowsubscribe`, `videosupport`, `maxcallbitrate`, `rfc2833compensate`, `mailbox`, `session-timers`, `session-expires`, `session-minse`, `session-refresher`, `t38pt_usertpsource`, `regexten`, `fromdomain`, `fromuser`, `qualify`, `defaultip`, `rtptimeout`, `rtpholdtimeout`, `sendrpid`, `outboundproxy`, `callbackextension`, `timert1`, `timerb`, `qualifyfreq`, `constantssrc`, `contactpermit`, `contactdeny`, `usereqphone`, `textsupport`, `faxdetect`, `buggymwi`, `auth`, `fullname`, `trunkname`, `cid_number`, `callingpres`, `mohinterpret`, `mohsuggest`, `parkinglot`, `hasvoicemail`, `subscribemwi`, `vmexten`, `autoframing`, `rtpkeepalive`, `call-limit`, `g726nonstandard`, `ignoresdpversion`, `allowtransfer`, `dynamic`, `path`, `supportpath`, `avpf`, `encryption`, `dtlsenable`, `dtlsverify`, `dtlscertfile`, `dtlsprivatekey`, `dtlssetup`, `force_avp`, `custom_id`) values('" . $name . "',NULL,NULL,NULL,'" . $name . "','','',NULL,'0','dynamic','friend','default',NULL,NULL,'" . $password . "',NULL,NULL,'udp,ws,wss','auto','no',NULL,NULL,NULL,NULL,NULL,'ulaw,alaw,g729,h264,g719,opus,vp8,gsm',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'no',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'yes','',NULL,'yes','yes','yes','no','/etc/asterisk/keys/asterisk.pem','/etc/asterisk/keys/asterisk.pem','actpass','yes','" . $custom_id . "')";
        $res=odbc_exec($conn,$req);

        return 'OK';
}


function  DeleteExtension($name)
{
        $conn=odbc_connect('your-asterisk-connector-as-in-odbcinst.ini','your-mysql-user','your-mysql-password');
        $req="DELETE FROM `sippeers` WHERE `name` = '" . $name . "'";
        $res=odbc_exec($conn,$req);
        return 'OK';
}

function GetByCustomId($name)
{
    $conn=odbc_connect('your-asterisk-connector-as-in-odbcinst.ini','your-mysql-user','your-mysql-password');
        $result = array();
        $req="SELECT * FROM `sippeers` WHERE `custom_id` = '" . $name . "'";
        $res=odbc_exec($conn,$req);
        while($obj=odbc_fetch_object($res)) {
                $result[] = array( 'name' => $obj->name, 'custom_id' => $obj->custom_id);
        }
        return $result;
}


// Get our posted data if the service is being consumed
// otherwise leave this data blank.
$POST_DATA = isset($GLOBALS['HTTP_RAW_POST_DATA']) ? $GLOBALS['HTTP_RAW_POST_DATA'] : '';

// pass our posted data (or nothing) to the soap service
$server->service($POST_DATA);
exit();
?>

你可以查看我在星号12+实时+WebRTC上的帖子:

最重要的是,添加一个Web服务,将一个对等点插入表sippeers中。您的系统将调用此Web服务,以创建可立即使用SIP或其他任何方式(通过WS/WSS的SIP、WebRTC…)进行注册的对等点

如果您在Unix上工作,并且需要.Net Web服务,那么可以使用NUSOAP和类似的东西:(sudo nano/var/html/www/mywebservice.php`。这是我用于测试的基本实现

<?php
require_once("nusoap.php");


$namespace = "http://yourdomain.com";
// create a new soap server
$server = new soap_server();
// configure your WSDL
$server->configureWSDL("AsteriskRealtime");
// set your namespace
$server->wsdl->schemaTargetNamespace = $namespace;
// register your WebMethod
$server->register(
                // method name:
                'HelloWorld',
            // parameter list:
                array('name'=>'xsd:string'),
                // return value(s):
                array('return'=>'xsd:string'),
                // namespace:
                $namespace,
                // soapaction: (use default)
                false,
                // style: rpc or document
                'rpc',
                // use: encoded or literal
                'encoded',
                // description: documentation for the method
                'A simple hello world');



$server->wsdl->addComplexType(
   'AsteriskExtensions',
   'complexType',
   'struct',
   'all','',
   array(
      'name' => array('name' => 'name', 'type' => 'xsd:string'),
      'custom_id' => array('name' => 'custom_id', 'type' => 'xsd:string')
   )
);

$server->wsdl->addComplexType(
   'AsteriskExtensionsArray',
   'complexType',
   'array','',
   'SOAP-ENC:Array',array(),
   array(
      array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'tns:AsteriskExtensions[]')
   ),
   'tns:AsteriskExtensions'
);


$server->register(
                // method name:
                'GetRegisteredExtensions',
                // parameter list:
                array(),
                // return value(s):
                array('AsteriskExtensions' => 'tns:AsteriskExtensionsArray'),
                // namespace:
                $namespace,
                // soapaction: (use default)
                false,
                // style: rpc or document
                'rpc',
                // use: encoded or literal
                'encoded',
                // description: documentation for the method
                'List the extensions registered in AsteriskRealtime database.');


$server->register(
                // method name:
                'AddUpdateExtension',
                // parameter list:
                array('name' => 'xsd:string', 'password' => 'xsd:string', 'custom_id' => 'xsd:string'),
                // return value(s):
                array('return' => 'xsd:string'),
                // namespace:
                $namespace,
                // soapaction: (use default)
                false,
                // style: rpc or document
                'rpc',
                // use: encoded or literal
                'encoded',
                // description: documentation for the method
                'Add or Update an extension in AsteriskRealtime database. NAME is the PRIMARY KEY.  Returns OK for success or ERR for failure.');



$server->register(
                // method name:
                'DeleteExtension',
                // parameter list:
                array('name' => 'xsd:string'),
                // return value(s):
                array('return' => 'xsd:string'),
                // namespace:
                $namespace,
                // soapaction: (use default)
                false,
                // style: rpc or document
                'rpc',
                // use: encoded or literal
                'encoded',
                // description: documentation for the method
                'Delete an extension registered in AsteriskRealtime database. Returns OK for success or ERR for failure. ');

$server->register(
                // method name:
                'GetByCustomId',
                // parameter list:
                array('name' => 'xsd:string'),
                // return value(s):
                array('AsteriskExtensions' => 'tns:AsteriskExtensionsArray'),
                // namespace:
                $namespace,
                // soapaction: (use default)
                false,
                // style: rpc or document
                'rpc',
                // use: encoded or literal
                'encoded',
                // description: documentation for the method
                'Gets an extension or a list of extensions for a CustomID. ');






function HelloWorld($sName)
{
    return 'Hello ' . $sName . '!  Hello world!';
}

function  GetRegisteredExtensions()
{ 
    $conn=odbc_connect('your-asterisk-connector-as-in-odbcinst.ini','your-mysql-user','your-mysql-password');
    $result = array();
    $req="SELECT * FROM `sippeers`";
    $res=odbc_exec($conn,$req);
    while($obj=odbc_fetch_object($res)) {
        $result[] = array( 'name' => $obj->name, 'custom_id' => $obj->custom_id);
    }
    return $result;
}

function  AddUpdateExtension($name,$password,$custom_id)
{
        $conn=odbc_connect('your-asterisk-connector-as-in-odbcinst.ini','your-mysql-user','your-mysql-password');
    $req="DELETE FROM `sippeers` WHERE `name` = '" . $name . "'";
        $res=odbc_exec($conn,$req);
        $req="insert into `sippeers` (`name`, `ipaddr`, `port`, `regseconds`, `defaultuser`, `fullcontact`, `regserver`, `useragent`, `lastms`, `host`, `type`, `context`, `permit`, `deny`, `secret`, `md5secret`, `remotesecret`, `transport`, `dtmfmode`, `directmedia`, `nat`, `callgroup`, `pickupgroup`, `language`, `disallow`, `allow`, `insecure`, `trustrpid`, `progressinband`, `promiscredir`, `useclientcode`, `accountcode`, `setvar`, `callerid`, `amaflags`, `callcounter`, `busylevel`, `allowoverlap`, `allowsubscribe`, `videosupport`, `maxcallbitrate`, `rfc2833compensate`, `mailbox`, `session-timers`, `session-expires`, `session-minse`, `session-refresher`, `t38pt_usertpsource`, `regexten`, `fromdomain`, `fromuser`, `qualify`, `defaultip`, `rtptimeout`, `rtpholdtimeout`, `sendrpid`, `outboundproxy`, `callbackextension`, `timert1`, `timerb`, `qualifyfreq`, `constantssrc`, `contactpermit`, `contactdeny`, `usereqphone`, `textsupport`, `faxdetect`, `buggymwi`, `auth`, `fullname`, `trunkname`, `cid_number`, `callingpres`, `mohinterpret`, `mohsuggest`, `parkinglot`, `hasvoicemail`, `subscribemwi`, `vmexten`, `autoframing`, `rtpkeepalive`, `call-limit`, `g726nonstandard`, `ignoresdpversion`, `allowtransfer`, `dynamic`, `path`, `supportpath`, `avpf`, `encryption`, `dtlsenable`, `dtlsverify`, `dtlscertfile`, `dtlsprivatekey`, `dtlssetup`, `force_avp`, `custom_id`) values('" . $name . "',NULL,NULL,NULL,'" . $name . "','','',NULL,'0','dynamic','friend','default',NULL,NULL,'" . $password . "',NULL,NULL,'udp,ws,wss','auto','no',NULL,NULL,NULL,NULL,NULL,'ulaw,alaw,g729,h264,g719,opus,vp8,gsm',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'no',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'yes','',NULL,'yes','yes','yes','no','/etc/asterisk/keys/asterisk.pem','/etc/asterisk/keys/asterisk.pem','actpass','yes','" . $custom_id . "')";
        $res=odbc_exec($conn,$req);

        return 'OK';
}


function  DeleteExtension($name)
{
        $conn=odbc_connect('your-asterisk-connector-as-in-odbcinst.ini','your-mysql-user','your-mysql-password');
        $req="DELETE FROM `sippeers` WHERE `name` = '" . $name . "'";
        $res=odbc_exec($conn,$req);
        return 'OK';
}

function GetByCustomId($name)
{
    $conn=odbc_connect('your-asterisk-connector-as-in-odbcinst.ini','your-mysql-user','your-mysql-password');
        $result = array();
        $req="SELECT * FROM `sippeers` WHERE `custom_id` = '" . $name . "'";
        $res=odbc_exec($conn,$req);
        while($obj=odbc_fetch_object($res)) {
                $result[] = array( 'name' => $obj->name, 'custom_id' => $obj->custom_id);
        }
        return $result;
}


// Get our posted data if the service is being consumed
// otherwise leave this data blank.
$POST_DATA = isset($GLOBALS['HTTP_RAW_POST_DATA']) ? $GLOBALS['HTTP_RAW_POST_DATA'] : '';

// pass our posted data (or nothing) to the soap service
$server->service($POST_DATA);
exit();
?>

你可以查看我在星号12+实时+WebRTC上的帖子:

最重要的是,添加一个Web服务,将一个对等点插入表sippeers中。您的系统将调用此Web服务,以创建可立即使用SIP或其他任何方式(通过WS/WSS的SIP、WebRTC…)进行注册的对等点

如果您在Unix上工作,并且需要.Net Web服务,那么可以使用NUSOAP和类似的东西:(sudo nano/var/html/www/mywebservice.php`。这是我用于测试的基本实现

<?php
require_once("nusoap.php");


$namespace = "http://yourdomain.com";
// create a new soap server
$server = new soap_server();
// configure your WSDL
$server->configureWSDL("AsteriskRealtime");
// set your namespace
$server->wsdl->schemaTargetNamespace = $namespace;
// register your WebMethod
$server->register(
                // method name:
                'HelloWorld',
            // parameter list:
                array('name'=>'xsd:string'),
                // return value(s):
                array('return'=>'xsd:string'),
                // namespace:
                $namespace,
                // soapaction: (use default)
                false,
                // style: rpc or document
                'rpc',
                // use: encoded or literal
                'encoded',
                // description: documentation for the method
                'A simple hello world');



$server->wsdl->addComplexType(
   'AsteriskExtensions',
   'complexType',
   'struct',
   'all','',
   array(
      'name' => array('name' => 'name', 'type' => 'xsd:string'),
      'custom_id' => array('name' => 'custom_id', 'type' => 'xsd:string')
   )
);

$server->wsdl->addComplexType(
   'AsteriskExtensionsArray',
   'complexType',
   'array','',
   'SOAP-ENC:Array',array(),
   array(
      array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'tns:AsteriskExtensions[]')
   ),
   'tns:AsteriskExtensions'
);


$server->register(
                // method name:
                'GetRegisteredExtensions',
                // parameter list:
                array(),
                // return value(s):
                array('AsteriskExtensions' => 'tns:AsteriskExtensionsArray'),
                // namespace:
                $namespace,
                // soapaction: (use default)
                false,
                // style: rpc or document
                'rpc',
                // use: encoded or literal
                'encoded',
                // description: documentation for the method
                'List the extensions registered in AsteriskRealtime database.');


$server->register(
                // method name:
                'AddUpdateExtension',
                // parameter list:
                array('name' => 'xsd:string', 'password' => 'xsd:string', 'custom_id' => 'xsd:string'),
                // return value(s):
                array('return' => 'xsd:string'),
                // namespace:
                $namespace,
                // soapaction: (use default)
                false,
                // style: rpc or document
                'rpc',
                // use: encoded or literal
                'encoded',
                // description: documentation for the method
                'Add or Update an extension in AsteriskRealtime database. NAME is the PRIMARY KEY.  Returns OK for success or ERR for failure.');



$server->register(
                // method name:
                'DeleteExtension',
                // parameter list:
                array('name' => 'xsd:string'),
                // return value(s):
                array('return' => 'xsd:string'),
                // namespace:
                $namespace,
                // soapaction: (use default)
                false,
                // style: rpc or document
                'rpc',
                // use: encoded or literal
                'encoded',
                // description: documentation for the method
                'Delete an extension registered in AsteriskRealtime database. Returns OK for success or ERR for failure. ');

$server->register(
                // method name:
                'GetByCustomId',
                // parameter list:
                array('name' => 'xsd:string'),
                // return value(s):
                array('AsteriskExtensions' => 'tns:AsteriskExtensionsArray'),
                // namespace:
                $namespace,
                // soapaction: (use default)
                false,
                // style: rpc or document
                'rpc',
                // use: encoded or literal
                'encoded',
                // description: documentation for the method
                'Gets an extension or a list of extensions for a CustomID. ');






function HelloWorld($sName)
{
    return 'Hello ' . $sName . '!  Hello world!';
}

function  GetRegisteredExtensions()
{ 
    $conn=odbc_connect('your-asterisk-connector-as-in-odbcinst.ini','your-mysql-user','your-mysql-password');
    $result = array();
    $req="SELECT * FROM `sippeers`";
    $res=odbc_exec($conn,$req);
    while($obj=odbc_fetch_object($res)) {
        $result[] = array( 'name' => $obj->name, 'custom_id' => $obj->custom_id);
    }
    return $result;
}

function  AddUpdateExtension($name,$password,$custom_id)
{
        $conn=odbc_connect('your-asterisk-connector-as-in-odbcinst.ini','your-mysql-user','your-mysql-password');
    $req="DELETE FROM `sippeers` WHERE `name` = '" . $name . "'";
        $res=odbc_exec($conn,$req);
        $req="insert into `sippeers` (`name`, `ipaddr`, `port`, `regseconds`, `defaultuser`, `fullcontact`, `regserver`, `useragent`, `lastms`, `host`, `type`, `context`, `permit`, `deny`, `secret`, `md5secret`, `remotesecret`, `transport`, `dtmfmode`, `directmedia`, `nat`, `callgroup`, `pickupgroup`, `language`, `disallow`, `allow`, `insecure`, `trustrpid`, `progressinband`, `promiscredir`, `useclientcode`, `accountcode`, `setvar`, `callerid`, `amaflags`, `callcounter`, `busylevel`, `allowoverlap`, `allowsubscribe`, `videosupport`, `maxcallbitrate`, `rfc2833compensate`, `mailbox`, `session-timers`, `session-expires`, `session-minse`, `session-refresher`, `t38pt_usertpsource`, `regexten`, `fromdomain`, `fromuser`, `qualify`, `defaultip`, `rtptimeout`, `rtpholdtimeout`, `sendrpid`, `outboundproxy`, `callbackextension`, `timert1`, `timerb`, `qualifyfreq`, `constantssrc`, `contactpermit`, `contactdeny`, `usereqphone`, `textsupport`, `faxdetect`, `buggymwi`, `auth`, `fullname`, `trunkname`, `cid_number`, `callingpres`, `mohinterpret`, `mohsuggest`, `parkinglot`, `hasvoicemail`, `subscribemwi`, `vmexten`, `autoframing`, `rtpkeepalive`, `call-limit`, `g726nonstandard`, `ignoresdpversion`, `allowtransfer`, `dynamic`, `path`, `supportpath`, `avpf`, `encryption`, `dtlsenable`, `dtlsverify`, `dtlscertfile`, `dtlsprivatekey`, `dtlssetup`, `force_avp`, `custom_id`) values('" . $name . "',NULL,NULL,NULL,'" . $name . "','','',NULL,'0','dynamic','friend','default',NULL,NULL,'" . $password . "',NULL,NULL,'udp,ws,wss','auto','no',NULL,NULL,NULL,NULL,NULL,'ulaw,alaw,g729,h264,g719,opus,vp8,gsm',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'no',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'yes','',NULL,'yes','yes','yes','no','/etc/asterisk/keys/asterisk.pem','/etc/asterisk/keys/asterisk.pem','actpass','yes','" . $custom_id . "')";
        $res=odbc_exec($conn,$req);

        return 'OK';
}


function  DeleteExtension($name)
{
        $conn=odbc_connect('your-asterisk-connector-as-in-odbcinst.ini','your-mysql-user','your-mysql-password');
        $req="DELETE FROM `sippeers` WHERE `name` = '" . $name . "'";
        $res=odbc_exec($conn,$req);
        return 'OK';
}

function GetByCustomId($name)
{
    $conn=odbc_connect('your-asterisk-connector-as-in-odbcinst.ini','your-mysql-user','your-mysql-password');
        $result = array();
        $req="SELECT * FROM `sippeers` WHERE `custom_id` = '" . $name . "'";
        $res=odbc_exec($conn,$req);
        while($obj=odbc_fetch_object($res)) {
                $result[] = array( 'name' => $obj->name, 'custom_id' => $obj->custom_id);
        }
        return $result;
}


// Get our posted data if the service is being consumed
// otherwise leave this data blank.
$POST_DATA = isset($GLOBALS['HTTP_RAW_POST_DATA']) ? $GLOBALS['HTTP_RAW_POST_DATA'] : '';

// pass our posted data (or nothing) to the soap service
$server->service($POST_DATA);
exit();
?>


谢谢。我可以使用实时数据库来完成这项工作,从而生成实时sip。字段的顺序很重要。谢谢。我可以使用实时数据库来完成这项工作,从而生成实时sip。字段的顺序很重要。谢谢。我可以使用实时数据库来完成这项工作,从而生成实时sip。顺序很重要谢谢。我可以使用实时数据库来实现这一点,从而生成实时sip。字段的顺序很重要。