[ previous ] [ next ] [ threads ]
 To :  Rodrigo Ricardo Passos <rodrigopassos@g...>,"yate@v..." <yate@v...>
 From :  Marian Podgoreanu <marian@v...>
 Subject :  Re: [yate] Drop a call in Javascript
 Date :  Fri, 09 Jan 2015 09:58:40 +0200
Hi,

You don't need to drop the call.
Execute it to wave: it will be terminated when file play is done.

if (msg.cause_sip == 410) {
     var m = new Message("chan.masquerade");
     m.message = "call.execute";
     m.id = partycallid;
     m.callto = "wave/play//etc/yate/invalidCall.alaw";
     if (m.dispatch()) {
         var progress = new Message("chan.masquerade");
         progress.message = "call.progress";
         progress.id = m.peerid;
         progress.earlymedia = "true";
         progress.dispatch();
     }
}

NOTE: You should avoid answering the call:
- The caller will hear the prompt anyway
- There might be billing issues

Marian

On 09.01.2015 06:41, Rodrigo Ricardo Passos wrote:
> Hi Yate,
>
> I'm using chan.masquerade to get a message to an incorrect dialed
> number, with noroute returned by sip message.
>
> The javascript below, get the announcement, but, can't disconnect the call.
>
> function onCallDisconnect(msg){
>
>      var partycallid = msg.id;
>      if (msg.cause_sip == 410) {
>
>          var m = new Message("chan.masquerade");
>          m.message = "call.execute";
>          m.id = partycallid;
>          m.callto = "dumb/";
>          m.dispatch();
>
>          var am = new Message("chan.masquerade");
>          am.message = "chan.attach";
>          am.id = m.peerid;
>          am.source = "wave/play//etc/yate/invalidCall.alaw";
>          am.notify = m.peerid;
>
>          am.dispatch();
>
>          var nm = new Message("chan.masquerade");
>          nm.message = "call.progress";
>          nm.id = am.id;
>          nm.earlymedia = "true";
>
>          nm.dispatch();
>
>          var wm = new Message("call.answered");
>          wm.id = nm.peerid;
>          wm.targetid = partycallid;
>          wm.rtp_forward = "no";
>
>          wm.dispatch();
>
>      }
>
>      return false;
>
> }
>
> Engine.debugName("disconnected_proc");
> Message.trackName("disconnected_proc");
> Message.install(onCallDisconnect, "chan.disconnected", disconnectPrio);
>
>
> If i put call.drop, the message can't be listened. Someone could help,
> to show me where is my error?
>
> Regards,
>
>
> Rodrigo