[ previous ] [ next ] [ threads ]
 To :  "yate@v..." <yate@v...>
 From :  Rodrigo Ricardo Passos <rodrigopassos@g...>
 Subject :  Drop a call in Javascript
 Date :  Fri, 09 Jan 2015 02:41:04 -0200
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