[pjsip] Problem to set custom SDP offer using pjsua2. Possible bug?

Maxim S sipouser at gmail.com
Wed May 7 06:58:10 EDT 2014

I am trying to develop UAC on pjsua2 library basis, windows 7 platform.
And I have a problem to set custom SDP offer in INVITE message. I used
onCallSdpCreated() virtual method to set PCMU/8000 and PCMA/8000 codecs

class MyCall : public Call
   virtual void onCallSdpCreated( OnCallSdpCreatedParam &prm );

void MyCall::onCallSdpCreated( OnCallSdpCreatedParam &prm )
   // Сhanging prm.sdp.wholeSdp string according to my codecs
   prm.sdp.wholeSdp = “v=0\r\n...

This doesn’t work. In INVITE message I see initial automatically generated
SDP offer as before.

It seems there are two variants.

1) It’s not enough to change prm.sdp.wholeSdp only.I need to do some more
actions to apply changes. If so, please, give me a hint what I should do.

2) It’s a bug. I used a debugger to see a call stack. Here it is

MyCall.cpp: MyCall::onCallSdpCreated( OnCallSdpCreatedParam &prm )
Endpoint.cpp: Endpoint::on_call_sdp_created(..., pjmedia_sdp_session *sdp,
Pjsua_media.c: pjsua_media_channel_create_sdp(..., pjmedia_sdp_session
Pjsua_call.c: on_make_call_med_tp_complete(...)
on_make_call_med_tp_complete() function sends INVITE message. But my custom
SDP offer is not available here. To get it available the signature should
be Endpoint::on_call_sdp_created (…, pjmedia_sdp_session **sdp, …). But
this doesn’t solve the problem. The pointers to SDP string are not valid
because prm.sdp.wholeSdp string out of scope here. As soon as I made
OnCallSdpCreatedParam prm be static (just for experiment) in
Endpoint::on_call_sdp_created() my SIP UA sends SDP offer I want.

Thank you

Maxim S
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20140507/1d9de9a5/attachment-0002.html>

More information about the pjsip mailing list