Skip to content
This repository was archived by the owner on Feb 3, 2025. It is now read-only.

Commit 29e9020

Browse files
author
bossiel
committed
- Fix issue 24
- Fix BYE routes issue - Factorize header parsers to lower the code size
1 parent fa2ec54 commit 29e9020

File tree

153 files changed

+9841
-21072
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

153 files changed

+9841
-21072
lines changed

call.htm

Lines changed: 64 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@
9797
var videoRemote, videoLocal;
9898
var divVideo, divCallOptions;
9999
var bFullScreen = false;
100+
var oNotifICall;
100101

101102
window.onload = function () {
102103
if (!haveWebSocket()) {
@@ -150,15 +151,18 @@
150151
document.body.style.cursor = 'default';
151152
};
152153

154+
// checks whether the browser supports WebRTC
153155
function haveWebRTC() {
154156
// 'webkitDeprecatedPeerConnection' is not used
155157
return (navigator.webkitGetUserMedia && (webkitPeerConnection00));
156158
}
157159

160+
// checks whether the browser supports WebSockets
158161
function haveWebSocket() {
159162
return (WebSocket != null);
160163
}
161164

165+
// checks whether the user accepted access to the webcam/soundcard
162166
function gotMediaStream() {
163167
return (__o_stream != null);
164168
}
@@ -195,6 +199,7 @@
195199
}
196200
};
197201

202+
// sends SIP REGISTER request to login
198203
function sipRegister() {
199204
btnRegister.disabled = true;
200205
if (!txtRealm.value || !txtPrivateIdentity.value || !txtPublicIdentity.value) {
@@ -208,13 +213,20 @@
208213
btnRegister.disabled = false;
209214
return;
210215
}
216+
217+
// enable notifications if not already done
218+
if (window.webkitNotifications && window.webkitNotifications.checkPermission() != 0) {
219+
window.webkitNotifications.requestPermission();
220+
}
211221

222+
// save credentials
212223
saveCredentials();
213224

225+
// create a new SIP stack. Not mandatory as it's possible to reuse the same satck
214226
oSipStack = new tsip_stack(txtRealm.value, txtPrivateIdentity.value, txtPublicIdentity.value, "sipml5.org", 4062,
215227
tsip_stack.prototype.SetPassword(txtPassword.value),
216228
tsip_stack.prototype.SetDisplayName(txtDisplayName.value),
217-
// tsip_stack.prototype.SetProxyOutBound('192.168.0.12', 5060, tsip_transport_type_e.UDP), // uncommend to use SIP outbound proxy
229+
//tsip_stack.prototype.SetProxyOutBound('192.168.0.10', 5060, tsip_transport_type_e.UDP), // uncommend to use SIP outbound proxy
218230
tsip_stack.prototype.SetHeader('User-Agent', 'IM-client/OMA1.0 sipML5/v0.0.0000.0'),
219231
tsip_stack.prototype.SetHeader('Organization', 'Doubango Telecom'));
220232
if (oSipStack) {
@@ -230,12 +242,14 @@
230242
btnRegister.disabled = false;
231243
}
232244

245+
// sends SIP REGISTER (expires=0) to logout
233246
function sipUnRegister() {
234247
if (oSipStack) {
235248
oSipStack.stop(); // shutdown all sessions
236249
}
237250
}
238251

252+
// makes a call (SIP INVITE)
239253
function sipCall() {
240254
if (oSipStack && !oSipSessionCall && !tsk_string_is_null_or_empty(txtPhoneNumber.value)) {
241255
btnCall.disabled = true;
@@ -259,6 +273,7 @@
259273
}
260274
}
261275

276+
// transfers the call
262277
function sipTransfer() {
263278
if (oSipSessionCall) {
264279
var s_destination = prompt('Enter destination number', '');
@@ -273,7 +288,8 @@
273288
}
274289
}
275290
}
276-
291+
292+
// holds or resumes the call
277293
function sipToggleHoldResume() {
278294
if (oSipSessionCall) {
279295
var i_ret;
@@ -288,6 +304,7 @@
288304
}
289305
}
290306

307+
// terminates the call (SIP BYE or CANCEL)
291308
function sipHangUp() {
292309
if (oSipSessionCall) {
293310
txtCallStatus.innerHTML = '<i>Terminating the call...</i>';
@@ -353,6 +370,18 @@
353370
}
354371
}
355372

