< Previous by Date Date Index Next by Date >
< Previous in Thread Thread Index  

Re: [reSIProcate-users] Problems faced in assigning return value from SipMessage::getContents to a PlainContents object when the conetnt is of application/dtmf-relay type


Try calling getBodyData() on the DtmfPayloadContents - its a method implemented in the Contents base class.

Scott

On Fri, Nov 7, 2014 at 11:33 AM, Yogesh Chathley1 <yogesh.chathley1@xxxxxxxxxxxxxxx> wrote:
Thanks, I was able to use DtmfPayloadContents.
However, I want to read the DTMF contents as a string, since we are doing some customizations. Is there any way out?

Thanks in advance.


Yogesh Chathley | Manager Engineering
GlobalLogic
P +91.120.4342586 M +91.987.327.7262  S yogeshchathley
www.globallogic.com

http://www.globallogic.com/email_disclaimer.txt

On Thu, Nov 6, 2014 at 11:04 PM, <slgodin@xxxxxxxxx> wrote:
I'm not sure offhand.  The cast to PlainContents may be an issue now.  You should be using dynamic cast and checking for null.

Scott

Sent from my iPhone

On Nov 6, 2014, at 12:24 PM, Yogesh Chathley1 <yogesh.chathley1@xxxxxxxxxxxxxxx> wrote:

Sure, I saw that.
But will the old implementation not work and cause the application to core?


Yogesh Chathley | Manager Engineering
GlobalLogic
P +91.120.4342586 M +91.987.327.7262  S yogeshchathley
www.globallogic.com

http://www.globallogic.com/email_disclaimer.txt

On Thu, Nov 6, 2014 at 10:20 PM, Scott Godin <sgodin@xxxxxxxxxxxxxxx> wrote:
There is now a DtmfPayloadContents class.  You should be using this instead of PlainContents.

Best Regards,
Scott Godin

On Thu, Nov 6, 2014 at 11:25 AM, Yogesh Chathley1 <yogesh.chathley1@xxxxxxxxxxxxxxx> wrote:
Hi,

This scenario is related to out of band DTMF where INFO request is received with header "Content-Type" set to "application/dtmf-relay". My application code processes the the message and extracts the Signal & Duration from the Contents. Below is a snapshot of my application code:

SipMessage* sm is passed to my function as an argument after which following is done:

        PlainContents *pc = (PlainContents*) sm->getContents();

        // Decode and store DTMF info
        static const string SIGNAL = "Signal=";
        static const string SIGNAL_UPDATE = "Signal-Update=";
        static const string DURATION = "Duration=";

        string::size_type idx;
        string body = pc->text().c_str();
        string signal;
        string value;
        bool signalExists = false;
        bool isSignalUpdate = false;


The "body" string is then used to find the Signal and Duration using some string manipulations.

My application was earlier using reSIP 1.6 and my code was working perfectly fine without any issues. However, after upgrading the stack to the latest version 1.9, my application cores at the following line:
string body = pc->text().c_str();

On further debugging, it is found that the core occurs while doing "pc->text().c_str()". The core occurs at the following line of function "const char* Data::c_str() const" in file rutil/Data.cxx:
mBuf[mSize] = 0;

Has something changed in the stack after 1.6 version that is causing the crash? Please help in providing the resolution here.

Thanks,

Yogesh Chathley | Manager Engineering
GlobalLogic
P +91.120.4342586 M +91.987.327.7262  S yogeshchathley
www.globallogic.com

http://www.globallogic.com/email_disclaimer.txt

_______________________________________________
resiprocate-users mailing list
resiprocate-users@xxxxxxxxxxxxxxx
List Archive: http://list.resiprocate.org/archive/resiprocate-users/