Index: ser_ims/modules/isc/third_party_reg.c =================================================================== --- ser_ims/modules/isc/third_party_reg.c (revision 11549) +++ ser_ims/modules/isc/third_party_reg.c (revision 13364) @@ -132,8 +132,8 @@ r.cv = cv; r.service_info = m->service_info; - if (expires<=0) r_send_third_party_reg(&r,0); - else r_send_third_party_reg(&r,expires+isc_expires_grace); + if (expires<=0) r_send_third_party_reg(&r,0, msg); + else r_send_third_party_reg(&r,expires+isc_expires_grace, msg); return ISC_RETURN_TRUE; }else{ return ISC_RETURN_FALSE; @@ -162,6 +162,9 @@ static str body_s={"",36}; static str body_e={"",26}; +static str content_type_message_sip={"Content-Type: message/sip\r\n",27}; #ifdef WITH_IMS_PM static str zero={0,0}; @@ -173,7 +176,7 @@ * @returns true if OK, false if not */ -int r_send_third_party_reg(r_third_party_registration *r,int expires) +int r_send_third_party_reg(r_third_party_registration *r,int expires, struct sip_msg *msg) { str h={0,0}; str b={0,0}; @@ -198,6 +201,10 @@ if (r->cv.len) h.len += p_charging_vector_s.len + p_charging_vector_e.len + r->cv.len; + h.len += content_type_message_sip.len; + h.s = pkg_malloc(h.len); if (!h.s){ LOG(L_ERR,"ERR:"M_NAME":r_send_third_party_reg: Error allocating %d bytes\n",h.len); @@ -237,21 +244,34 @@ STR_APPEND(h,p_charging_vector_e); } LOG(L_CRIT,"SRV INFO:<%.*s>\n",r->service_info.len, r->service_info.s); - if (r->service_info.len){ - b.len = body_s.len+r->service_info.len+body_e.len; - b.s = pkg_malloc(b.len); - if (!b.s){ - LOG(L_ERR,"ERR:"M_NAME":r_send_third_party_reg: Error allocating %d bytes\n",b.len); - b.len = 0; - return 0; - } - - b.len = 0; - STR_APPEND(b,body_s); - STR_APPEND(b,r->service_info); - STR_APPEND(b,body_e); + if (r->service_info.len){ + b.len = body_s.len+r->service_info.len+body_e.len; + b.s = pkg_malloc(b.len); + if (!b.s){ + LOG(L_ERR,"ERR:"M_NAME":r_send_third_party_reg: Error allocating %d bytes\n",b.len); + b.len = 0; + return 0; } - + + b.len = 0; + STR_APPEND(b,body_s); + STR_APPEND(b,r->service_info); + STR_APPEND(b,body_e); + } + else if(expires > 0) { + STR_APPEND(h,content_type_message_sip); + b.len = msg->len; + b.s = pkg_malloc(b.len); + if (!b.s){ + LOG(L_ERR,"ERR:"M_NAME":r_send_third_party_reg: Error allocating %d bytes\n",b.len); + b.len = 0; + return 0; + } + memcpy(b.s, msg->buf, msg->len); + } + #ifdef SER_MOD_INTERFACE set_uac_req(&req, &method, Index: ser_ims/modules/isc/third_party_reg.h =================================================================== --- ser_ims/modules/isc/third_party_reg.h (revision 11549) +++ ser_ims/modules/isc/third_party_reg.h (revision 13364) @@ -80,7 +80,7 @@ r_third_party_registration* new_r_third_party_reg(str req_uri, str to, str from, str pvni, str cv); -int r_send_third_party_reg(r_third_party_registration *r,int duration); +int r_send_third_party_reg(r_third_party_registration *r,int duration, struct sip_msg *msg); void r_third_party_reg_response(struct cell *t,int type,struct tmcb_params *ps);