373+
function showNotifICall(s_number) {
374+
// permission already asked when we registered
375+
if (window.webkitNotifications && window.webkitNotifications.checkPermission() == 0) {
376+
if (oNotifICall) {
377+
oNotifICall.cancel();
378+
}
379+
oNotifICall = window.webkitNotifications.createNotification('images/sipml-34x39.png', 'Incaming call', 'Incoming call from ' + s_number);
380+
oNotifICall.onclose = function () { oNotifICall = null; };
381+
oNotifICall.show();
382+
}
383+
}
384+
356385
function onKeyUp(evt) {
357386
evt = evt || window.event;
358387
if (evt.keyCode == 27) {
@@ -374,13 +403,15 @@
374403
btnHangUp.disabled = !oSipSessionCall;
375404
}
376405

406+
// Callback function for SIP Stacks
377407
function onSipEventStack(evt) {
378408
// this is a special event shared by all sessions and there is no "e_stack_type"
379409
// check the 'sip/stack' code
380410
console.debug(evt.s_phrase);
381411
switch (evt.i_code) {
382412
case tsip_event_code_e.STACK_STARTED:
383413
{
414+
// LogIn (REGISTER) as soon as the stack finish starting
384415
oSipSessionRegister = new tsip_session_register(oSipStack,
385416
tsip_session.prototype.SetExpires(200),
386417
tsip_session.prototype.SetCaps("+g.oma.sip-im"),
@@ -419,6 +450,7 @@
419450
}
420451
};
421452

453+
// Callback function for all SIP dialogs (INVITE, REGISTER, INFO...)
422454
function onSipEventDialog(evt) {
423455
// this is special event shared by all sessions and there is no "e_dialog_type"
424456
// check the 'sip/dialog' code
@@ -457,6 +489,11 @@
457489
if (b_connected) {
458490
stopRingbackTone();
459491
stopRingTone();
492+
493+
if (oNotifICall) {
494+
oNotifICall.cancel();
495+
oNotifICall = null;
496+
}
460497
}
461498

462499
txtCallStatus.innerHTML = "<i>" + evt.s_phrase + "</i>";
@@ -491,13 +528,19 @@
491528
divVideo.style.height = '0px';
492529
divCallOptions.style.opacity = 0;
493530

531+
if (oNotifICall) {
532+
oNotifICall.cancel();
533+
oNotifICall = null;
534+
}
535+
494536
setTimeout(function () { if (!oSipSessionCall) txtCallStatus.innerHTML = ''; }, 2500);
495537
}
496538
break;
497539
}
498540
}
499541
};
500542

543+
// Call back function for SIP INVITE Dialog
501544
function onSipEventInvite(evt) {
502545
console.debug(evt.s_phrase);
503546

@@ -518,7 +561,9 @@
518561

519562
startRingTone();
520563

521-
txtCallStatus.innerHTML = "<i>Incoming call from [<b>" + (oSipSessionCall.o_uri_from.s_display_name ? oSipSessionCall.o_uri_from.s_display_name : oSipSessionCall.o_uri_from.s_user_name) + "</b>]</i>";
564+
var s_number = (oSipSessionCall.o_uri_from.s_display_name ? oSipSessionCall.o_uri_from.s_display_name : oSipSessionCall.o_uri_from.s_user_name);
565+
txtCallStatus.innerHTML = "<i>Incoming call from [<b>" + s_number + "</b>]</i>";
566+
showNotifICall(s_number);
522567
}
523568
break;
524569
}
@@ -788,7 +833,7 @@ <h2>
788833
<table style='width: 100%;'>
789834
<tr>
790835
<td style="white-space:nowrap;">
791-
<input type="text" style="width: 100%; height:30px" id="txtPhoneNumber" value="" placeholder="Enter phone number to call" />
836+
<input type="text" style="width: 100%; height:100%" id="txtPhoneNumber" value="" placeholder="Enter phone number to call" />
792837
</td>
793838
</tr>
794839
<tr>
@@ -850,5 +895,20 @@ <h2>
850895
<script type="text/javascript" src="./assets/js/bootstrap-collapse.js"></script>
851896
<script type="text/javascript" src="./assets/js/bootstrap-carousel.js"></script>
852897
<script type="text/javascript" src="./assets/js/bootstrap-typeahead.js"></script>
898+
899+
900+
<!-- GOOGLE ANALYTICS -->
901+
<script type="text/javascript">
902+
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
903+
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
904+
</script>
905+
906+
<script type="text/javascript">
907+
try {
908+
var pageTracker = _gat._getTracker("UA-6868621-19");
909+
pageTracker._trackPageview();
910+
} catch (err) { }
911+
</script>
912+
853913
</body>
854914
</html>

docs/Doxyfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -911,7 +911,7 @@ HTML_FOOTER =
911911
# the style sheet file to the HTML output directory, so don't put your own
912912
# style sheet in the HTML output directory as well, or it will be erased!
913913

914-
HTML_STYLESHEET =
914+
HTML_STYLESHEET = doxygen.css
915915

