Created
June 27, 2019 14:13
-
-
Save phildunks/62628a2b6e2383cea6ed6c56390bb578 to your computer and use it in GitHub Desktop.
App logs and javascript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
srf.invite((req, res) => { | |
console.log(`Received an Invite`); | |
if( req.body.indexOf('Conferencing Control Leg') > -1) { | |
handleControlLegInvite( req, res ); | |
} | |
else{ | |
handleMediaLegInvite( req, res ); | |
} | |
}); | |
handleMediaLegInvite = (req, res) => { | |
console.log(`Handling Media Leg Invite`); | |
let uac, uas; | |
srf.createUAC('sip:1234@192.168.47.161:5063', {localSdp: req.body}) | |
.then((_uac) => { | |
uac = _uac; | |
srf.createUAS(req, res, { | |
localSdp: uac.remote.sdp, | |
headers: { | |
'User-Agent': 'drachtio/iechyd-da', | |
'X-Linked-UUID': '1e2587c' | |
} | |
}) | |
.then((_uas) => { | |
uas = _uas; | |
console.log('Created UAS Dialog For Media Leg. Local Tag = ', uas.sip.localTag); | |
console.log('Created UAS Dialog For Media Leg. Stack Dialog ID = ', uas.id); | |
addTag(uas.sip.localTag, uac.sip.callId); | |
uas.on('info', (req,res) => { handleInfo(req,res, uas.sip.callId, uas.id); }); | |
uas.on('destroy', () => { console.log('MM2 Ended Call'); uac.destroy(); removeTag(uas.sip.localTag); handleBye(uas.sip.callId)}); | |
uac.on('destroy', () => { console.log('DrumSwitch Ended Call' ); uas.destroy(); removeTag(uas.sip.localTag); }); | |
}) | |
.catch((err) => { | |
console.log(`Error Creating Media Leg UAS dialog: ${err}`); | |
uac.destroy(); | |
}) ; | |
}) | |
.catch((err) => { | |
console.log(`Media Leg Call Failed: ${err}`); | |
}); | |
}; | |
handleInfo = (req, res, callId, stackDialogId) => { | |
console.log('Processing INFO. MSML=', req.body); | |
res.send(200, 'OK', { | |
headers: { | |
'Content-Type': 'application/msml+xml' | |
}, | |
body: "<MSML value='response=200'/>" | |
}); | |
parser.parseString(req.body, function (err, result) { | |
// console.log('Error =', err); | |
// console.log('Parsed to JSON =', JSON.stringify(result,null,2)); | |
parseJSON(result.msml, callId, stackDialogId); | |
}); | |
}; | |
Phils-Mac-906:src $ DEBUG=drachtio:srf node server.js | |
connected to a drachtio server listening on: tcp/192.168.47.161:5060,tcp/192.168.47.161:5060,udp/192.168.47.161:5060,udp/192.168.47.161:5060 | |
drachtio:srf examining INVITE, dialog id: +0ms | |
Received an Invite | |
Handling Media Leg Invite | |
drachtio:srf Srf#addDialog: adding dialog with id 043fe682-1384-1238-98a7-0242ac110002;from-tag=8tX7cZ99UpSyc type INVITE, dialog count is now 1 +62ms | |
drachtio:srf Srf#addDialog: adding dialog with id wlQIfyWJXC;from-tag=1213583215616428499171.0 type INVITE, dialog count is now 2 +19ms | |
Created UAS Dialog For Media Leg. Local Tag = 93p0ettDSZFHr | |
Created UAS Dialog For Media Leg. Stack Dialog ID = wlQIfyWJXC;from-tag=1213583215616428499171.0 | |
Added Tag to Store [93p0ettDSZFHr] [043fe682-1384-1238-98a7-0242ac110002]. Store Size = 2 | |
drachtio:srf examining ACK, dialog id: wlQIfyWJXC;from-tag=1213583215616428499171.0 +19ms | |
drachtio:srf calling dialog handler +0ms | |
drachtio:srf Dialog handling message: ACK +0ms | |
drachtio:srf examining INFO, dialog id: wlQIfyWJXC;from-tag=1213583215616428499171.0 +4ms | |
drachtio:srf calling dialog handler +0ms | |
drachtio:srf Dialog handling message: INFO +4ms | |
Processing INFO. MSML= <?xml version='1.0' encoding='US-ASCII'?> | |
<msml version='1.1'> | |
<dialogstart target='conn:93p0ettDSZFHr' type='application/moml+xml' > | |
<play cvd:barge='true' cvd:cleardb='false' > | |
<audio uri='file://provisioned/bt/MM2/eng/pin_prompt.wav' /> | |
</play> | |
<dtmf fdt='10s' idt='20s' edt='20s' cleardb='false' > | |
<pattern digits='min=1;max=27;rtk=#' format='moml+digits'> | |
<exit namelist='dtmf.digits dtmf.end'/> | |
</pattern> | |
<noinput><exit namelist='dtmf.digits dtmf.end'/></noinput> | |
<nomatch><exit namelist='dtmf.digits dtmf.end'/></nomatch> | |
</dtmf> | |
</dialogstart> | |
</msml> | |
EXECUTING COMMANDS [ | |
{ | |
"type": "dialogStart", | |
"responseLeg": "wlQIfyWJXC;from-tag=1213583215616428499171.0", | |
"connId": "043fe682-1384-1238-98a7-0242ac110002", | |
"dialogName": "1561642850046", | |
"dtmf": { | |
"startTimeout": "10", | |
"digitTimeout": "20", | |
"min": "1", | |
"max": "27", | |
"terminator": "#" | |
}, | |
"play": { | |
"tracks": [ | |
"file://provisioned/bt/MM2/eng/pin_prompt.wav" | |
], | |
"notifyFinished": false | |
} | |
} | |
] | |
Emulating Dialog Ended { type: 'dialogStart', | |
responseLeg: 'wlQIfyWJXC;from-tag=1213583215616428499171.0', | |
connId: '043fe682-1384-1238-98a7-0242ac110002', | |
dialogName: '1561642850046', | |
dtmf: | |
{ startTimeout: '10', | |
digitTimeout: '20', | |
min: '1', | |
max: '27', | |
terminator: '#' }, | |
play: | |
{ tracks: [ 'file://provisioned/bt/MM2/eng/pin_prompt.wav' ], | |
notifyFinished: false } } | |
Sending INFO <?xml version="1.0"?><msml version="1.1"><event name="msml.dialog.exit" id="conn:043fe682-1384-1238-98a7-0242ac110002/dialog:1561642850046"><name>dtmf.end</name><value>dtmf.match</value><name>dtmf.digits</name><value>11111111#</value></event></msml> | |
drachtio:srf examining INVITE, dialog id: +81ms | |
Received an Invite | |
Handling Control Leg Invite! | |
drachtio:srf Srf#addDialog: adding dialog with id UWROczfBjJ;from-tag=1213583015616428501091.0 type INVITE, dialog count is now 3 +6ms | |
Created UAS Dialog For Control Leg | |
drachtio:srf examining ACK, dialog id: UWROczfBjJ;from-tag=1213583015616428501091.0 +13ms | |
drachtio:srf calling dialog handler +0ms | |
drachtio:srf Dialog handling message: ACK +100ms | |
drachtio:srf examining INFO, dialog id: UWROczfBjJ;from-tag=1213583015616428501091.0 +3ms | |
drachtio:srf calling dialog handler +0ms | |
drachtio:srf Dialog handling message: INFO +3ms | |
Processing INFO. MSML= <?xml version='1.0' encoding='US-ASCII'?> | |
<msml version="1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://convedia.com/msml" xmlns:cvd="http://convedia.com/ext"> | |
<createconference name="233442549241261" deletewhen="nocontrol"> | |
<audiomix id="1"> | |
<n-loudest n="4"/> | |
</audiomix> | |
</createconference> | |
</msml> | |
Added Control Leg Mapping to Store [UWROczfBjJ] [233442549241261]. Store Size = 1 | |
EXECUTING COMMANDS [] | |
drachtio:srf examining INFO, dialog id: UWROczfBjJ;from-tag=1213583015616428501091.0 +29ms | |
drachtio:srf calling dialog handler +0ms | |
drachtio:srf Dialog handling message: INFO +29ms | |
Processing INFO. MSML= <?xml version='1.0' encoding='US-ASCII'?> | |
<msml version="1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://convedia.com/msml" xmlns:cvd="http://convedia.com/ext"> | |
<join id1="conn:93p0ettDSZFHr" id2="conf:233442549241261"> | |
<stream dir="to-id1" media="audio"> | |
<gain amt="0"/> | |
</stream> | |
<stream dir="from-id1" media="audio" dlb:audio_processing="enable" dlb:audio_processing_ver="1" > | |
<clamp dtmf="true"/> | |
<gain amt="0"/> | |
</stream> | |
</join> | |
<dialogstart target="conn:93p0ettDSZFHr" type="application/moml+xml" name="listen"> | |
<dtmf fdt="0s" idt="5s" edt="5s" cleardb="true"> | |
<pattern digits="length=2" format="moml+digits"> | |
<exit namelist="dtmf.digits dtmf.end"/> | |
</pattern> | |
<noinput> | |
<exit namelist="dtmf.digits dtmf.end"/> | |
</noinput> | |
<nomatch> | |
<exit namelist="dtmf.digits dtmf.end"/> | |
</nomatch> | |
</dtmf> | |
</dialogstart> | |
<modifystream id1="conn:93p0ettDSZFHr" id2="conf:233442549241261"> | |
<stream media="audio" dir="to-id1"> | |
<gain amt="mute"/> | |
</stream> | |
</modifystream> | |
<dialogstart target="conn:93p0ettDSZFHr" type="application/moml+xml" name="playAnnc0"> | |
<play cvd:barge="false" cvd:cleardb="true"> | |
<audio uri="file://provisioned/bt/MM2/eng/first_person.wav"/> | |
<playexit> | |
<exit namelist="play.end" /> | |
</playexit> | |
</play> | |
</dialogstart> | |
</msml> | |
EXECUTING COMMANDS [ | |
{ | |
"type": "join", | |
"connId": "043fe682-1384-1238-98a7-0242ac110002", | |
"confId": "233442549241261", | |
"deaf": false, | |
"mute": false | |
}, | |
{ | |
"type": "dialogStart", | |
"responseLeg": "UWROczfBjJ;from-tag=1213583015616428501091.0", | |
"connId": "043fe682-1384-1238-98a7-0242ac110002", | |
"dialogName": "listen", | |
"dtmf": { | |
"startTimeout": "0", | |
"digitTimeout": "5", | |
"min": "2", | |
"max": "2" | |
} | |
}, | |
{ | |
"type": "deaf", | |
"connId": "043fe682-1384-1238-98a7-0242ac110002", | |
"confId": "233442549241261" | |
}, | |
{ | |
"type": "dialogStart", | |
"responseLeg": "UWROczfBjJ;from-tag=1213583015616428501091.0", | |
"connId": "043fe682-1384-1238-98a7-0242ac110002", | |
"dialogName": "playAnnc0", | |
"play": { | |
"tracks": [ | |
"file://provisioned/bt/MM2/eng/first_person.wav" | |
], | |
"notifyFinished": true | |
} | |
} | |
] | |
Emulating Dialog Ended { type: 'dialogStart', | |
responseLeg: 'UWROczfBjJ;from-tag=1213583015616428501091.0', | |
connId: '043fe682-1384-1238-98a7-0242ac110002', | |
dialogName: 'listen', | |
dtmf: { startTimeout: '0', digitTimeout: '5', min: '2', max: '2' } } | |
Emulating Dialog Ended { type: 'dialogStart', | |
responseLeg: 'UWROczfBjJ;from-tag=1213583015616428501091.0', | |
connId: '043fe682-1384-1238-98a7-0242ac110002', | |
dialogName: 'playAnnc0', | |
play: | |
{ tracks: [ 'file://provisioned/bt/MM2/eng/first_person.wav' ], | |
notifyFinished: true } } | |
Sending INFO <?xml version="1.0"?><msml version="1.1"><event name="msml.dialog.exit" id="conn:043fe682-1384-1238-98a7-0242ac110002/dialog:playAnnc0"><name>play.end</name><value>play.complete</value></event></msml> | |
drachtio:srf examining BYE, dialog id: UWROczfBjJ;from-tag=1213583015616428501091.0 +10s | |
drachtio:srf calling dialog handler +1ms | |
drachtio:srf Dialog handling message: BYE +10s | |
drachtio:srf Srf#removeDialog: removing dialog with id UWROczfBjJ;from-tag=1213583015616428501091.0 dialog count is now 2 +0ms | |
Leg Hung Up - Killing Associated Conference 233442549241261 | |
Removed Control Leg Mapping from Store [UWROczfBjJ] [233442549241261]. Store Size = 0 | |
EXECUTING COMMANDS [ | |
{ | |
"type": "kill", | |
"confId": "233442549241261" | |
} | |
] | |
drachtio:srf examining INVITE, dialog id: +5m | |
Received an Invite | |
Handling Media Leg Invite | |
drachtio:srf Srf#addDialog: adding dialog with id ba95458a-1384-1238-98a7-0242ac110002;from-tag=Bp9HjgvmKHvpF type INVITE, dialog count is now 3 +59ms | |
drachtio:srf Srf#addDialog: adding dialog with id EOYgk4C5qS;from-tag=1213582715616431558271.0 type INVITE, dialog count is now 4 +39ms | |
drachtio:srf examining ACK, dialog id: EOYgk4C5qS;from-tag=1213582715616431558271.0 +1ms | |
drachtio:srf calling dialog handler +0ms | |
drachtio:srf Dialog handling message: ACK +5m | |
drachtio:srf examining INFO, dialog id: EOYgk4C5qS;from-tag=1213582715616431558271.0 +1ms | |
drachtio:srf calling dialog handler +0ms | |
drachtio:srf Dialog handling message: INFO +1ms | |
Created UAS Dialog For Media Leg. Local Tag = cZ2amBDrgtj9a | |
Created UAS Dialog For Media Leg. Stack Dialog ID = EOYgk4C5qS;from-tag=1213582715616431558271.0 | |
Added Tag to Store [cZ2amBDrgtj9a] [ba95458a-1384-1238-98a7-0242ac110002]. Store Size = 4 | |
drachtio:srf examining BYE, dialog id: EOYgk4C5qS;from-tag=1213582715616431558271.0 +58ms | |
drachtio:srf calling dialog handler +0ms | |
drachtio:srf Dialog handling message: BYE +58ms | |
drachtio:srf Srf#removeDialog: removing dialog with id EOYgk4C5qS;from-tag=1213582715616431558271.0 dialog count is now 3 +0ms | |
MM2 Ended Call | |
Removed Tag from Store [cZ2amBDrgtj9a] [ba95458a-1384-1238-98a7-0242ac110002]. Store Size = 2 | |
Leg Hung Up - nothing to do. | |
drachtio:srf Srf#removeDialog: removing dialog with id ba95458a-1384-1238-98a7-0242ac110002;from-tag=Bp9HjgvmKHvpF dialog count is now 2 +48ms | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment