Author Topic: place a new call after calll has been answered  (Read 555 times)

xyswitchz

  • Newbie
  • *
  • Posts: 26
    • View Profile
place a new call after calll has been answered
« on: April 11, 2018, 06:59:09 PM »
In regexroute on call.answered how to originate a separate new call ?

I tried but it does nothing

[call.answered]
^.*$=echo answered
^.*$=dispatch chan.masquerade;message=call.execute;callto=wave/play//usr/local/yate/audio.sln;direct=sip/sip:bruce@9.8.7.6;line=localsip

marian

  • Hero Member
  • *****
  • Posts: 508
    • View Profile
Re: place a new call after calll has been answered
« Reply #1 on: April 12, 2018, 03:43:01 AM »
For chan.masquerade you need to indicate channel id to handle it in 'id' parameter.
If you need to re-execute the call it is useless to put the 'direct' parameter.
When the required call leg will masquerade the call.execute the target module (wavefile) will detect the request is from an existing call leg and will ignore the 'direct' parameter.

If you want to make a completely new call, unrelated to handled message you must enqueue/dispatch a call.execute message (not a chan.masquerade) with parameters listed in the post:
^.*$=dispatch call.execute;callto=wave/play//usr/local/yate/audio.sln;direct=sip/sip:bruce@9.8.7.6;line=localsip

xyswitchz

  • Newbie
  • *
  • Posts: 26
    • View Profile
Re: place a new call after calll has been answered
« Reply #2 on: April 12, 2018, 08:52:13 AM »
thanks marian.

One more question How would execute a new call and place into directly in a conference room.

something like?

^.*$=dispatch call.execute;callto=conf/studio;direct=sip/sip:bruce@9.8.7.6;line=localsip


marian

  • Hero Member
  • *****
  • Posts: 508
    • View Profile
Re: place a new call after calll has been answered
« Reply #3 on: April 13, 2018, 01:00:10 AM »
conference module does not support making outbound calls.

You need to connect the outbound call leg to conference after started.
You may use some call event to do it (e.g. answer).

You may also use an external script to do it.
Here is an example of javascript function to do it:

function makeCallConf(callto)
{
    var m = new Message("call.execute");
    m.callto = "dumb/";
    m.direct = callto;
    // TODO: Fill other params
    if (m.dispatch()) {
        // Connect outbound call leg to conference
        var masq = new Message("chan.masquerade");
        masq.message = "call.execute";
        masq.id = m.peerid;
        masq.callto = "conf/studio";
        masq.enqueue();
    }
}