Pekka Pessi wrote:
2007/5/22, Michael Jerris <[EMAIL PROTECTED]>:
What we need here is support for:
rfc 3264 8.3.3 Changing Media Types
I propose we add a tag that can be passed in on revinvite that tells it
to not merge in previous m= lines... and to only add those are in the
passed sdp user string. Is this approach correct?
That is probably what is needed. I had a peek on soa_static.c, there
might be some problems because we do not keep old user sdp around..
I have a "very basic" patch which does part of the job (attached).
This basically allowme to do something like:
nua_invite(tech_pvt->nh,
SOATAG_USER_SDP_FORCE( 1 ),
SOATAG_USER_SDP_STR( buf_final ),
TAG_END()
);
That sends a reinvite "automagically" using the provided SDP.
There is another problem though.
Even if i am able to send a reinvite with the content i like, i
absolutely cannot handle a received T38 reinvite.
some logs:invitge received...
recv 1208 bytes from udp/[10.10.10.251]:55283 at 20:06:41.130584:
------------------------------------------------------------------------
INVITE sip:[EMAIL PROTECTED]:5061 SIP/2.0
Via: SIP/2.0/UDP 10.10.10.251:5060;branch=z9hG4bK1182323
From: <sip:[EMAIL PROTECTED]>;tag=6813A01-988
To: <sip:[EMAIL PROTECTED]>;tag=B0tSSBH0NNp7a
Date: Fri, 25 May 2007 20:06:43 GMT
Call-ID: [EMAIL PROTECTED]
Supported: 100rel,timer,replaces
Min-SE: 1800
Cisco-Guid: 1178450830-171053532-2169671471-563812834
User-Agent: Cisco-SIPGateway/IOS-12.x
Allow: INVITE, OPTIONS, BYE, CANCEL, ACK, PRACK, COMET, REFER,
SUBSCRIBE, NOTIFY, INFO, UPDATE, REGISTER
CSeq: 102 INVITE
Max-Forwards: 50
Remote-Party-ID:
<sip:[EMAIL PROTECTED]>;party=calling;screen=no;privacy=off
Timestamp: 1180123603
Contact: <sip:[EMAIL PROTECTED]:5060>
Expires: 180
Allow-Events: telephone-event
Content-Type: application/sdp
Content-Length: 396
v=0
o=CiscoSystemsSIP-GW-UserAgent 6126 6474 IN IP4 10.10.10.251
s=SIP Call
c=IN IP4 10.10.10.251
t=0 0
m=image 18108 udptl t38
c=IN IP4 10.10.10.251
a=T38FaxVersion:0
a=T38MaxBitRate:14400
a=T38FaxFillBitRemoval:0
a=T38FaxTranscodingMMR:0
a=T38FaxTranscodingJBIG:0
a=T38FaxRateManagement:transferredTCF
a=T38FaxMaxBuffer:200
a=T38FaxMaxDatagram:72
a=T38FaxUdpEC:t38UDPRedundancy
------------------------------------------------------------------------
nta: received INVITE sip:[EMAIL PROTECTED]:5061 SIP/2.0 (CSeq 102)
nta: canonizing sip:[EMAIL PROTECTED]:5061 with contact
nta: INVITE (102) going to existing leg
nta: timer set to 200 ms
nua: nua_stack_process_request: entering
soa_init_offer_answer(static::0x8b04cf8) called
soa_set_remote_sdp(static::0x8b04cf8, (nil), 0x8b1a264, 396) called
nua: nua_invite_server_respond: entering
send 514 bytes to udp/[10.10.10.251]:5060 at 20:06:41.131623:
This sends the reinvite with wrong SDP...
Still no hooks where my code can overcome sofia decisions...
only later ...
------------------------------------------------------------------------
nta: sent 200 OK for INVITE (102)
nua(0x8b049e0): event i_invite 200 OK
nua(0x8b049e0): ready call updated: completed received offer
soa_get_remote_sdp(static::0x8b04cf8, [0xb6fecde8], [0xb6fecde4],
[(nil)]) called
nua(0x8b049e0): event i_state 200 OK
nua: nua_event: entering
DEBUG - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
WARNING - Event callback - nua_i_invite: 1: 200 OK
DEBUG - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
::tag_null: 0
DEBUG - *[ event handler: session name 0 ]*
WARNING - nua_i_invite with a session !!
WARNING - Is this a reinvite ?
nua: nua_event: entering
DEBUG - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
WARNING - Event callback - nua_i_state: 7: 200 OK
DEBUG - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
------------------------------------------------------------------------
nua::callstate: 7
soa::active_audio: 3
nua::offer_recv: true
soa::remote_sdp: v=0
...
[correct received sdp]
...
DEBUG - _*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*
nua_callstate_completed (status 200)
it enters the completed state which is the very 1st hook when i can
handle something.
of course, nua_respond here with the correct sdp, gives:
nua: nua_respond: entering
nua(0x8b049e0): signal r_respond
nua(0x8b049e0): recv r_respond
nua(0x8b049e0): signal r_respond 200 OK
nua(0x8b049e0): event i_error 500 Already Sent Final Response
nua: nua_event: entering
because sofia has already answered
So, by now there is a patch that allows me to send whatever i want.
But incoming reinvites are not manageable.
I have no clue on how to handle this.
Thanks to Matthew O Connor who gave me a similar patch...
i only embellished it.
Max
diff -Nuar libsofia-sip-ua/nua/nua_session.c libsofia-sip-ua-/nua/nua_session.c
--- libsofia-sip-ua/nua/nua_session.c 2007-04-25 21:12:37.000000000 +0200
+++ libsofia-sip-ua-/nua/nua_session.c 2007-05-25 15:09:24.000000000 +0200
@@ -1966,9 +1966,11 @@
else if (tags && 100 < sr->sr_status && sr->sr_status < 200 &&
!NHP_ISSET(nh->nh_prefs, early_answer)) {
sdp_session_t const *user_sdp = NULL;
+ unsigned int user_sdp_force;
char const *user_sdp_str = NULL;
tl_gets(tags,
+ SOATAG_USER_SDP_FORCE_REF(user_sdp_force),
SOATAG_USER_SDP_REF(user_sdp),
SOATAG_USER_SDP_STR_REF(user_sdp_str),
TAG_END());
diff -Nuar libsofia-sip-ua/soa/soa.c libsofia-sip-ua-/soa/soa.c
--- libsofia-sip-ua/soa/soa.c 2007-04-25 21:12:37.000000000 +0200
+++ libsofia-sip-ua-/soa/soa.c 2007-05-25 19:07:46.000000000 +0200
@@ -341,6 +341,10 @@
ss->ss_srtp_enable = parent->ss_srtp_enable;
ss->ss_srtp_confidentiality = parent->ss_srtp_confidentiality;
ss->ss_srtp_integrity = parent->ss_srtp_integrity;
+
+ SU_DEBUG_1(("\n\nSET1: >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\nss_sdp_force: %d\n", ss->ss_sdp_force ));
+ ss->ss_sdp_force = parent->ss_sdp_force;
+
}
return 0;
@@ -443,7 +447,7 @@
int af;
char const *media_address, *hold;
- int rtp_select, rtp_sort;
+ int rtp_select, rtp_sort, user_sdp_force;
int rtp_mismatch;
int srtp_enable, srtp_confidentiality, srtp_integrity;
@@ -460,6 +464,9 @@
srtp_confidentiality = ss->ss_srtp_confidentiality;
srtp_integrity = ss->ss_srtp_integrity;
+ SU_DEBUG_1(("\n\nGET1: >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\nss_sdp_force: %d\n", ss->ss_sdp_force ));
+ user_sdp_force = ss->ss_sdp_force;
+
caps_sdp = user_sdp = NONE;
caps_sdp_str = user_sdp_str = NONE;
@@ -483,6 +490,8 @@
SOATAG_SRTP_CONFIDENTIALITY_REF(srtp_confidentiality),
SOATAG_SRTP_INTEGRITY_REF(srtp_integrity),
+ SOATAG_USER_SDP_FORCE_REF(user_sdp_force),
+
TAG_END());
if (n <= 0)
@@ -531,6 +540,9 @@
srtp_confidentiality = srtp_confidentiality != 0;
srtp_integrity = srtp_integrity != 0;
+ user_sdp_force = user_sdp_force != 0;
+ SU_DEBUG_1(("\n\nGET2: >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\nss_sdp_force: %d\n", ss->ss_sdp_force ));
+
change_session
= af != (int)ss->ss_af
|| rtp_select != (int)ss->ss_rtp_select
@@ -551,6 +563,9 @@
ss->ss_srtp_confidentiality = srtp_confidentiality;
ss->ss_srtp_integrity = srtp_integrity;
+ ss->ss_sdp_force = user_sdp_force;
+ SU_DEBUG_1(("\n\nSET2: >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\nss_sdp_force: %d\n", ss->ss_sdp_force ));
+
if (str0casecmp(media_address, ss->ss_address)) {
su_free(ss->ss_home, (void *)ss->ss_address);
ss->ss_address = su_strdup(ss->ss_home, media_address);
@@ -675,6 +690,8 @@
SOATAG_SRTP_CONFIDENTIALITY(ss->ss_srtp_confidentiality),
SOATAG_SRTP_INTEGRITY(ss->ss_srtp_integrity),
+ SOATAG_USER_SDP_FORCE(ss->ss_sdp_force),
+
TAG_END());
return n;
@@ -742,6 +759,8 @@
SOATAG_SRTP_CONFIDENTIALITY(ss->ss_srtp_confidentiality),
SOATAG_SRTP_INTEGRITY(ss->ss_srtp_integrity),
+ SOATAG_USER_SDP_FORCE(ss->ss_sdp_force),
+
ta_tags(ta));
ta_end(ta);
diff -Nuar libsofia-sip-ua/soa/soa_static.c libsofia-sip-ua-/soa/soa_static.c
--- libsofia-sip-ua/soa/soa_static.c 2007-04-25 21:12:37.000000000 +0200
+++ libsofia-sip-ua-/soa/soa_static.c 2007-05-25 19:15:11.000000000 +0200
@@ -719,7 +719,9 @@
s_media[i] = m;
}
}
- else {
+ else
+ {
+ if ( !ss->ss_sdp_force ) {
/* Update session according to local */
for (i = 0; i < Ns; i++) {
m = soa_sdp_matching(ss, c_media, o_media[i], NULL);
@@ -727,13 +729,24 @@
m = soa_sdp_make_rejected_media(home, o_media[i], session, 0);
s_media[i] = m;
}
+ }
+ else
+ {
+ // The for loop above resets i to zero.
+ SU_DEBUG_1(("\n\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\nss_sdp_force: %d - forcing user SDP\n", ss->ss_sdp_force ));
+ i=0;
+ }
+
+
/* Here we just append new media at the end */
for (j = 0; c_media[j]; j++)
s_media[i++] = c_media[j];
assert(i <= size);
}
+ SU_DEBUG_1(("\n\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\nss_sdp_force: %d\n", ss->ss_sdp_force ));
mm = &session->sdp_media;
+
for (i = 0; s_media[i]; i++) {
m = s_media[i]; *mm = m; mm = &m->m_next;
}
diff -Nuar libsofia-sip-ua/soa/soa_tag.c libsofia-sip-ua-/soa/soa_tag.c
--- libsofia-sip-ua/soa/soa_tag.c 2007-04-25 21:12:37.000000000 +0200
+++ libsofia-sip-ua-/soa/soa_tag.c 2007-05-25 14:50:05.000000000 +0200
@@ -211,6 +211,8 @@
*/
tag_typedef_t soatag_user_sdp = SDPTAG_TYPEDEF(user_sdp);
+tag_typedef_t soatag_user_sdp_force = BOOLTAG_TYPEDEF(sdp_force);
+
/[EMAIL PROTECTED] SOATAG_USER_SDP_STR(x)
* Pass unparsed user session description to soa session object.
*
diff -Nuar libsofia-sip-ua/soa/sofia-sip/soa_session.h libsofia-sip-ua-/soa/sofia-sip/soa_session.h
--- libsofia-sip-ua/soa/sofia-sip/soa_session.h 2007-04-25 21:12:37.000000000 +0200
+++ libsofia-sip-ua-/soa/sofia-sip/soa_session.h 2007-05-25 13:37:36.000000000 +0200
@@ -220,6 +220,7 @@
unsigned ss_rtp_select:2;
unsigned ss_rtp_sort:2;
unsigned ss_rtp_mismatch:1;
+ unsigned ss_sdp_force:1;
unsigned ss_srtp_enable:1,
ss_srtp_confidentiality:1,
diff -Nuar libsofia-sip-ua/soa/sofia-sip/soa_tag.h libsofia-sip-ua-/soa/sofia-sip/soa_tag.h
--- libsofia-sip-ua/soa/sofia-sip/soa_tag.h 2007-04-25 21:12:37.000000000 +0200
+++ libsofia-sip-ua-/soa/sofia-sip/soa_tag.h 2007-05-25 14:55:30.000000000 +0200
@@ -90,8 +90,15 @@
soatag_user_sdp_ref, sdptag_session_vr(&(x))
SOFIAPUBVAR tag_typedef_t soatag_user_sdp_ref;
+#define SOATAG_USER_SDP_FORCE(x) soatag_user_sdp_force, tag_bool_v(x)
+SOFIAPUBVAR tag_typedef_t soatag_user_sdp_force;
+
+#define SOATAG_USER_SDP_FORCE_REF(x) soatag_user_sdp_force_ref, tag_bool_vr(&(x))
+SOFIAPUBVAR tag_typedef_t soatag_user_sdp_force_ref;
+
#define SOATAG_USER_SDP_STR(x) soatag_user_sdp_str, tag_str_v(x)
SOFIAPUBVAR tag_typedef_t soatag_user_sdp_str;
+
#define SOATAG_USER_SDP_STR_REF(x) \
soatag_user_sdp_str_ref, tag_str_vr(&(x))
SOFIAPUBVAR tag_typedef_t soatag_user_sdp_str_ref;
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Sofia-sip-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sofia-sip-devel