小编Mic*_*bov的帖子

如何在JsSIP中处理音频流?

我正在创建使用JsSIP库来应答通过VoIP SIP提供商进行的呼叫的React应用程序.

我已经创建了一个有两个按钮的页面(Accept和Reject).它成功在SIP服务器上注册SIP客户端.它也成功接听电话,我可以回答.但接听电话时我什么都没听到.

注册JsSIP客户端(willReceiveProps因为我有道具更改后的连接信息):

const socketHost = 'wss://' + contactCenter.host + ':' + contactCenter.port
const socket = new JsSIP.WebSocketInterface(socketHost)
const configuration = {
    sockets: [socket],
    uri: 'sip:' + contactCenter.login + '@' + contactCenter.host,
    password: contactCenter.password,
    socketHost: socketHost,
}

const coolPhone = new JsSIP.UA(configuration)

coolPhone.on('connected', (e: any) => {
    const messages = ServiceContainer.get<MessageManagerInterface>(ServiceTypes.Messages)
    messages.addSuccess('SIP connected')
})

coolPhone.on('newRTCSession', (e: any) => {
    const messages = ServiceContainer.get<MessageManagerInterface>(ServiceTypes.Messages)
    messages.addAlert('New call')

    const session = e.session

    session.on('failed', this.resetLocalState)
    session.on('ended', this.resetLocalState)

    const numberRegexp = /\"(\d+)\"/ …
Run Code Online (Sandbox Code Playgroud)

javascript sip typescript reactjs jssip

2
推荐指数
1
解决办法
2472
查看次数

Symfony,使用数组将对象序列化为保留属性和结构的 XML

我正在使用 Symfony2 并尝试将不同的对象集合序列化为 XML。为了简洁起见,我们假设我正在尝试列出和取消列出实体,这是我想要获得的 XML 结果:

<?xml version="1.0" encoding="UTF-8"?>
<r someattribute="value">
    <data_list>
        <item id="9" type="a"><![CDATA[list data 1]></item>
        <item id="10" type="a"><![CDATA[list data 2]></item>
        <item id="11" type="b"><![CDATA[list data 3]></item>
    </data_list>
    <data_unlist>
        <uitem id="9" type="a" />
    </data_unlist>
</r>
Run Code Online (Sandbox Code Playgroud)

以下是我的类:“item”节点的 Item、“uitem”节点的 Uitem 和 Model,以包含所有这些节点:

class Item
{
    private $data=array();
    public function getData() {return $this->data;}

    public function __construct($id, $type, $value)
    {
        $this->data["@id"]=$id;
        $this->data["@type"]=$type;
        //How do I put $value as the node value????
    }
}

class UItem
{
    private $data=array();
    public function getData() {return $this->data;}

    public …
Run Code Online (Sandbox Code Playgroud)

php xml serialization symfony

1
推荐指数
1
解决办法
7699
查看次数

使用 Jssip 的 Webrtc 客户端 - 使用 Free switch 和 chrome 双向无音频

我正在使用 JsSip 0.7x api 来制作 webrtc 的客户端。使用铬进行测试。使用网关终止对 pstn 的呼叫。在 index.html 中使用音频元素并在事件“addstream”初始注册邀请等消息交换和 200 ok 上添加远程流。

日志显示已添加远程流但双方没有音频甚至不响铃。媒体流活动:真,结束:假

有人可以提出可能的问题吗

  • index.html <audio id='remoteVideo' 控制 autoplay = "autoplay" > 不支持

-testjssip.js

var localStream, remoteStream = null;

var remoteVideo = document.getElementById('remoteVideo');
var ua, session = null;

var eventHandlers;
var configuration = {
    'ws_servers': '******',
    'uri': '******',
    'password': '*****'
};

// Register callbacks to desired call events 

eventHandlers = {

    'peerconnection': function (e) {

        console.trace("fired for outgoing calls but before sdp generation in peerconnection ");

    },
    'connecting': …
Run Code Online (Sandbox Code Playgroud)

javascript webrtc jssip

1
推荐指数
1
解决办法
4662
查看次数

无法加载类型Symfony2

好吧,它可能很简单,但我无法找到问题所在.我试过但我的问题没有匹配

我试图从形式类创建,而不是在控制器中创建表单..

这是代码..

这是来自控制器

    /**
 * @Route("login", name="login")
 */
public function loginAction (Request $request) {
    $registration = new Registration();

    $form = $this->createForm(LoginForm::class, $registration, array(
        'method' => 'POST'
    ));

    return $this->render(
        'admin/login.html.twig',
        array('form' => $form->createView())
    );
}
Run Code Online (Sandbox Code Playgroud)

在控制器内部,我使用USE来定义LoginForm,我在部分createForm中使用,所以这不是问题

这是来自FORM类

<?php

namespace AppBundle\AppForm;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;

class LoginForm extends AbstractType {
public function buildForm(FormBuilderInterface $builder, array $options)
{
    $builder
        ->add('name')
        ->add('password')
        ->add('save', SubmitType::class);
}
public function configureOptions(OptionsResolver $resolver)
{
    $resolver->setDefaults(
        array(
          'data_class' => 'AppBundle\Entity\Registration'
        ));
}

public function getName() …
Run Code Online (Sandbox Code Playgroud)

php symfony-forms symfony

1
推荐指数
1
解决办法
4665
查看次数

VueJS 的 WebPack encore 配置

当我从带有 VueJS 的基本 symfony 应用程序和 symfony 提供的 Webpack encore 包加载页面时出现以下错误

[Vue warn]: You are using the runtime-only build of Vue where the template compiler is not available. Either pre-compile the templates into render functions, or use the compiler-included build.

所以我需要将 VueJS 的别名更改为 webpack:

resolve: {
  alias: {
    vue: 'vue/dist/vue.js'
  }
}
Run Code Online (Sandbox Code Playgroud)

但是我没有在 Webpack Encore 中找到任何可以更改此设置的内容。

Webpack Encore:http ://symfony.com/doc/current/frontend.html

symfony webpack vue.js webpack-encore

1
推荐指数
1
解决办法
1200
查看次数