InnovateAsterisk / Browser-Phone

A fully featured browser based WebRTC SIP phone for Asterisk
https://www.innovateasterisk.com
GNU Affero General Public License v3.0
470 stars 239 forks source link

Integration with external application #519

Open prathibhacdac opened 3 months ago

prathibhacdac commented 3 months ago

I want to send call START, call CONNECT and call END messages through UDP communication to an external application. Is it possible?

rosliyaakub commented 3 months ago

you can use "BroadcastChannel" here to for this exercise.

some snipped code below:

const channel = new BroadcastChannel('app-data'); channel.addEventListener ('message', (event) => { if (event.data == "hangup"){ // then call hangup event here;

          if ($(".progressCall").is(":visible")){
              var reject_func = $(".progressCall .rejectButton").attr('onclick');
              // then call reject button here
          }
        }else{
          // call dial event here
        }
      });
InnovateAsterisk commented 3 months ago

Or you can just use the web hooks.

var web_hook_on_invite = function(session){
    // console.log("web_hook_on_invite", session);
}
var web_hook_on_modify = function(action, session){
    // console.log("web_hook_on_modify", action, session);
}
var web_hook_on_terminate = function(session){
    // console.log("web_hook_on_terminate", session);
}