Author Topic: Make Call, Play 2 Audio files and Disconnect ( Hello World script )  (Read 7289 times)

jamie

  • Newbie
  • *
  • Posts: 38
    • View Profile
Hi

Please could I ask for for help ?

As a simple training exercise for myself, I'm trying to achieve the following:

1. Make a Call
2. Wait for answer
3. Play 2 or more prompts, one after the other.
4. Disconnect

This is in a global php script on a Windows machine.


I've been loosely following an example suggested by Monica Tepelus here:

http://yate.null.ro/archive/?action=show_msg&actionargs%5B%5D=81&actionargs%5B%5D=79

I understand the theory ok, but I'm having some difficulties implementing it.


The first step suggests to call execute to a dumb channel, then chan.masquerade a real destination on behalf of the dumb channel.

So, this is what I started with:

Code: [Select]

       $m = new Yate("call.execute");
       $m->SetParam("callto","dumb/");
       $m->Dispatch();



       $m = new Yate("chan.masquerade");
       $m->SetParam("message","call.execute");
       $m->SetParam("id", $id_from_above_call_execute   );
       $m->SetParam( "target", 'test2' );
       $m->SetParam( "caller",  'test5');
       $m->Dispatch();



-----  listen for call.answer -----

       $m = new Yate("chan.masquerade");
       $m->SetParam("message","chan.attach");
       $m->SetParam("id", $id_from_above_call_execute );
       $m->SetParam("source", 'wave/play/C:\Program Files\Yate\share\sounds/welcome.au' );
       $m->Dispatch();



      ( test2 and test5 are two registered users )



but on running this, unfortunately I can't get past:

<dumb:WARN> Outgoing call with no target!

which appears to be generated from the call.execute to the dumb channel.



From getting 'call.answered' I was going to use the following

Multiple prompts using the notify and listening for 'eof'

http://yate.null.ro/archive/?action=show_msg&actionargs%5B%5D=54&actionargs%5B%5D=87



Some help on getting me going on this would really be appreciated,

Thank you!
Jamie









« Last Edit: December 14, 2014, 09:24:29 PM by jamie »

marian

  • Hero Member
  • *****
  • Posts: 513
    • View Profile
Re: Make Call, Play 2 Audio files and Disconnect ( Hello World script )
« Reply #1 on: December 16, 2014, 02:35:28 AM »
call.execute is used to call from a channel.
You don't have one in your script.

Some modules (like dumb, tonegen) have the ability to build a channel and re-send the call.execute message.
You must add a 'target' (containing the called party number) parameter to your message.
If you do it the dumb module will send a call.route message and then a call.execute on behalf of the newly created dumb channel.
If you add a 'direct' parameter the dumb module will send a call.execute (to indicated 'direct' will be set in 'callto' parameter) without routing the call.

On return your call.execute will contain the 'id' of the dumb channel and 'peerid' its peer channel id.
You may then use these to track the call.

Don't forget to track call termination.
You may use call.cdr with operation=finalize: check the 'chan' parameter
You may also track chan.disconnected for either channel (chan.disconnected is sent by the disconnected channel, i.e. for a call only 1 channel will send it).

When you attach your sources (play) instruct wavefile to notify on termination and do your stuff when a source terminates.
See http://docs.yate.ro/wiki/Chan.attach and http://docs.yate.ro/wiki/Chan.notify

When you are done just enqueue a call.drop message with 'id' set to one of the tracked channel's id.


jamie

  • Newbie
  • *
  • Posts: 38
    • View Profile
Re: Make Call, Play 2 Audio files and Disconnect ( Hello World script )
« Reply #2 on: January 04, 2015, 01:10:18 PM »

Thanks Marian and happy new year !

That makes sense now.