From 8f85b5204c735f0797e4a965659bd78cbd168c86 Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Wed, 17 Sep 2014 18:11:20 -0500 Subject: [PATCH 01/13] vs2010 trival compiler warnings --- src/switch_rtp.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 475f804675..086d7b0e1c 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -1803,11 +1803,11 @@ static void rtcp_generate_sender_info(switch_rtp_t *rtp_session, struct switch_r uint32_t sec, ntp_sec, ntp_usec; switch_time_exp_t now_hr; now = switch_time_now(); - sec = now/1000000; /* convert to seconds */ + sec = (uint32_t)(now/1000000); /* convert to seconds */ ntp_sec = sec+NTP_TIME_OFFSET; /* convert to NTP seconds */ sr->ntp_msw = htonl(ntp_sec); /* store result in "most significant word" */ - ntp_usec = now - (sec*1000000); /* remove seconds to keep only the microseconds */ - sr->ntp_lsw = htonl(ntp_usec*(double)(((uint64_t)1)<<32)*1.0e-6); /* convert microseconds to fraction of 32bits and store result in "least significatn word" */ + ntp_usec = (uint32_t)(now - (sec*1000000)); /* remove seconds to keep only the microseconds */ + sr->ntp_lsw = htonl((u_long)(ntp_usec*(double)(((uint64_t)1)<<32)*1.0e-6)); /* convert microseconds to fraction of 32bits and store result in "least significatn word" */ sr->ts = htonl(rtp_session->last_write_ts); sr->pc = htonl(rtp_session->stats.outbound.packet_count); @@ -1832,9 +1832,9 @@ static void rtcp_generate_report_block(switch_rtp_t *rtp_session, struct switch_ int32_t pkt_lost; uint32_t ntp_sec, ntp_usec, lsr_now, sec; now = switch_time_now(); - sec = now/1000000; /* convert to seconds */ + sec = (uint32_t)(now/1000000); /* convert to seconds */ ntp_sec = sec+NTP_TIME_OFFSET; /* convert to NTP seconds */ - ntp_usec = now - (sec*1000000); /* remove seconds to keep only the microseconds */ + ntp_usec = (uint32_t)(now - (sec*1000000)); /* remove seconds to keep only the microseconds */ /* Packet loss */ if (stats->rtcp_rtp_count == 0) { @@ -3865,7 +3865,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_activate_rtcp(switch_rtp_t *rtp_sessi switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG, "RTCP send rate is: %d and packet rate is: %d Remote Port: %d\n", send_rate, rtp_session->ms_per_packet, rtp_session->remote_rtcp_port); rtp_session->rtcp_interval = send_rate; - rtp_session->rtcp_send_rate = send_rate/1000; + rtp_session->rtcp_send_rate = (uint16_t)(send_rate/1000); rtp_session->next_rtcp_send = switch_time_now() + (rtp_session->rtcp_interval * 1000); } @@ -5088,9 +5088,9 @@ static switch_status_t process_rtcp_packet(switch_rtp_t *rtp_session, switch_siz uint32_t lsr; uint32_t packet_ssrc; now = switch_time_now(); /* number of microseconds since 00:00:00 january 1, 1970 UTC */ - sec = now/1000000; /* converted to second (NTP most significant bits) */ + sec = (uint32_t)(now/1000000); /* converted to second (NTP most significant bits) */ ntp_sec = sec+NTP_TIME_OFFSET; /* 32bits most significant */ - ntp_usec = now - (sec*1000000); /* micro seconds */ + ntp_usec = (uint32_t)(now - (sec*1000000)); /* micro seconds */ lsr_now = (uint32_t)(ntp_usec*0.065536) | (ntp_sec&0x0000ffff)<<16; // 0.065536 is used for convertion from useconds if (rtp_session->rtcp_recv_msg.header.type == 200) { /* Sender report */ From 1379a2cc9f79a25b52429ea9b43847ef431b5ec0 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Thu, 18 Sep 2014 18:34:36 +0000 Subject: [PATCH 02/13] Document some guidelines for creating commits --- docs/SubmittingPatches | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/docs/SubmittingPatches b/docs/SubmittingPatches index a7d2347aeb..58f2467731 100644 --- a/docs/SubmittingPatches +++ b/docs/SubmittingPatches @@ -46,6 +46,32 @@ Create Your Patch # create an account in JIRA and create a new issue; # attach the patch file(s) you created to the issue +Guidelines for a Good Commit +---------------------------- + +To the extent possible and appropriate, address only one issue per +commit. When we review your commit, anything that doesn't need to be +there will only create confusion. + +This means that, for example, unrelated refactoring or whitespace +cleanups should generally happen in separate commits. Whitespace +cleanup commits should not change anything other than whitespace, and +refactoring commits should strive to preserve identical behavior. + +However, don't go overboard. A commit should do some identifiable +thing completely. If you're adding a new module, the build changes +for that module should go in the commit that adds the module itself. +If you're adding a feature, the feature should work after applying +that commit. + +We don't need to see your missteps and corrections. Use `git rebase +-i` to squash those out of your history before submitting the commit +series to us. It should look like you got everything right the first +time. + +Use `git log -p` to verify that each diff is correct and minimal, and +that your git author name is correct and complete. + Writing a Good Commit Message ----------------------------- From bb2427e833ada46c5ace51a60777b9f4e15bc662 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 18 Sep 2014 15:30:28 -0400 Subject: [PATCH 03/13] add state change to verto to allow call to stay up when network conditions change --- html5/verto/demo/js/verto-min.js | 2 +- html5/verto/js/src/jquery.verto.js | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/html5/verto/demo/js/verto-min.js b/html5/verto/demo/js/verto-min.js index 01ee8b57a4..7f249bd894 100644 --- a/html5/verto/demo/js/verto-min.js +++ b/html5/verto/demo/js/verto-min.js @@ -219,5 +219,5 @@ dialog.rtc.createAnswer(dialog.params.sdp);dialog.answered=true;}};$.verto.dialo if(dialog.state.val>=$.verto.enum.state.early.val){dialog.setState($.verto.enum.state.active);}else{if(dialog.gotEarly){console.log("Dialog "+dialog.callID+"Got answer while still establishing early media, delaying...");}else{console.log("Dialog "+dialog.callID+"Answering Channel");dialog.rtc.answer(params.sdp,function(){dialog.setState($.verto.enum.state.active);},function(e){console.error(e);dialog.hangup();});console.log("Dialog "+dialog.callID+"ANSWER SDP",params.sdp);}}};$.verto.dialog.prototype.cidString=function(enc){var dialog=this;var party=dialog.params.remote_caller_id_name+(enc?" <":" <")+dialog.params.remote_caller_id_number+(enc?">":">");return party;};$.verto.dialog.prototype.sendMessage=function(msg,params){var dialog=this;if(dialog.callbacks.onMessage){dialog.callbacks.onMessage(dialog.verto,dialog,msg,params);}};$.verto.dialog.prototype.handleInfo=function(params){var dialog=this;dialog.sendMessage($.verto.enum.message.info,params.msg);};$.verto.dialog.prototype.handleDisplay=function(params){var dialog=this;if(params.display_name){dialog.params.remote_caller_id_name=params.display_name;} if(params.display_number){dialog.params.remote_caller_id_number=params.display_number;} dialog.sendMessage($.verto.enum.message.display,{});};$.verto.dialog.prototype.handleMedia=function(params){var dialog=this;if(dialog.state.val>=$.verto.enum.state.early.val){return;} -dialog.gotEarly=true;dialog.rtc.answer(params.sdp,function(){console.log("Dialog "+dialog.callID+"Establishing early media");dialog.setState($.verto.enum.state.early);if(dialog.gotAnswer){console.log("Dialog "+dialog.callID+"Answering Channel");dialog.setState($.verto.enum.state.active);}},function(e){console.error(e);dialog.hangup();});console.log("Dialog "+dialog.callID+"EARLY SDP",params.sdp);};$.verto.ENUM=function(s){var i=0,o={};s.split(" ").map(function(x){o[x]={name:x,val:i++};});return Object.freeze(o);};$.verto.enum={};$.verto.enum.states=Object.freeze({new:{requesting:1,recovering:1,ringing:1,destroy:1,answering:1},requesting:{trying:1,hangup:1},recovering:{answering:1,hangup:1},trying:{active:1,early:1,hangup:1},ringing:{answering:1,hangup:1},answering:{active:1,hangup:1},active:{hangup:1,held:1},held:{hangup:1,active:1},early:{hangup:1,active:1},hangup:{destroy:1},destroy:{},purge:{destroy:1}});$.verto.enum.state=$.verto.ENUM("new requesting trying recovering ringing answering early active held hangup destroy purge");$.verto.enum.direction=$.verto.ENUM("inbound outbound");$.verto.enum.message=$.verto.ENUM("display info pvtEvent");$.verto.enum=Object.freeze($.verto.enum);$.verto.saved=[];$(window).bind('beforeunload',function(){for(var i in $.verto.saved){var verto=$.verto.saved[i];if(verto){verto.logout();verto.purge();}} +dialog.gotEarly=true;dialog.rtc.answer(params.sdp,function(){console.log("Dialog "+dialog.callID+"Establishing early media");dialog.setState($.verto.enum.state.early);if(dialog.gotAnswer){console.log("Dialog "+dialog.callID+"Answering Channel");dialog.setState($.verto.enum.state.active);}},function(e){console.error(e);dialog.hangup();});console.log("Dialog "+dialog.callID+"EARLY SDP",params.sdp);};$.verto.ENUM=function(s){var i=0,o={};s.split(" ").map(function(x){o[x]={name:x,val:i++};});return Object.freeze(o);};$.verto.enum={};$.verto.enum.states=Object.freeze({new:{requesting:1,recovering:1,ringing:1,destroy:1,answering:1},requesting:{trying:1,hangup:1},recovering:{answering:1,hangup:1},trying:{active:1,early:1,hangup:1},ringing:{answering:1,hangup:1},answering:{active:1,hangup:1},active:{answering:1,requesting:1,hangup:1,held:1},held:{hangup:1,active:1},early:{hangup:1,active:1},hangup:{destroy:1},destroy:{},purge:{destroy:1}});$.verto.enum.state=$.verto.ENUM("new requesting trying recovering ringing answering early active held hangup destroy purge");$.verto.enum.direction=$.verto.ENUM("inbound outbound");$.verto.enum.message=$.verto.ENUM("display info pvtEvent");$.verto.enum=Object.freeze($.verto.enum);$.verto.saved=[];$(window).bind('beforeunload',function(){for(var i in $.verto.saved){var verto=$.verto.saved[i];if(verto){verto.logout();verto.purge();}} return $.verto.warnOnUnload;});})(jQuery); \ No newline at end of file diff --git a/html5/verto/js/src/jquery.verto.js b/html5/verto/js/src/jquery.verto.js index c09d4f5756..583e3a62a7 100644 --- a/html5/verto/js/src/jquery.verto.js +++ b/html5/verto/js/src/jquery.verto.js @@ -1951,6 +1951,8 @@ hangup: 1 }, active: { + answering: 1, + requesting: 1, hangup: 1, held: 1 }, From 718e3c658324c9fd0a97a5e9fc8a87f01e5e0482 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Thu, 18 Sep 2014 19:47:36 +0000 Subject: [PATCH 04/13] Document our deviations from commit guidelines --- docs/SubmittingPatches | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/docs/SubmittingPatches b/docs/SubmittingPatches index 58f2467731..4aa8dcdff7 100644 --- a/docs/SubmittingPatches +++ b/docs/SubmittingPatches @@ -129,6 +129,23 @@ If you believe your patch resolves the issue in question, follow the issue number with a space and the "--resolve" directive as in the example above. +Do As We Say... +--------------- + +When you look in our git history, you'll find not all commits follow +the guidelines here. Don't be fooled by this. These guidelines are +what we want, and your commits should follow them. + +It's always difficult to counsel, "do as we say and not as we do," but +the truth is that the format of your commits will be held to a +different standard than the commits of people who have written the +majority of the code in FS. For one thing, your commits will be +reviewed, so following a careful format helps us to review and merge +your patches quickly and efficiently. + +We want a clean and sensible git history, and over time more +contributors will be following the guidelines here. + Where to Go for Help -------------------- From 527016cdec257a2bc7461b0053d7d9ad1ee80e23 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Thu, 18 Sep 2014 19:50:25 +0000 Subject: [PATCH 05/13] Fix straggling reference to old commit hooks --- docs/SubmittingPatches | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/SubmittingPatches b/docs/SubmittingPatches index 4aa8dcdff7..51d207b779 100644 --- a/docs/SubmittingPatches +++ b/docs/SubmittingPatches @@ -126,7 +126,7 @@ before "Signed-off-by:" and "Thanks-to:" lines. This helps our JIRA bot do useful things by relating the commit to the issue. If you believe your patch resolves the issue in question, follow the -issue number with a space and the "--resolve" directive as in the +issue number with a space and the "#resolve" directive as in the example above. Do As We Say... From 58110da8709b41bcd7642b3ccd7cdaa1a6863a38 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Thu, 18 Sep 2014 20:02:19 +0000 Subject: [PATCH 06/13] Document policy against merges in a feature branch --- docs/SubmittingPatches | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/docs/SubmittingPatches b/docs/SubmittingPatches index 51d207b779..1cbcc08d95 100644 --- a/docs/SubmittingPatches +++ b/docs/SubmittingPatches @@ -129,6 +129,17 @@ If you believe your patch resolves the issue in question, follow the issue number with a space and the "#resolve" directive as in the example above. +Avoid Merges +------------ + +When you've created a local git branch to make and test your changes, +it can be tempting to merge that branch periodically against our git +HEAD, particularly if the branch lingers for some time. Don't do +this. Instead, please rebase your branch onto our tree before +submitting the commits to us. Random "update branch to master" merges +make our history hard to understand and make it more difficult to +isolate regressions with `git-bisect`. + Do As We Say... --------------- From 2ef2146a2670a0883df543487f13bb0bc42e4247 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Thu, 18 Sep 2014 20:32:23 +0000 Subject: [PATCH 07/13] Refer to our contributor guidelines on git setup --- scripts/setup-git.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/setup-git.sh b/scripts/setup-git.sh index 369c118560..2c7cf2b3f8 100755 --- a/scripts/setup-git.sh +++ b/scripts/setup-git.sh @@ -82,6 +82,10 @@ EOF EOF cat 1>&2 < Date: Thu, 18 Sep 2014 20:33:08 +0000 Subject: [PATCH 08/13] Cleanup whitespace --- scripts/setup-git.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/setup-git.sh b/scripts/setup-git.sh index 2c7cf2b3f8..54d30219d6 100755 --- a/scripts/setup-git.sh +++ b/scripts/setup-git.sh @@ -88,4 +88,3 @@ cat 1>&2 < Date: Thu, 18 Sep 2014 21:08:14 +0000 Subject: [PATCH 09/13] Use preformatted text for example commit message We want to highlight that lines are hard wrapped in a commit message, and using the typical Markdown blockquote syntax fails to achieve that. --- docs/SubmittingPatches | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/docs/SubmittingPatches b/docs/SubmittingPatches index 1cbcc08d95..e648530e0b 100644 --- a/docs/SubmittingPatches +++ b/docs/SubmittingPatches @@ -102,19 +102,19 @@ The commit subject is the first line of your commit message, then there is an empty line, then your commit body starts. A good commit message might look like this: -> Add frobinator support to mod_sofia -> -> Without proper frobinator support users had to make multiple calls -> to shell scripts to do the sort of frobbing needed in high call -> volume environments. -> -> With this change, we now link to libfrob and support the IETF -> draft-cross-voip-frobbing API. -> -> After appropriate amounts of frobbing have been done, a new variable -> `frobbing_done` is set in the caller's channel. -> -> FS-XXXX #resolve + Add frobinator support to mod_sofia + + Without proper frobinator support users had to make multiple calls + to shell scripts to do the sort of frobbing needed in high call + volume environments. + + With this change, we now link to libfrob and support the IETF + draft-cross-voip-frobbing API. + + After appropriate amounts of frobbing have been done, a new variable + `frobbing_done` is set in the caller's channel. + + FS-XXXX #resolve Patches Related to JIRA Issues ------------------------------ From b7b01d0144a2a221d2e53e160b34d43578a8843c Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Thu, 18 Sep 2014 21:10:18 +0000 Subject: [PATCH 10/13] Make example commit look like git log output This makes it visually clearer what the reader is looking at and highlights that we want a real name as the author name. --- docs/SubmittingPatches | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/SubmittingPatches b/docs/SubmittingPatches index e648530e0b..d0fc992f12 100644 --- a/docs/SubmittingPatches +++ b/docs/SubmittingPatches @@ -102,6 +102,10 @@ The commit subject is the first line of your commit message, then there is an empty line, then your commit body starts. A good commit message might look like this: + commit b5c64234ea5d4417abe02b282d6f41c019f2252f + Author: John Doe + Date: Tue Jan 19 03:14:07 2014 +0000 + Add frobinator support to mod_sofia Without proper frobinator support users had to make multiple calls From b92ad9bbb51fd0fad5115da1662b6a3bb9f6356c Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Thu, 18 Sep 2014 21:14:52 +0000 Subject: [PATCH 11/13] Escape a literal pound for Markdown Markdown treats this as an H1 otherwise. --- docs/SubmittingPatches | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/SubmittingPatches b/docs/SubmittingPatches index d0fc992f12..49bf9c6a03 100644 --- a/docs/SubmittingPatches +++ b/docs/SubmittingPatches @@ -176,7 +176,7 @@ submitted to JIRA. You can also reach us on freenode.net at: -> #freeswitch-dev +> \#freeswitch-dev Finally, feel free to join us in our weekly conference call. Many of the core developers are often on the call and you'll have an From 372455c30a216d38392ffd68b5283886c3d94d36 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 19 Sep 2014 02:28:41 +0500 Subject: [PATCH 12/13] FS-6829 #resolve --- src/switch_core_media.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/switch_core_media.c b/src/switch_core_media.c index 2616237fbe..844497cc80 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -4103,7 +4103,10 @@ SWITCH_DECLARE(int) switch_core_media_toggle_hold(switch_core_session_t *session switch_channel_mark_hold(session->channel, SWITCH_FALSE); switch_channel_presence(session->channel, "unknown", "unhold", NULL); - switch_rtp_clear_flag(a_engine->rtp_session, SWITCH_RTP_FLAG_PAUSE); + if (a_engine->rtp_session) { + switch_rtp_clear_flag(a_engine->rtp_session, SWITCH_RTP_FLAG_PAUSE); + } + if (v_engine->rtp_session) { switch_rtp_clear_flag(v_engine->rtp_session, SWITCH_RTP_FLAG_PAUSE); } From 393c7c3e9731c74fbc6e41ffa52e706b608a4ea9 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Thu, 18 Sep 2014 21:42:44 +0000 Subject: [PATCH 13/13] Update our contributor guidelines for PRs --- docs/SubmittingPatches | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/docs/SubmittingPatches b/docs/SubmittingPatches index 49bf9c6a03..f60483fc0b 100644 --- a/docs/SubmittingPatches +++ b/docs/SubmittingPatches @@ -14,8 +14,8 @@ Ensure Git is Setup # real name and not a username ./scripts/setup-git.sh -Create Your Patch ------------------ +Create Your Commits +------------------- # create a topic/feature branch in your local repository git checkout -b myfeature @@ -34,17 +34,29 @@ Create Your Patch # review changes; ensure your author name is correct git log -p - # create patch files - git format-patch origin/master..HEAD - - # you'll now have a number of *.patch files in your current - # directory +Create a Pull Request +--------------------- # navigate to the FreeSWITCH JIRA chromium http://jira.freeswitch.org/ - # create an account in JIRA and create a new issue; - # attach the patch file(s) you created to the issue + # create an account in JIRA and create a new issue + + # navigate to FreeSWITCH Stash + chromium http://stash.freeswitch.org/ + + # create an account in Stash; create a forked FS repository; read + # the details here: + chromium https://confluence.freeswitch.org/display/FREESWITCH/Pull+Requests + + # add your repository as a remote (change to your username) + git remote add stash ssh://git@stash.freeswitch.org:7999/~johndoe/freeswitch.git + + # push your changes to a branch + git push stash +HEAD:myfeature + + # create a pull request as described here: + chromium https://confluence.freeswitch.org/display/FREESWITCH/Pull+Requests Guidelines for a Good Commit ----------------------------