Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

drachtio signaling resource framework

License

NotificationsYou must be signed in to change notification settings

drachtio/drachtio-srf

Repository files navigation

drachtio logo

Welcome to the Drachtio Signaling Resource framework (drachtio-srf), the Node.js framework for SIP Server applications.

Please visitdrachtio.org for getting started instructions, API documentation, sample apps and more!

Example proxy

constSrf=require('drachtio-srf');constsrf=newSrf();srf.connect({host:'192.168.32.5',port:9022,secret:'cymru'});srf.invite((req,res)=>{srf.proxyRequest(req,['sip.example1.com','sip.example2.com'],{recordRoute:true,followRedirects:true,provisionalTimeout:'2s'}).then((results)=>{console.log(JSON.stringify(result));// {finalStatus: 200, finalResponse:{..}, responses: [..]}});});

Example Back-to-back user agent

constSrf=require('drachtio-srf');constsrf=newSrf();srf.connect({host:'192.168.32.5',port:9022,secret:'cymru'});constSrf=require('drachtio-srf');constsrf=newSrf();srf.invite((req,res)=>{srf.createB2BUA('sip:1234@10.10.100.1',req,res,{localSdpB:req.body}).then(({uas, uac})=>{console.log('call connected');// when one side terminates, hang up the otheruas.on('destroy',()=>{uac.destroy();});uac.on('destroy',()=>{uas.destroy();});return;}).catch((err)=>{console.log(`call failed to connect:${err}`);});});

Example sending a request (OPTIONS ping)

constSrf=require('drachtio-srf');constsrf=newSrf();srf.connect({host:'127.0.0.1',port:9022,secret:'cymru'});srf.on('connect',(err,hp)=>{if(err)returnconsole.log(`Error connecting:${err}`);console.log(`connected to server listening on${hp}`);setInterval(optionsPing,10000);});functionoptionsPing(){srf.request('sip:tighthead.drachtio.org',{method:'OPTIONS',headers:{'Subject':'OPTIONS Ping'}},(err,req)=>{if(err)returnconsole.log(`Error sending OPTIONS:${err}`);req.on('response',(res)=>{console.log(`Response to OPTIONS ping:${res.status}`);});});}

[8]ページ先頭

©2009-2025 Movatter.jp