Re: [Sofia-sip-devel] How to change media mode in active call?

2014-09-04 Thread Andreas Wehrmann
Alright, from the beginning:

---
That's how I create the stack:

sip_stack = nua_create( sip_root,
sip_evt_dispatcher,
reinterpret_cast nua_magic_t* ( this ),
TAG_IF( (! uas_id.empty()), SIPTAG_USER_AGENT_STR( 
uas_id.c_str() ) ),
SIPTAG_ALLOW_STR( 
INVITE,ACK,CANCEL,BYE,OPTIONS,PRACK,UPDATE,MESSAGE ),
NUTAG_URL( my_url.c_str() ),
TAG_END() );

---
Placing a call involves these calls:

nh = nua_handle( sip_stack, reinterpret_cast nua_hmagic_t* ( this ),
 SIPTAG_TO( to ),
 TAG_IF( (NULL != from), SIPTAG_FROM( from ) ),
 TAG_IF( ((NULL == from)  (strlen(from_user ? from_user : 
)  0)), NUTAG_M_USERNAME( from_user ) ),
 TAG_IF( session_timer.useSessionTimer(), 
NUTAG_SESSION_REFRESHER( nua_local_refresher ) ),
 TAG_IF( session_timer.useSessionTimer(), NUTAG_MIN_SE( 
session_timer.minimumSessionExpires() ) ),
 TAG_IF( session_timer.useSessionTimer(), 
NUTAG_SESSION_TIMER( session_timer.sessionExpires() ) ),
 TAG_IF( session_timer.useSessionTimer(), 
NUTAG_REFRESH_WITHOUT_SDP( 1 ) ),
 TAG_END() );
some other stuff (i.e. generation of SDP string)

nua_invite( nh,
TAG_IF( (! additional_header_str.empty()), SIPTAG_HEADER_STR( 
additional_header_str.c_str() ) ),
SOATAG_USER_SDP_STR( sdp_os.str().c_str() ),
SOATAG_RTP_SELECT( SOA_RTP_SELECT_COMMON ),
TAG_END() );

---
Accepting a call looks like this:

nua_respond( reinterpret_cast nua_handle_t* ( call_id() ),
 status_code,
 sip_status_phrase( status_code ),
 TAG_IF( strlen( sdp_str ), SOATAG_USER_SDP_STR( sdp_str ) ),
 TAG_IF( (! aux_codecs.empty()), SOATAG_AUDIO_AUX( 
aux_codecs.c_str() ) ),
 TAG_IF( strlen( reason_str ), SIPTAG_REASON_STR( reason_str ) 
),
 TAG_IF( use_session_timer, NUTAG_SESSION_REFRESHER( 
nua_local_refresher ) ),
 TAG_IF( use_session_timer, NUTAG_MIN_SE( 
session_timer.minimumSessionExpires() ) ),
 TAG_IF( use_session_timer, NUTAG_SESSION_TIMER( 
session_timer.sessionExpires() ) ),
 TAG_IF( use_session_timer, NUTAG_REFRESH_WITHOUT_SDP( 1 ) ),
 TAG_END() );

---
My first (naive) attempt was trying to update the media mode like so:

std::string sdp_media_mode_line( a= );
sdp_media_mode_line.append( media_mode.sdp_str() );
nua_invite( reinterpret_cast nua_handle_t* ( call_id() ),
SOATAG_USER_SDP_STR( sdp_media_mode_line.c_str() ),
TAG_END() );

Of course this doesn't work since SOA doesn't know what media that attribute 
belongs to...
I didn't try to include the media line (yet).

What I'm basically trying to do is to change a certain attribute for all media 
of a certain type at once.
Is there a more elegant way than USER_SDP_STR, or is it the recommended way to 
go?


Regards,

Andreas


03.09.2014, 15:23, Michael Jerris m...@jerris.com:
  I know it works with USER_SDP_STR, what exactly is your call to 
 update/invite?  are you doing ACTIVE_AUDIO(1) ?

  On Sep 3, 2014, at 9:13 AM, Andreas Wehrmann a.wehrm...@yandex.com wrote:
   Hi!

   I'm somewhat at a loss here.
   I'm in a SIP call that I made or accepted with one of
   a=[inactive|recvonly|sendonly|sendrecv] in the SDP.
   There is only one media (audio).
   When I make or answer a call, I create the complete SDP and provide it
   to nua with SOATAG_USER_SDP_STR which is working just fine.

   Now I would like to be able to change the media mode mid-call using the
   same SDP as before with a new media mode setting, but how do I do that?
   I tried calling nua_update/nua_invite using SOATAG_ACTIVE_AUDIO but it
   was to no avail.

   Is SOATAG_ACTIVE_AUDIO the way to go or should I be doing something
   different?

   Any help is appreciated.

   Best regards,
   Andreas