916916
# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
917917
# other source files which should be copied to the HTML output directory. Note

docs/html/_conding.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
<div id="projectname">sipML5
3333
&#160;<span id="projectnumber">1.0</span>
3434
</div>
35-
<div id="projectbrief">World&#39;s first open source HTML5 SIP Client</div>
35+
<div id="projectbrief">World&#39;s first HTML5 SIP Client</div>
3636
</td>
3737

3838

@@ -120,7 +120,7 @@ <h2>Prefixes</h2>
120120

121121

122122
<hr class="footer"/><address class="footer"><small>
123-
Generated on Tue May 8 2012 01:55:56 for sipML5 by &#160;<a href="http://www.doxygen.org/index.html">
123+
Generated on Wed May 16 2012 23:47:02 for sipML5 by &#160;<a href="http://www.doxygen.org/index.html">
124124
<img class="footer" src="doxygen.png" alt="doxygen"/>
125125
</a> 1.8.0
126126
</small></address>

docs/html/_introduction.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
<div id="projectname">sipML5
3333
&#160;<span id="projectnumber">1.0</span>
3434
</div>
35-
<div id="projectbrief">World&#39;s first open source HTML5 SIP Client</div>
35+
<div id="projectbrief">World&#39;s first HTML5 SIP Client</div>
3636
</td>
3737

3838

@@ -104,7 +104,7 @@ <h3>Server-side components</h3>
104104

105105

106106
<hr class="footer"/><address class="footer"><small>
107-
Generated on Tue May 8 2012 01:55:56 for sipML5 by &#160;<a href="http://www.doxygen.org/index.html">
107+
Generated on Wed May 16 2012 01:43:23 for sipML5 by &#160;<a href="http://www.doxygen.org/index.html">
108108
<img class="footer" src="doxygen.png" alt="doxygen"/>
109109
</a> 1.8.0
110110
</small></address>

docs/html/annotated.html

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
<div id="projectname">sipML5
3333
&#160;<span id="projectnumber">1.0</span>
3434
</div>
35-
<div id="projectbrief">World&#39;s first open source HTML5 SIP Client</div>
35+
<div id="projectbrief">World&#39;s first HTML5 SIP Client</div>
3636
</td>
3737

3838

@@ -97,18 +97,14 @@
9797
</div><!--header-->
9898
<div class="contents">
9999
<div class="textblock">Here are the classes, structs, unions and interfaces with brief descriptions:</div><table>
100-
<tr><td class="indexkey"><a class="el" href="classtsip__event__invite.html">tsip_event_invite</a></td><td class="indexvalue"></td></tr>
101-
<tr><td class="indexkey"><a class="el" href="classtsip__event__register.html">tsip_event_register</a></td><td class="indexvalue"></td></tr>
102100
<tr><td class="indexkey"><a class="el" href="classtsip__session.html">tsip_session</a></td><td class="indexvalue"></td></tr>
103-
<tr><td class="indexkey"><a class="el" href="classtsip__session__invite.html">tsip_session_invite</a></td><td class="indexvalue"></td></tr>
104-
<tr><td class="indexkey"><a class="el" href="classtsip__session__register.html">tsip_session_register</a></td><td class="indexvalue"></td></tr>
105101
<tr><td class="indexkey"><a class="el" href="classtsip__stack.html">tsip_stack</a></td><td class="indexvalue"></td></tr>
106102
</table>
107103
</div><!-- contents -->
108104

109105

110106
<hr class="footer"/><address class="footer"><small>
111-
Generated on Tue May 8 2012 01:55:56 for sipML5 by &#160;<a href="http://www.doxygen.org/index.html">
107+
Generated on Wed May 16 2012 23:47:02 for sipML5 by &#160;<a href="http://www.doxygen.org/index.html">
112108
<img class="footer" src="doxygen.png" alt="doxygen"/>
113109
</a> 1.8.0
114110
</small></address>

docs/html/classes.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
<div id="projectname">sipML5
3333
&#160;<span id="projectnumber">1.0</span>
3434
</div>
35-
<div id="projectbrief">World&#39;s first open source HTML5 SIP Client</div>
35+
<div id="projectbrief">World&#39;s first HTML5 SIP Client</div>
3636
</td>
3737

3838

