Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems playing audio into call #28

Open
ruipfmendes opened this issue Oct 23, 2019 · 2 comments
Open

Problems playing audio into call #28

ruipfmendes opened this issue Oct 23, 2019 · 2 comments

Comments

@ruipfmendes
Copy link

ruipfmendes commented Oct 23, 2019

Hello Dave,

Me and a colleague of mine are working on an academic project that we are building based on this Drachtio and Freeswitch framework but we have been running into some problems playing audio into our call as was somewhat described here. We use containers for both of them as is suggested in several of your readmes/comments.
I decided to open a new issue with more info so that maybe we could pinpoint the problem since we have been stuck on this for a long time

We changed our app.js to be similar to what you showed us and right now it looks like this:

const Srf = require('drachtio-srf');
const srf = new Srf();
const Mrf = require('drachtio-fsmrf');
const mrf = new Mrf(srf);


srf.connect({
  "host": "127.0.0.1",
  "port": 9060,
  "secret": "cymru"
})
  .on('connect', (err, hp) => console.log(`connected to sip on ${hp}`))
  .on('error', (err) => console.log(err, 'Error connecting'));


srf.register((req, res) => {
  res.send(200);
});

srf.invite(async(req, res) => {
  try {
    const ms = await mrf.connect(
    { address:'127.0.0.1',
      port: 9070,
      secret: 'ClueCon'});
    
    const {endpoint, dialog} = await ms.connectCaller(req, res);
    console.log('Call connected');
    dialog.on('destroy', () => {
      console.log('Call ended');
      endpoint.destroy();
    });

    // await endpoint.play('/file.wav');
    await endpoint.play('http://www.music.helsinki.fi/tmt/opetus/uusmedia/esim/a2002011001-e02.wav');
    console.log('Finished playing');
  } catch (err) {
    console.log(err);
  }
});

Dockerfile:

version: '3'

networks: 
  sip-stack-drachtio:
    driver: bridge
    ipam:
      config:
        - subnet: 172.38.0.0/16

services:

  drachtio-server:
    image: drachtio/drachtio-server:latest
    command: drachtio --contact "sip:*;transport=udp" --loglevel warning --sofia-loglevel 9
    container_name: drachtio
    ports:
      - "9060:9022/tcp"
      - "5060:5060/tcp"
      - "5060:5060/udp"
    networks:
      sip-stack-drachtio:
        ipv4_address: 172.38.0.13

  freeswitch:
    image: drachtio/drachtio-freeswitch-mrf:latest
    command: freeswitch --sip-port 5060 --rtp-range-start 20000 --rtp-range-end 20040
    container_name: freeswitch
    ports:
      - "9070:8021/tcp"
      - "20000-20040:20000-20040/udp"
      - "20000-20040:20000-20040/tcp"
    
    networks:
      sip-stack-drachtio:
        ipv4_address: 172.38.0.14

package related dependencies:

"dependencies": {
    "drachtio-fn-fsmrf-sugar": "0.0.9",
    "drachtio-fsmrf": "^1.5.7",
    "drachtio-mw-registration-parser": "^0.1.0",
    "drachtio-srf": "^4.4.18"
  }

We use zoiper5 to make a call. The registration process works, the call is accepted and it hangs on silently for some time (around 30s) before printing the "Call ended" and "Finished playing" logs.

Are we doing something wrong? Could this be a container issue? We are not sure what else to test. I've considered running freeswitch locally on my machine to test but the configuration needed to set it up with drachtio is kind of scary for a newbie and deterred me.

Thank you in advance :)

@guy032
Copy link

guy032 commented Mar 31, 2020

I agree. It happens to me as well.
I found out that with Mizudroid on Android I can hear the sound when using their video call feature but not on their regular voice call feature. It seems to me that their video call is using their proxy which is not used by their voice call.

@guy032
Copy link

guy032 commented Apr 26, 2020

It's all about figuring out if the Freeswitch server external ip is configured to work with a public IP or not. By default the image on docker most of the time will use a private one. you can check yourself and see how it's configured with sofia status profile drachtio_mrf:
Ext-RTP-IP
Ext-SIP-IP

I think you can close it now @davehorton

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants