removing the extra assertEndCRLF(call_profile->append_headers) call was
not enough.  in some other tests it turned out that this call was made
also when call_profile->append_headers was empty.  i verified that be
adding info statements to CCCtl.cpp like this:

  INFO("append_headers='%s'\n", call_profile->append_headers.c_str());
  ADD_TO_CALL_PROFILE("append_headers", append_headers);
  assertEndCRLF(call_profile->append_headers);
  INFO("append_headers='%s'\n", call_profile->append_headers.c_str());

and got to syslog:

Feb 20 07:25:31 sip sems[27135]: [#b4691b70] [start, CCCtl.cpp:163] INFO: 
append_headers=''
Feb 20 07:25:31 sip sems[27135]: [#b4691b70] [start, CCCtl.cpp:166] INFO: 
append_headers='#015#012'
Feb 20 07:25:31 sip sems[27135]: [#b4691b70] [start, CCCtl.cpp:163] INFO: 
append_headers='#015#012'
Feb 20 07:25:31 sip sems[27135]: [#b4691b70] [start, CCCtl.cpp:166] INFO: 
append_headers='#015#012'
Feb 20 07:25:31 sip sems[27135]: [#b4691b70] [start, CCCtl.cpp:163] INFO: 
append_headers='#015#012'
Feb 20 07:25:31 sip sems[27135]: [#b4691b70] [start, CCCtl.cpp:166] INFO: 
append_headers='#015#012P-App-Name: sbc#015#012'

i.e., the macro call was made three times, the first one on empty
call_profile->append_headers.

i then went and fixed that by adding size > 0 test to assertEndCRLF macro:

void assertEndCRLF(string& s) {
    if (s.size() > 0 && (s[s.size()-2] != '\r' || s[s.size()-1] != '\n')) {
        while ((s[s.size()-1] == '\r') ||
               (s[s.size()-1] == '\n'))
            s.erase(s.size()-1);
        s += "\r\n";
    }
}

i didn't commit this yet, since i'm not sure if it is the best way to
fix the issue.

please check and commit the best fix.

-- juha
_______________________________________________
Semsdev mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/semsdev

Reply via email to