@@ -99,17 +99,17 @@
9999
<div class="qindex"><a class="qindex" href="#letter_T">T</a></div>
100100
<table style="margin: 10px; white-space: nowrap;" align="center" width="95%" border="0" cellspacing="0" cellpadding="0">
101101
<tr><td rowspan="2" valign="bottom"><a name="letter_T"></a><table border="0" cellspacing="0" cellpadding="0"><tr><td><div class="ah">&#160;&#160;T&#160;&#160;</div></td></tr></table>
102-
</td><td valign="top"><a class="el" href="classtsip__event__register.html">tsip_event_register</a>&#160;&#160;&#160;</td><td valign="top"><a class="el" href="classtsip__session__invite.html">tsip_session_invite</a>&#160;&#160;&#160;</td><td valign="top"><a class="el" href="classtsip__stack.html">tsip_stack</a>&#160;&#160;&#160;</td></tr>
103-
<tr><td valign="top"><a class="el" href="classtsip__session.html">tsip_session</a>&#160;&#160;&#160;</td><td valign="top"><a class="el" href="classtsip__session__register.html">tsip_session_register</a>&#160;&#160;&#160;</td><td></td></tr>
104-
<tr><td valign="top"><a class="el" href="classtsip__event__invite.html">tsip_event_invite</a>&#160;&#160;&#160;</td><td></td><td></td><td></td></tr>
105-
<tr><td></td><td></td><td></td><td></td></tr>
102+
</td><td valign="top"><a class="el" href="classtsip__stack.html">tsip_stack</a>&#160;&#160;&#160;</td><td></td></tr>
103+
<tr><td></td><td></td></tr>
104+
<tr><td valign="top"><a class="el" href="classtsip__session.html">tsip_session</a>&#160;&#160;&#160;</td><td></td><td></td></tr>
105+
<tr><td></td><td></td><td></td></tr>
106106
</table>
107107
<div class="qindex"><a class="qindex" href="#letter_T">T</a></div>
108108
</div><!-- contents -->
109109

110110

111111
<hr class="footer"/><address class="footer"><small>
112-
Generated on Tue May 8 2012 01:55:56 for sipML5 by &#160;<a href="http://www.doxygen.org/index.html">
112+
Generated on Wed May 16 2012 23:47:02 for sipML5 by &#160;<a href="http://www.doxygen.org/index.html">
113113
<img class="footer" src="doxygen.png" alt="doxygen"/>
114114
</a> 1.8.0
115115
</small></address>

docs/html/classtsip__session-members.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
<div id="projectname">sipML5
3333
&#160;<span id="projectnumber">1.0</span>
3434
</div>
35-
<div id="projectbrief">World&#39;s first open source HTML5 SIP Client</div>
35+
<div id="projectbrief">World&#39;s first HTML5 SIP Client</div>
3636
</td>
3737

3838

@@ -111,7 +111,7 @@
111111

112112

113113
<hr class="footer"/><address class="footer"><small>
114-
Generated on Tue May 8 2012 01:55:56 for sipML5 by &#160;<a href="http://www.doxygen.org/index.html">
114+
Generated on Wed May 16 2012 23:47:02 for sipML5 by &#160;<a href="http://www.doxygen.org/index.html">
115115
<img class="footer" src="doxygen.png" alt="doxygen"/>
116116
</a> 1.8.0
117117
</small></address>

docs/html/classtsip__session.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
<div id="projectname">sipML5
3333
&#160;<span id="projectnumber">1.0</span>
3434
</div>
35-
<div id="projectbrief">World&#39;s first open source HTML5 SIP Client</div>
35+
<div id="projectbrief">World&#39;s first HTML5 SIP Client</div>
3636
</td>
3737

3838

@@ -375,7 +375,7 @@
375375

376376

377377
<hr class="footer"/><address class="footer"><small>
378-
Generated on Tue May 8 2012 01:55:56 for sipML5 by &#160;<a href="http://www.doxygen.org/index.html">
378+
Generated on Wed May 16 2012 23:47:02 for sipML5 by &#160;<a href="http://www.doxygen.org/index.html">
379379
<img class="footer" src="doxygen.png" alt="doxygen"/>
380380
</a> 1.8.0
381381
</small></address>

docs/html/classtsip__stack-members.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
<div id="projectname">sipML5
3333
&#160;<span id="projectnumber">1.0</span>
3434
</div>
35-
<div id="projectbrief">World&#39;s first open source HTML5 SIP Client</div>
35+
<div id="projectbrief">World&#39;s first HTML5 SIP Client</div>
3636
</td>
3737

3838

@@ -114,7 +114,7 @@
114114

115115

116116
<hr class="footer"/><address class="footer"><small>
117-
Generated on Tue May 8 2012 01:55:56 for sipML5 by &#160;<a href="http://www.doxygen.org/index.html">
117+
Generated on Wed May 16 2012 23:47:02 for sipML5 by &#160;<a href="http://www.doxygen.org/index.html">
118118
<img class="footer" src="doxygen.png" alt="doxygen"/>
119119
</a> 1.8.0
120120
</small></address>

0 commit comments

Comments
 (0)