Author Topic: how to play wave file to conference using javascript module  (Read 11179 times)

attank

  • Newbie
  • *
  • Posts: 2
    • View Profile
how to play wave file to conference using javascript module
« on: August 22, 2014, 12:29:56 PM »
Hello,

I am trying to play file to conference when user joined but no success...

I do not know how to create utility leg and play file to it (I am getting usually "Conference call with no call endpoint"...)

Thanks in advance for any help.


/*
 * conf.js
 */


function onMessage(msg)
{
    if (msg.event == "joined")
    {
        playFile(msg, "/usr/local/yate/sounds/conference/8000/conf-alone.alaw");
    }
}

function playFile(msg, file)
{
//  how to play ???????????????...
}

Message.install(onMessage, "chan.notify", 50);

Monica Tepelus

  • Administrator
  • Full Member
  • *****
  • Posts: 198
    • View Profile
Re: how to play wave file to conference using javascript module
« Reply #1 on: August 25, 2014, 12:53:29 PM »
Hi,

You play a file with chan.attach
http://docs.yate.ro/wiki/Chan.attach

Depending on the scenario you might need to send it inside a chan.masquerade.
http://docs.yate.ro/wiki/Chan.masquerade

I'm not sure how your javascript works. You must first make sure the javascript script is started and sees the relevant messages for the conference.

attank

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: how to play wave file to conference using javascript module
« Reply #2 on: August 25, 2014, 01:25:31 PM »
Thanks for reply



/*
 * conf.js
 */


function onMessage(msg)
{
    if (msg.event == "joined")
    {
       Engine.output("=====================================================================" + msg.id);
        playFile2(msg, "conf-alone.alaw");
    }
}

//
// <WARN> Wave override 'conf-alone.alaw' attach request with no data channel!
//
function playFile1(msg, file)
{
    var m = new Message("chan.attach");
    m.room = "conf/" + msg.room;
    m.override = "wave/play/" + file;
    m.single = true;
    m.dispatch();
}

//
// No error messages
//
function playFile2(msg, file)
{
    var m = new Message("chan.masquerade");
    m.message = "chan.attach";
    m.room = "conf/" + msg.room;
    m.override = "wave/play/" + file;
    m.single = true;
    m.id = msg.id;
    m.dispatch();
}



Message.install(onMessage, "chan.notify", 50);



Javascript works as i see debug output. When i am trying "chan.attach" i am getting "<WARN> Wave override 'conf-alone.alaw' attach request with no data channel!"
when "chan.masquerade" - nothing happend.


Monica Tepelus

  • Administrator
  • Full Member
  • *****
  • Posts: 198
    • View Profile
Re: how to play wave file to conference using javascript module
« Reply #3 on: August 28, 2014, 02:20:01 PM »
Start sniffer and check the various messages and their parameters. See what is the appropriate message and parameter you need. If you  can't tell post the log.