--
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
___
Sofia-sip-devel mailing list
Sofia-sip-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sofia-sip-devel


Re: [Sofia-sip-devel] How to change media mode in active call?

2014-09-04 Thread Andreas Wehrmann

On 09/04/2014 03:19 PM, Michael Jerris wrote:
 You can do the actual sdp structure as well.  For sure you will need the m 
 lines in the sdp, if you do the structure, it can be sparse just like the 
 string.



I rewrote my function to create the SDP as string and supply it to NUA 
using USER_SDP_STR,
that works just fine.

Another question though:

I tried to use SOATAG_LOCAL_SDP and SOATAG_REMOTE_SDP within my 
nua_i_state callback,
but it gives me an assertion:

WARNING: tag soa::remote_sdp directly used by tl_gets()
Assertion failed: tt-tt_class == ref_tag_class

Is it illegal to use these tags in that context?
Their _REF version are working.

How would I get the structure to the local SDP when I'm not in the 
nua_i_state callback?
Would I use soa_get_local_sdp() using the session object directly from 
the nua handle?
I mean like so:

soa_get_local_sdp( nua_handle-nh_soa, l_sdp, NULL, NULL );

I don't feel safe accessing members of the nua handle directly, that's 
why I'm asking.

Thanks a lot,

Andreas


--
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
___
Sofia-sip-devel mailing list
Sofia-sip-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sofia-sip-devel


Re: [Sofia-sip-devel] How to change media mode in active call?

2014-09-03 Thread Michael Jerris
I know it works with USER_SDP_STR, what exactly is your call to update/invite?  
are you doing ACTIVE_AUDIO(1) ?

On Sep 3, 2014, at 9:13 AM, Andreas Wehrmann a.wehrm...@yandex.com wrote:

 Hi!
 
 I'm somewhat at a loss here.
 I'm in a SIP call that I made or accepted with one of 
 a=[inactive|recvonly|sendonly|sendrecv] in the SDP.
 There is only one media (audio).
 When I make or answer a call, I create the complete SDP and provide it 
 to nua with SOATAG_USER_SDP_STR which is working just fine.
 
 Now I would like to be able to change the media mode mid-call using the 
 same SDP as before with a new media mode setting, but how do I do that?
 I tried calling nua_update/nua_invite using SOATAG_ACTIVE_AUDIO but it 
 was to no avail.
 
 Is SOATAG_ACTIVE_AUDIO the way to go or should I be doing something 
 different?
 
 Any help is appreciated.
 
 Best regards,
 Andreas
 


--
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
___
Sofia-sip-devel mailing list
Sofia-sip-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sofia-sip-devel


Re: [Sofia-sip-devel] How to change media mode in active call?

2014-09-03 Thread Andreas Wehrmann

On 09/03/2014 03:13 PM, Andreas Wehrmann wrote:
 Hi!

 I'm somewhat at a loss here.
 I'm in a SIP call that I made or accepted with one of
 a=[inactive|recvonly|sendonly|sendrecv] in the SDP.
 There is only one media (audio).
 When I make or answer a call, I create the complete SDP and provide it
 to nua with SOATAG_USER_SDP_STR which is working just fine.

 Now I would like to be able to change the media mode mid-call using the
 same SDP as before with a new media mode setting, but how do I do that?
 I tried calling nua_update/nua_invite using SOATAG_ACTIVE_AUDIO but it
 was to no avail.

 Is SOATAG_ACTIVE_AUDIO the way to go or should I be doing something
 different?

 Any help is appreciated.

 Best regards,
 Andreas





I forgot to mention, that the SDP sent out when calling 
nua_update/nua_invite is not even the original SDP but a new minimal SDP
that doesn't seem to reflect the current state of the call/media.



--
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
___
Sofia-sip-devel mailing list
Sofia-sip-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sofia-sip-devel